MCPcopy Index your code
hub / github.com/simstudioai/sim / extractTextContent

Function extractTextContent

apps/sim/providers/google/utils.ts:82–93  ·  view source on GitHub ↗
(candidate: Candidate | undefined)

Source from the content-addressed store, hash-verified

80 * Filters out thought parts (model reasoning) from the output.
81 */
82export function extractTextContent(candidate: Candidate | undefined): string {
83 if (!candidate?.content?.parts) return ''
84
85 const textParts = candidate.content.parts.filter(
86 (part): part is Part & { text: string } => Boolean(part.text) && part.thought !== true
87 )
88
89 if (textParts.length === 0) return ''
90 if (textParts.length === 1) return textParts[0].text
91
92 return textParts.map((part) => part.text).join('\n')
93}
94
95/**
96 * Extracts the first function call from a Gemini response candidate

Callers 3

executeGeminiRequestFunction · 0.90
route.tsFile · 0.90

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected