From 2686db1b0b5d5153f22ad68b8783dbd64bd4bbe7 Mon Sep 17 00:00:00 2001 From: sameelarif Date: Mon, 6 Jan 2025 17:41:36 -0800 Subject: [PATCH 1/3] add comment --- lib/inference.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/inference.ts b/lib/inference.ts index 2aa23c5c..0bb08f14 100644 --- a/lib/inference.ts +++ b/lib/inference.ts @@ -174,6 +174,7 @@ export async function extract({ }) { type ExtractionResponse = z.infer; type MetadataResponse = z.infer; + // TODO: antipattern const isUsingAnthropic = llmClient.type === "anthropic"; const extractionResponse = await llmClient.createChatCompletion({ From 77ff054abf77db8e6e89cf70ac2e8875ffebd9e6 Mon Sep 17 00:00:00 2001 From: sameelarif Date: Mon, 6 Jan 2025 17:44:01 -0800 Subject: [PATCH 2/3] changeset --- .changeset/calm-teachers-rescue.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/calm-teachers-rescue.md diff --git a/.changeset/calm-teachers-rescue.md b/.changeset/calm-teachers-rescue.md new file mode 100644 index 00000000..c77cc7b7 --- /dev/null +++ b/.changeset/calm-teachers-rescue.md @@ -0,0 +1,5 @@ +--- +"@browserbasehq/stagehand": patch +--- + +Unified LLM input/output types for reduced dependence on OpenAI types From 247a8444372be63bcd64512eb1dab29a5ddd5d58 Mon Sep 17 00:00:00 2001 From: sameelarif Date: Mon, 6 Jan 2025 17:45:22 -0800 Subject: [PATCH 3/3] fix ollama tool usage --- examples/external_clients/ollama.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/external_clients/ollama.ts b/examples/external_clients/ollama.ts index a488ec0e..5d5b68f7 100644 --- a/examples/external_clients/ollama.ts +++ b/examples/external_clients/ollama.ts @@ -239,7 +239,14 @@ export class OllamaClient extends LLMClient { messages: formattedMessages, response_format: responseFormat, stream: false, - tools: options.tools?.filter((tool) => "function" in tool), // ensure only OpenAI compatibletools are used + tools: options.tools?.map((tool) => ({ + function: { + name: tool.name, + description: tool.description, + parameters: tool.parameters, + }, + type: "function", + })), }; const response = await this.client.chat.completions.create(body);