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

Function extractResponseText

apps/sim/providers/openai/utils.ts:198–216  ·  view source on GitHub ↗
(output: OpenAI.Responses.ResponseOutputItem[])

Source from the content-addressed store, hash-verified

196 * Extracts plain text from Responses API output items.
197 */
198export function extractResponseText(output: OpenAI.Responses.ResponseOutputItem[]): string {
199 if (!Array.isArray(output)) {
200 return ''
201 }
202
203 const textParts: string[] = []
204 for (const item of output) {
205 if (item?.type !== 'message') {
206 continue
207 }
208
209 const text = extractTextFromMessageItem(item)
210 if (text) {
211 textParts.push(text)
212 }
213 }
214
215 return textParts.join('')
216}
217
218/**
219 * Extracts reasoning summary text from Responses API output items. Reasoning

Callers 2

route.tsFile · 0.90

Calls 3

joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected