test(openai): cover future cache boundaries
This commit is contained in:
@@ -199,20 +199,26 @@ describe("openai-responses stateful chaining", () => {
|
||||
{ messages: [oldestUser, firstUser] },
|
||||
options,
|
||||
).result();
|
||||
const secondUser = { role: "user" as const, content: "Second question", timestamp: 1002 };
|
||||
const secondResponse = await streamOpenAIResponses(
|
||||
explicitPromptCacheModel,
|
||||
{
|
||||
messages: [
|
||||
oldestUser,
|
||||
firstUser,
|
||||
firstResponse,
|
||||
{ role: "user", content: "Second question", timestamp: 1002 },
|
||||
],
|
||||
messages: [oldestUser, firstUser, firstResponse, secondUser],
|
||||
},
|
||||
options,
|
||||
).result();
|
||||
const thirdUser = { role: "user" as const, content: "Third question", timestamp: 1003 };
|
||||
const thirdResponse = await streamOpenAIResponses(
|
||||
explicitPromptCacheModel,
|
||||
{
|
||||
messages: [oldestUser, firstUser, firstResponse, secondUser, secondResponse, thirdUser],
|
||||
},
|
||||
options,
|
||||
).result();
|
||||
|
||||
expect(secondResponse.stopReason).toBe("stop");
|
||||
expect(thirdResponse.stopReason).toBe("stop");
|
||||
expect(sentRequests).toHaveLength(3);
|
||||
expect(sentRequests[0]?.input).toEqual([
|
||||
{
|
||||
role: "user",
|
||||
@@ -230,6 +236,10 @@ describe("openai-responses stateful chaining", () => {
|
||||
expect(sentRequests[1]?.input).toEqual([
|
||||
{ role: "user", content: [{ type: "input_text", text: "Second question" }] },
|
||||
]);
|
||||
expect(sentRequests[2]?.previous_response_id).toBe("resp_2");
|
||||
expect(sentRequests[2]?.input).toEqual([
|
||||
{ role: "user", content: [{ type: "input_text", text: "Third question" }] },
|
||||
]);
|
||||
});
|
||||
|
||||
it("chains turns without appending an extra no-reasoning developer item", async () => {
|
||||
|
||||
@@ -440,6 +440,14 @@ describe("OpenAI explicit prompt-cache breakpoint compat", () => {
|
||||
buildOpenAICompat(completionsSpec({ id: "gpt-5.5", provider: "openai", baseUrl: "https://api.openai.com/v1" }))
|
||||
.supportsPromptCacheBreakpoints,
|
||||
).toBe(false);
|
||||
expect(
|
||||
buildOpenAIResponsesCompat({
|
||||
id: "gpt-5.6",
|
||||
provider: "openrouter",
|
||||
name: "GPT 5.6 through OpenRouter",
|
||||
baseUrl: "https://openrouter.ai/api/v1",
|
||||
}).supportsPromptCacheBreakpoints,
|
||||
).toBe(false);
|
||||
expect(
|
||||
buildOpenAIResponsesCompat({
|
||||
id: "gpt-4.1",
|
||||
|
||||
Reference in New Issue
Block a user