@depup/firebase__ai 2.9.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +31 -0
  2. package/changes.json +10 -0
  3. package/dist/ai-public.d.ts +3472 -0
  4. package/dist/ai.d.ts +3712 -0
  5. package/dist/esm/index.esm.js +4765 -0
  6. package/dist/esm/index.esm.js.map +1 -0
  7. package/dist/esm/package.json +1 -0
  8. package/dist/esm/src/api.d.ts +121 -0
  9. package/dist/esm/src/backend.d.ts +98 -0
  10. package/dist/esm/src/constants.d.ts +29 -0
  11. package/dist/esm/src/errors.d.ts +35 -0
  12. package/dist/esm/src/factory-browser.d.ts +19 -0
  13. package/dist/esm/src/factory-node.d.ts +19 -0
  14. package/dist/esm/src/googleai-mappers.d.ts +73 -0
  15. package/dist/esm/src/helpers.d.ts +30 -0
  16. package/dist/esm/src/index.d.ts +13 -0
  17. package/dist/esm/src/index.node.d.ts +7 -0
  18. package/dist/esm/src/logger.d.ts +18 -0
  19. package/dist/esm/src/methods/chat-session-helpers.d.ts +18 -0
  20. package/dist/esm/src/methods/chat-session.d.ts +77 -0
  21. package/dist/esm/src/methods/chrome-adapter.d.ts +124 -0
  22. package/dist/esm/src/methods/count-tokens.d.ts +21 -0
  23. package/dist/esm/src/methods/generate-content.d.ts +25 -0
  24. package/dist/esm/src/methods/live-session-helpers.d.ts +154 -0
  25. package/dist/esm/src/methods/live-session.d.ts +154 -0
  26. package/dist/esm/src/models/ai-model.d.ts +72 -0
  27. package/dist/esm/src/models/generative-model.d.ts +56 -0
  28. package/dist/esm/src/models/imagen-model.d.ts +102 -0
  29. package/dist/esm/src/models/index.d.ts +20 -0
  30. package/dist/esm/src/models/live-generative-model.d.ts +55 -0
  31. package/dist/esm/src/models/template-generative-model.d.ts +64 -0
  32. package/dist/esm/src/models/template-imagen-model.d.ts +51 -0
  33. package/dist/esm/src/models/utils.d.ts +26 -0
  34. package/dist/esm/src/public-types.d.ts +97 -0
  35. package/dist/esm/src/requests/hybrid-helpers.d.ts +33 -0
  36. package/dist/esm/src/requests/imagen-image-format.d.ts +61 -0
  37. package/dist/esm/src/requests/request-helpers.d.ts +28 -0
  38. package/dist/esm/src/requests/request.d.ts +69 -0
  39. package/dist/esm/src/requests/response-helpers.d.ts +57 -0
  40. package/dist/esm/src/requests/schema-builder.d.ts +170 -0
  41. package/dist/esm/src/requests/stream-reader.d.ts +39 -0
  42. package/dist/esm/src/service.d.ts +35 -0
  43. package/dist/esm/src/types/chrome-adapter.d.ts +61 -0
  44. package/dist/esm/src/types/content.d.ts +266 -0
  45. package/dist/esm/src/types/enums.d.ts +419 -0
  46. package/dist/esm/src/types/error.d.ts +89 -0
  47. package/dist/esm/src/types/googleai.d.ts +57 -0
  48. package/dist/esm/src/types/imagen/index.d.ts +18 -0
  49. package/dist/esm/src/types/imagen/internal.d.ts +134 -0
  50. package/dist/esm/src/types/imagen/requests.d.ts +245 -0
  51. package/dist/esm/src/types/imagen/responses.d.ts +79 -0
  52. package/dist/esm/src/types/index.d.ts +26 -0
  53. package/dist/esm/src/types/internal.d.ts +35 -0
  54. package/dist/esm/src/types/language-model.d.ts +107 -0
  55. package/dist/esm/src/types/live-responses.d.ts +79 -0
  56. package/dist/esm/src/types/requests.d.ts +543 -0
  57. package/dist/esm/src/types/responses.d.ts +607 -0
  58. package/dist/esm/src/types/schema.d.ts +139 -0
  59. package/dist/esm/src/websocket.d.ts +67 -0
  60. package/dist/index.cjs.js +4820 -0
  61. package/dist/index.cjs.js.map +1 -0
  62. package/dist/index.node.cjs.js +4512 -0
  63. package/dist/index.node.cjs.js.map +1 -0
  64. package/dist/index.node.mjs +4457 -0
  65. package/dist/index.node.mjs.map +1 -0
  66. package/dist/src/api.d.ts +121 -0
  67. package/dist/src/backend.d.ts +98 -0
  68. package/dist/src/constants.d.ts +29 -0
  69. package/dist/src/errors.d.ts +35 -0
  70. package/dist/src/factory-browser.d.ts +19 -0
  71. package/dist/src/factory-node.d.ts +19 -0
  72. package/dist/src/googleai-mappers.d.ts +73 -0
  73. package/dist/src/helpers.d.ts +30 -0
  74. package/dist/src/index.d.ts +13 -0
  75. package/dist/src/index.node.d.ts +7 -0
  76. package/dist/src/logger.d.ts +18 -0
  77. package/dist/src/methods/chat-session-helpers.d.ts +18 -0
  78. package/dist/src/methods/chat-session.d.ts +77 -0
  79. package/dist/src/methods/chrome-adapter.d.ts +124 -0
  80. package/dist/src/methods/count-tokens.d.ts +21 -0
  81. package/dist/src/methods/generate-content.d.ts +25 -0
  82. package/dist/src/methods/live-session-helpers.d.ts +154 -0
  83. package/dist/src/methods/live-session.d.ts +154 -0
  84. package/dist/src/models/ai-model.d.ts +72 -0
  85. package/dist/src/models/generative-model.d.ts +56 -0
  86. package/dist/src/models/imagen-model.d.ts +102 -0
  87. package/dist/src/models/index.d.ts +20 -0
  88. package/dist/src/models/live-generative-model.d.ts +55 -0
  89. package/dist/src/models/template-generative-model.d.ts +64 -0
  90. package/dist/src/models/template-imagen-model.d.ts +51 -0
  91. package/dist/src/models/utils.d.ts +26 -0
  92. package/dist/src/public-types.d.ts +97 -0
  93. package/dist/src/requests/hybrid-helpers.d.ts +33 -0
  94. package/dist/src/requests/imagen-image-format.d.ts +61 -0
  95. package/dist/src/requests/request-helpers.d.ts +28 -0
  96. package/dist/src/requests/request.d.ts +69 -0
  97. package/dist/src/requests/response-helpers.d.ts +57 -0
  98. package/dist/src/requests/schema-builder.d.ts +170 -0
  99. package/dist/src/requests/stream-reader.d.ts +39 -0
  100. package/dist/src/service.d.ts +35 -0
  101. package/dist/src/tsdoc-metadata.json +11 -0
  102. package/dist/src/types/chrome-adapter.d.ts +61 -0
  103. package/dist/src/types/content.d.ts +266 -0
  104. package/dist/src/types/enums.d.ts +419 -0
  105. package/dist/src/types/error.d.ts +89 -0
  106. package/dist/src/types/googleai.d.ts +57 -0
  107. package/dist/src/types/imagen/index.d.ts +18 -0
  108. package/dist/src/types/imagen/internal.d.ts +134 -0
  109. package/dist/src/types/imagen/requests.d.ts +245 -0
  110. package/dist/src/types/imagen/responses.d.ts +79 -0
  111. package/dist/src/types/index.d.ts +26 -0
  112. package/dist/src/types/internal.d.ts +35 -0
  113. package/dist/src/types/language-model.d.ts +107 -0
  114. package/dist/src/types/live-responses.d.ts +79 -0
  115. package/dist/src/types/requests.d.ts +543 -0
  116. package/dist/src/types/responses.d.ts +607 -0
  117. package/dist/src/types/schema.d.ts +139 -0
  118. package/dist/src/websocket.d.ts +67 -0
  119. package/package.json +106 -0
@@ -0,0 +1,607 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Content, FunctionCall, InlineDataPart } from './content';
18
+ import { BlockReason, FinishReason, HarmCategory, HarmProbability, HarmSeverity, InferenceSource, Modality } from './enums';
19
+ /**
20
+ * Result object returned from {@link GenerativeModel.generateContent} call.
21
+ *
22
+ * @public
23
+ */
24
+ export interface GenerateContentResult {
25
+ response: EnhancedGenerateContentResponse;
26
+ }
27
+ /**
28
+ * Result object returned from {@link GenerativeModel.generateContentStream} call.
29
+ * Iterate over `stream` to get chunks as they come in and/or
30
+ * use the `response` promise to get the aggregated response when
31
+ * the stream is done.
32
+ *
33
+ * @public
34
+ */
35
+ export interface GenerateContentStreamResult {
36
+ stream: AsyncGenerator<EnhancedGenerateContentResponse>;
37
+ response: Promise<EnhancedGenerateContentResponse>;
38
+ }
39
+ /**
40
+ * Response object wrapped with helper methods.
41
+ *
42
+ * @public
43
+ */
44
+ export interface EnhancedGenerateContentResponse extends GenerateContentResponse {
45
+ /**
46
+ * Returns the text string from the response, if available.
47
+ * Throws if the prompt or candidate was blocked.
48
+ */
49
+ text: () => string;
50
+ /**
51
+ * Aggregates and returns every {@link InlineDataPart} from the first candidate of
52
+ * {@link GenerateContentResponse}.
53
+ *
54
+ * @throws If the prompt or candidate was blocked.
55
+ */
56
+ inlineDataParts: () => InlineDataPart[] | undefined;
57
+ /**
58
+ * Aggregates and returns every {@link FunctionCall} from the first candidate of
59
+ * {@link GenerateContentResponse}.
60
+ *
61
+ * @throws If the prompt or candidate was blocked.
62
+ */
63
+ functionCalls: () => FunctionCall[] | undefined;
64
+ /**
65
+ * Aggregates and returns every {@link TextPart} with their `thought` property set
66
+ * to `true` from the first candidate of {@link GenerateContentResponse}.
67
+ *
68
+ * @throws If the prompt or candidate was blocked.
69
+ *
70
+ * @remarks
71
+ * Thought summaries provide a brief overview of the model's internal thinking process,
72
+ * offering insight into how it arrived at the final answer. This can be useful for
73
+ * debugging, understanding the model's reasoning, and verifying its accuracy.
74
+ *
75
+ * Thoughts will only be included if {@link ThinkingConfig.includeThoughts} is
76
+ * set to `true`.
77
+ */
78
+ thoughtSummary: () => string | undefined;
79
+ /**
80
+ * Indicates whether inference happened on-device or in-cloud.
81
+ *
82
+ * @beta
83
+ */
84
+ inferenceSource?: InferenceSource;
85
+ }
86
+ /**
87
+ * Individual response from {@link GenerativeModel.generateContent} and
88
+ * {@link GenerativeModel.generateContentStream}.
89
+ * `generateContentStream()` will return one in each chunk until
90
+ * the stream is done.
91
+ * @public
92
+ */
93
+ export interface GenerateContentResponse {
94
+ candidates?: GenerateContentCandidate[];
95
+ promptFeedback?: PromptFeedback;
96
+ usageMetadata?: UsageMetadata;
97
+ }
98
+ /**
99
+ * Usage metadata about a {@link GenerateContentResponse}.
100
+ *
101
+ * @public
102
+ */
103
+ export interface UsageMetadata {
104
+ promptTokenCount: number;
105
+ candidatesTokenCount: number;
106
+ /**
107
+ * The number of tokens used by the model's internal "thinking" process.
108
+ */
109
+ thoughtsTokenCount?: number;
110
+ totalTokenCount: number;
111
+ /**
112
+ * The number of tokens used by tools.
113
+ */
114
+ toolUsePromptTokenCount?: number;
115
+ promptTokensDetails?: ModalityTokenCount[];
116
+ candidatesTokensDetails?: ModalityTokenCount[];
117
+ /**
118
+ * A list of tokens used by tools, broken down by modality.
119
+ */
120
+ toolUsePromptTokensDetails?: ModalityTokenCount[];
121
+ /**
122
+ * The number of tokens in the prompt that were served from the cache.
123
+ * If implicit caching is not active or no content was cached,
124
+ * this will be 0.
125
+ */
126
+ cachedContentTokenCount?: number;
127
+ /**
128
+ * Detailed breakdown of the cached tokens by modality (for example, text or
129
+ * image). This list provides granular insight into which parts of
130
+ * the content were cached.
131
+ */
132
+ cacheTokensDetails?: ModalityTokenCount[];
133
+ }
134
+ /**
135
+ * Represents token counting info for a single modality.
136
+ *
137
+ * @public
138
+ */
139
+ export interface ModalityTokenCount {
140
+ /** The modality associated with this token count. */
141
+ modality: Modality;
142
+ /** The number of tokens counted. */
143
+ tokenCount: number;
144
+ }
145
+ /**
146
+ * If the prompt was blocked, this will be populated with `blockReason` and
147
+ * the relevant `safetyRatings`.
148
+ * @public
149
+ */
150
+ export interface PromptFeedback {
151
+ blockReason?: BlockReason;
152
+ safetyRatings: SafetyRating[];
153
+ /**
154
+ * A human-readable description of the `blockReason`.
155
+ *
156
+ * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
157
+ */
158
+ blockReasonMessage?: string;
159
+ }
160
+ /**
161
+ * A candidate returned as part of a {@link GenerateContentResponse}.
162
+ * @public
163
+ */
164
+ export interface GenerateContentCandidate {
165
+ index: number;
166
+ content: Content;
167
+ finishReason?: FinishReason;
168
+ finishMessage?: string;
169
+ safetyRatings?: SafetyRating[];
170
+ citationMetadata?: CitationMetadata;
171
+ groundingMetadata?: GroundingMetadata;
172
+ urlContextMetadata?: URLContextMetadata;
173
+ }
174
+ /**
175
+ * Citation metadata that may be found on a {@link GenerateContentCandidate}.
176
+ * @public
177
+ */
178
+ export interface CitationMetadata {
179
+ citations: Citation[];
180
+ }
181
+ /**
182
+ * A single citation.
183
+ * @public
184
+ */
185
+ export interface Citation {
186
+ startIndex?: number;
187
+ endIndex?: number;
188
+ uri?: string;
189
+ license?: string;
190
+ /**
191
+ * The title of the cited source, if available.
192
+ *
193
+ * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
194
+ */
195
+ title?: string;
196
+ /**
197
+ * The publication date of the cited source, if available.
198
+ *
199
+ * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
200
+ */
201
+ publicationDate?: Date;
202
+ }
203
+ /**
204
+ * Metadata returned when grounding is enabled.
205
+ *
206
+ * Currently, only Grounding with Google Search is supported (see {@link GoogleSearchTool}).
207
+ *
208
+ * Important: If using Grounding with Google Search, you are required to comply with the
209
+ * "Grounding with Google Search" usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
210
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
211
+ * section within the Service Specific Terms).
212
+ *
213
+ * @public
214
+ */
215
+ export interface GroundingMetadata {
216
+ /**
217
+ * Google Search entry point for web searches. This contains an HTML/CSS snippet that must be
218
+ * embedded in an app to display a Google Search entry point for follow-up web searches related to
219
+ * a model's "Grounded Response".
220
+ */
221
+ searchEntryPoint?: SearchEntrypoint;
222
+ /**
223
+ * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content
224
+ * (for example, from a web page). that the model used to ground its response.
225
+ */
226
+ groundingChunks?: GroundingChunk[];
227
+ /**
228
+ * A list of {@link GroundingSupport} objects. Each object details how specific segments of the
229
+ * model's response are supported by the `groundingChunks`.
230
+ */
231
+ groundingSupports?: GroundingSupport[];
232
+ /**
233
+ * A list of web search queries that the model performed to gather the grounding information.
234
+ * These can be used to allow users to explore the search results themselves.
235
+ */
236
+ webSearchQueries?: string[];
237
+ /**
238
+ * @deprecated Use {@link GroundingSupport} instead.
239
+ */
240
+ retrievalQueries?: string[];
241
+ }
242
+ /**
243
+ * Google search entry point.
244
+ *
245
+ * @public
246
+ */
247
+ export interface SearchEntrypoint {
248
+ /**
249
+ * HTML/CSS snippet that must be embedded in a web page. The snippet is designed to avoid
250
+ * undesired interaction with the rest of the page's CSS.
251
+ *
252
+ * To ensure proper rendering and prevent CSS conflicts, it is recommended
253
+ * to encapsulate this `renderedContent` within a shadow DOM when embedding it
254
+ * into a webpage. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM | MDN: Using shadow DOM}.
255
+ *
256
+ * @example
257
+ * ```javascript
258
+ * const container = document.createElement('div');
259
+ * document.body.appendChild(container);
260
+ * container.attachShadow({ mode: 'open' }).innerHTML = renderedContent;
261
+ * ```
262
+ */
263
+ renderedContent?: string;
264
+ }
265
+ /**
266
+ * Represents a chunk of retrieved data that supports a claim in the model's response. This is part
267
+ * of the grounding information provided when grounding is enabled.
268
+ *
269
+ * @public
270
+ */
271
+ export interface GroundingChunk {
272
+ /**
273
+ * Contains details if the grounding chunk is from a web source.
274
+ */
275
+ web?: WebGroundingChunk;
276
+ }
277
+ /**
278
+ * A grounding chunk from the web.
279
+ *
280
+ * Important: If using Grounding with Google Search, you are required to comply with the
281
+ * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search".
282
+ *
283
+ * @public
284
+ */
285
+ export interface WebGroundingChunk {
286
+ /**
287
+ * The URI of the retrieved web page.
288
+ */
289
+ uri?: string;
290
+ /**
291
+ * The title of the retrieved web page.
292
+ */
293
+ title?: string;
294
+ /**
295
+ * The domain of the original URI from which the content was retrieved.
296
+ *
297
+ * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
298
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
299
+ * `undefined`.
300
+ */
301
+ domain?: string;
302
+ }
303
+ /**
304
+ * Provides information about how a specific segment of the model's response is supported by the
305
+ * retrieved grounding chunks.
306
+ *
307
+ * @public
308
+ */
309
+ export interface GroundingSupport {
310
+ /**
311
+ * Specifies the segment of the model's response content that this grounding support pertains to.
312
+ */
313
+ segment?: Segment;
314
+ /**
315
+ * A list of indices that refer to specific {@link GroundingChunk} objects within the
316
+ * {@link GroundingMetadata.groundingChunks} array. These referenced chunks
317
+ * are the sources that support the claim made in the associated `segment` of the response.
318
+ * For example, an array `[1, 3, 4]` means that `groundingChunks[1]`, `groundingChunks[3]`,
319
+ * and `groundingChunks[4]` are the retrieved content supporting this part of the response.
320
+ */
321
+ groundingChunkIndices?: number[];
322
+ }
323
+ /**
324
+ * Represents a specific segment within a {@link Content} object, often used to
325
+ * pinpoint the exact location of text or data that grounding information refers to.
326
+ *
327
+ * @public
328
+ */
329
+ export interface Segment {
330
+ /**
331
+ * The zero-based index of the {@link Part} object within the `parts` array
332
+ * of its parent {@link Content} object. This identifies which part of the
333
+ * content the segment belongs to.
334
+ */
335
+ partIndex: number;
336
+ /**
337
+ * The zero-based start index of the segment within the specified `Part`,
338
+ * measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the
339
+ * beginning of the part's content (e.g., `Part.text`).
340
+ */
341
+ startIndex: number;
342
+ /**
343
+ * The zero-based end index of the segment within the specified `Part`,
344
+ * measured in UTF-8 bytes. This offset is exclusive, meaning the character
345
+ * at this index is not included in the segment.
346
+ */
347
+ endIndex: number;
348
+ /**
349
+ * The text corresponding to the segment from the response.
350
+ */
351
+ text: string;
352
+ }
353
+ /**
354
+ * Metadata related to {@link URLContextTool}.
355
+ *
356
+ * @public
357
+ */
358
+ export interface URLContextMetadata {
359
+ /**
360
+ * List of URL metadata used to provide context to the Gemini model.
361
+ */
362
+ urlMetadata: URLMetadata[];
363
+ }
364
+ /**
365
+ * Metadata for a single URL retrieved by the {@link URLContextTool} tool.
366
+ *
367
+ * @public
368
+ */
369
+ export interface URLMetadata {
370
+ /**
371
+ * The retrieved URL.
372
+ */
373
+ retrievedUrl?: string;
374
+ /**
375
+ * The status of the URL retrieval.
376
+ */
377
+ urlRetrievalStatus?: URLRetrievalStatus;
378
+ }
379
+ /**
380
+ * The status of a URL retrieval.
381
+ *
382
+ * @remarks
383
+ * <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
384
+ * <br/>
385
+ * <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
386
+ * <br/>
387
+ * <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
388
+ * <br/>
389
+ * <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
390
+ * <br/>
391
+ * <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
392
+ * <br/>
393
+ *
394
+ * @public
395
+ */
396
+ export declare const URLRetrievalStatus: {
397
+ /**
398
+ * Unspecified retrieval status.
399
+ */
400
+ URL_RETRIEVAL_STATUS_UNSPECIFIED: string;
401
+ /**
402
+ * The URL retrieval was successful.
403
+ */
404
+ URL_RETRIEVAL_STATUS_SUCCESS: string;
405
+ /**
406
+ * The URL retrieval failed.
407
+ */
408
+ URL_RETRIEVAL_STATUS_ERROR: string;
409
+ /**
410
+ * The URL retrieval failed because the content is behind a paywall.
411
+ */
412
+ URL_RETRIEVAL_STATUS_PAYWALL: string;
413
+ /**
414
+ * The URL retrieval failed because the content is unsafe.
415
+ */
416
+ URL_RETRIEVAL_STATUS_UNSAFE: string;
417
+ };
418
+ /**
419
+ * The status of a URL retrieval.
420
+ *
421
+ * @remarks
422
+ * <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
423
+ * <br/>
424
+ * <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
425
+ * <br/>
426
+ * <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
427
+ * <br/>
428
+ * <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
429
+ * <br/>
430
+ * <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
431
+ * <br/>
432
+ *
433
+ * @public
434
+ */
435
+ export type URLRetrievalStatus = (typeof URLRetrievalStatus)[keyof typeof URLRetrievalStatus];
436
+ /**
437
+ * @public
438
+ */
439
+ export interface WebAttribution {
440
+ uri: string;
441
+ title: string;
442
+ }
443
+ /**
444
+ * @public
445
+ */
446
+ export interface RetrievedContextAttribution {
447
+ uri: string;
448
+ title: string;
449
+ }
450
+ /**
451
+ * Protobuf google.type.Date
452
+ * @public
453
+ */
454
+ export interface Date {
455
+ year: number;
456
+ month: number;
457
+ day: number;
458
+ }
459
+ /**
460
+ * A safety rating associated with a {@link GenerateContentCandidate}
461
+ * @public
462
+ */
463
+ export interface SafetyRating {
464
+ category: HarmCategory;
465
+ probability: HarmProbability;
466
+ /**
467
+ * The harm severity level.
468
+ *
469
+ * This property is only supported when using the Vertex AI Gemini API ({@link VertexAIBackend}).
470
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property is not supported and will default to `HarmSeverity.UNSUPPORTED`.
471
+ */
472
+ severity: HarmSeverity;
473
+ /**
474
+ * The probability score of the harm category.
475
+ *
476
+ * This property is only supported when using the Vertex AI Gemini API ({@link VertexAIBackend}).
477
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property is not supported and will default to 0.
478
+ */
479
+ probabilityScore: number;
480
+ /**
481
+ * The severity score of the harm category.
482
+ *
483
+ * This property is only supported when using the Vertex AI Gemini API ({@link VertexAIBackend}).
484
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property is not supported and will default to 0.
485
+ */
486
+ severityScore: number;
487
+ blocked: boolean;
488
+ }
489
+ /**
490
+ * Response from calling {@link GenerativeModel.countTokens}.
491
+ * @public
492
+ */
493
+ export interface CountTokensResponse {
494
+ /**
495
+ * The total number of tokens counted across all instances from the request.
496
+ */
497
+ totalTokens: number;
498
+ /**
499
+ * @deprecated Use `totalTokens` instead. This property is undefined when using models greater than `gemini-1.5-*`.
500
+ *
501
+ * The total number of billable characters counted across all instances
502
+ * from the request.
503
+ */
504
+ totalBillableCharacters?: number;
505
+ /**
506
+ * The breakdown, by modality, of how many tokens are consumed by the prompt.
507
+ */
508
+ promptTokensDetails?: ModalityTokenCount[];
509
+ }
510
+ /**
511
+ * An incremental content update from the model.
512
+ *
513
+ * @beta
514
+ */
515
+ export interface LiveServerContent {
516
+ type: 'serverContent';
517
+ /**
518
+ * The content that the model has generated as part of the current conversation with the user.
519
+ */
520
+ modelTurn?: Content;
521
+ /**
522
+ * Indicates whether the turn is complete. This is `undefined` if the turn is not complete.
523
+ */
524
+ turnComplete?: boolean;
525
+ /**
526
+ * Indicates whether the model was interrupted by the client. An interruption occurs when
527
+ * the client sends a message before the model finishes it's turn. This is `undefined` if the
528
+ * model was not interrupted.
529
+ */
530
+ interrupted?: boolean;
531
+ /**
532
+ * Transcription of the audio that was input to the model.
533
+ */
534
+ inputTranscription?: Transcription;
535
+ /**
536
+ * Transcription of the audio output from the model.
537
+ */
538
+ outputTranscription?: Transcription;
539
+ }
540
+ /**
541
+ * Transcription of audio. This can be returned from a {@link LiveGenerativeModel} if transcription
542
+ * is enabled with the `inputAudioTranscription` or `outputAudioTranscription` properties on
543
+ * the {@link LiveGenerationConfig}.
544
+ *
545
+ * @beta
546
+ */
547
+ export interface Transcription {
548
+ /**
549
+ * The text transcription of the audio.
550
+ */
551
+ text?: string;
552
+ }
553
+ /**
554
+ * A request from the model for the client to execute one or more functions.
555
+ *
556
+ * @beta
557
+ */
558
+ export interface LiveServerToolCall {
559
+ type: 'toolCall';
560
+ /**
561
+ * An array of function calls to run.
562
+ */
563
+ functionCalls: FunctionCall[];
564
+ }
565
+ /**
566
+ * Notification to cancel a previous function call triggered by {@link LiveServerToolCall}.
567
+ *
568
+ * @beta
569
+ */
570
+ export interface LiveServerToolCallCancellation {
571
+ type: 'toolCallCancellation';
572
+ /**
573
+ * IDs of function calls that were cancelled. These refer to the `id` property of a {@link FunctionCall}.
574
+ */
575
+ functionIds: string[];
576
+ }
577
+ /**
578
+ * Notification that the server will not be able to service the client soon.
579
+ *
580
+ * @beta
581
+ */
582
+ export interface LiveServerGoingAwayNotice {
583
+ type: 'goingAwayNotice';
584
+ /**
585
+ * The remaining time (in seconds) before the connection will be terminated.
586
+ */
587
+ timeLeft: number;
588
+ }
589
+ /**
590
+ * The types of responses that can be returned by {@link LiveSession.receive}.
591
+ *
592
+ * @beta
593
+ */
594
+ export declare const LiveResponseType: {
595
+ SERVER_CONTENT: string;
596
+ TOOL_CALL: string;
597
+ TOOL_CALL_CANCELLATION: string;
598
+ GOING_AWAY_NOTICE: string;
599
+ };
600
+ /**
601
+ * The types of responses that can be returned by {@link LiveSession.receive}.
602
+ * This is a property on all messages that can be used for type narrowing. This property is not
603
+ * returned by the server, it is assigned to a server message object once it's parsed.
604
+ *
605
+ * @beta
606
+ */
607
+ export type LiveResponseType = (typeof LiveResponseType)[keyof typeof LiveResponseType];