This commit is contained in:
reanon
2025-04-23 20:14:36 +00:00
parent 8197192223
commit 2ffce3eff8
2 changed files with 46 additions and 21 deletions
+7
View File
@@ -155,6 +155,12 @@ export const transformOpenAIToGoogleAI: APIFormatTransformer<
stops.push(...Array.from(foundNames).map((name) => `\n${name}:`));
stops = [...new Set(stops)].slice(0, 5);
// Handle thinking budget from the original request
let thinkingConfig = undefined;
if (body.generationConfig?.thinkingConfig || body.thinkingConfig) {
thinkingConfig = body.generationConfig?.thinkingConfig || body.thinkingConfig;
}
return {
model: req.body.model,
stream: rest.stream,
@@ -166,6 +172,7 @@ export const transformOpenAIToGoogleAI: APIFormatTransformer<
topP: rest.top_p,
topK: 40, // openai schema doesn't have this, google ai defaults to 40
temperature: rest.temperature,
...(thinkingConfig ? { thinkingConfig } : {})
},
safetySettings: [
{ category: "HARM_CATEGORY_HARASSMENT", threshold: "BLOCK_NONE" },