fix(xai): default store to false for Responses (#36629)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
parent
67aa9cee23
commit
49d997aec3
2 changed files with 41 additions and 2 deletions
|
|
@ -1102,7 +1102,8 @@ export function options(input: {
|
|||
input.model.providerID === "openai" ||
|
||||
input.model.api.npm === "@ai-sdk/openai" ||
|
||||
input.model.api.npm === "@ai-sdk/github-copilot" ||
|
||||
input.model.api.npm === "@ai-sdk/amazon-bedrock/mantle"
|
||||
input.model.api.npm === "@ai-sdk/amazon-bedrock/mantle" ||
|
||||
input.model.api.npm === "@ai-sdk/xai"
|
||||
) {
|
||||
result["store"] = false
|
||||
}
|
||||
|
|
@ -1257,7 +1258,8 @@ export function smallOptions(model: Provider.Model) {
|
|||
if (
|
||||
model.providerID === "openai" ||
|
||||
model.api.npm === "@ai-sdk/openai" ||
|
||||
model.api.npm === "@ai-sdk/github-copilot"
|
||||
model.api.npm === "@ai-sdk/github-copilot" ||
|
||||
model.api.npm === "@ai-sdk/xai"
|
||||
) {
|
||||
const base = { store: false }
|
||||
return mergeDeep(base, small)
|
||||
|
|
|
|||
|
|
@ -156,6 +156,43 @@ describe("ProviderTransform.options - setCacheKey", () => {
|
|||
expect(result.store).toBe(false)
|
||||
})
|
||||
|
||||
test("should set store=false for xAI provider by default", () => {
|
||||
const xaiModel = {
|
||||
...mockModel,
|
||||
providerID: "xai",
|
||||
api: {
|
||||
id: "grok-4",
|
||||
url: "https://api.x.ai",
|
||||
npm: "@ai-sdk/xai",
|
||||
},
|
||||
}
|
||||
const result = ProviderTransform.options({
|
||||
model: xaiModel,
|
||||
sessionID,
|
||||
providerOptions: {},
|
||||
})
|
||||
expect(result.store).toBe(false)
|
||||
expect(result.promptCacheKey).toBe(sessionID)
|
||||
})
|
||||
|
||||
test("should set store=false for xAI SDK regardless of provider ID", () => {
|
||||
const xaiModel = {
|
||||
...mockModel,
|
||||
providerID: "custom-xai",
|
||||
api: {
|
||||
id: "grok-4",
|
||||
url: "https://api.x.ai",
|
||||
npm: "@ai-sdk/xai",
|
||||
},
|
||||
}
|
||||
const result = ProviderTransform.options({
|
||||
model: xaiModel,
|
||||
sessionID,
|
||||
providerOptions: {},
|
||||
})
|
||||
expect(result.store).toBe(false)
|
||||
})
|
||||
|
||||
test("should set store=false for azure provider by default", () => {
|
||||
const azureModel = {
|
||||
...mockModel,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue