mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 10:05:14 +00:00
Merge pull request #221 from theBucky/fix/google-provider-baseurl
fix(ai): pass baseUrl to Google GenAI SDK via httpOptions
This commit is contained in:
commit
98e5b4dce9
1 changed files with 10 additions and 1 deletions
|
|
@ -265,9 +265,18 @@ function createClient(model: Model<"google-generative-ai">, apiKey?: string): Go
|
|||
}
|
||||
apiKey = process.env.GEMINI_API_KEY;
|
||||
}
|
||||
|
||||
const httpOptions: { baseUrl?: string; headers?: Record<string, string> } = {};
|
||||
if (model.baseUrl) {
|
||||
httpOptions.baseUrl = model.baseUrl;
|
||||
}
|
||||
if (model.headers) {
|
||||
httpOptions.headers = model.headers;
|
||||
}
|
||||
|
||||
return new GoogleGenAI({
|
||||
apiKey,
|
||||
httpOptions: model.headers ? { headers: model.headers } : undefined,
|
||||
httpOptions: Object.keys(httpOptions).length > 0 ? httpOptions : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue