Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
1508
node_modules/@firebase/vertexai/dist/esm/index.esm2017.js
generated
vendored
Normal file
1508
node_modules/@firebase/vertexai/dist/esm/index.esm2017.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/@firebase/vertexai/dist/esm/index.esm2017.js.map
generated
vendored
Normal file
1
node_modules/@firebase/vertexai/dist/esm/index.esm2017.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@firebase/vertexai/dist/esm/package.json
generated
vendored
Normal file
1
node_modules/@firebase/vertexai/dist/esm/package.json
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"type":"module"}
|
47
node_modules/@firebase/vertexai/dist/esm/src/api.d.ts
generated
vendored
Normal file
47
node_modules/@firebase/vertexai/dist/esm/src/api.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp } from '@firebase/app';
|
||||
import { VERTEX_TYPE } from './constants';
|
||||
import { VertexAIService } from './service';
|
||||
import { VertexAI, VertexAIOptions } from './public-types';
|
||||
import { ModelParams, RequestOptions } from './types';
|
||||
import { VertexAIError } from './errors';
|
||||
import { GenerativeModel } from './models/generative-model';
|
||||
export { ChatSession } from './methods/chat-session';
|
||||
export * from './requests/schema-builder';
|
||||
export { GenerativeModel };
|
||||
export { VertexAIError };
|
||||
declare module '@firebase/component' {
|
||||
interface NameServiceMapping {
|
||||
[VERTEX_TYPE]: VertexAIService;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a <code>{@link VertexAI}</code> instance for the given app.
|
||||
*
|
||||
* @public
|
||||
*
|
||||
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
||||
*/
|
||||
export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
|
||||
/**
|
||||
* Returns a <code>{@link GenerativeModel}</code> class with methods for inference
|
||||
* and other functionality.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function getGenerativeModel(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
|
1
node_modules/@firebase/vertexai/dist/esm/src/api.test.d.ts
generated
vendored
Normal file
1
node_modules/@firebase/vertexai/dist/esm/src/api.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
22
node_modules/@firebase/vertexai/dist/esm/src/constants.d.ts
generated
vendored
Normal file
22
node_modules/@firebase/vertexai/dist/esm/src/constants.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export declare const VERTEX_TYPE = "vertexAI";
|
||||
export declare const DEFAULT_LOCATION = "us-central1";
|
||||
export declare const DEFAULT_BASE_URL = "https://firebasevertexai.googleapis.com";
|
||||
export declare const DEFAULT_API_VERSION = "v1beta";
|
||||
export declare const PACKAGE_VERSION: string;
|
||||
export declare const LANGUAGE_TAG = "gl-js";
|
35
node_modules/@firebase/vertexai/dist/esm/src/errors.d.ts
generated
vendored
Normal file
35
node_modules/@firebase/vertexai/dist/esm/src/errors.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { VertexAIErrorCode, CustomErrorData } from './types';
|
||||
/**
|
||||
* Error class for the Vertex AI in Firebase SDK.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class VertexAIError extends FirebaseError {
|
||||
readonly code: VertexAIErrorCode;
|
||||
readonly customErrorData?: CustomErrorData | undefined;
|
||||
/**
|
||||
* Constructs a new instance of the `VertexAIError` class.
|
||||
*
|
||||
* @param code - The error code from <code>{@link VertexAIErrorCode}</code>.
|
||||
* @param message - A human-readable message describing the error.
|
||||
* @param customErrorData - Optional error data.
|
||||
*/
|
||||
constructor(code: VertexAIErrorCode, message: string, customErrorData?: CustomErrorData | undefined);
|
||||
}
|
12
node_modules/@firebase/vertexai/dist/esm/src/index.d.ts
generated
vendored
Normal file
12
node_modules/@firebase/vertexai/dist/esm/src/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* The Vertex AI in Firebase Web SDK.
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
declare global {
|
||||
interface Window {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
}
|
||||
export * from './api';
|
||||
export * from './public-types';
|
18
node_modules/@firebase/vertexai/dist/esm/src/methods/chat-session-helpers.d.ts
generated
vendored
Normal file
18
node_modules/@firebase/vertexai/dist/esm/src/methods/chat-session-helpers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content } from '../types';
|
||||
export declare function validateChatHistory(history: Content[]): void;
|
17
node_modules/@firebase/vertexai/dist/esm/src/methods/chat-session-helpers.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/src/methods/chat-session-helpers.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
50
node_modules/@firebase/vertexai/dist/esm/src/methods/chat-session.d.ts
generated
vendored
Normal file
50
node_modules/@firebase/vertexai/dist/esm/src/methods/chat-session.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content, GenerateContentResult, GenerateContentStreamResult, Part, RequestOptions, StartChatParams } from '../types';
|
||||
import { ApiSettings } from '../types/internal';
|
||||
/**
|
||||
* ChatSession class that enables sending chat messages and stores
|
||||
* history of sent and received messages so far.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ChatSession {
|
||||
model: string;
|
||||
params?: StartChatParams | undefined;
|
||||
requestOptions?: RequestOptions | undefined;
|
||||
private _apiSettings;
|
||||
private _history;
|
||||
private _sendPromise;
|
||||
constructor(apiSettings: ApiSettings, model: string, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
|
||||
/**
|
||||
* Gets the chat history so far. Blocked prompts are not added to history.
|
||||
* Neither blocked candidates nor the prompts that generated them are added
|
||||
* to history.
|
||||
*/
|
||||
getHistory(): Promise<Content[]>;
|
||||
/**
|
||||
* Sends a chat message and receives a non-streaming
|
||||
* <code>{@link GenerateContentResult}</code>
|
||||
*/
|
||||
sendMessage(request: string | Array<string | Part>): Promise<GenerateContentResult>;
|
||||
/**
|
||||
* Sends a chat message and receives the response as a
|
||||
* <code>{@link GenerateContentStreamResult}</code> containing an iterable stream
|
||||
* and a response promise.
|
||||
*/
|
||||
sendMessageStream(request: string | Array<string | Part>): Promise<GenerateContentStreamResult>;
|
||||
}
|
17
node_modules/@firebase/vertexai/dist/esm/src/methods/chat-session.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/src/methods/chat-session.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
19
node_modules/@firebase/vertexai/dist/esm/src/methods/count-tokens.d.ts
generated
vendored
Normal file
19
node_modules/@firebase/vertexai/dist/esm/src/methods/count-tokens.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { CountTokensRequest, CountTokensResponse, RequestOptions } from '../types';
|
||||
import { ApiSettings } from '../types/internal';
|
||||
export declare function countTokens(apiSettings: ApiSettings, model: string, params: CountTokensRequest, requestOptions?: RequestOptions): Promise<CountTokensResponse>;
|
17
node_modules/@firebase/vertexai/dist/esm/src/methods/count-tokens.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/src/methods/count-tokens.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
20
node_modules/@firebase/vertexai/dist/esm/src/methods/generate-content.d.ts
generated
vendored
Normal file
20
node_modules/@firebase/vertexai/dist/esm/src/methods/generate-content.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { GenerateContentRequest, GenerateContentResult, GenerateContentStreamResult, RequestOptions } from '../types';
|
||||
import { ApiSettings } from '../types/internal';
|
||||
export declare function generateContentStream(apiSettings: ApiSettings, model: string, params: GenerateContentRequest, requestOptions?: RequestOptions): Promise<GenerateContentStreamResult>;
|
||||
export declare function generateContent(apiSettings: ApiSettings, model: string, params: GenerateContentRequest, requestOptions?: RequestOptions): Promise<GenerateContentResult>;
|
17
node_modules/@firebase/vertexai/dist/esm/src/methods/generate-content.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/src/methods/generate-content.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
55
node_modules/@firebase/vertexai/dist/esm/src/models/generative-model.d.ts
generated
vendored
Normal file
55
node_modules/@firebase/vertexai/dist/esm/src/models/generative-model.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content, CountTokensRequest, CountTokensResponse, GenerateContentRequest, GenerateContentResult, GenerateContentStreamResult, GenerationConfig, ModelParams, Part, RequestOptions, SafetySetting, StartChatParams, Tool, ToolConfig } from '../types';
|
||||
import { ChatSession } from '../methods/chat-session';
|
||||
import { VertexAI } from '../public-types';
|
||||
/**
|
||||
* Class for generative model APIs.
|
||||
* @public
|
||||
*/
|
||||
export declare class GenerativeModel {
|
||||
private _apiSettings;
|
||||
model: string;
|
||||
generationConfig: GenerationConfig;
|
||||
safetySettings: SafetySetting[];
|
||||
requestOptions?: RequestOptions;
|
||||
tools?: Tool[];
|
||||
toolConfig?: ToolConfig;
|
||||
systemInstruction?: Content;
|
||||
constructor(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions);
|
||||
/**
|
||||
* Makes a single non-streaming call to the model
|
||||
* and returns an object containing a single <code>{@link GenerateContentResponse}</code>.
|
||||
*/
|
||||
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
|
||||
/**
|
||||
* Makes a single streaming call to the model
|
||||
* and returns an object containing an iterable stream that iterates
|
||||
* over all chunks in the streaming response as well as
|
||||
* a promise that returns the final aggregated response.
|
||||
*/
|
||||
generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;
|
||||
/**
|
||||
* Gets a new <code>{@link ChatSession}</code> instance which can be used for
|
||||
* multi-turn chats.
|
||||
*/
|
||||
startChat(startChatParams?: StartChatParams): ChatSession;
|
||||
/**
|
||||
* Counts the tokens in the provided request.
|
||||
*/
|
||||
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
|
||||
}
|
1
node_modules/@firebase/vertexai/dist/esm/src/models/generative-model.test.d.ts
generated
vendored
Normal file
1
node_modules/@firebase/vertexai/dist/esm/src/models/generative-model.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
36
node_modules/@firebase/vertexai/dist/esm/src/public-types.d.ts
generated
vendored
Normal file
36
node_modules/@firebase/vertexai/dist/esm/src/public-types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp } from '@firebase/app';
|
||||
export * from './types';
|
||||
/**
|
||||
* An instance of the Vertex AI in Firebase SDK.
|
||||
* @public
|
||||
*/
|
||||
export interface VertexAI {
|
||||
/**
|
||||
* The {@link @firebase/app#FirebaseApp} this <code>{@link VertexAI}</code> instance is associated with.
|
||||
*/
|
||||
app: FirebaseApp;
|
||||
location: string;
|
||||
}
|
||||
/**
|
||||
* Options when initializing the Vertex AI in Firebase SDK.
|
||||
* @public
|
||||
*/
|
||||
export interface VertexAIOptions {
|
||||
location?: string;
|
||||
}
|
20
node_modules/@firebase/vertexai/dist/esm/src/requests/request-helpers.d.ts
generated
vendored
Normal file
20
node_modules/@firebase/vertexai/dist/esm/src/requests/request-helpers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content, GenerateContentRequest, Part } from '../types';
|
||||
export declare function formatSystemInstruction(input?: string | Part | Content): Content | undefined;
|
||||
export declare function formatNewContent(request: string | Array<string | Part>): Content;
|
||||
export declare function formatGenerateContentInput(params: GenerateContentRequest | string | Array<string | Part>): GenerateContentRequest;
|
17
node_modules/@firebase/vertexai/dist/esm/src/requests/request-helpers.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/src/requests/request-helpers.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
43
node_modules/@firebase/vertexai/dist/esm/src/requests/request.d.ts
generated
vendored
Normal file
43
node_modules/@firebase/vertexai/dist/esm/src/requests/request.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { RequestOptions } from '../types';
|
||||
import { ApiSettings } from '../types/internal';
|
||||
export declare enum Task {
|
||||
GENERATE_CONTENT = "generateContent",
|
||||
STREAM_GENERATE_CONTENT = "streamGenerateContent",
|
||||
COUNT_TOKENS = "countTokens"
|
||||
}
|
||||
export declare class RequestUrl {
|
||||
model: string;
|
||||
task: Task;
|
||||
apiSettings: ApiSettings;
|
||||
stream: boolean;
|
||||
requestOptions?: RequestOptions | undefined;
|
||||
constructor(model: string, task: Task, apiSettings: ApiSettings, stream: boolean, requestOptions?: RequestOptions | undefined);
|
||||
toString(): string;
|
||||
/**
|
||||
* If the model needs to be passed to the backend, it needs to
|
||||
* include project and location path.
|
||||
*/
|
||||
get fullModelString(): string;
|
||||
}
|
||||
export declare function getHeaders(url: RequestUrl): Promise<Headers>;
|
||||
export declare function constructRequest(model: string, task: Task, apiSettings: ApiSettings, stream: boolean, body: string, requestOptions?: RequestOptions): Promise<{
|
||||
url: string;
|
||||
fetchOptions: RequestInit;
|
||||
}>;
|
||||
export declare function makeRequest(model: string, task: Task, apiSettings: ApiSettings, stream: boolean, body: string, requestOptions?: RequestOptions): Promise<Response>;
|
17
node_modules/@firebase/vertexai/dist/esm/src/requests/request.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/src/requests/request.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
36
node_modules/@firebase/vertexai/dist/esm/src/requests/response-helpers.d.ts
generated
vendored
Normal file
36
node_modules/@firebase/vertexai/dist/esm/src/requests/response-helpers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { EnhancedGenerateContentResponse, FunctionCall, GenerateContentResponse } from '../types';
|
||||
/**
|
||||
* Creates an EnhancedGenerateContentResponse object that has helper functions and
|
||||
* other modifications that improve usability.
|
||||
*/
|
||||
export declare function createEnhancedContentResponse(response: GenerateContentResponse): EnhancedGenerateContentResponse;
|
||||
/**
|
||||
* Adds convenience helper methods to a response object, including stream
|
||||
* chunks (as long as each chunk is a complete GenerateContentResponse JSON).
|
||||
*/
|
||||
export declare function addHelpers(response: GenerateContentResponse): EnhancedGenerateContentResponse;
|
||||
/**
|
||||
* Returns all text found in all parts of first candidate.
|
||||
*/
|
||||
export declare function getText(response: GenerateContentResponse): string;
|
||||
/**
|
||||
* Returns <code>{@link FunctionCall}</code>s associated with first candidate.
|
||||
*/
|
||||
export declare function getFunctionCalls(response: GenerateContentResponse): FunctionCall[] | undefined;
|
||||
export declare function formatBlockErrorMessage(response: GenerateContentResponse): string;
|
17
node_modules/@firebase/vertexai/dist/esm/src/requests/response-helpers.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/src/requests/response-helpers.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
145
node_modules/@firebase/vertexai/dist/esm/src/requests/schema-builder.d.ts
generated
vendored
Normal file
145
node_modules/@firebase/vertexai/dist/esm/src/requests/schema-builder.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,145 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { SchemaInterface, SchemaType, SchemaParams, SchemaRequest } from '../types/schema';
|
||||
/**
|
||||
* Parent class encompassing all Schema types, with static methods that
|
||||
* allow building specific Schema types. This class can be converted with
|
||||
* `JSON.stringify()` into a JSON string accepted by Vertex AI REST endpoints.
|
||||
* (This string conversion is automatically done when calling SDK methods.)
|
||||
* @public
|
||||
*/
|
||||
export declare abstract class Schema implements SchemaInterface {
|
||||
/**
|
||||
* Optional. The type of the property. {@link
|
||||
* SchemaType}.
|
||||
*/
|
||||
type: SchemaType;
|
||||
/** Optional. The format of the property.
|
||||
* Supported formats:<br/>
|
||||
* <ul>
|
||||
* <li>for NUMBER type: "float", "double"</li>
|
||||
* <li>for INTEGER type: "int32", "int64"</li>
|
||||
* <li>for STRING type: "email", "byte", etc</li>
|
||||
* </ul>
|
||||
*/
|
||||
format?: string;
|
||||
/** Optional. The description of the property. */
|
||||
description?: string;
|
||||
/** Optional. Whether the property is nullable. Defaults to false. */
|
||||
nullable: boolean;
|
||||
/** Optional. The example of the property. */
|
||||
example?: unknown;
|
||||
/**
|
||||
* Allows user to add other schema properties that have not yet
|
||||
* been officially added to the SDK.
|
||||
*/
|
||||
[key: string]: unknown;
|
||||
constructor(schemaParams: SchemaInterface);
|
||||
/**
|
||||
* Defines how this Schema should be serialized as JSON.
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#tojson_behavior
|
||||
* @internal
|
||||
*/
|
||||
toJSON(): SchemaRequest;
|
||||
static array(arrayParams: SchemaParams & {
|
||||
items: Schema;
|
||||
}): ArraySchema;
|
||||
static object(objectParams: SchemaParams & {
|
||||
properties: {
|
||||
[k: string]: Schema;
|
||||
};
|
||||
optionalProperties?: string[];
|
||||
}): ObjectSchema;
|
||||
static string(stringParams?: SchemaParams): StringSchema;
|
||||
static enumString(stringParams: SchemaParams & {
|
||||
enum: string[];
|
||||
}): StringSchema;
|
||||
static integer(integerParams?: SchemaParams): IntegerSchema;
|
||||
static number(numberParams?: SchemaParams): NumberSchema;
|
||||
static boolean(booleanParams?: SchemaParams): BooleanSchema;
|
||||
}
|
||||
/**
|
||||
* A type that includes all specific Schema types.
|
||||
* @public
|
||||
*/
|
||||
export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema;
|
||||
/**
|
||||
* Schema class for "integer" types.
|
||||
* @public
|
||||
*/
|
||||
export declare class IntegerSchema extends Schema {
|
||||
constructor(schemaParams?: SchemaParams);
|
||||
}
|
||||
/**
|
||||
* Schema class for "number" types.
|
||||
* @public
|
||||
*/
|
||||
export declare class NumberSchema extends Schema {
|
||||
constructor(schemaParams?: SchemaParams);
|
||||
}
|
||||
/**
|
||||
* Schema class for "boolean" types.
|
||||
* @public
|
||||
*/
|
||||
export declare class BooleanSchema extends Schema {
|
||||
constructor(schemaParams?: SchemaParams);
|
||||
}
|
||||
/**
|
||||
* Schema class for "string" types. Can be used with or without
|
||||
* enum values.
|
||||
* @public
|
||||
*/
|
||||
export declare class StringSchema extends Schema {
|
||||
enum?: string[];
|
||||
constructor(schemaParams?: SchemaParams, enumValues?: string[]);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
toJSON(): SchemaRequest;
|
||||
}
|
||||
/**
|
||||
* Schema class for "array" types.
|
||||
* The `items` param should refer to the type of item that can be a member
|
||||
* of the array.
|
||||
* @public
|
||||
*/
|
||||
export declare class ArraySchema extends Schema {
|
||||
items: TypedSchema;
|
||||
constructor(schemaParams: SchemaParams, items: TypedSchema);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
toJSON(): SchemaRequest;
|
||||
}
|
||||
/**
|
||||
* Schema class for "object" types.
|
||||
* The `properties` param must be a map of `Schema` objects.
|
||||
* @public
|
||||
*/
|
||||
export declare class ObjectSchema extends Schema {
|
||||
properties: {
|
||||
[k: string]: TypedSchema;
|
||||
};
|
||||
optionalProperties: string[];
|
||||
constructor(schemaParams: SchemaParams, properties: {
|
||||
[k: string]: TypedSchema;
|
||||
}, optionalProperties?: string[]);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
toJSON(): SchemaRequest;
|
||||
}
|
17
node_modules/@firebase/vertexai/dist/esm/src/requests/schema-builder.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/src/requests/schema-builder.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
37
node_modules/@firebase/vertexai/dist/esm/src/requests/stream-reader.d.ts
generated
vendored
Normal file
37
node_modules/@firebase/vertexai/dist/esm/src/requests/stream-reader.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { GenerateContentResponse, GenerateContentStreamResult } from '../types';
|
||||
/**
|
||||
* Process a response.body stream from the backend and return an
|
||||
* iterator that provides one complete GenerateContentResponse at a time
|
||||
* and a promise that resolves with a single aggregated
|
||||
* GenerateContentResponse.
|
||||
*
|
||||
* @param response - Response from a fetch call
|
||||
*/
|
||||
export declare function processStream(response: Response): GenerateContentStreamResult;
|
||||
/**
|
||||
* Reads a raw stream from the fetch response and join incomplete
|
||||
* chunks, returning a new stream that provides a single complete
|
||||
* GenerateContentResponse in each iteration.
|
||||
*/
|
||||
export declare function getResponseStream<T>(inputStream: ReadableStream<string>): ReadableStream<T>;
|
||||
/**
|
||||
* Aggregates an array of `GenerateContentResponse`s into a single
|
||||
* GenerateContentResponse.
|
||||
*/
|
||||
export declare function aggregateResponses(responses: GenerateContentResponse[]): GenerateContentResponse;
|
17
node_modules/@firebase/vertexai/dist/esm/src/requests/stream-reader.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/src/requests/stream-reader.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
30
node_modules/@firebase/vertexai/dist/esm/src/service.d.ts
generated
vendored
Normal file
30
node_modules/@firebase/vertexai/dist/esm/src/service.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp, _FirebaseService } from '@firebase/app';
|
||||
import { VertexAI, VertexAIOptions } from './public-types';
|
||||
import { AppCheckInternalComponentName, FirebaseAppCheckInternal } from '@firebase/app-check-interop-types';
|
||||
import { Provider } from '@firebase/component';
|
||||
import { FirebaseAuthInternal, FirebaseAuthInternalName } from '@firebase/auth-interop-types';
|
||||
export declare class VertexAIService implements VertexAI, _FirebaseService {
|
||||
app: FirebaseApp;
|
||||
options?: VertexAIOptions | undefined;
|
||||
auth: FirebaseAuthInternal | null;
|
||||
appCheck: FirebaseAppCheckInternal | null;
|
||||
location: string;
|
||||
constructor(app: FirebaseApp, authProvider?: Provider<FirebaseAuthInternalName>, appCheckProvider?: Provider<AppCheckInternalComponentName>, options?: VertexAIOptions | undefined);
|
||||
_delete(): Promise<void>;
|
||||
}
|
1
node_modules/@firebase/vertexai/dist/esm/src/service.test.d.ts
generated
vendored
Normal file
1
node_modules/@firebase/vertexai/dist/esm/src/service.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
144
node_modules/@firebase/vertexai/dist/esm/src/types/content.d.ts
generated
vendored
Normal file
144
node_modules/@firebase/vertexai/dist/esm/src/types/content.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Role } from './enums';
|
||||
/**
|
||||
* Content type for both prompts and response candidates.
|
||||
* @public
|
||||
*/
|
||||
export interface Content {
|
||||
role: Role;
|
||||
parts: Part[];
|
||||
}
|
||||
/**
|
||||
* Content part - includes text, image/video, or function call/response
|
||||
* part types.
|
||||
* @public
|
||||
*/
|
||||
export declare type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;
|
||||
/**
|
||||
* Content part interface if the part represents a text string.
|
||||
* @public
|
||||
*/
|
||||
export interface TextPart {
|
||||
text: string;
|
||||
inlineData?: never;
|
||||
functionCall?: never;
|
||||
functionResponse?: never;
|
||||
}
|
||||
/**
|
||||
* Content part interface if the part represents an image.
|
||||
* @public
|
||||
*/
|
||||
export interface InlineDataPart {
|
||||
text?: never;
|
||||
inlineData: GenerativeContentBlob;
|
||||
functionCall?: never;
|
||||
functionResponse?: never;
|
||||
/**
|
||||
* Applicable if `inlineData` is a video.
|
||||
*/
|
||||
videoMetadata?: VideoMetadata;
|
||||
}
|
||||
/**
|
||||
* Describes the input video content.
|
||||
* @public
|
||||
*/
|
||||
export interface VideoMetadata {
|
||||
/**
|
||||
* The start offset of the video in
|
||||
* protobuf {@link https://cloud.google.com/ruby/docs/reference/google-cloud-workflows-v1/latest/Google-Protobuf-Duration#json-mapping | Duration} format.
|
||||
*/
|
||||
startOffset: string;
|
||||
/**
|
||||
* The end offset of the video in
|
||||
* protobuf {@link https://cloud.google.com/ruby/docs/reference/google-cloud-workflows-v1/latest/Google-Protobuf-Duration#json-mapping | Duration} format.
|
||||
*/
|
||||
endOffset: string;
|
||||
}
|
||||
/**
|
||||
* Content part interface if the part represents a <code>{@link FunctionCall}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionCallPart {
|
||||
text?: never;
|
||||
inlineData?: never;
|
||||
functionCall: FunctionCall;
|
||||
functionResponse?: never;
|
||||
}
|
||||
/**
|
||||
* Content part interface if the part represents <code>{@link FunctionResponse}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionResponsePart {
|
||||
text?: never;
|
||||
inlineData?: never;
|
||||
functionCall?: never;
|
||||
functionResponse: FunctionResponse;
|
||||
}
|
||||
/**
|
||||
* Content part interface if the part represents <code>{@link FileData}</code>
|
||||
* @public
|
||||
*/
|
||||
export interface FileDataPart {
|
||||
text?: never;
|
||||
inlineData?: never;
|
||||
functionCall?: never;
|
||||
functionResponse?: never;
|
||||
fileData: FileData;
|
||||
}
|
||||
/**
|
||||
* A predicted <code>{@link FunctionCall}</code> returned from the model
|
||||
* that contains a string representing the {@link FunctionDeclaration.name}
|
||||
* and a structured JSON object containing the parameters and their values.
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionCall {
|
||||
name: string;
|
||||
args: object;
|
||||
}
|
||||
/**
|
||||
* The result output from a <code>{@link FunctionCall}</code> that contains a string
|
||||
* representing the {@link FunctionDeclaration.name}
|
||||
* and a structured JSON object containing any output
|
||||
* from the function is used as context to the model.
|
||||
* This should contain the result of a <code>{@link FunctionCall}</code>
|
||||
* made based on model prediction.
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionResponse {
|
||||
name: string;
|
||||
response: object;
|
||||
}
|
||||
/**
|
||||
* Interface for sending an image.
|
||||
* @public
|
||||
*/
|
||||
export interface GenerativeContentBlob {
|
||||
mimeType: string;
|
||||
/**
|
||||
* Image as a base64 string.
|
||||
*/
|
||||
data: string;
|
||||
}
|
||||
/**
|
||||
* Data pointing to a file uploaded on Google Cloud Storage.
|
||||
* @public
|
||||
*/
|
||||
export interface FileData {
|
||||
mimeType: string;
|
||||
fileUri: string;
|
||||
}
|
100
node_modules/@firebase/vertexai/dist/esm/src/types/enums.d.ts
generated
vendored
Normal file
100
node_modules/@firebase/vertexai/dist/esm/src/types/enums.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Role is the producer of the content.
|
||||
* @public
|
||||
*/
|
||||
export declare type Role = (typeof POSSIBLE_ROLES)[number];
|
||||
/**
|
||||
* Possible roles.
|
||||
* @public
|
||||
*/
|
||||
export declare const POSSIBLE_ROLES: readonly ["user", "model", "function", "system"];
|
||||
/**
|
||||
* Harm categories that would cause prompts or candidates to be blocked.
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmCategory {
|
||||
HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
|
||||
HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
||||
HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT",
|
||||
HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT"
|
||||
}
|
||||
/**
|
||||
* Threshold above which a prompt or candidate will be blocked.
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmBlockThreshold {
|
||||
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
|
||||
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
|
||||
BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH",
|
||||
BLOCK_NONE = "BLOCK_NONE"
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmBlockMethod {
|
||||
SEVERITY = "SEVERITY",
|
||||
PROBABILITY = "PROBABILITY"
|
||||
}
|
||||
/**
|
||||
* Probability that a prompt or candidate matches a harm category.
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmProbability {
|
||||
NEGLIGIBLE = "NEGLIGIBLE",
|
||||
LOW = "LOW",
|
||||
MEDIUM = "MEDIUM",
|
||||
HIGH = "HIGH"
|
||||
}
|
||||
/**
|
||||
* Harm severity levels.
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmSeverity {
|
||||
HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
|
||||
HARM_SEVERITY_LOW = "HARM_SEVERITY_LOW",
|
||||
HARM_SEVERITY_MEDIUM = "HARM_SEVERITY_MEDIUM",
|
||||
HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH"
|
||||
}
|
||||
/**
|
||||
* Reason that a prompt was blocked.
|
||||
* @public
|
||||
*/
|
||||
export declare enum BlockReason {
|
||||
SAFETY = "SAFETY",
|
||||
OTHER = "OTHER"
|
||||
}
|
||||
/**
|
||||
* Reason that a candidate finished.
|
||||
* @public
|
||||
*/
|
||||
export declare enum FinishReason {
|
||||
STOP = "STOP",
|
||||
MAX_TOKENS = "MAX_TOKENS",
|
||||
SAFETY = "SAFETY",
|
||||
RECITATION = "RECITATION",
|
||||
OTHER = "OTHER"
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare enum FunctionCallingMode {
|
||||
AUTO = "AUTO",
|
||||
ANY = "ANY",
|
||||
NONE = "NONE"
|
||||
}
|
77
node_modules/@firebase/vertexai/dist/esm/src/types/error.d.ts
generated
vendored
Normal file
77
node_modules/@firebase/vertexai/dist/esm/src/types/error.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { GenerateContentResponse } from './responses';
|
||||
/**
|
||||
* Details object that may be included in an error response.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface ErrorDetails {
|
||||
'@type'?: string;
|
||||
/** The reason for the error. */
|
||||
reason?: string;
|
||||
/** The domain where the error occurred. */
|
||||
domain?: string;
|
||||
/** Additional metadata about the error. */
|
||||
metadata?: Record<string, unknown>;
|
||||
/** Any other relevant information about the error. */
|
||||
[key: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Details object that contains data originating from a bad HTTP response.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface CustomErrorData {
|
||||
/** HTTP status code of the error response. */
|
||||
status?: number;
|
||||
/** HTTP status text of the error response. */
|
||||
statusText?: string;
|
||||
/** Response from a <code>{@link GenerateContentRequest}</code> */
|
||||
response?: GenerateContentResponse;
|
||||
/** Optional additional details about the error. */
|
||||
errorDetails?: ErrorDetails[];
|
||||
}
|
||||
/**
|
||||
* Standardized error codes that <code>{@link VertexAIError}</code> can have.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const enum VertexAIErrorCode {
|
||||
/** A generic error occurred. */
|
||||
ERROR = "error",
|
||||
/** An error occurred in a request. */
|
||||
REQUEST_ERROR = "request-error",
|
||||
/** An error occurred in a response. */
|
||||
RESPONSE_ERROR = "response-error",
|
||||
/** An error occurred while performing a fetch. */
|
||||
FETCH_ERROR = "fetch-error",
|
||||
/** An error associated with a Content object. */
|
||||
INVALID_CONTENT = "invalid-content",
|
||||
/** An error due to the Firebase API not being enabled in the Console. */
|
||||
API_NOT_ENABLED = "api-not-enabled",
|
||||
/** An error due to invalid Schema input. */
|
||||
INVALID_SCHEMA = "invalid-schema",
|
||||
/** An error occurred due to a missing Firebase API key. */
|
||||
NO_API_KEY = "no-api-key",
|
||||
/** An error occurred due to a model name not being specified during initialization. */
|
||||
NO_MODEL = "no-model",
|
||||
/** An error occurred due to a missing project ID. */
|
||||
NO_PROJECT_ID = "no-project-id",
|
||||
/** An error occurred while parsing. */
|
||||
PARSE_FAILED = "parse-failed"
|
||||
}
|
22
node_modules/@firebase/vertexai/dist/esm/src/types/index.d.ts
generated
vendored
Normal file
22
node_modules/@firebase/vertexai/dist/esm/src/types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export * from './content';
|
||||
export * from './enums';
|
||||
export * from './requests';
|
||||
export * from './responses';
|
||||
export * from './error';
|
||||
export * from './schema';
|
25
node_modules/@firebase/vertexai/dist/esm/src/types/internal.d.ts
generated
vendored
Normal file
25
node_modules/@firebase/vertexai/dist/esm/src/types/internal.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
|
||||
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
|
||||
export interface ApiSettings {
|
||||
apiKey: string;
|
||||
project: string;
|
||||
location: string;
|
||||
getAuthToken?: () => Promise<FirebaseAuthTokenData | null>;
|
||||
getAppCheckToken?: () => Promise<AppCheckTokenResult>;
|
||||
}
|
184
node_modules/@firebase/vertexai/dist/esm/src/types/requests.d.ts
generated
vendored
Normal file
184
node_modules/@firebase/vertexai/dist/esm/src/types/requests.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,184 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TypedSchema } from '../requests/schema-builder';
|
||||
import { Content, Part } from './content';
|
||||
import { FunctionCallingMode, HarmBlockMethod, HarmBlockThreshold, HarmCategory } from './enums';
|
||||
import { ObjectSchemaInterface, SchemaRequest } from './schema';
|
||||
/**
|
||||
* Base parameters for a number of methods.
|
||||
* @public
|
||||
*/
|
||||
export interface BaseParams {
|
||||
safetySettings?: SafetySetting[];
|
||||
generationConfig?: GenerationConfig;
|
||||
}
|
||||
/**
|
||||
* Params passed to <code>{@link getGenerativeModel}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface ModelParams extends BaseParams {
|
||||
model: string;
|
||||
tools?: Tool[];
|
||||
toolConfig?: ToolConfig;
|
||||
systemInstruction?: string | Part | Content;
|
||||
}
|
||||
/**
|
||||
* Request sent through {@link GenerativeModel.generateContent}
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentRequest extends BaseParams {
|
||||
contents: Content[];
|
||||
tools?: Tool[];
|
||||
toolConfig?: ToolConfig;
|
||||
systemInstruction?: string | Part | Content;
|
||||
}
|
||||
/**
|
||||
* Safety setting that can be sent as part of request parameters.
|
||||
* @public
|
||||
*/
|
||||
export interface SafetySetting {
|
||||
category: HarmCategory;
|
||||
threshold: HarmBlockThreshold;
|
||||
method?: HarmBlockMethod;
|
||||
}
|
||||
/**
|
||||
* Config options for content-related requests
|
||||
* @public
|
||||
*/
|
||||
export interface GenerationConfig {
|
||||
candidateCount?: number;
|
||||
stopSequences?: string[];
|
||||
maxOutputTokens?: number;
|
||||
temperature?: number;
|
||||
topP?: number;
|
||||
topK?: number;
|
||||
presencePenalty?: number;
|
||||
frequencyPenalty?: number;
|
||||
/**
|
||||
* Output response MIME type of the generated candidate text.
|
||||
* Supported MIME types are `text/plain` (default, text output),
|
||||
* `application/json` (JSON response in the candidates), and
|
||||
* `text/x.enum`.
|
||||
*/
|
||||
responseMimeType?: string;
|
||||
/**
|
||||
* Output response schema of the generated candidate text. This
|
||||
* value can be a class generated with a <code>{@link Schema}</code> static method
|
||||
* like `Schema.string()` or `Schema.object()` or it can be a plain
|
||||
* JS object matching the <code>{@link SchemaRequest}</code> interface.
|
||||
* <br/>Note: This only applies when the specified `responseMIMEType` supports a schema; currently
|
||||
* this is limited to `application/json` and `text/x.enum`.
|
||||
*/
|
||||
responseSchema?: TypedSchema | SchemaRequest;
|
||||
}
|
||||
/**
|
||||
* Params for {@link GenerativeModel.startChat}.
|
||||
* @public
|
||||
*/
|
||||
export interface StartChatParams extends BaseParams {
|
||||
history?: Content[];
|
||||
tools?: Tool[];
|
||||
toolConfig?: ToolConfig;
|
||||
systemInstruction?: string | Part | Content;
|
||||
}
|
||||
/**
|
||||
* Params for calling {@link GenerativeModel.countTokens}
|
||||
* @public
|
||||
*/
|
||||
export interface CountTokensRequest {
|
||||
contents: Content[];
|
||||
}
|
||||
/**
|
||||
* Params passed to <code>{@link getGenerativeModel}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface RequestOptions {
|
||||
/**
|
||||
* Request timeout in milliseconds. Defaults to 180 seconds (180000ms).
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* Base url for endpoint. Defaults to https://firebaseml.googleapis.com
|
||||
*/
|
||||
baseUrl?: string;
|
||||
}
|
||||
/**
|
||||
* Defines a tool that model can call to access external knowledge.
|
||||
* @public
|
||||
*/
|
||||
export declare type Tool = FunctionDeclarationsTool;
|
||||
/**
|
||||
* Structured representation of a function declaration as defined by the
|
||||
* {@link https://spec.openapis.org/oas/v3.0.3 | OpenAPI 3.0 specification}.
|
||||
* Included
|
||||
* in this declaration are the function name and parameters. This
|
||||
* `FunctionDeclaration` is a representation of a block of code that can be used
|
||||
* as a Tool by the model and executed by the client.
|
||||
* @public
|
||||
*/
|
||||
export declare interface FunctionDeclaration {
|
||||
/**
|
||||
* The name of the function to call. Must start with a letter or an
|
||||
* underscore. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with
|
||||
* a max length of 64.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Description and purpose of the function. Model uses it to decide
|
||||
* how and whether to call the function.
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* Optional. Describes the parameters to this function in JSON Schema Object
|
||||
* format. Reflects the Open API 3.03 Parameter Object. Parameter names are
|
||||
* case-sensitive. For a function with no parameters, this can be left unset.
|
||||
*/
|
||||
parameters?: ObjectSchemaInterface;
|
||||
}
|
||||
/**
|
||||
* A `FunctionDeclarationsTool` is a piece of code that enables the system to
|
||||
* interact with external systems to perform an action, or set of actions,
|
||||
* outside of knowledge and scope of the model.
|
||||
* @public
|
||||
*/
|
||||
export declare interface FunctionDeclarationsTool {
|
||||
/**
|
||||
* Optional. One or more function declarations
|
||||
* to be passed to the model along with the current user query. Model may
|
||||
* decide to call a subset of these functions by populating
|
||||
* <code>{@link FunctionCall}</code> in the response. User should
|
||||
* provide a <code>{@link FunctionResponse}</code> for each
|
||||
* function call in the next turn. Based on the function responses, the model will
|
||||
* generate the final response back to the user. Maximum 64 function
|
||||
* declarations can be provided.
|
||||
*/
|
||||
functionDeclarations?: FunctionDeclaration[];
|
||||
}
|
||||
/**
|
||||
* Tool config. This config is shared for all tools provided in the request.
|
||||
* @public
|
||||
*/
|
||||
export interface ToolConfig {
|
||||
functionCallingConfig?: FunctionCallingConfig;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionCallingConfig {
|
||||
mode?: FunctionCallingMode;
|
||||
allowedFunctionNames?: string[];
|
||||
}
|
191
node_modules/@firebase/vertexai/dist/esm/src/types/responses.d.ts
generated
vendored
Normal file
191
node_modules/@firebase/vertexai/dist/esm/src/types/responses.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,191 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content, FunctionCall } from './content';
|
||||
import { BlockReason, FinishReason, HarmCategory, HarmProbability, HarmSeverity } from './enums';
|
||||
/**
|
||||
* Result object returned from {@link GenerativeModel.generateContent} call.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentResult {
|
||||
response: EnhancedGenerateContentResponse;
|
||||
}
|
||||
/**
|
||||
* Result object returned from {@link GenerativeModel.generateContentStream} call.
|
||||
* Iterate over `stream` to get chunks as they come in and/or
|
||||
* use the `response` promise to get the aggregated response when
|
||||
* the stream is done.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentStreamResult {
|
||||
stream: AsyncGenerator<EnhancedGenerateContentResponse>;
|
||||
response: Promise<EnhancedGenerateContentResponse>;
|
||||
}
|
||||
/**
|
||||
* Response object wrapped with helper methods.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface EnhancedGenerateContentResponse extends GenerateContentResponse {
|
||||
/**
|
||||
* Returns the text string from the response, if available.
|
||||
* Throws if the prompt or candidate was blocked.
|
||||
*/
|
||||
text: () => string;
|
||||
functionCalls: () => FunctionCall[] | undefined;
|
||||
}
|
||||
/**
|
||||
* Individual response from {@link GenerativeModel.generateContent} and
|
||||
* {@link GenerativeModel.generateContentStream}.
|
||||
* `generateContentStream()` will return one in each chunk until
|
||||
* the stream is done.
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentResponse {
|
||||
candidates?: GenerateContentCandidate[];
|
||||
promptFeedback?: PromptFeedback;
|
||||
usageMetadata?: UsageMetadata;
|
||||
}
|
||||
/**
|
||||
* Usage metadata about a <code>{@link GenerateContentResponse}</code>.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface UsageMetadata {
|
||||
promptTokenCount: number;
|
||||
candidatesTokenCount: number;
|
||||
totalTokenCount: number;
|
||||
}
|
||||
/**
|
||||
* If the prompt was blocked, this will be populated with `blockReason` and
|
||||
* the relevant `safetyRatings`.
|
||||
* @public
|
||||
*/
|
||||
export interface PromptFeedback {
|
||||
blockReason?: BlockReason;
|
||||
safetyRatings: SafetyRating[];
|
||||
blockReasonMessage?: string;
|
||||
}
|
||||
/**
|
||||
* A candidate returned as part of a <code>{@link GenerateContentResponse}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentCandidate {
|
||||
index: number;
|
||||
content: Content;
|
||||
finishReason?: FinishReason;
|
||||
finishMessage?: string;
|
||||
safetyRatings?: SafetyRating[];
|
||||
citationMetadata?: CitationMetadata;
|
||||
groundingMetadata?: GroundingMetadata;
|
||||
}
|
||||
/**
|
||||
* Citation metadata that may be found on a <code>{@link GenerateContentCandidate}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface CitationMetadata {
|
||||
citations: Citation[];
|
||||
}
|
||||
/**
|
||||
* A single citation.
|
||||
* @public
|
||||
*/
|
||||
export interface Citation {
|
||||
startIndex?: number;
|
||||
endIndex?: number;
|
||||
uri?: string;
|
||||
license?: string;
|
||||
title?: string;
|
||||
publicationDate?: Date;
|
||||
}
|
||||
/**
|
||||
* Metadata returned to client when grounding is enabled.
|
||||
* @public
|
||||
*/
|
||||
export interface GroundingMetadata {
|
||||
webSearchQueries?: string[];
|
||||
retrievalQueries?: string[];
|
||||
groundingAttributions: GroundingAttribution[];
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface GroundingAttribution {
|
||||
segment: Segment;
|
||||
confidenceScore?: number;
|
||||
web?: WebAttribution;
|
||||
retrievedContext?: RetrievedContextAttribution;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Segment {
|
||||
partIndex: number;
|
||||
startIndex: number;
|
||||
endIndex: number;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface WebAttribution {
|
||||
uri: string;
|
||||
title: string;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface RetrievedContextAttribution {
|
||||
uri: string;
|
||||
title: string;
|
||||
}
|
||||
/**
|
||||
* Protobuf google.type.Date
|
||||
* @public
|
||||
*/
|
||||
export interface Date {
|
||||
year: number;
|
||||
month: number;
|
||||
day: number;
|
||||
}
|
||||
/**
|
||||
* A safety rating associated with a <code>{@link GenerateContentCandidate}</code>
|
||||
* @public
|
||||
*/
|
||||
export interface SafetyRating {
|
||||
category: HarmCategory;
|
||||
probability: HarmProbability;
|
||||
severity: HarmSeverity;
|
||||
probabilityScore: number;
|
||||
severityScore: number;
|
||||
blocked: boolean;
|
||||
}
|
||||
/**
|
||||
* Response from calling {@link GenerativeModel.countTokens}.
|
||||
* @public
|
||||
*/
|
||||
export interface CountTokensResponse {
|
||||
/**
|
||||
* The total number of tokens counted across all instances from the request.
|
||||
*/
|
||||
totalTokens: number;
|
||||
/**
|
||||
* The total number of billable characters counted across all instances
|
||||
* from the request.
|
||||
*/
|
||||
totalBillableCharacters?: number;
|
||||
}
|
99
node_modules/@firebase/vertexai/dist/esm/src/types/schema.d.ts
generated
vendored
Normal file
99
node_modules/@firebase/vertexai/dist/esm/src/types/schema.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Contains the list of OpenAPI data types
|
||||
* as defined by the
|
||||
* {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
|
||||
* @public
|
||||
*/
|
||||
export declare enum SchemaType {
|
||||
/** String type. */
|
||||
STRING = "string",
|
||||
/** Number type. */
|
||||
NUMBER = "number",
|
||||
/** Integer type. */
|
||||
INTEGER = "integer",
|
||||
/** Boolean type. */
|
||||
BOOLEAN = "boolean",
|
||||
/** Array type. */
|
||||
ARRAY = "array",
|
||||
/** Object type. */
|
||||
OBJECT = "object"
|
||||
}
|
||||
/**
|
||||
* Basic <code>{@link Schema}</code> properties shared across several Schema-related
|
||||
* types.
|
||||
* @public
|
||||
*/
|
||||
export interface SchemaShared<T> {
|
||||
/** Optional. The format of the property. */
|
||||
format?: string;
|
||||
/** Optional. The description of the property. */
|
||||
description?: string;
|
||||
/** Optional. The items of the property. */
|
||||
items?: T;
|
||||
/** Optional. Map of `Schema` objects. */
|
||||
properties?: {
|
||||
[k: string]: T;
|
||||
};
|
||||
/** Optional. The enum of the property. */
|
||||
enum?: string[];
|
||||
/** Optional. The example of the property. */
|
||||
example?: unknown;
|
||||
/** Optional. Whether the property is nullable. */
|
||||
nullable?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Params passed to <code>{@link Schema}</code> static methods to create specific
|
||||
* <code>{@link Schema}</code> classes.
|
||||
* @public
|
||||
*/
|
||||
export interface SchemaParams extends SchemaShared<SchemaInterface> {
|
||||
}
|
||||
/**
|
||||
* Final format for <code>{@link Schema}</code> params passed to backend requests.
|
||||
* @public
|
||||
*/
|
||||
export interface SchemaRequest extends SchemaShared<SchemaRequest> {
|
||||
/**
|
||||
* The type of the property. {@link
|
||||
* SchemaType}.
|
||||
*/
|
||||
type: SchemaType;
|
||||
/** Optional. Array of required property. */
|
||||
required?: string[];
|
||||
}
|
||||
/**
|
||||
* Interface for <code>{@link Schema}</code> class.
|
||||
* @public
|
||||
*/
|
||||
export interface SchemaInterface extends SchemaShared<SchemaInterface> {
|
||||
/**
|
||||
* The type of the property. {@link
|
||||
* SchemaType}.
|
||||
*/
|
||||
type: SchemaType;
|
||||
}
|
||||
/**
|
||||
* Interface for <code>{@link ObjectSchema}</code> class.
|
||||
* @public
|
||||
*/
|
||||
export interface ObjectSchemaInterface extends SchemaInterface {
|
||||
type: SchemaType.OBJECT;
|
||||
optionalProperties?: string[];
|
||||
}
|
17
node_modules/@firebase/vertexai/dist/esm/test-utils/base64cat.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/esm/test-utils/base64cat.d.ts
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
24
node_modules/@firebase/vertexai/dist/esm/test-utils/convert-mocks.d.ts
generated
vendored
Normal file
24
node_modules/@firebase/vertexai/dist/esm/test-utils/convert-mocks.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Converts mock text files into a js file that karma can read without
|
||||
* using fs.
|
||||
*/
|
||||
declare const fs: any;
|
||||
declare const join: any;
|
||||
declare const mockResponseDir: any;
|
||||
declare function main(): Promise<void>;
|
23
node_modules/@firebase/vertexai/dist/esm/test-utils/mock-response.d.ts
generated
vendored
Normal file
23
node_modules/@firebase/vertexai/dist/esm/test-utils/mock-response.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Mock native Response.body
|
||||
* Streams contents of json file in 20 character chunks
|
||||
*/
|
||||
export declare function getChunkedStream(input: string, chunkLength?: number): ReadableStream<Uint8Array>;
|
||||
export declare function getMockResponseStreaming(filename: string, chunkLength?: number): Partial<Response>;
|
||||
export declare function getMockResponse(filename: string): Partial<Response>;
|
1524
node_modules/@firebase/vertexai/dist/index.cjs.js
generated
vendored
Normal file
1524
node_modules/@firebase/vertexai/dist/index.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/@firebase/vertexai/dist/index.cjs.js.map
generated
vendored
Normal file
1
node_modules/@firebase/vertexai/dist/index.cjs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
47
node_modules/@firebase/vertexai/dist/src/api.d.ts
generated
vendored
Normal file
47
node_modules/@firebase/vertexai/dist/src/api.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp } from '@firebase/app';
|
||||
import { VERTEX_TYPE } from './constants';
|
||||
import { VertexAIService } from './service';
|
||||
import { VertexAI, VertexAIOptions } from './public-types';
|
||||
import { ModelParams, RequestOptions } from './types';
|
||||
import { VertexAIError } from './errors';
|
||||
import { GenerativeModel } from './models/generative-model';
|
||||
export { ChatSession } from './methods/chat-session';
|
||||
export * from './requests/schema-builder';
|
||||
export { GenerativeModel };
|
||||
export { VertexAIError };
|
||||
declare module '@firebase/component' {
|
||||
interface NameServiceMapping {
|
||||
[VERTEX_TYPE]: VertexAIService;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a <code>{@link VertexAI}</code> instance for the given app.
|
||||
*
|
||||
* @public
|
||||
*
|
||||
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
||||
*/
|
||||
export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
|
||||
/**
|
||||
* Returns a <code>{@link GenerativeModel}</code> class with methods for inference
|
||||
* and other functionality.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function getGenerativeModel(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
|
1
node_modules/@firebase/vertexai/dist/src/api.test.d.ts
generated
vendored
Normal file
1
node_modules/@firebase/vertexai/dist/src/api.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
22
node_modules/@firebase/vertexai/dist/src/constants.d.ts
generated
vendored
Normal file
22
node_modules/@firebase/vertexai/dist/src/constants.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export declare const VERTEX_TYPE = "vertexAI";
|
||||
export declare const DEFAULT_LOCATION = "us-central1";
|
||||
export declare const DEFAULT_BASE_URL = "https://firebasevertexai.googleapis.com";
|
||||
export declare const DEFAULT_API_VERSION = "v1beta";
|
||||
export declare const PACKAGE_VERSION: string;
|
||||
export declare const LANGUAGE_TAG = "gl-js";
|
35
node_modules/@firebase/vertexai/dist/src/errors.d.ts
generated
vendored
Normal file
35
node_modules/@firebase/vertexai/dist/src/errors.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { VertexAIErrorCode, CustomErrorData } from './types';
|
||||
/**
|
||||
* Error class for the Vertex AI in Firebase SDK.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class VertexAIError extends FirebaseError {
|
||||
readonly code: VertexAIErrorCode;
|
||||
readonly customErrorData?: CustomErrorData | undefined;
|
||||
/**
|
||||
* Constructs a new instance of the `VertexAIError` class.
|
||||
*
|
||||
* @param code - The error code from <code>{@link VertexAIErrorCode}</code>.
|
||||
* @param message - A human-readable message describing the error.
|
||||
* @param customErrorData - Optional error data.
|
||||
*/
|
||||
constructor(code: VertexAIErrorCode, message: string, customErrorData?: CustomErrorData | undefined);
|
||||
}
|
12
node_modules/@firebase/vertexai/dist/src/index.d.ts
generated
vendored
Normal file
12
node_modules/@firebase/vertexai/dist/src/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* The Vertex AI in Firebase Web SDK.
|
||||
*
|
||||
* @packageDocumentation
|
||||
*/
|
||||
declare global {
|
||||
interface Window {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
}
|
||||
export * from './api';
|
||||
export * from './public-types';
|
18
node_modules/@firebase/vertexai/dist/src/methods/chat-session-helpers.d.ts
generated
vendored
Normal file
18
node_modules/@firebase/vertexai/dist/src/methods/chat-session-helpers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content } from '../types';
|
||||
export declare function validateChatHistory(history: Content[]): void;
|
17
node_modules/@firebase/vertexai/dist/src/methods/chat-session-helpers.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/src/methods/chat-session-helpers.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
50
node_modules/@firebase/vertexai/dist/src/methods/chat-session.d.ts
generated
vendored
Normal file
50
node_modules/@firebase/vertexai/dist/src/methods/chat-session.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content, GenerateContentResult, GenerateContentStreamResult, Part, RequestOptions, StartChatParams } from '../types';
|
||||
import { ApiSettings } from '../types/internal';
|
||||
/**
|
||||
* ChatSession class that enables sending chat messages and stores
|
||||
* history of sent and received messages so far.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ChatSession {
|
||||
model: string;
|
||||
params?: StartChatParams | undefined;
|
||||
requestOptions?: RequestOptions | undefined;
|
||||
private _apiSettings;
|
||||
private _history;
|
||||
private _sendPromise;
|
||||
constructor(apiSettings: ApiSettings, model: string, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
|
||||
/**
|
||||
* Gets the chat history so far. Blocked prompts are not added to history.
|
||||
* Neither blocked candidates nor the prompts that generated them are added
|
||||
* to history.
|
||||
*/
|
||||
getHistory(): Promise<Content[]>;
|
||||
/**
|
||||
* Sends a chat message and receives a non-streaming
|
||||
* <code>{@link GenerateContentResult}</code>
|
||||
*/
|
||||
sendMessage(request: string | Array<string | Part>): Promise<GenerateContentResult>;
|
||||
/**
|
||||
* Sends a chat message and receives the response as a
|
||||
* <code>{@link GenerateContentStreamResult}</code> containing an iterable stream
|
||||
* and a response promise.
|
||||
*/
|
||||
sendMessageStream(request: string | Array<string | Part>): Promise<GenerateContentStreamResult>;
|
||||
}
|
17
node_modules/@firebase/vertexai/dist/src/methods/chat-session.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/src/methods/chat-session.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
19
node_modules/@firebase/vertexai/dist/src/methods/count-tokens.d.ts
generated
vendored
Normal file
19
node_modules/@firebase/vertexai/dist/src/methods/count-tokens.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { CountTokensRequest, CountTokensResponse, RequestOptions } from '../types';
|
||||
import { ApiSettings } from '../types/internal';
|
||||
export declare function countTokens(apiSettings: ApiSettings, model: string, params: CountTokensRequest, requestOptions?: RequestOptions): Promise<CountTokensResponse>;
|
17
node_modules/@firebase/vertexai/dist/src/methods/count-tokens.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/src/methods/count-tokens.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
20
node_modules/@firebase/vertexai/dist/src/methods/generate-content.d.ts
generated
vendored
Normal file
20
node_modules/@firebase/vertexai/dist/src/methods/generate-content.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { GenerateContentRequest, GenerateContentResult, GenerateContentStreamResult, RequestOptions } from '../types';
|
||||
import { ApiSettings } from '../types/internal';
|
||||
export declare function generateContentStream(apiSettings: ApiSettings, model: string, params: GenerateContentRequest, requestOptions?: RequestOptions): Promise<GenerateContentStreamResult>;
|
||||
export declare function generateContent(apiSettings: ApiSettings, model: string, params: GenerateContentRequest, requestOptions?: RequestOptions): Promise<GenerateContentResult>;
|
17
node_modules/@firebase/vertexai/dist/src/methods/generate-content.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/src/methods/generate-content.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
55
node_modules/@firebase/vertexai/dist/src/models/generative-model.d.ts
generated
vendored
Normal file
55
node_modules/@firebase/vertexai/dist/src/models/generative-model.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content, CountTokensRequest, CountTokensResponse, GenerateContentRequest, GenerateContentResult, GenerateContentStreamResult, GenerationConfig, ModelParams, Part, RequestOptions, SafetySetting, StartChatParams, Tool, ToolConfig } from '../types';
|
||||
import { ChatSession } from '../methods/chat-session';
|
||||
import { VertexAI } from '../public-types';
|
||||
/**
|
||||
* Class for generative model APIs.
|
||||
* @public
|
||||
*/
|
||||
export declare class GenerativeModel {
|
||||
private _apiSettings;
|
||||
model: string;
|
||||
generationConfig: GenerationConfig;
|
||||
safetySettings: SafetySetting[];
|
||||
requestOptions?: RequestOptions;
|
||||
tools?: Tool[];
|
||||
toolConfig?: ToolConfig;
|
||||
systemInstruction?: Content;
|
||||
constructor(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions);
|
||||
/**
|
||||
* Makes a single non-streaming call to the model
|
||||
* and returns an object containing a single <code>{@link GenerateContentResponse}</code>.
|
||||
*/
|
||||
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
|
||||
/**
|
||||
* Makes a single streaming call to the model
|
||||
* and returns an object containing an iterable stream that iterates
|
||||
* over all chunks in the streaming response as well as
|
||||
* a promise that returns the final aggregated response.
|
||||
*/
|
||||
generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;
|
||||
/**
|
||||
* Gets a new <code>{@link ChatSession}</code> instance which can be used for
|
||||
* multi-turn chats.
|
||||
*/
|
||||
startChat(startChatParams?: StartChatParams): ChatSession;
|
||||
/**
|
||||
* Counts the tokens in the provided request.
|
||||
*/
|
||||
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
|
||||
}
|
1
node_modules/@firebase/vertexai/dist/src/models/generative-model.test.d.ts
generated
vendored
Normal file
1
node_modules/@firebase/vertexai/dist/src/models/generative-model.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
36
node_modules/@firebase/vertexai/dist/src/public-types.d.ts
generated
vendored
Normal file
36
node_modules/@firebase/vertexai/dist/src/public-types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp } from '@firebase/app';
|
||||
export * from './types';
|
||||
/**
|
||||
* An instance of the Vertex AI in Firebase SDK.
|
||||
* @public
|
||||
*/
|
||||
export interface VertexAI {
|
||||
/**
|
||||
* The {@link @firebase/app#FirebaseApp} this <code>{@link VertexAI}</code> instance is associated with.
|
||||
*/
|
||||
app: FirebaseApp;
|
||||
location: string;
|
||||
}
|
||||
/**
|
||||
* Options when initializing the Vertex AI in Firebase SDK.
|
||||
* @public
|
||||
*/
|
||||
export interface VertexAIOptions {
|
||||
location?: string;
|
||||
}
|
20
node_modules/@firebase/vertexai/dist/src/requests/request-helpers.d.ts
generated
vendored
Normal file
20
node_modules/@firebase/vertexai/dist/src/requests/request-helpers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content, GenerateContentRequest, Part } from '../types';
|
||||
export declare function formatSystemInstruction(input?: string | Part | Content): Content | undefined;
|
||||
export declare function formatNewContent(request: string | Array<string | Part>): Content;
|
||||
export declare function formatGenerateContentInput(params: GenerateContentRequest | string | Array<string | Part>): GenerateContentRequest;
|
17
node_modules/@firebase/vertexai/dist/src/requests/request-helpers.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/src/requests/request-helpers.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
43
node_modules/@firebase/vertexai/dist/src/requests/request.d.ts
generated
vendored
Normal file
43
node_modules/@firebase/vertexai/dist/src/requests/request.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { RequestOptions } from '../types';
|
||||
import { ApiSettings } from '../types/internal';
|
||||
export declare enum Task {
|
||||
GENERATE_CONTENT = "generateContent",
|
||||
STREAM_GENERATE_CONTENT = "streamGenerateContent",
|
||||
COUNT_TOKENS = "countTokens"
|
||||
}
|
||||
export declare class RequestUrl {
|
||||
model: string;
|
||||
task: Task;
|
||||
apiSettings: ApiSettings;
|
||||
stream: boolean;
|
||||
requestOptions?: RequestOptions | undefined;
|
||||
constructor(model: string, task: Task, apiSettings: ApiSettings, stream: boolean, requestOptions?: RequestOptions | undefined);
|
||||
toString(): string;
|
||||
/**
|
||||
* If the model needs to be passed to the backend, it needs to
|
||||
* include project and location path.
|
||||
*/
|
||||
get fullModelString(): string;
|
||||
}
|
||||
export declare function getHeaders(url: RequestUrl): Promise<Headers>;
|
||||
export declare function constructRequest(model: string, task: Task, apiSettings: ApiSettings, stream: boolean, body: string, requestOptions?: RequestOptions): Promise<{
|
||||
url: string;
|
||||
fetchOptions: RequestInit;
|
||||
}>;
|
||||
export declare function makeRequest(model: string, task: Task, apiSettings: ApiSettings, stream: boolean, body: string, requestOptions?: RequestOptions): Promise<Response>;
|
17
node_modules/@firebase/vertexai/dist/src/requests/request.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/src/requests/request.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
36
node_modules/@firebase/vertexai/dist/src/requests/response-helpers.d.ts
generated
vendored
Normal file
36
node_modules/@firebase/vertexai/dist/src/requests/response-helpers.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { EnhancedGenerateContentResponse, FunctionCall, GenerateContentResponse } from '../types';
|
||||
/**
|
||||
* Creates an EnhancedGenerateContentResponse object that has helper functions and
|
||||
* other modifications that improve usability.
|
||||
*/
|
||||
export declare function createEnhancedContentResponse(response: GenerateContentResponse): EnhancedGenerateContentResponse;
|
||||
/**
|
||||
* Adds convenience helper methods to a response object, including stream
|
||||
* chunks (as long as each chunk is a complete GenerateContentResponse JSON).
|
||||
*/
|
||||
export declare function addHelpers(response: GenerateContentResponse): EnhancedGenerateContentResponse;
|
||||
/**
|
||||
* Returns all text found in all parts of first candidate.
|
||||
*/
|
||||
export declare function getText(response: GenerateContentResponse): string;
|
||||
/**
|
||||
* Returns <code>{@link FunctionCall}</code>s associated with first candidate.
|
||||
*/
|
||||
export declare function getFunctionCalls(response: GenerateContentResponse): FunctionCall[] | undefined;
|
||||
export declare function formatBlockErrorMessage(response: GenerateContentResponse): string;
|
17
node_modules/@firebase/vertexai/dist/src/requests/response-helpers.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/src/requests/response-helpers.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
145
node_modules/@firebase/vertexai/dist/src/requests/schema-builder.d.ts
generated
vendored
Normal file
145
node_modules/@firebase/vertexai/dist/src/requests/schema-builder.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,145 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { SchemaInterface, SchemaType, SchemaParams, SchemaRequest } from '../types/schema';
|
||||
/**
|
||||
* Parent class encompassing all Schema types, with static methods that
|
||||
* allow building specific Schema types. This class can be converted with
|
||||
* `JSON.stringify()` into a JSON string accepted by Vertex AI REST endpoints.
|
||||
* (This string conversion is automatically done when calling SDK methods.)
|
||||
* @public
|
||||
*/
|
||||
export declare abstract class Schema implements SchemaInterface {
|
||||
/**
|
||||
* Optional. The type of the property. {@link
|
||||
* SchemaType}.
|
||||
*/
|
||||
type: SchemaType;
|
||||
/** Optional. The format of the property.
|
||||
* Supported formats:<br/>
|
||||
* <ul>
|
||||
* <li>for NUMBER type: "float", "double"</li>
|
||||
* <li>for INTEGER type: "int32", "int64"</li>
|
||||
* <li>for STRING type: "email", "byte", etc</li>
|
||||
* </ul>
|
||||
*/
|
||||
format?: string;
|
||||
/** Optional. The description of the property. */
|
||||
description?: string;
|
||||
/** Optional. Whether the property is nullable. Defaults to false. */
|
||||
nullable: boolean;
|
||||
/** Optional. The example of the property. */
|
||||
example?: unknown;
|
||||
/**
|
||||
* Allows user to add other schema properties that have not yet
|
||||
* been officially added to the SDK.
|
||||
*/
|
||||
[key: string]: unknown;
|
||||
constructor(schemaParams: SchemaInterface);
|
||||
/**
|
||||
* Defines how this Schema should be serialized as JSON.
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#tojson_behavior
|
||||
* @internal
|
||||
*/
|
||||
toJSON(): SchemaRequest;
|
||||
static array(arrayParams: SchemaParams & {
|
||||
items: Schema;
|
||||
}): ArraySchema;
|
||||
static object(objectParams: SchemaParams & {
|
||||
properties: {
|
||||
[k: string]: Schema;
|
||||
};
|
||||
optionalProperties?: string[];
|
||||
}): ObjectSchema;
|
||||
static string(stringParams?: SchemaParams): StringSchema;
|
||||
static enumString(stringParams: SchemaParams & {
|
||||
enum: string[];
|
||||
}): StringSchema;
|
||||
static integer(integerParams?: SchemaParams): IntegerSchema;
|
||||
static number(numberParams?: SchemaParams): NumberSchema;
|
||||
static boolean(booleanParams?: SchemaParams): BooleanSchema;
|
||||
}
|
||||
/**
|
||||
* A type that includes all specific Schema types.
|
||||
* @public
|
||||
*/
|
||||
export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema;
|
||||
/**
|
||||
* Schema class for "integer" types.
|
||||
* @public
|
||||
*/
|
||||
export declare class IntegerSchema extends Schema {
|
||||
constructor(schemaParams?: SchemaParams);
|
||||
}
|
||||
/**
|
||||
* Schema class for "number" types.
|
||||
* @public
|
||||
*/
|
||||
export declare class NumberSchema extends Schema {
|
||||
constructor(schemaParams?: SchemaParams);
|
||||
}
|
||||
/**
|
||||
* Schema class for "boolean" types.
|
||||
* @public
|
||||
*/
|
||||
export declare class BooleanSchema extends Schema {
|
||||
constructor(schemaParams?: SchemaParams);
|
||||
}
|
||||
/**
|
||||
* Schema class for "string" types. Can be used with or without
|
||||
* enum values.
|
||||
* @public
|
||||
*/
|
||||
export declare class StringSchema extends Schema {
|
||||
enum?: string[];
|
||||
constructor(schemaParams?: SchemaParams, enumValues?: string[]);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
toJSON(): SchemaRequest;
|
||||
}
|
||||
/**
|
||||
* Schema class for "array" types.
|
||||
* The `items` param should refer to the type of item that can be a member
|
||||
* of the array.
|
||||
* @public
|
||||
*/
|
||||
export declare class ArraySchema extends Schema {
|
||||
items: TypedSchema;
|
||||
constructor(schemaParams: SchemaParams, items: TypedSchema);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
toJSON(): SchemaRequest;
|
||||
}
|
||||
/**
|
||||
* Schema class for "object" types.
|
||||
* The `properties` param must be a map of `Schema` objects.
|
||||
* @public
|
||||
*/
|
||||
export declare class ObjectSchema extends Schema {
|
||||
properties: {
|
||||
[k: string]: TypedSchema;
|
||||
};
|
||||
optionalProperties: string[];
|
||||
constructor(schemaParams: SchemaParams, properties: {
|
||||
[k: string]: TypedSchema;
|
||||
}, optionalProperties?: string[]);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
toJSON(): SchemaRequest;
|
||||
}
|
17
node_modules/@firebase/vertexai/dist/src/requests/schema-builder.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/src/requests/schema-builder.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
37
node_modules/@firebase/vertexai/dist/src/requests/stream-reader.d.ts
generated
vendored
Normal file
37
node_modules/@firebase/vertexai/dist/src/requests/stream-reader.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { GenerateContentResponse, GenerateContentStreamResult } from '../types';
|
||||
/**
|
||||
* Process a response.body stream from the backend and return an
|
||||
* iterator that provides one complete GenerateContentResponse at a time
|
||||
* and a promise that resolves with a single aggregated
|
||||
* GenerateContentResponse.
|
||||
*
|
||||
* @param response - Response from a fetch call
|
||||
*/
|
||||
export declare function processStream(response: Response): GenerateContentStreamResult;
|
||||
/**
|
||||
* Reads a raw stream from the fetch response and join incomplete
|
||||
* chunks, returning a new stream that provides a single complete
|
||||
* GenerateContentResponse in each iteration.
|
||||
*/
|
||||
export declare function getResponseStream<T>(inputStream: ReadableStream<string>): ReadableStream<T>;
|
||||
/**
|
||||
* Aggregates an array of `GenerateContentResponse`s into a single
|
||||
* GenerateContentResponse.
|
||||
*/
|
||||
export declare function aggregateResponses(responses: GenerateContentResponse[]): GenerateContentResponse;
|
17
node_modules/@firebase/vertexai/dist/src/requests/stream-reader.test.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/src/requests/stream-reader.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export {};
|
30
node_modules/@firebase/vertexai/dist/src/service.d.ts
generated
vendored
Normal file
30
node_modules/@firebase/vertexai/dist/src/service.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp, _FirebaseService } from '@firebase/app';
|
||||
import { VertexAI, VertexAIOptions } from './public-types';
|
||||
import { AppCheckInternalComponentName, FirebaseAppCheckInternal } from '@firebase/app-check-interop-types';
|
||||
import { Provider } from '@firebase/component';
|
||||
import { FirebaseAuthInternal, FirebaseAuthInternalName } from '@firebase/auth-interop-types';
|
||||
export declare class VertexAIService implements VertexAI, _FirebaseService {
|
||||
app: FirebaseApp;
|
||||
options?: VertexAIOptions | undefined;
|
||||
auth: FirebaseAuthInternal | null;
|
||||
appCheck: FirebaseAppCheckInternal | null;
|
||||
location: string;
|
||||
constructor(app: FirebaseApp, authProvider?: Provider<FirebaseAuthInternalName>, appCheckProvider?: Provider<AppCheckInternalComponentName>, options?: VertexAIOptions | undefined);
|
||||
_delete(): Promise<void>;
|
||||
}
|
1
node_modules/@firebase/vertexai/dist/src/service.test.d.ts
generated
vendored
Normal file
1
node_modules/@firebase/vertexai/dist/src/service.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
11
node_modules/@firebase/vertexai/dist/src/tsdoc-metadata.json
generated
vendored
Normal file
11
node_modules/@firebase/vertexai/dist/src/tsdoc-metadata.json
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
||||
// It should be published with your NPM package. It should not be tracked by Git.
|
||||
{
|
||||
"tsdocVersion": "0.12",
|
||||
"toolPackages": [
|
||||
{
|
||||
"packageName": "@microsoft/api-extractor",
|
||||
"packageVersion": "0.1.2"
|
||||
}
|
||||
]
|
||||
}
|
144
node_modules/@firebase/vertexai/dist/src/types/content.d.ts
generated
vendored
Normal file
144
node_modules/@firebase/vertexai/dist/src/types/content.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Role } from './enums';
|
||||
/**
|
||||
* Content type for both prompts and response candidates.
|
||||
* @public
|
||||
*/
|
||||
export interface Content {
|
||||
role: Role;
|
||||
parts: Part[];
|
||||
}
|
||||
/**
|
||||
* Content part - includes text, image/video, or function call/response
|
||||
* part types.
|
||||
* @public
|
||||
*/
|
||||
export declare type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart;
|
||||
/**
|
||||
* Content part interface if the part represents a text string.
|
||||
* @public
|
||||
*/
|
||||
export interface TextPart {
|
||||
text: string;
|
||||
inlineData?: never;
|
||||
functionCall?: never;
|
||||
functionResponse?: never;
|
||||
}
|
||||
/**
|
||||
* Content part interface if the part represents an image.
|
||||
* @public
|
||||
*/
|
||||
export interface InlineDataPart {
|
||||
text?: never;
|
||||
inlineData: GenerativeContentBlob;
|
||||
functionCall?: never;
|
||||
functionResponse?: never;
|
||||
/**
|
||||
* Applicable if `inlineData` is a video.
|
||||
*/
|
||||
videoMetadata?: VideoMetadata;
|
||||
}
|
||||
/**
|
||||
* Describes the input video content.
|
||||
* @public
|
||||
*/
|
||||
export interface VideoMetadata {
|
||||
/**
|
||||
* The start offset of the video in
|
||||
* protobuf {@link https://cloud.google.com/ruby/docs/reference/google-cloud-workflows-v1/latest/Google-Protobuf-Duration#json-mapping | Duration} format.
|
||||
*/
|
||||
startOffset: string;
|
||||
/**
|
||||
* The end offset of the video in
|
||||
* protobuf {@link https://cloud.google.com/ruby/docs/reference/google-cloud-workflows-v1/latest/Google-Protobuf-Duration#json-mapping | Duration} format.
|
||||
*/
|
||||
endOffset: string;
|
||||
}
|
||||
/**
|
||||
* Content part interface if the part represents a <code>{@link FunctionCall}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionCallPart {
|
||||
text?: never;
|
||||
inlineData?: never;
|
||||
functionCall: FunctionCall;
|
||||
functionResponse?: never;
|
||||
}
|
||||
/**
|
||||
* Content part interface if the part represents <code>{@link FunctionResponse}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionResponsePart {
|
||||
text?: never;
|
||||
inlineData?: never;
|
||||
functionCall?: never;
|
||||
functionResponse: FunctionResponse;
|
||||
}
|
||||
/**
|
||||
* Content part interface if the part represents <code>{@link FileData}</code>
|
||||
* @public
|
||||
*/
|
||||
export interface FileDataPart {
|
||||
text?: never;
|
||||
inlineData?: never;
|
||||
functionCall?: never;
|
||||
functionResponse?: never;
|
||||
fileData: FileData;
|
||||
}
|
||||
/**
|
||||
* A predicted <code>{@link FunctionCall}</code> returned from the model
|
||||
* that contains a string representing the {@link FunctionDeclaration.name}
|
||||
* and a structured JSON object containing the parameters and their values.
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionCall {
|
||||
name: string;
|
||||
args: object;
|
||||
}
|
||||
/**
|
||||
* The result output from a <code>{@link FunctionCall}</code> that contains a string
|
||||
* representing the {@link FunctionDeclaration.name}
|
||||
* and a structured JSON object containing any output
|
||||
* from the function is used as context to the model.
|
||||
* This should contain the result of a <code>{@link FunctionCall}</code>
|
||||
* made based on model prediction.
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionResponse {
|
||||
name: string;
|
||||
response: object;
|
||||
}
|
||||
/**
|
||||
* Interface for sending an image.
|
||||
* @public
|
||||
*/
|
||||
export interface GenerativeContentBlob {
|
||||
mimeType: string;
|
||||
/**
|
||||
* Image as a base64 string.
|
||||
*/
|
||||
data: string;
|
||||
}
|
||||
/**
|
||||
* Data pointing to a file uploaded on Google Cloud Storage.
|
||||
* @public
|
||||
*/
|
||||
export interface FileData {
|
||||
mimeType: string;
|
||||
fileUri: string;
|
||||
}
|
100
node_modules/@firebase/vertexai/dist/src/types/enums.d.ts
generated
vendored
Normal file
100
node_modules/@firebase/vertexai/dist/src/types/enums.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Role is the producer of the content.
|
||||
* @public
|
||||
*/
|
||||
export declare type Role = (typeof POSSIBLE_ROLES)[number];
|
||||
/**
|
||||
* Possible roles.
|
||||
* @public
|
||||
*/
|
||||
export declare const POSSIBLE_ROLES: readonly ["user", "model", "function", "system"];
|
||||
/**
|
||||
* Harm categories that would cause prompts or candidates to be blocked.
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmCategory {
|
||||
HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
|
||||
HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
||||
HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT",
|
||||
HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT"
|
||||
}
|
||||
/**
|
||||
* Threshold above which a prompt or candidate will be blocked.
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmBlockThreshold {
|
||||
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
|
||||
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
|
||||
BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH",
|
||||
BLOCK_NONE = "BLOCK_NONE"
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmBlockMethod {
|
||||
SEVERITY = "SEVERITY",
|
||||
PROBABILITY = "PROBABILITY"
|
||||
}
|
||||
/**
|
||||
* Probability that a prompt or candidate matches a harm category.
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmProbability {
|
||||
NEGLIGIBLE = "NEGLIGIBLE",
|
||||
LOW = "LOW",
|
||||
MEDIUM = "MEDIUM",
|
||||
HIGH = "HIGH"
|
||||
}
|
||||
/**
|
||||
* Harm severity levels.
|
||||
* @public
|
||||
*/
|
||||
export declare enum HarmSeverity {
|
||||
HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
|
||||
HARM_SEVERITY_LOW = "HARM_SEVERITY_LOW",
|
||||
HARM_SEVERITY_MEDIUM = "HARM_SEVERITY_MEDIUM",
|
||||
HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH"
|
||||
}
|
||||
/**
|
||||
* Reason that a prompt was blocked.
|
||||
* @public
|
||||
*/
|
||||
export declare enum BlockReason {
|
||||
SAFETY = "SAFETY",
|
||||
OTHER = "OTHER"
|
||||
}
|
||||
/**
|
||||
* Reason that a candidate finished.
|
||||
* @public
|
||||
*/
|
||||
export declare enum FinishReason {
|
||||
STOP = "STOP",
|
||||
MAX_TOKENS = "MAX_TOKENS",
|
||||
SAFETY = "SAFETY",
|
||||
RECITATION = "RECITATION",
|
||||
OTHER = "OTHER"
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare enum FunctionCallingMode {
|
||||
AUTO = "AUTO",
|
||||
ANY = "ANY",
|
||||
NONE = "NONE"
|
||||
}
|
77
node_modules/@firebase/vertexai/dist/src/types/error.d.ts
generated
vendored
Normal file
77
node_modules/@firebase/vertexai/dist/src/types/error.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { GenerateContentResponse } from './responses';
|
||||
/**
|
||||
* Details object that may be included in an error response.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface ErrorDetails {
|
||||
'@type'?: string;
|
||||
/** The reason for the error. */
|
||||
reason?: string;
|
||||
/** The domain where the error occurred. */
|
||||
domain?: string;
|
||||
/** Additional metadata about the error. */
|
||||
metadata?: Record<string, unknown>;
|
||||
/** Any other relevant information about the error. */
|
||||
[key: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Details object that contains data originating from a bad HTTP response.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface CustomErrorData {
|
||||
/** HTTP status code of the error response. */
|
||||
status?: number;
|
||||
/** HTTP status text of the error response. */
|
||||
statusText?: string;
|
||||
/** Response from a <code>{@link GenerateContentRequest}</code> */
|
||||
response?: GenerateContentResponse;
|
||||
/** Optional additional details about the error. */
|
||||
errorDetails?: ErrorDetails[];
|
||||
}
|
||||
/**
|
||||
* Standardized error codes that <code>{@link VertexAIError}</code> can have.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const enum VertexAIErrorCode {
|
||||
/** A generic error occurred. */
|
||||
ERROR = "error",
|
||||
/** An error occurred in a request. */
|
||||
REQUEST_ERROR = "request-error",
|
||||
/** An error occurred in a response. */
|
||||
RESPONSE_ERROR = "response-error",
|
||||
/** An error occurred while performing a fetch. */
|
||||
FETCH_ERROR = "fetch-error",
|
||||
/** An error associated with a Content object. */
|
||||
INVALID_CONTENT = "invalid-content",
|
||||
/** An error due to the Firebase API not being enabled in the Console. */
|
||||
API_NOT_ENABLED = "api-not-enabled",
|
||||
/** An error due to invalid Schema input. */
|
||||
INVALID_SCHEMA = "invalid-schema",
|
||||
/** An error occurred due to a missing Firebase API key. */
|
||||
NO_API_KEY = "no-api-key",
|
||||
/** An error occurred due to a model name not being specified during initialization. */
|
||||
NO_MODEL = "no-model",
|
||||
/** An error occurred due to a missing project ID. */
|
||||
NO_PROJECT_ID = "no-project-id",
|
||||
/** An error occurred while parsing. */
|
||||
PARSE_FAILED = "parse-failed"
|
||||
}
|
22
node_modules/@firebase/vertexai/dist/src/types/index.d.ts
generated
vendored
Normal file
22
node_modules/@firebase/vertexai/dist/src/types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export * from './content';
|
||||
export * from './enums';
|
||||
export * from './requests';
|
||||
export * from './responses';
|
||||
export * from './error';
|
||||
export * from './schema';
|
25
node_modules/@firebase/vertexai/dist/src/types/internal.d.ts
generated
vendored
Normal file
25
node_modules/@firebase/vertexai/dist/src/types/internal.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
|
||||
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
|
||||
export interface ApiSettings {
|
||||
apiKey: string;
|
||||
project: string;
|
||||
location: string;
|
||||
getAuthToken?: () => Promise<FirebaseAuthTokenData | null>;
|
||||
getAppCheckToken?: () => Promise<AppCheckTokenResult>;
|
||||
}
|
184
node_modules/@firebase/vertexai/dist/src/types/requests.d.ts
generated
vendored
Normal file
184
node_modules/@firebase/vertexai/dist/src/types/requests.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,184 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TypedSchema } from '../requests/schema-builder';
|
||||
import { Content, Part } from './content';
|
||||
import { FunctionCallingMode, HarmBlockMethod, HarmBlockThreshold, HarmCategory } from './enums';
|
||||
import { ObjectSchemaInterface, SchemaRequest } from './schema';
|
||||
/**
|
||||
* Base parameters for a number of methods.
|
||||
* @public
|
||||
*/
|
||||
export interface BaseParams {
|
||||
safetySettings?: SafetySetting[];
|
||||
generationConfig?: GenerationConfig;
|
||||
}
|
||||
/**
|
||||
* Params passed to <code>{@link getGenerativeModel}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface ModelParams extends BaseParams {
|
||||
model: string;
|
||||
tools?: Tool[];
|
||||
toolConfig?: ToolConfig;
|
||||
systemInstruction?: string | Part | Content;
|
||||
}
|
||||
/**
|
||||
* Request sent through {@link GenerativeModel.generateContent}
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentRequest extends BaseParams {
|
||||
contents: Content[];
|
||||
tools?: Tool[];
|
||||
toolConfig?: ToolConfig;
|
||||
systemInstruction?: string | Part | Content;
|
||||
}
|
||||
/**
|
||||
* Safety setting that can be sent as part of request parameters.
|
||||
* @public
|
||||
*/
|
||||
export interface SafetySetting {
|
||||
category: HarmCategory;
|
||||
threshold: HarmBlockThreshold;
|
||||
method?: HarmBlockMethod;
|
||||
}
|
||||
/**
|
||||
* Config options for content-related requests
|
||||
* @public
|
||||
*/
|
||||
export interface GenerationConfig {
|
||||
candidateCount?: number;
|
||||
stopSequences?: string[];
|
||||
maxOutputTokens?: number;
|
||||
temperature?: number;
|
||||
topP?: number;
|
||||
topK?: number;
|
||||
presencePenalty?: number;
|
||||
frequencyPenalty?: number;
|
||||
/**
|
||||
* Output response MIME type of the generated candidate text.
|
||||
* Supported MIME types are `text/plain` (default, text output),
|
||||
* `application/json` (JSON response in the candidates), and
|
||||
* `text/x.enum`.
|
||||
*/
|
||||
responseMimeType?: string;
|
||||
/**
|
||||
* Output response schema of the generated candidate text. This
|
||||
* value can be a class generated with a <code>{@link Schema}</code> static method
|
||||
* like `Schema.string()` or `Schema.object()` or it can be a plain
|
||||
* JS object matching the <code>{@link SchemaRequest}</code> interface.
|
||||
* <br/>Note: This only applies when the specified `responseMIMEType` supports a schema; currently
|
||||
* this is limited to `application/json` and `text/x.enum`.
|
||||
*/
|
||||
responseSchema?: TypedSchema | SchemaRequest;
|
||||
}
|
||||
/**
|
||||
* Params for {@link GenerativeModel.startChat}.
|
||||
* @public
|
||||
*/
|
||||
export interface StartChatParams extends BaseParams {
|
||||
history?: Content[];
|
||||
tools?: Tool[];
|
||||
toolConfig?: ToolConfig;
|
||||
systemInstruction?: string | Part | Content;
|
||||
}
|
||||
/**
|
||||
* Params for calling {@link GenerativeModel.countTokens}
|
||||
* @public
|
||||
*/
|
||||
export interface CountTokensRequest {
|
||||
contents: Content[];
|
||||
}
|
||||
/**
|
||||
* Params passed to <code>{@link getGenerativeModel}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface RequestOptions {
|
||||
/**
|
||||
* Request timeout in milliseconds. Defaults to 180 seconds (180000ms).
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* Base url for endpoint. Defaults to https://firebaseml.googleapis.com
|
||||
*/
|
||||
baseUrl?: string;
|
||||
}
|
||||
/**
|
||||
* Defines a tool that model can call to access external knowledge.
|
||||
* @public
|
||||
*/
|
||||
export declare type Tool = FunctionDeclarationsTool;
|
||||
/**
|
||||
* Structured representation of a function declaration as defined by the
|
||||
* {@link https://spec.openapis.org/oas/v3.0.3 | OpenAPI 3.0 specification}.
|
||||
* Included
|
||||
* in this declaration are the function name and parameters. This
|
||||
* `FunctionDeclaration` is a representation of a block of code that can be used
|
||||
* as a Tool by the model and executed by the client.
|
||||
* @public
|
||||
*/
|
||||
export declare interface FunctionDeclaration {
|
||||
/**
|
||||
* The name of the function to call. Must start with a letter or an
|
||||
* underscore. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with
|
||||
* a max length of 64.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Description and purpose of the function. Model uses it to decide
|
||||
* how and whether to call the function.
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* Optional. Describes the parameters to this function in JSON Schema Object
|
||||
* format. Reflects the Open API 3.03 Parameter Object. Parameter names are
|
||||
* case-sensitive. For a function with no parameters, this can be left unset.
|
||||
*/
|
||||
parameters?: ObjectSchemaInterface;
|
||||
}
|
||||
/**
|
||||
* A `FunctionDeclarationsTool` is a piece of code that enables the system to
|
||||
* interact with external systems to perform an action, or set of actions,
|
||||
* outside of knowledge and scope of the model.
|
||||
* @public
|
||||
*/
|
||||
export declare interface FunctionDeclarationsTool {
|
||||
/**
|
||||
* Optional. One or more function declarations
|
||||
* to be passed to the model along with the current user query. Model may
|
||||
* decide to call a subset of these functions by populating
|
||||
* <code>{@link FunctionCall}</code> in the response. User should
|
||||
* provide a <code>{@link FunctionResponse}</code> for each
|
||||
* function call in the next turn. Based on the function responses, the model will
|
||||
* generate the final response back to the user. Maximum 64 function
|
||||
* declarations can be provided.
|
||||
*/
|
||||
functionDeclarations?: FunctionDeclaration[];
|
||||
}
|
||||
/**
|
||||
* Tool config. This config is shared for all tools provided in the request.
|
||||
* @public
|
||||
*/
|
||||
export interface ToolConfig {
|
||||
functionCallingConfig?: FunctionCallingConfig;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface FunctionCallingConfig {
|
||||
mode?: FunctionCallingMode;
|
||||
allowedFunctionNames?: string[];
|
||||
}
|
191
node_modules/@firebase/vertexai/dist/src/types/responses.d.ts
generated
vendored
Normal file
191
node_modules/@firebase/vertexai/dist/src/types/responses.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,191 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Content, FunctionCall } from './content';
|
||||
import { BlockReason, FinishReason, HarmCategory, HarmProbability, HarmSeverity } from './enums';
|
||||
/**
|
||||
* Result object returned from {@link GenerativeModel.generateContent} call.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentResult {
|
||||
response: EnhancedGenerateContentResponse;
|
||||
}
|
||||
/**
|
||||
* Result object returned from {@link GenerativeModel.generateContentStream} call.
|
||||
* Iterate over `stream` to get chunks as they come in and/or
|
||||
* use the `response` promise to get the aggregated response when
|
||||
* the stream is done.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentStreamResult {
|
||||
stream: AsyncGenerator<EnhancedGenerateContentResponse>;
|
||||
response: Promise<EnhancedGenerateContentResponse>;
|
||||
}
|
||||
/**
|
||||
* Response object wrapped with helper methods.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface EnhancedGenerateContentResponse extends GenerateContentResponse {
|
||||
/**
|
||||
* Returns the text string from the response, if available.
|
||||
* Throws if the prompt or candidate was blocked.
|
||||
*/
|
||||
text: () => string;
|
||||
functionCalls: () => FunctionCall[] | undefined;
|
||||
}
|
||||
/**
|
||||
* Individual response from {@link GenerativeModel.generateContent} and
|
||||
* {@link GenerativeModel.generateContentStream}.
|
||||
* `generateContentStream()` will return one in each chunk until
|
||||
* the stream is done.
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentResponse {
|
||||
candidates?: GenerateContentCandidate[];
|
||||
promptFeedback?: PromptFeedback;
|
||||
usageMetadata?: UsageMetadata;
|
||||
}
|
||||
/**
|
||||
* Usage metadata about a <code>{@link GenerateContentResponse}</code>.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface UsageMetadata {
|
||||
promptTokenCount: number;
|
||||
candidatesTokenCount: number;
|
||||
totalTokenCount: number;
|
||||
}
|
||||
/**
|
||||
* If the prompt was blocked, this will be populated with `blockReason` and
|
||||
* the relevant `safetyRatings`.
|
||||
* @public
|
||||
*/
|
||||
export interface PromptFeedback {
|
||||
blockReason?: BlockReason;
|
||||
safetyRatings: SafetyRating[];
|
||||
blockReasonMessage?: string;
|
||||
}
|
||||
/**
|
||||
* A candidate returned as part of a <code>{@link GenerateContentResponse}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface GenerateContentCandidate {
|
||||
index: number;
|
||||
content: Content;
|
||||
finishReason?: FinishReason;
|
||||
finishMessage?: string;
|
||||
safetyRatings?: SafetyRating[];
|
||||
citationMetadata?: CitationMetadata;
|
||||
groundingMetadata?: GroundingMetadata;
|
||||
}
|
||||
/**
|
||||
* Citation metadata that may be found on a <code>{@link GenerateContentCandidate}</code>.
|
||||
* @public
|
||||
*/
|
||||
export interface CitationMetadata {
|
||||
citations: Citation[];
|
||||
}
|
||||
/**
|
||||
* A single citation.
|
||||
* @public
|
||||
*/
|
||||
export interface Citation {
|
||||
startIndex?: number;
|
||||
endIndex?: number;
|
||||
uri?: string;
|
||||
license?: string;
|
||||
title?: string;
|
||||
publicationDate?: Date;
|
||||
}
|
||||
/**
|
||||
* Metadata returned to client when grounding is enabled.
|
||||
* @public
|
||||
*/
|
||||
export interface GroundingMetadata {
|
||||
webSearchQueries?: string[];
|
||||
retrievalQueries?: string[];
|
||||
groundingAttributions: GroundingAttribution[];
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface GroundingAttribution {
|
||||
segment: Segment;
|
||||
confidenceScore?: number;
|
||||
web?: WebAttribution;
|
||||
retrievedContext?: RetrievedContextAttribution;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Segment {
|
||||
partIndex: number;
|
||||
startIndex: number;
|
||||
endIndex: number;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface WebAttribution {
|
||||
uri: string;
|
||||
title: string;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface RetrievedContextAttribution {
|
||||
uri: string;
|
||||
title: string;
|
||||
}
|
||||
/**
|
||||
* Protobuf google.type.Date
|
||||
* @public
|
||||
*/
|
||||
export interface Date {
|
||||
year: number;
|
||||
month: number;
|
||||
day: number;
|
||||
}
|
||||
/**
|
||||
* A safety rating associated with a <code>{@link GenerateContentCandidate}</code>
|
||||
* @public
|
||||
*/
|
||||
export interface SafetyRating {
|
||||
category: HarmCategory;
|
||||
probability: HarmProbability;
|
||||
severity: HarmSeverity;
|
||||
probabilityScore: number;
|
||||
severityScore: number;
|
||||
blocked: boolean;
|
||||
}
|
||||
/**
|
||||
* Response from calling {@link GenerativeModel.countTokens}.
|
||||
* @public
|
||||
*/
|
||||
export interface CountTokensResponse {
|
||||
/**
|
||||
* The total number of tokens counted across all instances from the request.
|
||||
*/
|
||||
totalTokens: number;
|
||||
/**
|
||||
* The total number of billable characters counted across all instances
|
||||
* from the request.
|
||||
*/
|
||||
totalBillableCharacters?: number;
|
||||
}
|
99
node_modules/@firebase/vertexai/dist/src/types/schema.d.ts
generated
vendored
Normal file
99
node_modules/@firebase/vertexai/dist/src/types/schema.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Contains the list of OpenAPI data types
|
||||
* as defined by the
|
||||
* {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
|
||||
* @public
|
||||
*/
|
||||
export declare enum SchemaType {
|
||||
/** String type. */
|
||||
STRING = "string",
|
||||
/** Number type. */
|
||||
NUMBER = "number",
|
||||
/** Integer type. */
|
||||
INTEGER = "integer",
|
||||
/** Boolean type. */
|
||||
BOOLEAN = "boolean",
|
||||
/** Array type. */
|
||||
ARRAY = "array",
|
||||
/** Object type. */
|
||||
OBJECT = "object"
|
||||
}
|
||||
/**
|
||||
* Basic <code>{@link Schema}</code> properties shared across several Schema-related
|
||||
* types.
|
||||
* @public
|
||||
*/
|
||||
export interface SchemaShared<T> {
|
||||
/** Optional. The format of the property. */
|
||||
format?: string;
|
||||
/** Optional. The description of the property. */
|
||||
description?: string;
|
||||
/** Optional. The items of the property. */
|
||||
items?: T;
|
||||
/** Optional. Map of `Schema` objects. */
|
||||
properties?: {
|
||||
[k: string]: T;
|
||||
};
|
||||
/** Optional. The enum of the property. */
|
||||
enum?: string[];
|
||||
/** Optional. The example of the property. */
|
||||
example?: unknown;
|
||||
/** Optional. Whether the property is nullable. */
|
||||
nullable?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Params passed to <code>{@link Schema}</code> static methods to create specific
|
||||
* <code>{@link Schema}</code> classes.
|
||||
* @public
|
||||
*/
|
||||
export interface SchemaParams extends SchemaShared<SchemaInterface> {
|
||||
}
|
||||
/**
|
||||
* Final format for <code>{@link Schema}</code> params passed to backend requests.
|
||||
* @public
|
||||
*/
|
||||
export interface SchemaRequest extends SchemaShared<SchemaRequest> {
|
||||
/**
|
||||
* The type of the property. {@link
|
||||
* SchemaType}.
|
||||
*/
|
||||
type: SchemaType;
|
||||
/** Optional. Array of required property. */
|
||||
required?: string[];
|
||||
}
|
||||
/**
|
||||
* Interface for <code>{@link Schema}</code> class.
|
||||
* @public
|
||||
*/
|
||||
export interface SchemaInterface extends SchemaShared<SchemaInterface> {
|
||||
/**
|
||||
* The type of the property. {@link
|
||||
* SchemaType}.
|
||||
*/
|
||||
type: SchemaType;
|
||||
}
|
||||
/**
|
||||
* Interface for <code>{@link ObjectSchema}</code> class.
|
||||
* @public
|
||||
*/
|
||||
export interface ObjectSchemaInterface extends SchemaInterface {
|
||||
type: SchemaType.OBJECT;
|
||||
optionalProperties?: string[];
|
||||
}
|
17
node_modules/@firebase/vertexai/dist/test-utils/base64cat.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/vertexai/dist/test-utils/base64cat.d.ts
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
24
node_modules/@firebase/vertexai/dist/test-utils/convert-mocks.d.ts
generated
vendored
Normal file
24
node_modules/@firebase/vertexai/dist/test-utils/convert-mocks.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Converts mock text files into a js file that karma can read without
|
||||
* using fs.
|
||||
*/
|
||||
declare const fs: any;
|
||||
declare const join: any;
|
||||
declare const mockResponseDir: any;
|
||||
declare function main(): Promise<void>;
|
23
node_modules/@firebase/vertexai/dist/test-utils/mock-response.d.ts
generated
vendored
Normal file
23
node_modules/@firebase/vertexai/dist/test-utils/mock-response.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Mock native Response.body
|
||||
* Streams contents of json file in 20 character chunks
|
||||
*/
|
||||
export declare function getChunkedStream(input: string, chunkLength?: number): ReadableStream<Uint8Array>;
|
||||
export declare function getMockResponseStreaming(filename: string, chunkLength?: number): Partial<Response>;
|
||||
export declare function getMockResponse(filename: string): Partial<Response>;
|
1052
node_modules/@firebase/vertexai/dist/vertexai-public.d.ts
generated
vendored
Normal file
1052
node_modules/@firebase/vertexai/dist/vertexai-public.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1066
node_modules/@firebase/vertexai/dist/vertexai.d.ts
generated
vendored
Normal file
1066
node_modules/@firebase/vertexai/dist/vertexai.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue