Skip to content

Commit

Permalink
Gemini: show thoughts
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Jan 23, 2025
1 parent 8d86636 commit ae8602a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ export function createGeminiGenerateContentResponseParser(modelId: string, isStr

// <- TextPart
case 'text' in mPart:
pt.appendText(mPart.text || '');
// [Gemini, 2025-01-23] CoT support
if (mPart.thought)
pt.appendReasoningText(mPart.text || '');
else
pt.appendText(mPart.text || '');
break;

// <- FunctionCallPart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export namespace GeminiWire_ContentParts {

export const TextPart_schema = z.object({
text: z.string(),
thought: z.boolean().optional(), // [Gemini, 2025-01-23] CoT support
});

const InlineDataPart_schema = z.object({
Expand Down Expand Up @@ -395,7 +396,7 @@ export namespace GeminiWire_API_Generate_Content {
topP: z.number().optional(),
topK: z.number().int().optional(),

// Added on 2025-01-23 - undocumented yet, thinking traces
// [Gemini, 2025-01-23] CoT support - undocumented yet
thinkingConfig: z.object({
includeThoughts: z.boolean().optional(),
}).optional(),
Expand Down

0 comments on commit ae8602a

Please sign in to comment.