mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-15 10:26:07 +00:00
23 lines
769 B
TypeScript
23 lines
769 B
TypeScript
// Google plugin module implements google genai runtime behavior.
|
|
import { GoogleGenAI } from "@google/genai";
|
|
import { resolveGoogleApiClientHeaders } from "./google-api-client-header.js";
|
|
|
|
export type GoogleGenAIClient = InstanceType<typeof GoogleGenAI>;
|
|
type GoogleGenAIOptions = ConstructorParameters<typeof GoogleGenAI>[0];
|
|
|
|
export function createGoogleGenAI(options: GoogleGenAIOptions): GoogleGenAIClient {
|
|
const httpOptions = options.httpOptions ?? {};
|
|
return new GoogleGenAI({
|
|
...options,
|
|
httpOptions: {
|
|
...httpOptions,
|
|
headers: {
|
|
...httpOptions.headers,
|
|
...resolveGoogleApiClientHeaders({
|
|
baseUrl: typeof httpOptions.baseUrl === "string" ? httpOptions.baseUrl : undefined,
|
|
}),
|
|
},
|
|
},
|
|
});
|
|
}
|