Skip to content

Commit

Permalink
(update) remove skunk code
Browse files Browse the repository at this point in the history
  • Loading branch information
rdvo committed Jul 1, 2024
1 parent 7eb6e00 commit a2e0f55
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,13 @@ class LLM {
console.log("Merged Options:", JSON.stringify(mergedOptions, null, 2));
console.log("Messages:", JSON.stringify(messages, null, 2));

if (prompt.tools && this.provider === "cloudflare") {
const responseSchema = z.object({
response: z.string().describe("Your response to the user's message"),
tool_calls: z.array(z.object({
name: z.string().describe("The name of the tool to use"),
arguments: z.record(z.any()).describe("The arguments for the tool")
})).describe("Array of tools to use and their arguments")
});

enforcedJsonOptions = { ...mergedOptions, tools: prompt.tools };
prompt.schema = responseSchema; // Set the toolResponse as the schema
}


if (prompt.schema) {
const schema = zodToJsonSchema(prompt.schema, { target: "openApi3" });
messages.push({
// Check for which models support native function calling

const schema = zodToJsonSchema(prompt.schema, { target: "openApi3" });
messages.push({
role: "system",
content: `You MUST ALWAYS Respond with the determined final values in a valid JSON object containing all the required properties in the following defined object schema:
\n<schema_object>${JSON.stringify(schema, null, 2)}\n</schema_object>
Expand Down

0 comments on commit a2e0f55

Please sign in to comment.