@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.
- package/dist/ai-public.d.ts +119 -1
- package/dist/ai.d.ts +120 -1
- package/dist/esm/index.esm.js +54 -3
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/types/googleai.d.ts +2 -1
- package/dist/esm/src/types/requests.d.ts +21 -1
- package/dist/esm/src/types/responses.d.ts +92 -0
- package/dist/index.cjs.js +54 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +54 -2
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +54 -3
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/types/googleai.d.ts +2 -1
- package/dist/src/types/requests.d.ts +21 -1
- package/dist/src/types/responses.d.ts +92 -0
- package/package.json +8 -8
package/dist/index.node.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
|
|
|
8
8
|
var logger$1 = require('@firebase/logger');
|
|
9
9
|
|
|
10
10
|
var name = "@firebase/ai";
|
|
11
|
-
var version = "2.3.0-
|
|
11
|
+
var version = "2.3.0-canary.0ffcb26af";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -364,6 +364,45 @@ const Language = {
|
|
|
364
364
|
* See the License for the specific language governing permissions and
|
|
365
365
|
* limitations under the License.
|
|
366
366
|
*/
|
|
367
|
+
/**
|
|
368
|
+
* The status of a URL retrieval.
|
|
369
|
+
*
|
|
370
|
+
* @remarks
|
|
371
|
+
* <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
|
|
372
|
+
* <br/>
|
|
373
|
+
* <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
|
|
374
|
+
* <br/>
|
|
375
|
+
* <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
|
|
376
|
+
* <br/>
|
|
377
|
+
* <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
|
|
378
|
+
* <br/>
|
|
379
|
+
* <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
|
|
380
|
+
* <br/>
|
|
381
|
+
*
|
|
382
|
+
* @beta
|
|
383
|
+
*/
|
|
384
|
+
const URLRetrievalStatus = {
|
|
385
|
+
/**
|
|
386
|
+
* Unspecified retrieval status.
|
|
387
|
+
*/
|
|
388
|
+
URL_RETRIEVAL_STATUS_UNSPECIFIED: 'URL_RETRIEVAL_STATUS_UNSPECIFIED',
|
|
389
|
+
/**
|
|
390
|
+
* The URL retrieval was successful.
|
|
391
|
+
*/
|
|
392
|
+
URL_RETRIEVAL_STATUS_SUCCESS: 'URL_RETRIEVAL_STATUS_SUCCESS',
|
|
393
|
+
/**
|
|
394
|
+
* The URL retrieval failed.
|
|
395
|
+
*/
|
|
396
|
+
URL_RETRIEVAL_STATUS_ERROR: 'URL_RETRIEVAL_STATUS_ERROR',
|
|
397
|
+
/**
|
|
398
|
+
* The URL retrieval failed because the content is behind a paywall.
|
|
399
|
+
*/
|
|
400
|
+
URL_RETRIEVAL_STATUS_PAYWALL: 'URL_RETRIEVAL_STATUS_PAYWALL',
|
|
401
|
+
/**
|
|
402
|
+
* The URL retrieval failed because the content is unsafe.
|
|
403
|
+
*/
|
|
404
|
+
URL_RETRIEVAL_STATUS_UNSAFE: 'URL_RETRIEVAL_STATUS_UNSAFE'
|
|
405
|
+
};
|
|
367
406
|
/**
|
|
368
407
|
* The types of responses that can be returned by {@link LiveSession.receive}.
|
|
369
408
|
*
|
|
@@ -1567,7 +1606,8 @@ function mapGenerateContentCandidates(candidates) {
|
|
|
1567
1606
|
finishMessage: candidate.finishMessage,
|
|
1568
1607
|
safetyRatings: mappedSafetyRatings,
|
|
1569
1608
|
citationMetadata,
|
|
1570
|
-
groundingMetadata: candidate.groundingMetadata
|
|
1609
|
+
groundingMetadata: candidate.groundingMetadata,
|
|
1610
|
+
urlContextMetadata: candidate.urlContextMetadata
|
|
1571
1611
|
};
|
|
1572
1612
|
mappedCandidates.push(mappedCandidate);
|
|
1573
1613
|
});
|
|
@@ -1737,6 +1777,17 @@ function aggregateResponses(responses) {
|
|
|
1737
1777
|
candidate.safetyRatings;
|
|
1738
1778
|
aggregatedResponse.candidates[i].groundingMetadata =
|
|
1739
1779
|
candidate.groundingMetadata;
|
|
1780
|
+
// The urlContextMetadata object is defined in the first chunk of the response stream.
|
|
1781
|
+
// In all subsequent chunks, the urlContextMetadata object will be undefined. We need to
|
|
1782
|
+
// make sure that we don't overwrite the first value urlContextMetadata object with undefined.
|
|
1783
|
+
// FIXME: What happens if we receive a second, valid urlContextMetadata object?
|
|
1784
|
+
const urlContextMetadata = candidate.urlContextMetadata;
|
|
1785
|
+
if (typeof urlContextMetadata === 'object' &&
|
|
1786
|
+
urlContextMetadata !== null &&
|
|
1787
|
+
Object.keys(urlContextMetadata).length > 0) {
|
|
1788
|
+
aggregatedResponse.candidates[i].urlContextMetadata =
|
|
1789
|
+
urlContextMetadata;
|
|
1790
|
+
}
|
|
1740
1791
|
/**
|
|
1741
1792
|
* Candidates should always have content and parts, but this handles
|
|
1742
1793
|
* possible malformed responses.
|
|
@@ -3765,6 +3816,7 @@ exports.ResponseModality = ResponseModality;
|
|
|
3765
3816
|
exports.Schema = Schema;
|
|
3766
3817
|
exports.SchemaType = SchemaType;
|
|
3767
3818
|
exports.StringSchema = StringSchema;
|
|
3819
|
+
exports.URLRetrievalStatus = URLRetrievalStatus;
|
|
3768
3820
|
exports.VertexAIBackend = VertexAIBackend;
|
|
3769
3821
|
exports.getAI = getAI;
|
|
3770
3822
|
exports.getGenerativeModel = getGenerativeModel;
|