@firebase/ai 2.3.0-20250917161512 → 2.3.0-canary.0ffcb26af

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.
@@ -4,7 +4,7 @@ import { FirebaseError, Deferred, getModularInstance } from '@firebase/util';
4
4
  import { Logger } from '@firebase/logger';
5
5
 
6
6
  var name = "@firebase/ai";
7
- var version = "2.3.0-20250917161512";
7
+ var version = "2.3.0-canary.0ffcb26af";
8
8
 
9
9
  /**
10
10
  * @license
@@ -360,6 +360,45 @@ const Language = {
360
360
  * See the License for the specific language governing permissions and
361
361
  * limitations under the License.
362
362
  */
363
+ /**
364
+ * The status of a URL retrieval.
365
+ *
366
+ * @remarks
367
+ * <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
368
+ * <br/>
369
+ * <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
370
+ * <br/>
371
+ * <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
372
+ * <br/>
373
+ * <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
374
+ * <br/>
375
+ * <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
376
+ * <br/>
377
+ *
378
+ * @beta
379
+ */
380
+ const URLRetrievalStatus = {
381
+ /**
382
+ * Unspecified retrieval status.
383
+ */
384
+ URL_RETRIEVAL_STATUS_UNSPECIFIED: 'URL_RETRIEVAL_STATUS_UNSPECIFIED',
385
+ /**
386
+ * The URL retrieval was successful.
387
+ */
388
+ URL_RETRIEVAL_STATUS_SUCCESS: 'URL_RETRIEVAL_STATUS_SUCCESS',
389
+ /**
390
+ * The URL retrieval failed.
391
+ */
392
+ URL_RETRIEVAL_STATUS_ERROR: 'URL_RETRIEVAL_STATUS_ERROR',
393
+ /**
394
+ * The URL retrieval failed because the content is behind a paywall.
395
+ */
396
+ URL_RETRIEVAL_STATUS_PAYWALL: 'URL_RETRIEVAL_STATUS_PAYWALL',
397
+ /**
398
+ * The URL retrieval failed because the content is unsafe.
399
+ */
400
+ URL_RETRIEVAL_STATUS_UNSAFE: 'URL_RETRIEVAL_STATUS_UNSAFE'
401
+ };
363
402
  /**
364
403
  * The types of responses that can be returned by {@link LiveSession.receive}.
365
404
  *
@@ -1563,7 +1602,8 @@ function mapGenerateContentCandidates(candidates) {
1563
1602
  finishMessage: candidate.finishMessage,
1564
1603
  safetyRatings: mappedSafetyRatings,
1565
1604
  citationMetadata,
1566
- groundingMetadata: candidate.groundingMetadata
1605
+ groundingMetadata: candidate.groundingMetadata,
1606
+ urlContextMetadata: candidate.urlContextMetadata
1567
1607
  };
1568
1608
  mappedCandidates.push(mappedCandidate);
1569
1609
  });
@@ -1733,6 +1773,17 @@ function aggregateResponses(responses) {
1733
1773
  candidate.safetyRatings;
1734
1774
  aggregatedResponse.candidates[i].groundingMetadata =
1735
1775
  candidate.groundingMetadata;
1776
+ // The urlContextMetadata object is defined in the first chunk of the response stream.
1777
+ // In all subsequent chunks, the urlContextMetadata object will be undefined. We need to
1778
+ // make sure that we don't overwrite the first value urlContextMetadata object with undefined.
1779
+ // FIXME: What happens if we receive a second, valid urlContextMetadata object?
1780
+ const urlContextMetadata = candidate.urlContextMetadata;
1781
+ if (typeof urlContextMetadata === 'object' &&
1782
+ urlContextMetadata !== null &&
1783
+ Object.keys(urlContextMetadata).length > 0) {
1784
+ aggregatedResponse.candidates[i].urlContextMetadata =
1785
+ urlContextMetadata;
1786
+ }
1736
1787
  /**
1737
1788
  * Candidates should always have content and parts, but this handles
1738
1789
  * possible malformed responses.
@@ -3722,5 +3773,5 @@ function registerAI() {
3722
3773
  }
3723
3774
  registerAI();
3724
3775
 
3725
- export { AIError, AIErrorCode, AIModel, AnyOfSchema, ArraySchema, Backend, BackendType, BlockReason, BooleanSchema, ChatSession, FinishReason, FunctionCallingMode, GenerativeModel, GoogleAIBackend, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, ImagenAspectRatio, ImagenImageFormat, ImagenModel, ImagenPersonFilterLevel, ImagenSafetyFilterLevel, InferenceMode, IntegerSchema, Language, LiveGenerativeModel, LiveResponseType, LiveSession, Modality, NumberSchema, ObjectSchema, Outcome, POSSIBLE_ROLES, ResponseModality, Schema, SchemaType, StringSchema, VertexAIBackend, getAI, getGenerativeModel, getImagenModel, getLiveGenerativeModel, startAudioConversation };
3776
+ export { AIError, AIErrorCode, AIModel, AnyOfSchema, ArraySchema, Backend, BackendType, BlockReason, BooleanSchema, ChatSession, FinishReason, FunctionCallingMode, GenerativeModel, GoogleAIBackend, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, ImagenAspectRatio, ImagenImageFormat, ImagenModel, ImagenPersonFilterLevel, ImagenSafetyFilterLevel, InferenceMode, IntegerSchema, Language, LiveGenerativeModel, LiveResponseType, LiveSession, Modality, NumberSchema, ObjectSchema, Outcome, POSSIBLE_ROLES, ResponseModality, Schema, SchemaType, StringSchema, URLRetrievalStatus, VertexAIBackend, getAI, getGenerativeModel, getImagenModel, getLiveGenerativeModel, startAudioConversation };
3726
3777
  //# sourceMappingURL=index.node.mjs.map