mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 10:12:42 +00:00
fix(agents): detect Venice provider proxying xAI/Grok models for schema cleaning (#35355)
Merged via squash.
Prepared head SHA: 8bfdec257b
Co-authored-by: Sid-Qin <201593046+Sid-Qin@users.noreply.github.com>
Co-authored-by: shakkernerd <165377636+shakkernerd@users.noreply.github.com>
Reviewed-by: @shakkernerd
This commit is contained in:
@@ -29,6 +29,18 @@ describe("isXaiProvider", () => {
|
||||
it("handles undefined provider", () => {
|
||||
expect(isXaiProvider(undefined)).toBe(false);
|
||||
});
|
||||
|
||||
it("matches venice provider with grok model id", () => {
|
||||
expect(isXaiProvider("venice", "grok-4.1-fast")).toBe(true);
|
||||
});
|
||||
|
||||
it("matches venice provider with venice/ prefixed grok model id", () => {
|
||||
expect(isXaiProvider("venice", "venice/grok-4.1-fast")).toBe(true);
|
||||
});
|
||||
|
||||
it("does not match venice provider with non-grok model id", () => {
|
||||
expect(isXaiProvider("venice", "llama-3.3-70b")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("stripXaiUnsupportedKeywords", () => {
|
||||
|
||||
@@ -48,8 +48,13 @@ export function isXaiProvider(modelProvider?: string, modelId?: string): boolean
|
||||
if (provider.includes("xai") || provider.includes("x-ai")) {
|
||||
return true;
|
||||
}
|
||||
const lowerModelId = modelId?.toLowerCase() ?? "";
|
||||
// OpenRouter proxies to xAI when the model id starts with "x-ai/"
|
||||
if (provider === "openrouter" && modelId?.toLowerCase().startsWith("x-ai/")) {
|
||||
if (provider === "openrouter" && lowerModelId.startsWith("x-ai/")) {
|
||||
return true;
|
||||
}
|
||||
// Venice proxies to xAI/Grok models
|
||||
if (provider === "venice" && lowerModelId.includes("grok")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user