@genkit-ai/vertexai
Version:
Genkit AI framework plugin for Google Cloud Vertex AI APIs including Gemini APIs, Imagen, and more.
182 lines (178 loc) • 7.41 kB
text/typescript
import { CompletionChunk, ChatCompletionChoiceFinishReason, ChatCompletionResponse, ChatCompletionRequest } from '@mistralai/mistralai-gcp/models/components/index.js';
import { ModelReference, z, Part, GenerateRequest, ModelResponseData, Genkit } from 'genkit';
import { ModelAction } from 'genkit/model';
/**
* 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.
*/
/**
* See https://docs.mistral.ai/api/#tag/chat/operation/chat_completion_v1_chat_completions_post
* @deprecated
*/
declare const MistralConfigSchema: z.ZodObject<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">>;
/**
* @deprecated
*/
declare const mistralLarge: ModelReference<z.ZodObject<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">>>;
/**
* @deprecated
*/
declare const mistralNemo: ModelReference<z.ZodObject<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">>>;
/**
* @deprecated
*/
declare const codestral: ModelReference<z.ZodObject<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
version: z.ZodOptional<z.ZodString>;
temperature: z.ZodOptional<z.ZodNumber>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
apiKey: z.ZodOptional<z.ZodString>;
} & {
location: z.ZodOptional<z.ZodString>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">>>;
/**
* @deprecated
*/
declare const SUPPORTED_MISTRAL_MODELS: Record<string, ModelReference<typeof MistralConfigSchema>>;
/**
* @deprecated
*/
declare function toMistralRequest(model: string, input: GenerateRequest<typeof MistralConfigSchema>): ChatCompletionRequest;
/**
* Maps Mistral finish reasons to Genkit finish reasons
* @deprecated
*/
declare function fromMistralFinishReason(reason: ChatCompletionChoiceFinishReason | undefined): 'length' | 'unknown' | 'stop' | 'blocked' | 'other';
/**
* Converts a Mistral response to a Genkit response
* @deprecated
*/
declare function fromMistralResponse(_input: GenerateRequest<typeof MistralConfigSchema>, response: ChatCompletionResponse): ModelResponseData;
/** @deprecated */
declare function mistralModel(ai: Genkit, modelName: string, projectId: string, region: string): ModelAction;
/** @deprecated */
declare function fromMistralCompletionChunk(chunk: CompletionChunk): Part[];
export { MistralConfigSchema, SUPPORTED_MISTRAL_MODELS, codestral, fromMistralCompletionChunk, fromMistralFinishReason, fromMistralResponse, mistralLarge, mistralModel, mistralNemo, toMistralRequest };