refactor(core): Centralize tool response formatting (#743)

This commit is contained in:
N. Taylor Mullen
2025-06-04 00:24:25 -07:00
committed by GitHub
parent 4b2af10b04
commit d179b3aae4
8 changed files with 300 additions and 222 deletions

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { GenerateContentResponse } from '@google/genai';
import { GenerateContentResponse, Part } from '@google/genai';
export function getResponseText(
response: GenerateContentResponse,
@@ -15,3 +15,7 @@ export function getResponseText(
.join('') || undefined
);
}
export function getResponseTextFromParts(parts: Part[]): string | undefined {
return parts?.map((part) => part.text).join('') || undefined;
}