diff options
| author | Jerop Kipruto <[email protected]> | 2025-06-12 19:36:51 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-12 16:36:51 -0700 |
| commit | 3c3da655b0fd4dafce7a642c4112e2375e3fa02f (patch) | |
| tree | 7c014a30afb9b72034e0fd8e2118d6c05a78348d /packages/core/src/utils/requestUtils.ts | |
| parent | dc378e8d604030d934959cceefed4aef5a1ea6b0 (diff) | |
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
Diffstat (limited to 'packages/core/src/utils/requestUtils.ts')
| -rw-r--r-- | packages/core/src/utils/requestUtils.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/core/src/utils/requestUtils.ts b/packages/core/src/utils/requestUtils.ts new file mode 100644 index 00000000..4978e968 --- /dev/null +++ b/packages/core/src/utils/requestUtils.ts @@ -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(''); +} |
