( response: GenerateContentResponse, )
| 66 | } |
| 67 | |
| 68 | export function getResponseText( |
| 69 | response: GenerateContentResponse, |
| 70 | ): string | null { |
| 71 | if (response.candidates && response.candidates.length > 0) { |
| 72 | const candidate = response.candidates[0]; |
| 73 | |
| 74 | if ( |
| 75 | candidate.content && |
| 76 | candidate.content.parts && |
| 77 | candidate.content.parts.length > 0 |
| 78 | ) { |
| 79 | return candidate.content.parts |
| 80 | .filter((part) => part.text) |
| 81 | .map((part) => part.text) |
| 82 | .join(''); |
| 83 | } |
| 84 | } |
| 85 | return null; |
| 86 | } |
no outgoing calls
no test coverage detected