mirror of
https://github.com/run-llama/LlamaIndexTS.git
synced 2026-07-16 07:14:29 -04:00
fix(google): use api key provided by the user in the session store (#1989)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@llamaindex/google": patch
|
||||
---
|
||||
|
||||
use api key provided by the user
|
||||
@@ -245,11 +245,16 @@ export class Gemini extends ToolCallLLM<GeminiAdditionalChatOptions> {
|
||||
this.temperature = init?.temperature ?? 0.1;
|
||||
this.topP = init?.topP ?? 1;
|
||||
this.maxTokens = init?.maxTokens ?? undefined;
|
||||
this.session = init?.session ?? GeminiSessionStore.get();
|
||||
this.#requestOptions = init?.requestOptions ?? undefined;
|
||||
this.safetySettings = init?.safetySettings ?? DEFAULT_SAFETY_SETTINGS;
|
||||
this.apiKey = init?.apiKey ?? getEnv("GOOGLE_API_KEY");
|
||||
this.voiceName = init?.voiceName ?? undefined;
|
||||
this.session =
|
||||
init?.session ??
|
||||
GeminiSessionStore.get({
|
||||
apiKey: this.apiKey,
|
||||
backend: this.apiKey ? GEMINI_BACKENDS.GOOGLE : GEMINI_BACKENDS.VERTEX,
|
||||
});
|
||||
}
|
||||
|
||||
get supportToolCall(): boolean {
|
||||
|
||||
@@ -44,7 +44,7 @@ export enum GEMINI_BACKENDS {
|
||||
}
|
||||
|
||||
export type GoogleGeminiSessionOptions = {
|
||||
apiKey?: string;
|
||||
apiKey?: string | undefined;
|
||||
};
|
||||
|
||||
export type VertexGeminiSessionOptions = {
|
||||
|
||||
Reference in New Issue
Block a user