Skip to content

Commit a793676

Browse files
committed
fix(converter): stop sending top_p and stop to the CommandCode upstream
The CommandCode CLI wire body carries only model, messages, tools, system, max_tokens, stream, and optional temperature and reasoning_effort. Forwarding top_p and stop made every request that carried them distinguishable from the CLI. Clients may still send both; they are no longer relayed upstream.
1 parent 3fa6443 commit a793676

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/converter.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ export function buildCommandCodeGenerateBody(
195195
if (options.request.reasoning_effort !== undefined)
196196
params.reasoning_effort = options.request.reasoning_effort;
197197
if (options.request.temperature !== undefined) params.temperature = options.request.temperature;
198-
if (options.request.top_p !== undefined) params.top_p = options.request.top_p;
199-
if (options.request.stop !== undefined) params.stop = options.request.stop;
200198

201199
const threadId = options.threadId ?? randomUUID();
202200
return {

src/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ export interface CommandCodeGenerateBody {
119119
max_tokens?: number;
120120
reasoning_effort?: string;
121121
temperature?: number;
122-
top_p?: number;
123-
stop?: string | string[];
124122
stream: true;
125123
};
126124
threadId?: string;

tests/converter.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ import {
77
} from "../src/converter.js";
88

99
describe("OpenAI to CommandCode conversion", () => {
10+
it("forwards temperature but never top_p or stop, matching the CommandCode CLI wire body", () => {
11+
const body = buildCommandCodeGenerateBody({
12+
request: {
13+
model: "deepseek/deepseek-v4-pro",
14+
messages: [{ role: "user", content: "hi" }],
15+
temperature: 0.4,
16+
top_p: 0.9,
17+
stop: ["\n\n"],
18+
},
19+
upstreamModel: "deepseek/deepseek-v4-pro",
20+
});
21+
22+
expect(body.params.temperature).toBe(0.4);
23+
expect(Object.keys(body.params)).not.toContain("top_p");
24+
expect(Object.keys(body.params)).not.toContain("stop");
25+
});
26+
1027
it("flattens string and structured text content", () => {
1128
expect(flattenOpenAIContent("hello")).toBe("hello");
1229
expect(

0 commit comments

Comments
 (0)