summaryrefslogtreecommitdiff
path: root/packages/server/src/utils/generateContentResponseUtilities.ts
blob: a1d62124740343322ce3d1f1193aa01a074cd07c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

import { GenerateContentResponse } from '@google/genai';

export function getResponseText(
  response: GenerateContentResponse,
): string | undefined {
  return (
    response.candidates?.[0]?.content?.parts
      ?.map((part) => part.text)
      .join('') || undefined
  );
}