Refactor OTEL logging for API calls (#991)

Refactor OpenTelemetry logging for API requests, responses, and errors. Moved logging responsibility from GeminiClient to GeminiChat for more detailed logging.

#750
This commit is contained in:
Jerop Kipruto
2025-06-12 19:36:51 -04:00
committed by GitHub
parent dc378e8d60
commit 3c3da655b0
6 changed files with 294 additions and 209 deletions

View File

@@ -0,0 +1,15 @@
/**
* @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('');
}