import { createMistral } from "@ai-sdk/mistral" import { expect, test } from "bun:test" test("Mistral sends promptCacheKey as prompt_cache_key", async () => { let body: Record | undefined const mockFetch = Object.assign( async (_input: Parameters[0], init?: RequestInit) => { body = JSON.parse(String(init?.body)) return Response.json({ id: "response-1", created: 0, model: "mistral-large-latest", object: "chat.completion", choices: [{ index: 0, message: { role: "assistant", content: "Hello" }, finish_reason: "stop" }], usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 }, }) }, { preconnect: fetch.preconnect }, ) const model = createMistral({ apiKey: "test", fetch: mockFetch })("mistral-large-latest") await model.doGenerate({ prompt: [{ role: "user", content: [{ type: "text", text: "Hello" }] }], providerOptions: { mistral: { promptCacheKey: "session-123" } }, }) expect(body?.prompt_cache_key).toBe("session-123") })