Refactor OpenTelemetry logging for API requests, responses, and errors. Moved logging responsibility from GeminiClient to GeminiChat for more detailed logging. #750
16 lines
338 B
TypeScript
16 lines
338 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { Content } from '@google/genai';
|
|
|
|
export function getRequestTextFromContents(contents: Content[]): string {
|
|
return contents
|
|
.flatMap((content) => content.parts ?? [])
|
|
.map((part) => part.text)
|
|
.filter(Boolean)
|
|
.join('');
|
|
}
|