mirror of
https://github.com/sune-org/ORP.git
synced 2026-01-13 16:17:59 +00:00
Feat: Map reasoning effort to Google thinkingLevel
This commit is contained in:
3
index.js
3
index.js
@@ -283,7 +283,7 @@ export class MyDurableObject {
|
||||
|
||||
async streamGoogle({ apiKey, body }) {
|
||||
const generationConfig = Object.entries({ temperature: body.temperature, topP: body.top_p, maxOutputTokens: body.max_tokens }).reduce((acc, [k, v]) => (Number.isFinite(+v) && +v >= 0 ? { ...acc, [k]: +v } : acc), {});
|
||||
if (body.reasoning) generationConfig.thinkingConfig = { includeThoughts: body.reasoning.exclude !== true };
|
||||
if (body.reasoning) generationConfig.thinkingConfig = { includeThoughts: body.reasoning.exclude !== true, ...(body.reasoning.effort && body.reasoning.effort !== 'default' && { thinkingLevel: body.reasoning.effort === 'low' ? 'low' : 'high' }) };
|
||||
if (body.response_format?.type?.startsWith('json')) {
|
||||
generationConfig.responseMimeType = 'application/json';
|
||||
if (body.response_format.json_schema) {
|
||||
@@ -442,3 +442,4 @@ export class MyDurableObject {
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user