Skip to content

all llm clients in their own folder #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: anirudh/update-2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ BROWSERBASE_PROJECT_ID="YOUR_BROWSERBASE_PROJECT_ID"
BROWSERBASE_API_KEY="YOUR_BROWSERBASE_API_KEY"
OPENAI_API_KEY="THIS_IS_OPTIONAL_WITH_ANTHROPIC_KEY"
ANTHROPIC_API_KEY="THIS_IS_OPTIONAL_WITH_OPENAI_KEY"
GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
18 changes: 8 additions & 10 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"examples/quickstart.ts": "index.ts"
},
"blank": {
"examples/blank.ts": "index.ts",
"examples/run.ts": "index.ts"
"examples/blank.ts": "index.ts"
},
"chess": {
"examples/chess.ts": "index.ts"
},
"persist-context": {
"examples/persist-context.ts": "index.ts"
Expand All @@ -15,19 +17,15 @@
"examples/vercel.json": "vercel.json"
},
"custom-client-openai": {
"examples/quickstart.ts": "index.ts",
"examples/customOpenAI_client.ts": "customOpenAI_client.ts"
"examples/quickstart.ts": "index.ts"
},
"custom-client-openai-blank": {
"examples/blank.ts": "index.ts",
"examples/customOpenAI_client.ts": "customOpenAI_client.ts"
"examples/blank.ts": "index.ts"
},
"custom-client-aisdk": {
"examples/quickstart.ts": "index.ts",
"examples/aisdk_client.ts": "aisdk_client.ts"
"examples/quickstart.ts": "index.ts"
},
"custom-client-aisdk-blank": {
"examples/blank.ts": "index.ts",
"examples/aisdk_client.ts": "aisdk_client.ts"
"examples/blank.ts": "index.ts"
}
}
6 changes: 3 additions & 3 deletions examples/aisdk_client.ts → llm_clients/aisdk_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ export class AISdkClient extends LLMClient {
if ("image_url" in content) {
const imageContent: ImagePart = {
type: "image",
image: content.image_url.url,
image: content.image_url?.url ?? "",
};
return imageContent;
} else {
const textContent: TextPart = {
type: "text",
text: content.text,
text: content.text ?? "",
};
return textContent;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ export class AISdkClient extends LLMClient {

const tools: Record<string, CoreTool> = {};

for (const rawTool of options.tools) {
for (const rawTool of options.tools ?? []) {
tools[rawTool.name] = {
description: rawTool.description,
parameters: rawTool.parameters,
Expand Down
File renamed without changes.