summaryrefslogtreecommitdiff
path: root/packages/core/src/utils/requestUtils.ts
blob: 4978e968b1ed4cb4b9381cda6f07447b5fb34d5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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('');
}