@firebase/ai 1.4.1-canary.2d720995d → 1.4.1-canary.5200f7bb7
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 +34 -26
- package/dist/ai.d.ts +37 -26
- package/dist/esm/index.esm.js +40 -2
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/requests/schema-builder.d.ts +23 -4
- package/dist/esm/src/types/requests.d.ts +1 -1
- package/dist/esm/src/types/responses.d.ts +0 -14
- package/dist/esm/src/types/schema.d.ts +12 -6
- package/dist/index.cjs.js +40 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +40 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +40 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/requests/schema-builder.d.ts +23 -4
- package/dist/src/types/requests.d.ts +1 -1
- package/dist/src/types/responses.d.ts +0 -14
- package/dist/src/types/schema.d.ts +12 -6
- package/package.json +8 -8
|
@@ -24,10 +24,11 @@ import { SchemaInterface, SchemaType, SchemaParams, SchemaRequest } from '../typ
|
|
|
24
24
|
*/
|
|
25
25
|
export declare abstract class Schema implements SchemaInterface {
|
|
26
26
|
/**
|
|
27
|
-
* Optional. The type of the property.
|
|
28
|
-
*
|
|
27
|
+
* Optional. The type of the property.
|
|
28
|
+
* This can only be undefined when using `anyOf` schemas, which do not have an
|
|
29
|
+
* explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI specification}.
|
|
29
30
|
*/
|
|
30
|
-
type
|
|
31
|
+
type?: SchemaType;
|
|
31
32
|
/** Optional. The format of the property.
|
|
32
33
|
* Supported formats:<br/>
|
|
33
34
|
* <ul>
|
|
@@ -77,12 +78,15 @@ export declare abstract class Schema implements SchemaInterface {
|
|
|
77
78
|
static integer(integerParams?: SchemaParams): IntegerSchema;
|
|
78
79
|
static number(numberParams?: SchemaParams): NumberSchema;
|
|
79
80
|
static boolean(booleanParams?: SchemaParams): BooleanSchema;
|
|
81
|
+
static anyOf(anyOfParams: SchemaParams & {
|
|
82
|
+
anyOf: TypedSchema[];
|
|
83
|
+
}): AnyOfSchema;
|
|
80
84
|
}
|
|
81
85
|
/**
|
|
82
86
|
* A type that includes all specific Schema types.
|
|
83
87
|
* @public
|
|
84
88
|
*/
|
|
85
|
-
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema;
|
|
89
|
+
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
|
|
86
90
|
/**
|
|
87
91
|
* Schema class for "integer" types.
|
|
88
92
|
* @public
|
|
@@ -149,3 +153,18 @@ export declare class ObjectSchema extends Schema {
|
|
|
149
153
|
*/
|
|
150
154
|
toJSON(): SchemaRequest;
|
|
151
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Schema class representing a value that can conform to any of the provided sub-schemas. This is
|
|
158
|
+
* useful when a field can accept multiple distinct types or structures.
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
export declare class AnyOfSchema extends Schema {
|
|
162
|
+
anyOf: TypedSchema[];
|
|
163
|
+
constructor(schemaParams: SchemaParams & {
|
|
164
|
+
anyOf: TypedSchema[];
|
|
165
|
+
});
|
|
166
|
+
/**
|
|
167
|
+
* @internal
|
|
168
|
+
*/
|
|
169
|
+
toJSON(): SchemaRequest;
|
|
170
|
+
}
|
|
@@ -87,7 +87,7 @@ export interface GenerationConfig {
|
|
|
87
87
|
* value can be a class generated with a {@link Schema} static method
|
|
88
88
|
* like `Schema.string()` or `Schema.object()` or it can be a plain
|
|
89
89
|
* JS object matching the {@link SchemaRequest} interface.
|
|
90
|
-
* <br/>Note: This only applies when the specified `
|
|
90
|
+
* <br/>Note: This only applies when the specified `responseMimeType` supports a schema; currently
|
|
91
91
|
* this is limited to `application/json` and `text/x.enum`.
|
|
92
92
|
*/
|
|
93
93
|
responseSchema?: TypedSchema | SchemaRequest;
|
|
@@ -192,10 +192,6 @@ export interface GroundingMetadata {
|
|
|
192
192
|
* @deprecated Use {@link GroundingSupport} instead.
|
|
193
193
|
*/
|
|
194
194
|
retrievalQueries?: string[];
|
|
195
|
-
/**
|
|
196
|
-
* @deprecated Use {@link GroundingChunk} instead.
|
|
197
|
-
*/
|
|
198
|
-
groundingAttributions: GroundingAttribution[];
|
|
199
195
|
}
|
|
200
196
|
/**
|
|
201
197
|
* Google search entry point.
|
|
@@ -308,16 +304,6 @@ export interface Segment {
|
|
|
308
304
|
*/
|
|
309
305
|
text: string;
|
|
310
306
|
}
|
|
311
|
-
/**
|
|
312
|
-
* @deprecated
|
|
313
|
-
* @public
|
|
314
|
-
*/
|
|
315
|
-
export interface GroundingAttribution {
|
|
316
|
-
segment: Segment;
|
|
317
|
-
confidenceScore?: number;
|
|
318
|
-
web?: WebAttribution;
|
|
319
|
-
retrievedContext?: RetrievedContextAttribution;
|
|
320
|
-
}
|
|
321
307
|
/**
|
|
322
308
|
* @public
|
|
323
309
|
*/
|
|
@@ -47,6 +47,12 @@ export type SchemaType = (typeof SchemaType)[keyof typeof SchemaType];
|
|
|
47
47
|
* @public
|
|
48
48
|
*/
|
|
49
49
|
export interface SchemaShared<T> {
|
|
50
|
+
/**
|
|
51
|
+
* An array of {@link Schema}. The generated data must be valid against any of the schemas
|
|
52
|
+
* listed in this array. This allows specifying multiple possible structures or types for a
|
|
53
|
+
* single field.
|
|
54
|
+
*/
|
|
55
|
+
anyOf?: T[];
|
|
50
56
|
/** Optional. The format of the property.
|
|
51
57
|
* When using the Gemini Developer API ({@link GoogleAIBackend}), this must be either `'enum'` or
|
|
52
58
|
* `'date-time'`, otherwise requests will fail.
|
|
@@ -97,10 +103,10 @@ export interface SchemaParams extends SchemaShared<SchemaInterface> {
|
|
|
97
103
|
*/
|
|
98
104
|
export interface SchemaRequest extends SchemaShared<SchemaRequest> {
|
|
99
105
|
/**
|
|
100
|
-
* The type of the property.
|
|
101
|
-
*
|
|
106
|
+
* The type of the property. this can only be undefined when using `anyOf` schemas,
|
|
107
|
+
* which do not have an explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI specification }.
|
|
102
108
|
*/
|
|
103
|
-
type
|
|
109
|
+
type?: SchemaType;
|
|
104
110
|
/** Optional. Array of required property. */
|
|
105
111
|
required?: string[];
|
|
106
112
|
}
|
|
@@ -110,10 +116,10 @@ export interface SchemaRequest extends SchemaShared<SchemaRequest> {
|
|
|
110
116
|
*/
|
|
111
117
|
export interface SchemaInterface extends SchemaShared<SchemaInterface> {
|
|
112
118
|
/**
|
|
113
|
-
* The type of the property.
|
|
114
|
-
*
|
|
119
|
+
* The type of the property. this can only be undefined when using `anyof` schemas,
|
|
120
|
+
* which do not have an explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI Specification}.
|
|
115
121
|
*/
|
|
116
|
-
type
|
|
122
|
+
type?: SchemaType;
|
|
117
123
|
}
|
|
118
124
|
/**
|
|
119
125
|
* Interface for JSON parameters in a schema of {@link SchemaType}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/ai",
|
|
3
|
-
"version": "1.4.1-canary.
|
|
3
|
+
"version": "1.4.1-canary.5200f7bb7",
|
|
4
4
|
"description": "The Firebase AI SDK",
|
|
5
5
|
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
|
|
6
6
|
"engines": {
|
|
@@ -45,19 +45,19 @@
|
|
|
45
45
|
"trusted-type-check": "tsec -p tsconfig.json --noEmit"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@firebase/app": "0.13.2-canary.
|
|
49
|
-
"@firebase/app-types": "0.9.3-canary.
|
|
48
|
+
"@firebase/app": "0.13.2-canary.5200f7bb7",
|
|
49
|
+
"@firebase/app-types": "0.9.3-canary.5200f7bb7"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@firebase/app-check-interop-types": "0.3.3-canary.
|
|
53
|
-
"@firebase/component": "0.6.18-canary.
|
|
54
|
-
"@firebase/logger": "0.4.4-canary.
|
|
55
|
-
"@firebase/util": "1.12.1-canary.
|
|
52
|
+
"@firebase/app-check-interop-types": "0.3.3-canary.5200f7bb7",
|
|
53
|
+
"@firebase/component": "0.6.18-canary.5200f7bb7",
|
|
54
|
+
"@firebase/logger": "0.4.4-canary.5200f7bb7",
|
|
55
|
+
"@firebase/util": "1.12.1-canary.5200f7bb7",
|
|
56
56
|
"tslib": "^2.1.0"
|
|
57
57
|
},
|
|
58
58
|
"license": "Apache-2.0",
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@firebase/app": "0.13.2-canary.
|
|
60
|
+
"@firebase/app": "0.13.2-canary.5200f7bb7",
|
|
61
61
|
"@rollup/plugin-json": "6.1.0",
|
|
62
62
|
"rollup": "2.79.2",
|
|
63
63
|
"rollup-plugin-replace": "2.2.0",
|