fix(google): use api key provided by the user in the session store (#1989)

This commit is contained in:
ANKIT VARSHNEY
2025-05-30 10:23:54 +05:30
committed by GitHub
parent b370bd59f1
commit 534662368f
3 changed files with 12 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@llamaindex/google": patch
---
use api key provided by the user
+6 -1
View File
@@ -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 {
+1 -1
View File
@@ -44,7 +44,7 @@ export enum GEMINI_BACKENDS {
}
export type GoogleGeminiSessionOptions = {
apiKey?: string;
apiKey?: string | undefined;
};
export type VertexGeminiSessionOptions = {