Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/responses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@ describe("Responses adapter — block-index lifecycle", () => {
}),
).toThrow();
});

test.each([
["headers", { headers: { statc: {} } }],
[
"headers.fromOption",
{
headers: { fromOption: [{ optionKey: "a", header: "x-a", hedr: "" }] },
},
],
[
"systemPrompt",
{ systemPrompt: { role: "system", shape: "string", rol: "system" } },
],
["reasoning", { reasoning: { sumary: "auto" } }],
])("rejects an unrecognized %s field instead of ignoring it", (_, quirks) => {
expect(() => createOpenAIResponsesAdapter(source, quirks)).toThrow();
});
});

describe("Responses request builder — quirk matrix", () => {
Expand Down
4 changes: 4 additions & 0 deletions src/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import {
const HeaderFromOption = type({
optionKey: "string",
header: "string",
"+": "reject",
});
type HeaderFromOption = typeof HeaderFromOption.infer;

const ResponsesHeaders = type({
"static?": { "[string]": "string" },
"modelHeader?": "string",
"fromOption?": HeaderFromOption.array(),
"+": "reject",
});

// `shape: "string"` sends plain string content (Grok/OpenAI); `"parts"`
Expand All @@ -46,6 +48,7 @@ const ResponsesHeaders = type({
const SystemPromptPlacement = type({
role: "'system' | 'developer'",
shape: "'string' | 'parts'",
"+": "reject",
});
type SystemPromptPlacement = typeof SystemPromptPlacement.infer;

Expand All @@ -55,6 +58,7 @@ const ReasoningQuirks = type({
// The wire value Interchange's neutral `max` effort becomes. The highest
// level differs per model, so only the source can name it.
"maxEffort?": "'xhigh' | 'max'",
"+": "reject",
});
type ReasoningQuirks = typeof ReasoningQuirks.infer;

Expand Down
Loading