mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:01:01 +00:00
fix(models): normalize google-vertex flash-lite ids
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
isGoogleGenerativeAiApi,
|
||||
normalizeGoogleApiBaseUrl,
|
||||
normalizeGoogleGenerativeAiBaseUrl,
|
||||
normalizeGoogleProviderConfig,
|
||||
parseGeminiAuth,
|
||||
resolveGoogleGenerativeAiHttpRequestConfig,
|
||||
resolveGoogleGenerativeAiApiOrigin,
|
||||
@@ -106,6 +107,36 @@ describe("google generative ai helpers", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("normalizes google-vertex model ids without rewriting the OpenAI-compatible baseUrl", () => {
|
||||
expect(
|
||||
normalizeGoogleProviderConfig("google-vertex", {
|
||||
api: "openai-completions",
|
||||
baseUrl:
|
||||
"https://aiplatform.googleapis.com/v1/projects/test/locations/us-central1/endpoints/openapi",
|
||||
models: [
|
||||
{
|
||||
id: "gemini-3.1-flash-lite",
|
||||
name: "Gemini Flash Lite",
|
||||
input: ["text"],
|
||||
reasoning: false,
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: 1,
|
||||
maxTokens: 1,
|
||||
},
|
||||
],
|
||||
}),
|
||||
).toMatchObject({
|
||||
api: "openai-completions",
|
||||
baseUrl:
|
||||
"https://aiplatform.googleapis.com/v1/projects/test/locations/us-central1/endpoints/openapi",
|
||||
models: [
|
||||
expect.objectContaining({
|
||||
id: "gemini-3.1-flash-lite-preview",
|
||||
}),
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("derives the Gemini API origin without duplicating /v1beta", () => {
|
||||
expect(resolveGoogleGenerativeAiApiOrigin()).toBe("https://generativelanguage.googleapis.com");
|
||||
expect(resolveGoogleGenerativeAiApiOrigin("https://generativelanguage.googleapis.com")).toBe(
|
||||
|
||||
Reference in New Issue
Block a user