mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: only include verbosity parameter for models that support it (#7055)
Co-authored-by: Roo Code <roomote@roocode.com>
This commit is contained in:
parent
7ed833cb5d
commit
23afdfca03
2 changed files with 64 additions and 2 deletions
|
|
@ -258,6 +258,68 @@ describe("OpenAiNativeHandler", () => {
|
|||
})
|
||||
})
|
||||
|
||||
it("should not include verbosity parameter for models that don't support it", async () => {
|
||||
// Test with gpt-4.1 which does NOT support verbosity
|
||||
handler = new OpenAiNativeHandler({
|
||||
...mockOptions,
|
||||
apiModelId: "gpt-4.1",
|
||||
verbosity: "high", // Set verbosity but it should be ignored
|
||||
})
|
||||
|
||||
const stream = handler.createMessage(systemPrompt, messages)
|
||||
const chunks: any[] = []
|
||||
for await (const chunk of stream) {
|
||||
chunks.push(chunk)
|
||||
}
|
||||
|
||||
// Verify that verbosity is NOT included in the request
|
||||
const callArgs = mockCreate.mock.calls[0][0]
|
||||
expect(callArgs).not.toHaveProperty("verbosity")
|
||||
expect(callArgs.model).toBe("gpt-4.1")
|
||||
expect(callArgs.temperature).toBe(0)
|
||||
expect(callArgs.stream).toBe(true)
|
||||
})
|
||||
|
||||
it("should not include verbosity for gpt-4o models", async () => {
|
||||
// Test with gpt-4o which does NOT support verbosity
|
||||
handler = new OpenAiNativeHandler({
|
||||
...mockOptions,
|
||||
apiModelId: "gpt-4o",
|
||||
verbosity: "medium", // Set verbosity but it should be ignored
|
||||
})
|
||||
|
||||
const stream = handler.createMessage(systemPrompt, messages)
|
||||
const chunks: any[] = []
|
||||
for await (const chunk of stream) {
|
||||
chunks.push(chunk)
|
||||
}
|
||||
|
||||
// Verify that verbosity is NOT included in the request
|
||||
const callArgs = mockCreate.mock.calls[0][0]
|
||||
expect(callArgs).not.toHaveProperty("verbosity")
|
||||
expect(callArgs.model).toBe("gpt-4o")
|
||||
})
|
||||
|
||||
it("should not include verbosity for gpt-4.1-mini models", async () => {
|
||||
// Test with gpt-4.1-mini which does NOT support verbosity
|
||||
handler = new OpenAiNativeHandler({
|
||||
...mockOptions,
|
||||
apiModelId: "gpt-4.1-mini",
|
||||
verbosity: "low", // Set verbosity but it should be ignored
|
||||
})
|
||||
|
||||
const stream = handler.createMessage(systemPrompt, messages)
|
||||
const chunks: any[] = []
|
||||
for await (const chunk of stream) {
|
||||
chunks.push(chunk)
|
||||
}
|
||||
|
||||
// Verify that verbosity is NOT included in the request
|
||||
const callArgs = mockCreate.mock.calls[0][0]
|
||||
expect(callArgs).not.toHaveProperty("verbosity")
|
||||
expect(callArgs.model).toBe("gpt-4.1-mini")
|
||||
})
|
||||
|
||||
it("should handle empty delta content", async () => {
|
||||
const mockStream = [
|
||||
{ choices: [{ delta: {} }], usage: null },
|
||||
|
|
|
|||
|
|
@ -194,8 +194,8 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
|
|||
...(reasoning && reasoning),
|
||||
}
|
||||
|
||||
// Add verbosity if supported
|
||||
if (verbosity) {
|
||||
// Add verbosity only if the model supports it
|
||||
if (verbosity && model.info.supportsVerbosity) {
|
||||
params.verbosity = verbosity
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue