fix(core): lower OpenAI text verbosity
This commit is contained in:
@@ -40,7 +40,14 @@ const openai: Lowerer = {
|
|||||||
settings: omit(options, ["apiKey", "baseURL", "organization", "project", "headers", "body"]),
|
settings: omit(options, ["apiKey", "baseURL", "organization", "project", "headers", "body"]),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
request: snake,
|
request(options) {
|
||||||
|
const result = snake(options)
|
||||||
|
if (options.textVerbosity !== undefined) {
|
||||||
|
result.text = { ...(isRecord(result.text) ? result.text : {}), verbosity: options.textVerbosity }
|
||||||
|
delete result.text_verbosity
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const anthropic: Lowerer = {
|
const anthropic: Lowerer = {
|
||||||
|
|||||||
@@ -39,8 +39,16 @@ describe("ConfigProviderOptionsV1", () => {
|
|||||||
body: { store: true },
|
body: { store: true },
|
||||||
settings: { timeout: 1000 },
|
settings: { timeout: 1000 },
|
||||||
})
|
})
|
||||||
expect(lowerer.request({ reasoningEffort: "high", nestedValue: { camelCase: true } })).toEqual({
|
expect(
|
||||||
|
lowerer.request({
|
||||||
|
reasoningEffort: "high",
|
||||||
|
textVerbosity: "low",
|
||||||
|
text: { outputFormat: "plain" },
|
||||||
|
nestedValue: { camelCase: true },
|
||||||
|
}),
|
||||||
|
).toEqual({
|
||||||
reasoning_effort: "high",
|
reasoning_effort: "high",
|
||||||
|
text: { output_format: "plain", verbosity: "low" },
|
||||||
nested_value: { camel_case: true },
|
nested_value: { camel_case: true },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -130,7 +138,10 @@ describe("ConfigProviderOptionsV1", () => {
|
|||||||
body: { trace: true },
|
body: { trace: true },
|
||||||
settings: { resourceName: "resource" },
|
settings: { resourceName: "resource" },
|
||||||
})
|
})
|
||||||
expect(lowerer.request({ reasoningEffort: "high" })).toEqual({ reasoning_effort: "high" })
|
expect(lowerer.request({ reasoningEffort: "high", textVerbosity: "low" })).toEqual({
|
||||||
|
reasoning_effort: "high",
|
||||||
|
text: { verbosity: "low" },
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test("lowers Amazon Bedrock provider and request options", () => {
|
test("lowers Amazon Bedrock provider and request options", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user