@adaline/google 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1415,6 +1415,17 @@ declare const GoogleChatGenerationConfig: z.ZodObject<{
1415
1415
  topK?: number | undefined;
1416
1416
  }>;
1417
1417
  type GoogleChatGenerationConfigType = z.infer<typeof GoogleChatGenerationConfig>;
1418
+ declare const GoogleChatSafetySettings: z.ZodObject<{
1419
+ category: z.ZodEnum<["HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_SEXUALLY_EXPLICIT", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_CIVIC_INTEGRITY"]>;
1420
+ threshold: z.ZodEnum<["HARM_BLOCK_THRESHOLD_UNSPECIFIED", "BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE", "OFF"]>;
1421
+ }, "strip", z.ZodTypeAny, {
1422
+ threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
1423
+ category: "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
1424
+ }, {
1425
+ threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
1426
+ category: "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
1427
+ }>;
1428
+ type GoogleChatSafetySettingsType = z.infer<typeof GoogleChatSafetySettings>;
1418
1429
  declare const GoogleChatRequest: z.ZodObject<{
1419
1430
  model: z.ZodOptional<z.ZodString>;
1420
1431
  contents: z.ZodArray<z.ZodObject<{
@@ -3231,7 +3242,7 @@ declare class Text_Embedding_004 extends BaseEmbeddingModel {
3231
3242
  }
3232
3243
 
3233
3244
  declare const ProviderLiteral = "google";
3234
- declare class Google<O extends Record<string, any> = Record<string, any>> implements ProviderV1<O> {
3245
+ declare class Google<C extends BaseChatModelOptionsType, E extends BaseEmbeddingModelOptionsType> implements ProviderV1<C, E> {
3235
3246
  readonly version: "v1";
3236
3247
  readonly name = "google";
3237
3248
  static readonly baseUrl: string;
@@ -3239,10 +3250,10 @@ declare class Google<O extends Record<string, any> = Record<string, any>> implem
3239
3250
  private readonly embeddingModelFactories;
3240
3251
  chatModelLiterals(): string[];
3241
3252
  chatModelSchemas(): Record<string, ChatModelSchemaType>;
3242
- chatModel(options: O): ChatModelV1;
3253
+ chatModel(options: C): ChatModelV1;
3243
3254
  embeddingModelLiterals(): string[];
3244
3255
  embeddingModelSchemas(): Record<string, EmbeddingModelSchemaType>;
3245
- embeddingModel(options: O): EmbeddingModelV1;
3256
+ embeddingModel(options: E): EmbeddingModelV1;
3246
3257
  }
3247
3258
 
3248
- export { BaseChatModel, BaseChatModelGemini1, BaseChatModelOptions, type BaseChatModelOptionsType, BaseEmbeddingModel, BaseEmbeddingModelOptions, type BaseEmbeddingModelOptionsType, ChatModelBaseConfigDef, ChatModelBaseConfigSchema, ChatModelC1ConfigDef, ChatModelC1ConfigSchema, EmbeddingModelBaseConfigDef, EmbeddingModelBaseConfigSchema, Gemini1_0Pro, Gemini1_0ProLatest, Gemini1_0ProLatestLiteral, Gemini1_0ProLatestOptions, type Gemini1_0ProLatestOptionsType, Gemini1_0ProLatestSchema, Gemini1_0ProLiteral, Gemini1_0ProOptions, type Gemini1_0ProOptionsType, Gemini1_0ProSchema, Gemini1_0ProVision, Gemini1_0ProVisionLiteral, Gemini1_0ProVisionOptions, type Gemini1_0ProVisionOptionsType, Gemini1_0ProVisionSchema, Gemini1_0Pro_001, Gemini1_0Pro_001Literal, Gemini1_0Pro_001Options, type Gemini1_0Pro_001OptionsType, Gemini1_0Pro_001Schema, Gemini1_5Flash, Gemini1_5Flash001, Gemini1_5Flash001Literal, Gemini1_5Flash001Options, type Gemini1_5Flash001OptionsType, Gemini1_5Flash001Schema, Gemini1_5Flash002, Gemini1_5Flash002Literal, Gemini1_5Flash002Options, type Gemini1_5Flash002OptionsType, Gemini1_5Flash002Schema, Gemini1_5FlashLatest, Gemini1_5FlashLatestLiteral, Gemini1_5FlashLatestOptions, type Gemini1_5FlashLatestOptionsType, Gemini1_5FlashLatestSchema, Gemini1_5FlashLiteral, Gemini1_5FlashOptions, type Gemini1_5FlashOptionsType, Gemini1_5FlashSchema, Gemini1_5Pro, Gemini1_5Pro001, Gemini1_5Pro001Literal, Gemini1_5Pro001Options, type Gemini1_5Pro001OptionsType, Gemini1_5Pro001Schema, Gemini1_5Pro002, Gemini1_5Pro002Literal, Gemini1_5Pro002Options, type Gemini1_5Pro002OptionsType, Gemini1_5Pro002Schema, Gemini1_5ProLatest, Gemini1_5ProLatestLiteral, Gemini1_5ProLatestOptions, type Gemini1_5ProLatestOptionsType, Gemini1_5ProLatestSchema, Gemini1_5ProLiteral, Gemini1_5ProOptions, type Gemini1_5ProOptionsType, Gemini1_5ProSchema, GeminiPro, GeminiProLiteral, GeminiProOptions, type GeminiProOptionsType, GeminiProSchema, GeminiProVision, GeminiProVisionLiteral, GeminiProVisionOptions, type GeminiProVisionOptionsType, GeminiProVisionSchema, Google, GoogleChatAssistantRoleLiteral, GoogleChatContent, GoogleChatContentPartFunctionCall, type GoogleChatContentPartFunctionCallType, GoogleChatContentPartFunctionResponse, type GoogleChatContentPartFunctionResponseType, GoogleChatContentPartInlineData, type GoogleChatContentPartInlineDataType, GoogleChatContentPartText, type GoogleChatContentPartTextType, type GoogleChatContentType, GoogleChatGenerationConfig, type GoogleChatGenerationConfigType, GoogleChatModelConfigs, GoogleChatModelModalities, GoogleChatModelModalitiesEnum, GoogleChatModelRoles, GoogleChatModelRolesMap, GoogleChatModelTextModalities, GoogleChatModelTextModalitiesEnum, GoogleChatModelTextToolModalities, GoogleChatModelTextToolModalitiesEnum, GoogleChatModelTextVisionModalities, GoogleChatModelTextVisionModalitiesEnum, GoogleChatRequest, type GoogleChatRequestType, GoogleChatSystemInstruction, type GoogleChatSystemInstructionType, GoogleChatTool, GoogleChatToolConfig, type GoogleChatToolConfigType, GoogleChatToolRoleLiteral, type GoogleChatToolType, GoogleCompleteChatResponse, type GoogleCompleteChatResponseType, GoogleCompleteChatTextResponse, GoogleCompleteChatToolResponse, GoogleEmbeddingModelConfigs, GoogleEmbeddingModelModalities, GoogleEmbeddingModelModalitiesEnum, GoogleEmbeddingRequest, GoogleEmbeddingRequestInput, type GoogleEmbeddingRequestInputType, type GoogleEmbeddingRequestType, GoogleGetEmbeddingsResponse, type GoogleGetEmbeddingsResponseType, GoogleStreamChatResponse, type GoogleStreamChatResponseType, GoogleStreamChatTextResponse, GoogleStreamChatToolResponse, ProviderLiteral, Text_Embedding_001, Text_Embedding_001Literal, Text_Embedding_001Options, type Text_Embedding_001OptionsType, Text_Embedding_001Schema, Text_Embedding_004, Text_Embedding_004Literal, Text_Embedding_004Options, type Text_Embedding_004OptionsType, Text_Embedding_004Schema, dimensions, frequencyPenalty, maxTokens, presencePenalty, safetySettings, seed, stop, temperature, toolChoice, topK, topP };
3259
+ export { BaseChatModel, BaseChatModelGemini1, BaseChatModelOptions, type BaseChatModelOptionsType, BaseEmbeddingModel, BaseEmbeddingModelOptions, type BaseEmbeddingModelOptionsType, ChatModelBaseConfigDef, ChatModelBaseConfigSchema, ChatModelC1ConfigDef, ChatModelC1ConfigSchema, EmbeddingModelBaseConfigDef, EmbeddingModelBaseConfigSchema, Gemini1_0Pro, Gemini1_0ProLatest, Gemini1_0ProLatestLiteral, Gemini1_0ProLatestOptions, type Gemini1_0ProLatestOptionsType, Gemini1_0ProLatestSchema, Gemini1_0ProLiteral, Gemini1_0ProOptions, type Gemini1_0ProOptionsType, Gemini1_0ProSchema, Gemini1_0ProVision, Gemini1_0ProVisionLiteral, Gemini1_0ProVisionOptions, type Gemini1_0ProVisionOptionsType, Gemini1_0ProVisionSchema, Gemini1_0Pro_001, Gemini1_0Pro_001Literal, Gemini1_0Pro_001Options, type Gemini1_0Pro_001OptionsType, Gemini1_0Pro_001Schema, Gemini1_5Flash, Gemini1_5Flash001, Gemini1_5Flash001Literal, Gemini1_5Flash001Options, type Gemini1_5Flash001OptionsType, Gemini1_5Flash001Schema, Gemini1_5Flash002, Gemini1_5Flash002Literal, Gemini1_5Flash002Options, type Gemini1_5Flash002OptionsType, Gemini1_5Flash002Schema, Gemini1_5FlashLatest, Gemini1_5FlashLatestLiteral, Gemini1_5FlashLatestOptions, type Gemini1_5FlashLatestOptionsType, Gemini1_5FlashLatestSchema, Gemini1_5FlashLiteral, Gemini1_5FlashOptions, type Gemini1_5FlashOptionsType, Gemini1_5FlashSchema, Gemini1_5Pro, Gemini1_5Pro001, Gemini1_5Pro001Literal, Gemini1_5Pro001Options, type Gemini1_5Pro001OptionsType, Gemini1_5Pro001Schema, Gemini1_5Pro002, Gemini1_5Pro002Literal, Gemini1_5Pro002Options, type Gemini1_5Pro002OptionsType, Gemini1_5Pro002Schema, Gemini1_5ProLatest, Gemini1_5ProLatestLiteral, Gemini1_5ProLatestOptions, type Gemini1_5ProLatestOptionsType, Gemini1_5ProLatestSchema, Gemini1_5ProLiteral, Gemini1_5ProOptions, type Gemini1_5ProOptionsType, Gemini1_5ProSchema, GeminiPro, GeminiProLiteral, GeminiProOptions, type GeminiProOptionsType, GeminiProSchema, GeminiProVision, GeminiProVisionLiteral, GeminiProVisionOptions, type GeminiProVisionOptionsType, GeminiProVisionSchema, Google, GoogleChatAssistantRoleLiteral, GoogleChatContent, GoogleChatContentPartFunctionCall, type GoogleChatContentPartFunctionCallType, GoogleChatContentPartFunctionResponse, type GoogleChatContentPartFunctionResponseType, GoogleChatContentPartInlineData, type GoogleChatContentPartInlineDataType, GoogleChatContentPartText, type GoogleChatContentPartTextType, type GoogleChatContentType, GoogleChatGenerationConfig, type GoogleChatGenerationConfigType, GoogleChatModelConfigs, GoogleChatModelModalities, GoogleChatModelModalitiesEnum, GoogleChatModelRoles, GoogleChatModelRolesMap, GoogleChatModelTextModalities, GoogleChatModelTextModalitiesEnum, GoogleChatModelTextToolModalities, GoogleChatModelTextToolModalitiesEnum, GoogleChatModelTextVisionModalities, GoogleChatModelTextVisionModalitiesEnum, GoogleChatRequest, type GoogleChatRequestType, GoogleChatSafetySettings, type GoogleChatSafetySettingsType, GoogleChatSystemInstruction, type GoogleChatSystemInstructionType, GoogleChatTool, GoogleChatToolConfig, type GoogleChatToolConfigType, GoogleChatToolRoleLiteral, type GoogleChatToolType, GoogleCompleteChatResponse, type GoogleCompleteChatResponseType, GoogleCompleteChatTextResponse, GoogleCompleteChatToolResponse, GoogleEmbeddingModelConfigs, GoogleEmbeddingModelModalities, GoogleEmbeddingModelModalitiesEnum, GoogleEmbeddingRequest, GoogleEmbeddingRequestInput, type GoogleEmbeddingRequestInputType, type GoogleEmbeddingRequestType, GoogleGetEmbeddingsResponse, type GoogleGetEmbeddingsResponseType, GoogleStreamChatResponse, type GoogleStreamChatResponseType, GoogleStreamChatTextResponse, GoogleStreamChatToolResponse, ProviderLiteral, Text_Embedding_001, Text_Embedding_001Literal, Text_Embedding_001Options, type Text_Embedding_001OptionsType, Text_Embedding_001Schema, Text_Embedding_004, Text_Embedding_004Literal, Text_Embedding_004Options, type Text_Embedding_004OptionsType, Text_Embedding_004Schema, dimensions, frequencyPenalty, maxTokens, presencePenalty, safetySettings, seed, stop, temperature, toolChoice, topK, topP };
package/dist/index.d.ts CHANGED
@@ -1415,6 +1415,17 @@ declare const GoogleChatGenerationConfig: z.ZodObject<{
1415
1415
  topK?: number | undefined;
1416
1416
  }>;
1417
1417
  type GoogleChatGenerationConfigType = z.infer<typeof GoogleChatGenerationConfig>;
1418
+ declare const GoogleChatSafetySettings: z.ZodObject<{
1419
+ category: z.ZodEnum<["HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_SEXUALLY_EXPLICIT", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_CIVIC_INTEGRITY"]>;
1420
+ threshold: z.ZodEnum<["HARM_BLOCK_THRESHOLD_UNSPECIFIED", "BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE", "OFF"]>;
1421
+ }, "strip", z.ZodTypeAny, {
1422
+ threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
1423
+ category: "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
1424
+ }, {
1425
+ threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
1426
+ category: "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
1427
+ }>;
1428
+ type GoogleChatSafetySettingsType = z.infer<typeof GoogleChatSafetySettings>;
1418
1429
  declare const GoogleChatRequest: z.ZodObject<{
1419
1430
  model: z.ZodOptional<z.ZodString>;
1420
1431
  contents: z.ZodArray<z.ZodObject<{
@@ -3231,7 +3242,7 @@ declare class Text_Embedding_004 extends BaseEmbeddingModel {
3231
3242
  }
3232
3243
 
3233
3244
  declare const ProviderLiteral = "google";
3234
- declare class Google<O extends Record<string, any> = Record<string, any>> implements ProviderV1<O> {
3245
+ declare class Google<C extends BaseChatModelOptionsType, E extends BaseEmbeddingModelOptionsType> implements ProviderV1<C, E> {
3235
3246
  readonly version: "v1";
3236
3247
  readonly name = "google";
3237
3248
  static readonly baseUrl: string;
@@ -3239,10 +3250,10 @@ declare class Google<O extends Record<string, any> = Record<string, any>> implem
3239
3250
  private readonly embeddingModelFactories;
3240
3251
  chatModelLiterals(): string[];
3241
3252
  chatModelSchemas(): Record<string, ChatModelSchemaType>;
3242
- chatModel(options: O): ChatModelV1;
3253
+ chatModel(options: C): ChatModelV1;
3243
3254
  embeddingModelLiterals(): string[];
3244
3255
  embeddingModelSchemas(): Record<string, EmbeddingModelSchemaType>;
3245
- embeddingModel(options: O): EmbeddingModelV1;
3256
+ embeddingModel(options: E): EmbeddingModelV1;
3246
3257
  }
3247
3258
 
3248
- export { BaseChatModel, BaseChatModelGemini1, BaseChatModelOptions, type BaseChatModelOptionsType, BaseEmbeddingModel, BaseEmbeddingModelOptions, type BaseEmbeddingModelOptionsType, ChatModelBaseConfigDef, ChatModelBaseConfigSchema, ChatModelC1ConfigDef, ChatModelC1ConfigSchema, EmbeddingModelBaseConfigDef, EmbeddingModelBaseConfigSchema, Gemini1_0Pro, Gemini1_0ProLatest, Gemini1_0ProLatestLiteral, Gemini1_0ProLatestOptions, type Gemini1_0ProLatestOptionsType, Gemini1_0ProLatestSchema, Gemini1_0ProLiteral, Gemini1_0ProOptions, type Gemini1_0ProOptionsType, Gemini1_0ProSchema, Gemini1_0ProVision, Gemini1_0ProVisionLiteral, Gemini1_0ProVisionOptions, type Gemini1_0ProVisionOptionsType, Gemini1_0ProVisionSchema, Gemini1_0Pro_001, Gemini1_0Pro_001Literal, Gemini1_0Pro_001Options, type Gemini1_0Pro_001OptionsType, Gemini1_0Pro_001Schema, Gemini1_5Flash, Gemini1_5Flash001, Gemini1_5Flash001Literal, Gemini1_5Flash001Options, type Gemini1_5Flash001OptionsType, Gemini1_5Flash001Schema, Gemini1_5Flash002, Gemini1_5Flash002Literal, Gemini1_5Flash002Options, type Gemini1_5Flash002OptionsType, Gemini1_5Flash002Schema, Gemini1_5FlashLatest, Gemini1_5FlashLatestLiteral, Gemini1_5FlashLatestOptions, type Gemini1_5FlashLatestOptionsType, Gemini1_5FlashLatestSchema, Gemini1_5FlashLiteral, Gemini1_5FlashOptions, type Gemini1_5FlashOptionsType, Gemini1_5FlashSchema, Gemini1_5Pro, Gemini1_5Pro001, Gemini1_5Pro001Literal, Gemini1_5Pro001Options, type Gemini1_5Pro001OptionsType, Gemini1_5Pro001Schema, Gemini1_5Pro002, Gemini1_5Pro002Literal, Gemini1_5Pro002Options, type Gemini1_5Pro002OptionsType, Gemini1_5Pro002Schema, Gemini1_5ProLatest, Gemini1_5ProLatestLiteral, Gemini1_5ProLatestOptions, type Gemini1_5ProLatestOptionsType, Gemini1_5ProLatestSchema, Gemini1_5ProLiteral, Gemini1_5ProOptions, type Gemini1_5ProOptionsType, Gemini1_5ProSchema, GeminiPro, GeminiProLiteral, GeminiProOptions, type GeminiProOptionsType, GeminiProSchema, GeminiProVision, GeminiProVisionLiteral, GeminiProVisionOptions, type GeminiProVisionOptionsType, GeminiProVisionSchema, Google, GoogleChatAssistantRoleLiteral, GoogleChatContent, GoogleChatContentPartFunctionCall, type GoogleChatContentPartFunctionCallType, GoogleChatContentPartFunctionResponse, type GoogleChatContentPartFunctionResponseType, GoogleChatContentPartInlineData, type GoogleChatContentPartInlineDataType, GoogleChatContentPartText, type GoogleChatContentPartTextType, type GoogleChatContentType, GoogleChatGenerationConfig, type GoogleChatGenerationConfigType, GoogleChatModelConfigs, GoogleChatModelModalities, GoogleChatModelModalitiesEnum, GoogleChatModelRoles, GoogleChatModelRolesMap, GoogleChatModelTextModalities, GoogleChatModelTextModalitiesEnum, GoogleChatModelTextToolModalities, GoogleChatModelTextToolModalitiesEnum, GoogleChatModelTextVisionModalities, GoogleChatModelTextVisionModalitiesEnum, GoogleChatRequest, type GoogleChatRequestType, GoogleChatSystemInstruction, type GoogleChatSystemInstructionType, GoogleChatTool, GoogleChatToolConfig, type GoogleChatToolConfigType, GoogleChatToolRoleLiteral, type GoogleChatToolType, GoogleCompleteChatResponse, type GoogleCompleteChatResponseType, GoogleCompleteChatTextResponse, GoogleCompleteChatToolResponse, GoogleEmbeddingModelConfigs, GoogleEmbeddingModelModalities, GoogleEmbeddingModelModalitiesEnum, GoogleEmbeddingRequest, GoogleEmbeddingRequestInput, type GoogleEmbeddingRequestInputType, type GoogleEmbeddingRequestType, GoogleGetEmbeddingsResponse, type GoogleGetEmbeddingsResponseType, GoogleStreamChatResponse, type GoogleStreamChatResponseType, GoogleStreamChatTextResponse, GoogleStreamChatToolResponse, ProviderLiteral, Text_Embedding_001, Text_Embedding_001Literal, Text_Embedding_001Options, type Text_Embedding_001OptionsType, Text_Embedding_001Schema, Text_Embedding_004, Text_Embedding_004Literal, Text_Embedding_004Options, type Text_Embedding_004OptionsType, Text_Embedding_004Schema, dimensions, frequencyPenalty, maxTokens, presencePenalty, safetySettings, seed, stop, temperature, toolChoice, topK, topP };
3259
+ export { BaseChatModel, BaseChatModelGemini1, BaseChatModelOptions, type BaseChatModelOptionsType, BaseEmbeddingModel, BaseEmbeddingModelOptions, type BaseEmbeddingModelOptionsType, ChatModelBaseConfigDef, ChatModelBaseConfigSchema, ChatModelC1ConfigDef, ChatModelC1ConfigSchema, EmbeddingModelBaseConfigDef, EmbeddingModelBaseConfigSchema, Gemini1_0Pro, Gemini1_0ProLatest, Gemini1_0ProLatestLiteral, Gemini1_0ProLatestOptions, type Gemini1_0ProLatestOptionsType, Gemini1_0ProLatestSchema, Gemini1_0ProLiteral, Gemini1_0ProOptions, type Gemini1_0ProOptionsType, Gemini1_0ProSchema, Gemini1_0ProVision, Gemini1_0ProVisionLiteral, Gemini1_0ProVisionOptions, type Gemini1_0ProVisionOptionsType, Gemini1_0ProVisionSchema, Gemini1_0Pro_001, Gemini1_0Pro_001Literal, Gemini1_0Pro_001Options, type Gemini1_0Pro_001OptionsType, Gemini1_0Pro_001Schema, Gemini1_5Flash, Gemini1_5Flash001, Gemini1_5Flash001Literal, Gemini1_5Flash001Options, type Gemini1_5Flash001OptionsType, Gemini1_5Flash001Schema, Gemini1_5Flash002, Gemini1_5Flash002Literal, Gemini1_5Flash002Options, type Gemini1_5Flash002OptionsType, Gemini1_5Flash002Schema, Gemini1_5FlashLatest, Gemini1_5FlashLatestLiteral, Gemini1_5FlashLatestOptions, type Gemini1_5FlashLatestOptionsType, Gemini1_5FlashLatestSchema, Gemini1_5FlashLiteral, Gemini1_5FlashOptions, type Gemini1_5FlashOptionsType, Gemini1_5FlashSchema, Gemini1_5Pro, Gemini1_5Pro001, Gemini1_5Pro001Literal, Gemini1_5Pro001Options, type Gemini1_5Pro001OptionsType, Gemini1_5Pro001Schema, Gemini1_5Pro002, Gemini1_5Pro002Literal, Gemini1_5Pro002Options, type Gemini1_5Pro002OptionsType, Gemini1_5Pro002Schema, Gemini1_5ProLatest, Gemini1_5ProLatestLiteral, Gemini1_5ProLatestOptions, type Gemini1_5ProLatestOptionsType, Gemini1_5ProLatestSchema, Gemini1_5ProLiteral, Gemini1_5ProOptions, type Gemini1_5ProOptionsType, Gemini1_5ProSchema, GeminiPro, GeminiProLiteral, GeminiProOptions, type GeminiProOptionsType, GeminiProSchema, GeminiProVision, GeminiProVisionLiteral, GeminiProVisionOptions, type GeminiProVisionOptionsType, GeminiProVisionSchema, Google, GoogleChatAssistantRoleLiteral, GoogleChatContent, GoogleChatContentPartFunctionCall, type GoogleChatContentPartFunctionCallType, GoogleChatContentPartFunctionResponse, type GoogleChatContentPartFunctionResponseType, GoogleChatContentPartInlineData, type GoogleChatContentPartInlineDataType, GoogleChatContentPartText, type GoogleChatContentPartTextType, type GoogleChatContentType, GoogleChatGenerationConfig, type GoogleChatGenerationConfigType, GoogleChatModelConfigs, GoogleChatModelModalities, GoogleChatModelModalitiesEnum, GoogleChatModelRoles, GoogleChatModelRolesMap, GoogleChatModelTextModalities, GoogleChatModelTextModalitiesEnum, GoogleChatModelTextToolModalities, GoogleChatModelTextToolModalitiesEnum, GoogleChatModelTextVisionModalities, GoogleChatModelTextVisionModalitiesEnum, GoogleChatRequest, type GoogleChatRequestType, GoogleChatSafetySettings, type GoogleChatSafetySettingsType, GoogleChatSystemInstruction, type GoogleChatSystemInstructionType, GoogleChatTool, GoogleChatToolConfig, type GoogleChatToolConfigType, GoogleChatToolRoleLiteral, type GoogleChatToolType, GoogleCompleteChatResponse, type GoogleCompleteChatResponseType, GoogleCompleteChatTextResponse, GoogleCompleteChatToolResponse, GoogleEmbeddingModelConfigs, GoogleEmbeddingModelModalities, GoogleEmbeddingModelModalitiesEnum, GoogleEmbeddingRequest, GoogleEmbeddingRequestInput, type GoogleEmbeddingRequestInputType, type GoogleEmbeddingRequestType, GoogleGetEmbeddingsResponse, type GoogleGetEmbeddingsResponseType, GoogleStreamChatResponse, type GoogleStreamChatResponseType, GoogleStreamChatTextResponse, GoogleStreamChatToolResponse, ProviderLiteral, Text_Embedding_001, Text_Embedding_001Literal, Text_Embedding_001Options, type Text_Embedding_001OptionsType, Text_Embedding_001Schema, Text_Embedding_004, Text_Embedding_004Literal, Text_Embedding_004Options, type Text_Embedding_004OptionsType, Text_Embedding_004Schema, dimensions, frequencyPenalty, maxTokens, presencePenalty, safetySettings, seed, stop, temperature, toolChoice, topK, topP };
package/dist/index.js CHANGED
@@ -4,138 +4,139 @@ var zod = require('zod');
4
4
  var provider = require('@adaline/provider');
5
5
  var types = require('@adaline/types');
6
6
 
7
- var mt=Object.defineProperty,dt=Object.defineProperties;var pt=Object.getOwnPropertyDescriptors;var Go=Object.getOwnPropertySymbols;var ct=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var ht=(i,e)=>(e=Symbol[i])?e:Symbol.for("Symbol."+i);var Mo=(i,e,o)=>e in i?mt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[e]=o,G=(i,e)=>{for(var o in e||(e={}))ct.call(e,o)&&Mo(i,o,e[o]);if(Go)for(var o of Go(e))ft.call(e,o)&&Mo(i,o,e[o]);return i},we=(i,e)=>dt(i,pt(e));var R=(i,e,o)=>new Promise((t,s)=>{var r=l=>{try{m(o.next(l));}catch(p){s(p);}},n=l=>{try{m(o.throw(l));}catch(p){s(p);}},m=l=>l.done?t(l.value):Promise.resolve(l.value).then(r,n);m((o=o.apply(i,e)).next());}),gt=function(i,e){this[0]=i,this[1]=e;},bo=(i,e,o)=>{var t=(n,m,l,p)=>{try{var f=o[n](m),C=(m=f.value)instanceof gt,M=f.done;Promise.resolve(C?m[0]:m).then(g=>C?t(n==="return"?n:"next",m[1]?{done:g.done,value:g.value}:g,l,p):l({value:g,done:M})).catch(g=>t("throw",g,l,p));}catch(g){p(g);}},s=n=>r[n]=m=>new Promise((l,p)=>t(n,m,l,p)),r={};return o=o.apply(i,e),r[ht("asyncIterator")]=()=>r,s("next"),s("throw"),s("return"),r};var N=(i,e)=>provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:0,max:i,step:.01,default:e}),v=i=>provider.RangeConfigItem({param:"maxOutputTokens",title:provider.CHAT_CONFIG.MAX_TOKENS.title,description:provider.CHAT_CONFIG.MAX_TOKENS.description,min:0,max:i,step:1,default:0}),q=i=>provider.MultiStringConfigItem({param:"stopSequences",title:provider.CHAT_CONFIG.STOP(i).title,description:provider.CHAT_CONFIG.STOP(i).description,max:i}),F=i=>provider.RangeConfigItem({param:"topP",title:provider.CHAT_CONFIG.TOP_P.title,description:provider.CHAT_CONFIG.TOP_P.description,min:0,max:1,step:.01,default:i}),Le=i=>provider.RangeConfigItem({param:"topK",title:provider.CHAT_CONFIG.TOP_K.title,description:provider.CHAT_CONFIG.TOP_K.description,min:1,max:40,step:1,default:i}),Ie=provider.RangeConfigItem({param:"frequencyPenalty",title:provider.CHAT_CONFIG.FREQUENCY_PENALTY.title,description:provider.CHAT_CONFIG.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),ke=provider.RangeConfigItem({param:"presencePenalty",title:provider.CHAT_CONFIG.PRESENCE_PENALTY.title,description:provider.CHAT_CONFIG.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),Ne=provider.RangeConfigItem({param:"seed",title:provider.CHAT_CONFIG.SEED.title,description:provider.CHAT_CONFIG.SEED.description,min:0,max:1e6,step:1,default:0}),$=provider.SelectStringConfigItem({param:"toolChoice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","any","none"]}),z=provider.ObjectSchemaConfigItem({param:"safetySettings",title:"Safety settings",description:"The safety rating contains the category of harm and the harm probability level in that category for a piece of content.",objectSchema:zod.z.array(zod.z.object({threshold:zod.z.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"]),category:zod.z.enum(["HARM_CATEGORY_UNSPECIFIED","HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_CIVIC_INTEGRITY"])}))});var _o=(i,e,o,t,s)=>zod.z.object({temperature:N(i,e).schema,maxTokens:v(o).schema,stop:q(t).schema,topP:F(s).schema,toolChoice:$.schema,safetySettings:z.schema}),Eo=(i,e,o,t,s)=>({temperature:N(i,e).def,maxTokens:v(o).def,stop:q(t).def,topP:F(s).def,toolChoice:$.def,safetySettings:z.def});var Oo=(i,e,o,t,s,r)=>zod.z.object({temperature:N(i,e).schema,maxTokens:v(o).schema,stop:q(t).schema,topP:F(s).schema,topK:Le(r).schema,frequencyPenalty:Ie.schema,presencePenalty:ke.schema,seed:Ne.schema.transform(n=>n===0?void 0:n),toolChoice:$.schema,safetySettings:z.schema}),Po=(i,e,o,t,s,r)=>({temperature:N(i,e).def,maxTokens:v(o).def,stop:q(t).def,topP:F(s).def,topK:Le(r).def,frequencyPenalty:Ie.def,presencePenalty:ke.def,seed:Ne.def,toolChoice:$.def,safetySettings:z.def});var ve=i=>provider.RangeConfigItem({param:"outputDimensionality",title:provider.EMBEDDING_CONFIG.DIMENSIONS.title,description:provider.EMBEDDING_CONFIG.DIMENSIONS.description,min:1,max:i,step:1,default:i});var Ro=i=>zod.z.object({dimensions:ve(i).schema}),xo=i=>({dimensions:ve(i).def});var c={base:(i,e,o,t,s)=>({def:Eo(i,e,o,t,s),schema:_o(i,e,o,t,s)}),c1:(i,e,o,t,s,r)=>({def:Po(i,e,o,t,s,r),schema:Oo(i,e,o,t,s,r)})},j={base:i=>({def:xo(i),schema:Ro(i)})};var u=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),St="model",Rt="function",y={system:types.UserRoleLiteral,user:types.UserRoleLiteral,assistant:St,tool:Rt};var _=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],E=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),is=[types.TextModalityLiteral],as=zod.z.enum([types.TextModalityLiteral]),ae=[types.TextModalityLiteral,types.ImageModalityLiteral],re=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral]),L=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],I=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var xt=zod.z.object({text:zod.z.string()}),wt=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),wo=zod.z.object({candidates:zod.z.array(zod.z.object({content:zod.z.object({role:zod.z.string(),parts:zod.z.array(zod.z.union([xt,wt]))}).optional(),finishReason:zod.z.string(),index:zod.z.number().optional(),safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean().optional()})))})),promptFeedback:zod.z.optional(zod.z.object({safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string()})))})),usageMetadata:zod.z.object({promptTokenCount:zod.z.number(),cachedContentTokenCount:zod.z.number().optional(),candidatesTokenCount:zod.z.number().optional(),totalTokenCount:zod.z.number()}).optional()}),Lt=zod.z.object({text:zod.z.string()}),It=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),Lo=zod.z.object({candidates:zod.z.array(zod.z.object({content:zod.z.object({role:zod.z.string(),parts:zod.z.array(zod.z.union([Lt,It]))}).optional(),finishReason:zod.z.string().optional(),index:zod.z.number().optional(),safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean().optional()})))})),promptFeedback:zod.z.optional(zod.z.object({safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string()})))})),usageMetadata:zod.z.object({promptTokenCount:zod.z.number(),cachedContentTokenCount:zod.z.number().optional(),candidatesTokenCount:zod.z.number(),totalTokenCount:zod.z.number()}).optional()});var qo=zod.z.object({text:zod.z.string().min(1)}),kt=zod.z.object({inline_data:zod.z.object({mime_type:zod.z.string().min(1),data:zod.z.string().base64()})}),Nt=zod.z.object({function_call:zod.z.object({name:zod.z.string().min(1),args:zod.z.record(zod.z.string().min(1))})}),vt=zod.z.object({function_response:zod.z.object({name:zod.z.string().min(1),response:zod.z.record(zod.z.string().min(1))})}),qt=zod.z.object({role:zod.z.enum(["user","model","function"]),parts:zod.z.array(zod.z.union([qo,kt,Nt,vt]))}),Io=zod.z.object({parts:zod.z.array(qo)}),Ft=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),parameters:zod.z.any()}),ko=zod.z.object({function_calling_config:zod.z.object({mode:zod.z.enum(["ANY","AUTO","NONE"]),allowed_function_names:zod.z.array(zod.z.string()).optional()})}),No=zod.z.object({stopSequences:zod.z.array(zod.z.string()).optional(),maxOutputTokens:zod.z.number().optional(),temperature:zod.z.number().optional(),topP:zod.z.number().optional(),topK:zod.z.number().optional(),presencePenalty:zod.z.number().optional(),frequencyPenalty:zod.z.number().optional(),seed:zod.z.number().optional()}),vo=zod.z.object({category:zod.z.enum(["HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_CIVIC_INTEGRITY"]),threshold:zod.z.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"])}),Fo=zod.z.object({model:zod.z.string().min(1).optional(),contents:zod.z.array(qt),systemInstruction:Io.optional(),system_instruction:Io.optional(),generationConfig:No.optional(),generation_config:No.optional(),safetySettings:zod.z.array(vo).optional(),safety_settings:zod.z.array(vo).optional(),tools:zod.z.object({function_declarations:zod.z.array(Ft)}).optional(),toolConfig:ko.optional(),tool_config:ko.optional()});var $t="google",Y=class{constructor(){this.version="v1";this.name=$t;this.chatModelFactories={[Fe]:{model:me,modelOptions:$o,modelSchema:$e},[ze]:{model:de,modelOptions:zo,modelSchema:je},[Xe]:{model:ue,modelOptions:Vo,modelSchema:Qe},[Ze]:{model:ye,modelOptions:Ho,modelSchema:eo},[oo]:{model:Ce,modelOptions:Ko,modelSchema:to},[Je]:{model:ge,modelOptions:Ao,modelSchema:We},[io]:{model:Ge,modelOptions:Jo,modelSchema:ao},[ro]:{model:Me,modelOptions:Wo,modelSchema:lo},[mo]:{model:be,modelOptions:Xo,modelSchema:po},[no]:{model:Te,modelOptions:Yo,modelSchema:so},[Be]:{model:pe,modelOptions:jo,modelSchema:De},[Ke]:{model:he,modelOptions:Uo,modelSchema:Ye},[Ve]:{model:fe,modelOptions:Do,modelSchema:He},[Ue]:{model:ce,modelOptions:Bo,modelSchema:Ae}};this.embeddingModelFactories={[co]:{model:_e,modelOptions:Qo,modelSchema:fo},[ho]:{model:Ee,modelOptions:Zo,modelSchema:go}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,o)=>(e[o]=this.chatModelFactories[o].modelSchema,e),{})}chatModel(e){let o=e.modelName;if(!o)throw new provider.ProviderError({info:"Google chat model name is required",cause:new Error("Google chat model name is required")});if(!(o in this.chatModelFactories))throw new provider.ProviderError({info:`Google chat model: ${o} not found`,cause:new Error(`Google chat model: ${o} not found, available chat models:
8
- [${this.chatModelLiterals().join(", ")}]`)});let t=this.chatModelFactories[o].model,s=we(G({},e),{modelName:o}),r=this.chatModelFactories[o].modelOptions.parse(s);return new t(r)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((e,o)=>(e[o]=this.embeddingModelFactories[o].modelSchema,e),{})}embeddingModel(e){let o=e.modelName;if(!o)throw new provider.ProviderError({info:"Google embedding model name is required",cause:new Error("Google embedding model name is required")});if(!(o in this.embeddingModelFactories))throw new provider.ProviderError({info:`Google embedding model: ${o} not found`,cause:new Error(`Google embedding model: ${o} not found, available embedding models:
9
- [${this.embeddingModelLiterals().join(", ")}]`)});let t=this.embeddingModelFactories[o].model,s=we(G({},e),{modelName:o}),r=this.embeddingModelFactories[o].modelOptions.parse(s);return new t(r)}};Y.baseUrl="https://generativelanguage.googleapis.com/v1beta";var h=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional()}),T=class{constructor(e,o){this.version="v1";var s;let t=h.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash((s=t.baseUrl)!=null?s:Y.baseUrl),this.completeChatUrl=provider.urlWithoutTrailingSlash(t.completeChatUrl||`${this.baseUrl}/models/${this.modelName}:generateContent?key=${this.apiKey}`),this.streamChatUrl=provider.urlWithoutTrailingSlash(t.streamChatUrl||`${this.baseUrl}/models/${this.modelName}:streamGenerateContent?key=${this.apiKey}`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"Content-Type":"application/json",source:"adaline.ai"}}getDefaultParams(){return {}}getRetryDelay(e){return {shouldRetry:!1,delayMs:0}}getTokenCount(e){return e.reduce((o,t)=>o+t.content.map(s=>s.modality==="text"?s.value:"").join(" ").length,0)}transformModelRequest(e){let o=Fo.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,s=t.model;if(t.system_instruction&&t.systemInstruction)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'system_instruction' and 'systemInstruction' are not allowed at the same time")});if(t.generation_config&&t.generationConfig)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'generation_config' and 'generationConfig' are not allowed at the same time")});if(t.tool_config&&t.toolConfig)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tool_config' and 'toolConfig' are not allowed at the same time")});let r=t.system_instruction||t.systemInstruction,n=t.generation_config||t.generationConfig,m=t.safety_settings||t.safetySettings,l=t.tool_config||t.toolConfig;if(l&&(!t.tools||t.tools.function_declarations.length===0))throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let p={};l&&(l.function_calling_config.mode==="ANY"&&l.function_calling_config.allowed_function_names&&l.function_calling_config.allowed_function_names.length===1?p.toolChoice=l.function_calling_config.allowed_function_names[0]:p.toolChoice=l.function_calling_config.mode.toLowerCase()),p.seed=n==null?void 0:n.seed,p.maxTokens=n==null?void 0:n.maxOutputTokens,p.temperature=n==null?void 0:n.temperature,p.topP=n==null?void 0:n.topP,p.presencePenalty=n==null?void 0:n.presencePenalty,p.frequencyPenalty=n==null?void 0:n.frequencyPenalty,p.stop=n==null?void 0:n.stopSequences,p.safetySettings=m;let f=types.Config().parse(provider.removeUndefinedEntries(p)),C=[];r&&r.parts.forEach(g=>{C.push({role:types.SystemRoleLiteral,content:[{modality:types.TextModalityLiteral,value:g.text}]});}),t.contents.forEach(g=>{let V=g.role;switch(V){case"user":{let H=g.parts.map(S=>"text"in S?{modality:types.TextModalityLiteral,value:S.text}:{modality:types.ImageModalityLiteral,detail:"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:S.inline_data.data,media_type:S.inline_data.mime_type.split("/")[1]}});C.push({role:V,content:H});}break;case"model":{let H=g.parts.map((S,K)=>"text"in S?{modality:types.TextModalityLiteral,value:S.text}:{modality:types.ToolCallModalityLiteral,id:K.toString(),index:K,name:S.function_call.name,arguments:JSON.stringify(S.function_call.args)});C.push({role:types.AssistantRoleLiteral,content:H});}break;case"function":{let H=g.parts.map((S,K)=>({modality:types.ToolResponseModalityLiteral,id:K.toString(),index:K,name:S.function_response.name,data:JSON.stringify(S.function_response.response)}));C.push({role:types.ToolRoleLiteral,content:H});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${g.role}' is not supported for model : ${this.modelName}`)})}});let M=[];return t.tools&&t.tools.function_declarations.forEach(g=>{M.push({type:"function",definition:{schema:{name:g.name,description:g.description,parameters:g.parameters}}});}),{modelName:s,config:f,messages:C,tools:M.length>0?M:void 0}}transformConfig(e,o,t){let s=e.toolChoice;delete e.toolChoice;let r=this.modelSchema.config.schema.safeParse(e);if(!r.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:r.error});let n=r.data;Object.keys(n).forEach(f=>{if(!(f in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${f}',
10
- available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let m=Object.keys(n).reduce((f,C)=>{let M=this.modelSchema.config.def[C],g=M.param,V=n[C];return g==="maxOutputTokens"&&M.type==="range"&&V===0?f[g]=M.max:f[g]=V,f},{}),l=m.safetySettings;delete m.safetySettings;let p;if(s!==void 0){let f=s;if(!t||t&&t.length===0)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(t&&t.length>0){let C=this.modelSchema.config.def.toolChoice;if(C.choices.includes(f))f==="any"?p={function_calling_config:{mode:"ANY",allowed_function_names:t.map(M=>M.definition.schema.name)}}:p={function_calling_config:{mode:f.toUpperCase()}};else if(t.map(M=>M.definition.schema.name).includes(f))p={function_calling_config:{mode:"ANY",allowed_function_names:[f]}};else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${f}' is not part of provided 'tools' names or
11
- one of [${C.choices.join(", ")}]`)})}}return G(G({generation_config:m},p?{tool_config:p}:{}),l?{safety_settings:l}:{})}transformMessages(e){if(!e||e&&e.length===0)return {messages:[]};let o=e.map(n=>{let m=types.Message().safeParse(n);if(!m.success)throw new provider.InvalidMessagesError({info:"Invalid messages",cause:m.error});return m.data});o.forEach(n=>{n.content.forEach(m=>{if(!this.modelSchema.modalities.includes(m.modality))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${m.modality}',
12
- available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),o.forEach(n=>{if(!Object.keys(this.modelSchema.roles).includes(n.role))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${n.role}',
13
- available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})});let t={parts:[]},s=[];if(o.forEach(n=>{switch(n.role){case types.SystemRoleLiteral:n.content.forEach(m=>{if(m.modality===types.TextModalityLiteral)t.parts.push({text:m.value});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' cannot have content with modality : '${m.modality}'`)})});break;case types.AssistantRoleLiteral:{let m=[];n.content.forEach(l=>{if(l.modality===types.TextModalityLiteral)m.push({text:l.value});else if(l.modality===types.ToolCallModalityLiteral)m.push({function_call:{name:l.name,args:JSON.parse(l.arguments)}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' cannot have content with modality : '${l.modality}'`)})}),s.push({role:this.modelSchema.roles[n.role],parts:m});}break;case types.UserRoleLiteral:{let m=[];n.content.forEach(l=>{if(l.modality===types.TextModalityLiteral)m.push({text:l.value});else if(l.modality===types.ImageModalityLiteral){if(l.value.type==="base64")m.push({inline_data:{mime_type:l.value.media_type,data:l.value.base64}});else if(l.value.type==="url")throw new provider.InvalidMessagesError({info:`Invalid message 'modality' for model : ${this.modelName}`,cause:new Error(`model: '${this.modelName}' does not support image content type: '${l.value.type}'`)})}else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' cannot have content with modality : '${l.modality}'`)})}),s.push({role:this.modelSchema.roles[n.role],parts:m});}break;case types.ToolRoleLiteral:{let m=[];n.content.forEach(l=>{if(l.modality===types.ToolResponseModalityLiteral)m.push({function_response:{name:l.name,response:JSON.parse(l.data)}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' cannot have content with modality : '${l.modality}'`)})}),s.push({role:this.modelSchema.roles[n.role],parts:m});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${n.role}' is not supported,
14
- available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),s[0].role!==this.modelSchema.roles[types.UserRoleLiteral])throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires first message to be from user`)});let r=n=>n===this.modelSchema.roles[types.UserRoleLiteral]||n===this.modelSchema.roles[types.ToolRoleLiteral]?[this.modelSchema.roles[types.AssistantRoleLiteral]]:[this.modelSchema.roles[types.UserRoleLiteral],this.modelSchema.roles[types.ToolRoleLiteral]];for(let n=1;n<s.length;n++)if(!r(s[n-1].role).includes(s[n].role))throw new provider.InvalidMessagesError({info:`Invalid message format for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' cannot have message with role : '${s[n].role}' after message with role : '${s[n-1].role}'`)});if(s[s.length-1].role!==this.modelSchema.roles[types.UserRoleLiteral])throw new provider.InvalidMessagesError({info:`Invalid message format for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires last message to be from user`)});return G({contents:s},t.parts.length>0?{system_instruction:t}:{})}transformTools(e){if(!this.modelSchema.modalities.includes(types.ToolCallModalityLiteral))throw new provider.InvalidToolsError({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${types.ToolCallModalityLiteral}'`)});return !e||e&&e.length===0?{tools:[]}:{tools:e.map(s=>{let r=types.Tool().safeParse(s);if(!r.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:r.error});return r.data}).map(s=>({function_declarations:[{name:s.definition.schema.name,description:s.definition.schema.description,parameters:s.definition.schema.parameters}]}))}}getCompleteChatUrl(e,o,t){return R(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getCompleteChatHeaders(e,o,t){return R(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getCompleteChatData(e,o,t){return R(this,null,function*(){let s=this.transformConfig(e,o,t),r=this.transformMessages(o);if(r.messages&&r.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let n=t?this.transformTools(t):{};return new Promise(m=>{m(G(G(G(G({},this.getDefaultParams()),s),r),n));})})}transformCompleteChatResponse(e){let o=wo.safeParse(e);if(o.success){if(o.data.candidates.length===0)throw new provider.ModelResponseError({info:"Invalid response from model",cause:new Error(`No choices in response : ${JSON.stringify(o.data)}`)});let t=o.data,s=[],r,n=t.candidates[0].content;if(n){let p=n.parts.map((f,C)=>{if("text"in f&&f.text!==void 0)return types.createTextContent(f.text);if("functionCall"in f&&f.functionCall!==void 0)return types.createToolCallContent(C,`${f.functionCall.name}_${C}`,f.functionCall.name,JSON.stringify(f.functionCall.args))});return s.push({role:types.AssistantRoleLiteral,content:p}),t.usageMetadata&&(r={promptTokens:t.usageMetadata.promptTokenCount,totalTokens:t.usageMetadata.totalTokenCount,completionTokens:t.usageMetadata.candidatesTokenCount||0}),{messages:s,usage:r,logProbs:void 0}}let m=t.candidates[0].safetyRatings;if(m&&m.length>0&&m.forEach(p=>{if(p.blocked)throw new provider.ModelResponseError({info:`Blocked content for category: ${p.category} with probability: ${p.probability}`,cause:new Error(`Blocked content for category: ${p.category} with probability: ${p.probability}`)})}),t.candidates[0].finishReason==="SAFETY")throw new provider.ModelResponseError({info:"Blocked content, model response finished with safety reason",cause:new Error("Blocked content, model response finished with safety reason")})}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}getStreamChatUrl(e,o,t){return R(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getStreamChatHeaders(e,o,t){return R(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getStreamChatData(e,o,t){return R(this,null,function*(){let s=this.transformConfig(e,o,t),r=this.transformMessages(o);if(r.messages&&r.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let n=t?this.transformTools(t):{};return new Promise(m=>{m(G(G(G(G({},this.getDefaultParams()),s),r),n));})})}transformStreamChatResponseChunk(e,o){return bo(this,null,function*(){let t=(o+e).split(",\r").filter(s=>s.trim()!=="");for(let s of t){let r=s;if(r=r.replace(/\n/g,""),r.startsWith("["))r=r.slice(1);else if(r.endsWith("]")){if(r==="]")return;r=r.slice(0,-1);}let n;try{n=JSON.parse(r);}catch(l){if(l instanceof SyntaxError){o=r;continue}else throw l}o="";let m=Lo.safeParse(n);if(m.success){let l={partialMessages:[]},p=m.data;if(p.candidates.length>0){let f=p.candidates[0].content;f&&"parts"in f&&f.parts.length>0&&f.parts.forEach((C,M)=>{if("text"in C&&C.text!==void 0&&l.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,C.text)),"functionCall"in C&&C.functionCall!==void 0){let g=C.functionCall;l.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,M,`${g.name}_${M}`,g.name,JSON.stringify(g.args)));}});}p.usageMetadata&&(l.usage={promptTokens:p.usageMetadata.promptTokenCount,completionTokens:p.usageMetadata.candidatesTokenCount,totalTokens:p.usageMetadata.totalTokenCount}),yield {partialResponse:l,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:m.error})}yield {partialResponse:{partialMessages:[]},buffer:o};})}};var P=class extends T{transformMessages(e){let o=super.transformMessages(e);if(o.systemInstruction){let t={role:this.modelSchema.roles[types.UserRoleLiteral],parts:o.systemInstruction.parts};o.contents.unshift(t),delete o.systemInstruction;}return o}};var Fe="gemini-pro",Wt="A model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",$e=provider.ChatModelSchema(u,I).parse({name:Fe,description:Wt,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:L,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),$o=h,me=class extends P{constructor(e){super($e,e);}};var ze="gemini-pro-vision",Qt="An image understanding model to handle a broad range of applications",je=provider.ChatModelSchema(u,re).parse({name:ze,description:Qt,maxInputTokens:12288,maxOutputTokens:4096,roles:y,modalities:ae,config:{def:c.c1(1,.4,4096,4,1,32).def,schema:c.c1(1,.4,4096,4,1,32).schema}}),zo=h,de=class extends P{constructor(e){super(je,e);}};var Be="gemini-1.0-pro",en="Google's predecessor to Gemini 1.5 Pro, a model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",De=provider.ChatModelSchema(u,I).parse({name:Be,description:en,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:L,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),jo=h,pe=class extends P{constructor(e){super(De,e);}};var Ue="gemini-1.0-pro-001",tn="Google's predecessor to Gemini 1.5 Pro, a model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",Ae=provider.ChatModelSchema(u,I).parse({name:Ue,description:tn,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:L,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),Bo=h,ce=class extends P{constructor(e){super(Ae,e);}};var Ve="gemini-1.0-pro-latest",sn="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for natural language tasks, multi-turn text and code chat, and code generation",He=provider.ChatModelSchema(u,I).parse({name:Ve,description:sn,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:L,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),Do=h,fe=class extends P{constructor(e){super(He,e);}};var Ke="gemini-1.0-pro-vision",rn="Google's predecessor to Gemini 1.5 Pro, an image understanding model to handle a broad range of applications",Ye=provider.ChatModelSchema(u,re).parse({name:Ke,description:rn,maxInputTokens:12288,maxOutputTokens:4096,roles:y,modalities:ae,config:{def:c.c1(1,.4,4096,4,1,32).def,schema:c.c1(1,.4,4096,4,1,32).schema}}),Uo=h,he=class extends P{constructor(e){super(Ye,e);}};var Je="gemini-1.5-flash",mn="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",We=provider.ChatModelSchema(u,E).parse({name:Je,description:mn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Ao=h,ge=class extends T{constructor(e){super(We,e);}};var Xe="gemini-1.5-flash-001",pn="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",Qe=provider.ChatModelSchema(u,E).parse({name:Xe,description:pn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Vo=h,ue=class extends T{constructor(e){super(Qe,e);}};var Ze="gemini-1.5-flash-002",fn="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",eo=provider.ChatModelSchema(u,E).parse({name:Ze,description:fn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,40).def,schema:c.c1(2,1,8192,4,.95,40).schema}}),Ho=h,ye=class extends T{constructor(e){super(eo,e);}};var oo="gemini-1.5-flash-latest",gn="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",to=provider.ChatModelSchema(u,E).parse({name:oo,description:gn,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Ko=h,Ce=class extends T{constructor(e){super(to,e);}};var no="gemini-1.5-pro",yn="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",so=provider.ChatModelSchema(u,E).parse({name:no,description:yn,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Yo=h,Te=class extends T{constructor(e){super(so,e);}};var io="gemini-1.5-pro-001",Tn="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",ao=provider.ChatModelSchema(u,E).parse({name:io,description:Tn,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Jo=h,Ge=class extends T{constructor(e){super(ao,e);}};var ro="gemini-1.5-pro-002",Mn="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",lo=provider.ChatModelSchema(u,E).parse({name:ro,description:Mn,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,40).def,schema:c.c1(2,1,8192,4,.95,40).schema}}),Wo=h,Me=class extends T{constructor(e){super(lo,e);}};var mo="gemini-1.5-pro-latest",_n="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",po=provider.ChatModelSchema(u,E).parse({name:mo,description:_n,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Xo=h,be=class extends T{constructor(e){super(po,e);}};var Re=[types.EmbeddingTextModalityLiteral],xe=zod.z.enum([types.EmbeddingTextModalityLiteral]);var it=zod.z.object({embeddings:zod.z.array(zod.z.object({values:zod.z.array(zod.z.number())}))});var On=zod.z.object({model:zod.z.string().min(1),content:zod.z.object({parts:zod.z.array(zod.z.object({text:zod.z.string().min(1)})).min(1)})}),at=zod.z.object({model:zod.z.string().min(1).optional(),requests:zod.z.array(On).min(1),outputDimensionality:zod.z.number().int().min(1).optional()});var ee=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url(),getEmbeddingsUrl:zod.z.string().url().optional()}),A=class{constructor(e,o){this.version="v1";let t=ee.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(t.baseUrl),this.getEmbeddingsUrl=provider.urlWithoutTrailingSlash(t.getEmbeddingsUrl||`${this.baseUrl}/models/${this.modelName}:batchEmbedContents?key=${this.apiKey}`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"Content-Type":"application/json",source:"adaline.ai"}}getDefaultParams(){return {model:this.modelName}}getRetryDelay(e){return {shouldRetry:!1,delayMs:0}}getTokenCount(e){return e.requests.reduce((o,t)=>o+t.length,0)}transformModelRequest(e){let o=at.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,s=t.model,r={outputDimensionality:t.outputDimensionality},n=types.Config().parse(provider.removeUndefinedEntries(r)),m={modality:types.EmbeddingTextModalityLiteral,requests:t.requests.reduce((l,p)=>(l.push(...p.content.parts.map(f=>f.text)),l),[])};return {modelName:s,config:n,embeddingRequests:m}}transformConfig(e,o){let t=this.modelSchema.config.schema.safeParse(e);if(!t.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:t.error});let s=t.data;return Object.keys(s).forEach(n=>{if(!this.modelSchema.config.def[n])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${n}',
15
- available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(s).reduce((n,m)=>{let p=this.modelSchema.config.def[m].param,f=s[m];return n[p]=f,n},{})}transformEmbeddingRequests(e){let o=types.EmbeddingRequests().safeParse(e);if(!o.success)throw new provider.InvalidEmbeddingRequestsError({info:"Invalid embedding requests",cause:o.error});if(e.modality!==types.EmbeddingTextModalityLiteral)throw new provider.InvalidEmbeddingRequestsError({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error(`Only '${types.EmbeddingTextModalityLiteral}' modality is supported for model : '${this.modelName}'`)});return {requests:o.data.requests.map(s=>({model:`models/${this.modelName}`,content:{parts:[{text:s}]}}))}}getGetEmbeddingsUrl(e,o){return R(this,null,function*(){return new Promise(t=>{t(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,o){return R(this,null,function*(){return new Promise(t=>{t(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,o){return R(this,null,function*(){return new Promise(t=>{let s=this.transformConfig(e),r=this.transformEmbeddingRequests(o);if(o.requests.length===0)throw new provider.InvalidEmbeddingRequestsError({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error("requests cannot be empty")});s.outputDimensionality&&(r.requests.forEach(n=>{n.outputDimensionality=s.outputDimensionality;}),delete s.outputDimensionality),t(G(G(G({},this.getDefaultParams()),s),r));})})}transformGetEmbeddingsResponse(e){let o=it.safeParse(e);if(o.success){let s=o.data.embeddings.map((r,n)=>({index:n,embedding:r.values}));return {encodingFormat:types.FloatEmbeddingLiteral,embeddings:s}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}};var co="text-embedding-001",kn="text-embedding-001",fo=provider.EmbeddingModelSchema(xe).parse({name:co,description:kn,modalities:Re,maxInputTokens:2048,maxOutputTokens:768,config:{def:j.base(768).def,schema:j.base(768).schema}}),Qo=ee,_e=class extends A{constructor(e){super(fo,e);}};var ho="text-embedding-004",vn="text-embedding-004",go=provider.EmbeddingModelSchema(xe).parse({name:ho,description:vn,modalities:Re,maxInputTokens:2048,maxOutputTokens:768,config:{def:j.base(768).def,schema:j.base(768).schema}}),Zo=ee,Ee=class extends A{constructor(e){super(go,e);}};
7
+ var lt=Object.defineProperty;var Co=Object.getOwnPropertySymbols;var mt=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable;var pt=(i,e)=>(e=Symbol[i])?e:Symbol.for("Symbol."+i);var To=(i,e,o)=>e in i?lt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[e]=o,G=(i,e)=>{for(var o in e||(e={}))mt.call(e,o)&&To(i,o,e[o]);if(Co)for(var o of Co(e))dt.call(e,o)&&To(i,o,e[o]);return i};var R=(i,e,o)=>new Promise((t,n)=>{var l=r=>{try{m(o.next(r));}catch(p){n(p);}},s=r=>{try{m(o.throw(r));}catch(p){n(p);}},m=r=>r.done?t(r.value):Promise.resolve(r.value).then(l,s);m((o=o.apply(i,e)).next());}),ct=function(i,e){this[0]=i,this[1]=e;},Mo=(i,e,o)=>{var t=(s,m,r,p)=>{try{var f=o[s](m),C=(m=f.value)instanceof ct,M=f.done;Promise.resolve(C?m[0]:m).then(g=>C?t(s==="return"?s:"next",m[1]?{done:g.done,value:g.value}:g,r,p):r({value:g,done:M})).catch(g=>t("throw",g,r,p));}catch(g){p(g);}},n=s=>l[s]=m=>new Promise((r,p)=>t(s,m,r,p)),l={};return o=o.apply(i,e),l[pt("asyncIterator")]=()=>l,n("next"),n("throw"),n("return"),l};var v=(i,e)=>provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:0,max:i,step:.01,default:e}),N=i=>provider.RangeConfigItem({param:"maxOutputTokens",title:provider.CHAT_CONFIG.MAX_TOKENS.title,description:provider.CHAT_CONFIG.MAX_TOKENS.description,min:0,max:i,step:1,default:0}),F=i=>provider.MultiStringConfigItem({param:"stopSequences",title:provider.CHAT_CONFIG.STOP(i).title,description:provider.CHAT_CONFIG.STOP(i).description,max:i}),q=i=>provider.RangeConfigItem({param:"topP",title:provider.CHAT_CONFIG.TOP_P.title,description:provider.CHAT_CONFIG.TOP_P.description,min:0,max:1,step:.01,default:i}),xe=i=>provider.RangeConfigItem({param:"topK",title:provider.CHAT_CONFIG.TOP_K.title,description:provider.CHAT_CONFIG.TOP_K.description,min:1,max:40,step:1,default:i}),we=provider.RangeConfigItem({param:"frequencyPenalty",title:provider.CHAT_CONFIG.FREQUENCY_PENALTY.title,description:provider.CHAT_CONFIG.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),Ie=provider.RangeConfigItem({param:"presencePenalty",title:provider.CHAT_CONFIG.PRESENCE_PENALTY.title,description:provider.CHAT_CONFIG.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),Le=provider.RangeConfigItem({param:"seed",title:provider.CHAT_CONFIG.SEED.title,description:provider.CHAT_CONFIG.SEED.description,min:0,max:1e6,step:1,default:0}),$=provider.SelectStringConfigItem({param:"toolChoice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","any","none"]}),z=provider.ObjectSchemaConfigItem({param:"safetySettings",title:"Safety settings",description:"The safety rating contains the category of harm and the harm probability level in that category for a piece of content.",objectSchema:zod.z.array(zod.z.object({threshold:zod.z.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"]),category:zod.z.enum(["HARM_CATEGORY_UNSPECIFIED","HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_CIVIC_INTEGRITY"])}))});var Go=(i,e,o,t,n)=>zod.z.object({temperature:v(i,e).schema,maxTokens:N(o).schema,stop:F(t).schema,topP:q(n).schema,toolChoice:$.schema,safetySettings:z.schema}),bo=(i,e,o,t,n)=>({temperature:v(i,e).def,maxTokens:N(o).def,stop:F(t).def,topP:q(n).def,toolChoice:$.def,safetySettings:z.def});var _o=(i,e,o,t,n,l)=>zod.z.object({temperature:v(i,e).schema,maxTokens:N(o).schema,stop:F(t).schema,topP:q(n).schema,topK:xe(l).schema,frequencyPenalty:we.schema,presencePenalty:Ie.schema,seed:Le.schema.transform(s=>s===0?void 0:s),toolChoice:$.schema,safetySettings:z.schema}),Eo=(i,e,o,t,n,l)=>({temperature:v(i,e).def,maxTokens:N(o).def,stop:F(t).def,topP:q(n).def,topK:xe(l).def,frequencyPenalty:we.def,presencePenalty:Ie.def,seed:Le.def,toolChoice:$.def,safetySettings:z.def});var ke=i=>provider.RangeConfigItem({param:"outputDimensionality",title:provider.EMBEDDING_CONFIG.DIMENSIONS.title,description:provider.EMBEDDING_CONFIG.DIMENSIONS.description,min:1,max:i,step:1,default:i});var Po=i=>zod.z.object({dimensions:ke(i).schema}),So=i=>({dimensions:ke(i).def});var c={base:(i,e,o,t,n)=>({def:bo(i,e,o,t,n),schema:Go(i,e,o,t,n)}),c1:(i,e,o,t,n,l)=>({def:Eo(i,e,o,t,n,l),schema:_o(i,e,o,t,n,l)})},j={base:i=>({def:So(i),schema:Po(i)})};var u=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),Et="model",Ot="function",y={system:types.UserRoleLiteral,user:types.UserRoleLiteral,assistant:Et,tool:Ot};var _=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],E=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),on=[types.TextModalityLiteral],tn=zod.z.enum([types.TextModalityLiteral]),ae=[types.TextModalityLiteral,types.ImageModalityLiteral],re=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral]),I=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],L=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var Pt=zod.z.object({text:zod.z.string()}),St=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),Ro=zod.z.object({candidates:zod.z.array(zod.z.object({content:zod.z.object({role:zod.z.string(),parts:zod.z.array(zod.z.union([Pt,St]))}).optional(),finishReason:zod.z.string(),index:zod.z.number().optional(),safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean().optional()})))})),promptFeedback:zod.z.optional(zod.z.object({safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string()})))})),usageMetadata:zod.z.object({promptTokenCount:zod.z.number(),cachedContentTokenCount:zod.z.number().optional(),candidatesTokenCount:zod.z.number().optional(),totalTokenCount:zod.z.number()}).optional()}),Rt=zod.z.object({text:zod.z.string()}),xt=zod.z.object({functionCall:zod.z.object({name:zod.z.string(),args:zod.z.record(zod.z.any())})}),xo=zod.z.object({candidates:zod.z.array(zod.z.object({content:zod.z.object({role:zod.z.string(),parts:zod.z.array(zod.z.union([Rt,xt]))}).optional(),finishReason:zod.z.string().optional(),index:zod.z.number().optional(),safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean().optional()})))})),promptFeedback:zod.z.optional(zod.z.object({safetyRatings:zod.z.optional(zod.z.array(zod.z.object({category:zod.z.string(),probability:zod.z.string()})))})),usageMetadata:zod.z.object({promptTokenCount:zod.z.number(),cachedContentTokenCount:zod.z.number().optional(),candidatesTokenCount:zod.z.number(),totalTokenCount:zod.z.number()}).optional()});var vo=zod.z.object({text:zod.z.string().min(1)}),wt=zod.z.object({inline_data:zod.z.object({mime_type:zod.z.string().min(1),data:zod.z.string().base64()})}),It=zod.z.object({function_call:zod.z.object({name:zod.z.string().min(1),args:zod.z.record(zod.z.string().min(1))})}),Lt=zod.z.object({function_response:zod.z.object({name:zod.z.string().min(1),response:zod.z.record(zod.z.string().min(1))})}),kt=zod.z.object({role:zod.z.enum(["user","model","function"]),parts:zod.z.array(zod.z.union([vo,wt,It,Lt]))}),wo=zod.z.object({parts:zod.z.array(vo)}),vt=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),parameters:zod.z.any()}),Io=zod.z.object({function_calling_config:zod.z.object({mode:zod.z.enum(["ANY","AUTO","NONE"]),allowed_function_names:zod.z.array(zod.z.string()).optional()})}),Lo=zod.z.object({stopSequences:zod.z.array(zod.z.string()).optional(),maxOutputTokens:zod.z.number().optional(),temperature:zod.z.number().optional(),topP:zod.z.number().optional(),topK:zod.z.number().optional(),presencePenalty:zod.z.number().optional(),frequencyPenalty:zod.z.number().optional(),seed:zod.z.number().optional()}),ko=zod.z.object({category:zod.z.enum(["HARM_CATEGORY_HARASSMENT","HARM_CATEGORY_HATE_SPEECH","HARM_CATEGORY_SEXUALLY_EXPLICIT","HARM_CATEGORY_DANGEROUS_CONTENT","HARM_CATEGORY_CIVIC_INTEGRITY"]),threshold:zod.z.enum(["HARM_BLOCK_THRESHOLD_UNSPECIFIED","BLOCK_LOW_AND_ABOVE","BLOCK_MEDIUM_AND_ABOVE","BLOCK_ONLY_HIGH","BLOCK_NONE","OFF"])}),No=zod.z.object({model:zod.z.string().min(1).optional(),contents:zod.z.array(kt),systemInstruction:wo.optional(),system_instruction:wo.optional(),generationConfig:Lo.optional(),generation_config:Lo.optional(),safetySettings:zod.z.array(ko).optional(),safety_settings:zod.z.array(ko).optional(),tools:zod.z.object({function_declarations:zod.z.array(vt)}).optional(),toolConfig:Io.optional(),tool_config:Io.optional()});var Nt="google",Y=class{constructor(){this.version="v1";this.name=Nt;this.chatModelFactories={[Ne]:{model:le,modelOptions:qo,modelSchema:Fe},[qe]:{model:me,modelOptions:$o,modelSchema:$e},[Je]:{model:ge,modelOptions:Ao,modelSchema:We},[Xe]:{model:ue,modelOptions:Vo,modelSchema:Qe},[Ze]:{model:ye,modelOptions:Ho,modelSchema:eo},[Ke]:{model:he,modelOptions:Uo,modelSchema:Ye},[so]:{model:Te,modelOptions:Yo,modelSchema:no},[io]:{model:Me,modelOptions:Jo,modelSchema:ao},[ro]:{model:Ge,modelOptions:Wo,modelSchema:lo},[oo]:{model:Ce,modelOptions:Ko,modelSchema:to},[ze]:{model:de,modelOptions:zo,modelSchema:je},[Ve]:{model:fe,modelOptions:Do,modelSchema:He},[Ue]:{model:ce,modelOptions:Bo,modelSchema:Ae},[Be]:{model:pe,modelOptions:jo,modelSchema:De}};this.embeddingModelFactories={[mo]:{model:be,modelOptions:Xo,modelSchema:po},[co]:{model:_e,modelOptions:Qo,modelSchema:fo}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,o)=>(e[o]=this.chatModelFactories[o].modelSchema,e),{})}chatModel(e){let o=e.modelName;if(!(o in this.chatModelFactories))throw new provider.ProviderError({info:`Google chat model: ${o} not found`,cause:new Error(`Google chat model: ${o} not found, available chat models:
8
+ [${this.chatModelLiterals().join(", ")}]`)});let t=this.chatModelFactories[o].model,n=this.chatModelFactories[o].modelOptions.parse(e);return new t(n)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((e,o)=>(e[o]=this.embeddingModelFactories[o].modelSchema,e),{})}embeddingModel(e){let o=e.modelName;if(!(o in this.embeddingModelFactories))throw new provider.ProviderError({info:`Google embedding model: ${o} not found`,cause:new Error(`Google embedding model: ${o} not found, available embedding models:
9
+ [${this.embeddingModelLiterals().join(", ")}]`)});let t=this.embeddingModelFactories[o].model,n=this.embeddingModelFactories[o].modelOptions.parse(e);return new t(n)}};Y.baseUrl="https://generativelanguage.googleapis.com/v1beta";var h=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional()}),T=class{constructor(e,o){this.version="v1";var n;let t=h.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash((n=t.baseUrl)!=null?n:Y.baseUrl),this.completeChatUrl=provider.urlWithoutTrailingSlash(t.completeChatUrl||`${this.baseUrl}/models/${this.modelName}:generateContent?key=${this.apiKey}`),this.streamChatUrl=provider.urlWithoutTrailingSlash(t.streamChatUrl||`${this.baseUrl}/models/${this.modelName}:streamGenerateContent?key=${this.apiKey}`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"Content-Type":"application/json"}}getDefaultParams(){return {}}getRetryDelay(e){return {shouldRetry:!1,delayMs:0}}getTokenCount(e){return e.reduce((o,t)=>o+t.content.map(n=>n.modality==="text"?n.value:"").join(" ").length,0)}transformModelRequest(e){let o=No.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,n=t.model;if(t.system_instruction&&t.systemInstruction)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'system_instruction' and 'systemInstruction' are not allowed at the same time")});if(t.generation_config&&t.generationConfig)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'generation_config' and 'generationConfig' are not allowed at the same time")});if(t.tool_config&&t.toolConfig)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tool_config' and 'toolConfig' are not allowed at the same time")});let l=t.system_instruction||t.systemInstruction,s=t.generation_config||t.generationConfig,m=t.safety_settings||t.safetySettings,r=t.tool_config||t.toolConfig;if(r&&(!t.tools||t.tools.function_declarations.length===0))throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let p={};r&&(r.function_calling_config.mode==="ANY"&&r.function_calling_config.allowed_function_names&&r.function_calling_config.allowed_function_names.length===1?p.toolChoice=r.function_calling_config.allowed_function_names[0]:p.toolChoice=r.function_calling_config.mode.toLowerCase()),p.seed=s==null?void 0:s.seed,p.maxTokens=s==null?void 0:s.maxOutputTokens,p.temperature=s==null?void 0:s.temperature,p.topP=s==null?void 0:s.topP,p.presencePenalty=s==null?void 0:s.presencePenalty,p.frequencyPenalty=s==null?void 0:s.frequencyPenalty,p.stop=s==null?void 0:s.stopSequences,p.safetySettings=m;let f=types.Config().parse(provider.removeUndefinedEntries(p)),C=[];l&&l.parts.forEach(g=>{C.push({role:types.SystemRoleLiteral,content:[{modality:types.TextModalityLiteral,value:g.text}]});}),t.contents.forEach(g=>{let V=g.role;switch(V){case"user":{let H=g.parts.map(S=>"text"in S?{modality:types.TextModalityLiteral,value:S.text}:{modality:types.ImageModalityLiteral,detail:"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:S.inline_data.data,media_type:S.inline_data.mime_type.split("/")[1]}});C.push({role:V,content:H});}break;case"model":{let H=g.parts.map((S,K)=>"text"in S?{modality:types.TextModalityLiteral,value:S.text}:{modality:types.ToolCallModalityLiteral,id:K.toString(),index:K,name:S.function_call.name,arguments:JSON.stringify(S.function_call.args)});C.push({role:types.AssistantRoleLiteral,content:H});}break;case"function":{let H=g.parts.map((S,K)=>({modality:types.ToolResponseModalityLiteral,id:K.toString(),index:K,name:S.function_response.name,data:JSON.stringify(S.function_response.response)}));C.push({role:types.ToolRoleLiteral,content:H});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${g.role}' is not supported for model : ${this.modelName}`)})}});let M=[];return t.tools&&t.tools.function_declarations.forEach(g=>{M.push({type:"function",definition:{schema:{name:g.name,description:g.description,parameters:g.parameters}}});}),{modelName:n,config:f,messages:C,tools:M.length>0?M:void 0}}transformConfig(e,o,t){let n=e.toolChoice;delete e.toolChoice;let l=this.modelSchema.config.schema.safeParse(e);if(!l.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:l.error});let s=l.data;Object.keys(s).forEach(f=>{if(!(f in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${f}',
10
+ available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let m=Object.keys(s).reduce((f,C)=>{let M=this.modelSchema.config.def[C],g=M.param,V=s[C];return g==="maxOutputTokens"&&M.type==="range"&&V===0?f[g]=M.max:f[g]=V,f},{}),r=m.safetySettings;delete m.safetySettings;let p;if(n!==void 0){let f=n;if(!t||t&&t.length===0)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(t&&t.length>0){let C=this.modelSchema.config.def.toolChoice;if(C.choices.includes(f))f==="any"?p={function_calling_config:{mode:"ANY",allowed_function_names:t.map(M=>M.definition.schema.name)}}:p={function_calling_config:{mode:f.toUpperCase()}};else if(t.map(M=>M.definition.schema.name).includes(f))p={function_calling_config:{mode:"ANY",allowed_function_names:[f]}};else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${f}' is not part of provided 'tools' names or
11
+ one of [${C.choices.join(", ")}]`)})}}return G(G({generation_config:m},p?{tool_config:p}:{}),r?{safety_settings:r}:{})}transformMessages(e){if(!e||e&&e.length===0)return {messages:[]};let o=e.map(s=>{let m=types.Message().safeParse(s);if(!m.success)throw new provider.InvalidMessagesError({info:"Invalid messages",cause:m.error});return m.data});o.forEach(s=>{s.content.forEach(m=>{if(!this.modelSchema.modalities.includes(m.modality))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${m.modality}',
12
+ available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),o.forEach(s=>{if(!Object.keys(this.modelSchema.roles).includes(s.role))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${s.role}',
13
+ available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})});let t={parts:[]},n=[];if(o.forEach(s=>{switch(s.role){case types.SystemRoleLiteral:s.content.forEach(m=>{if(m.modality===types.TextModalityLiteral)t.parts.push({text:m.value});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${m.modality}'`)})});break;case types.AssistantRoleLiteral:{let m=[];s.content.forEach(r=>{if(r.modality===types.TextModalityLiteral)m.push({text:r.value});else if(r.modality===types.ToolCallModalityLiteral)m.push({function_call:{name:r.name,args:JSON.parse(r.arguments)}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${r.modality}'`)})}),n.push({role:this.modelSchema.roles[s.role],parts:m});}break;case types.UserRoleLiteral:{let m=[];s.content.forEach(r=>{if(r.modality===types.TextModalityLiteral)m.push({text:r.value});else if(r.modality===types.ImageModalityLiteral){if(r.value.type==="base64")m.push({inline_data:{mime_type:r.value.media_type,data:r.value.base64}});else if(r.value.type==="url")throw new provider.InvalidMessagesError({info:`Invalid message 'modality' for model : ${this.modelName}`,cause:new Error(`model: '${this.modelName}' does not support image content type: '${r.value.type}'`)})}else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${r.modality}'`)})}),n.push({role:this.modelSchema.roles[s.role],parts:m});}break;case types.ToolRoleLiteral:{let m=[];s.content.forEach(r=>{if(r.modality===types.ToolResponseModalityLiteral)m.push({function_response:{name:r.name,response:JSON.parse(r.data)}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${r.modality}'`)})}),n.push({role:this.modelSchema.roles[s.role],parts:m});}break;default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' is not supported,
14
+ available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),n[0].role!==this.modelSchema.roles[types.UserRoleLiteral])throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires first message to be from user`)});let l=s=>s===this.modelSchema.roles[types.UserRoleLiteral]||s===this.modelSchema.roles[types.ToolRoleLiteral]?[this.modelSchema.roles[types.AssistantRoleLiteral]]:[this.modelSchema.roles[types.UserRoleLiteral],this.modelSchema.roles[types.ToolRoleLiteral]];for(let s=1;s<n.length;s++)if(!l(n[s-1].role).includes(n[s].role))throw new provider.InvalidMessagesError({info:`Invalid message format for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' cannot have message with role : '${n[s].role}' after message with role : '${n[s-1].role}'`)});if(n[n.length-1].role!==this.modelSchema.roles[types.UserRoleLiteral])throw new provider.InvalidMessagesError({info:`Invalid message format for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires last message to be from user`)});return G({contents:n},t.parts.length>0?{system_instruction:t}:{})}transformTools(e){if(!this.modelSchema.modalities.includes(types.ToolCallModalityLiteral))throw new provider.InvalidToolsError({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${types.ToolCallModalityLiteral}'`)});return !e||e&&e.length===0?{tools:[]}:{tools:e.map(n=>{let l=types.Tool().safeParse(n);if(!l.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:l.error});return l.data}).map(n=>({function_declarations:[{name:n.definition.schema.name,description:n.definition.schema.description,parameters:n.definition.schema.parameters}]}))}}getCompleteChatUrl(e,o,t){return R(this,null,function*(){return new Promise(n=>{n(this.completeChatUrl);})})}getCompleteChatHeaders(e,o,t){return R(this,null,function*(){return new Promise(n=>{n(this.getDefaultHeaders());})})}getCompleteChatData(e,o,t){return R(this,null,function*(){let n=this.transformConfig(e,o,t),l=this.transformMessages(o);if(l.messages&&l.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let s=t?this.transformTools(t):{};return new Promise(m=>{m(G(G(G(G({},this.getDefaultParams()),n),l),s));})})}transformCompleteChatResponse(e){let o=Ro.safeParse(e);if(o.success){if(o.data.candidates.length===0)throw new provider.ModelResponseError({info:"Invalid response from model",cause:new Error(`No choices in response : ${JSON.stringify(o.data)}`)});let t=o.data,n=[],l,s=t.candidates[0].content;if(s){let p=s.parts.map((f,C)=>{if("text"in f&&f.text!==void 0)return types.createTextContent(f.text);if("functionCall"in f&&f.functionCall!==void 0)return types.createToolCallContent(C,`${f.functionCall.name}_${C}`,f.functionCall.name,JSON.stringify(f.functionCall.args))});return n.push({role:types.AssistantRoleLiteral,content:p}),t.usageMetadata&&(l={promptTokens:t.usageMetadata.promptTokenCount,totalTokens:t.usageMetadata.totalTokenCount,completionTokens:t.usageMetadata.candidatesTokenCount||0}),{messages:n,usage:l,logProbs:void 0}}let m=t.candidates[0].safetyRatings;if(m&&m.length>0&&m.forEach(p=>{if(p.blocked)throw new provider.ModelResponseError({info:`Blocked content for category: ${p.category} with probability: ${p.probability}`,cause:new Error(`Blocked content for category: ${p.category} with probability: ${p.probability}`)})}),t.candidates[0].finishReason==="SAFETY")throw new provider.ModelResponseError({info:"Blocked content, model response finished with safety reason",cause:new Error("Blocked content, model response finished with safety reason")})}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}getStreamChatUrl(e,o,t){return R(this,null,function*(){return new Promise(n=>{n(this.streamChatUrl);})})}getStreamChatHeaders(e,o,t){return R(this,null,function*(){return new Promise(n=>{n(this.getDefaultHeaders());})})}getStreamChatData(e,o,t){return R(this,null,function*(){let n=this.transformConfig(e,o,t),l=this.transformMessages(o);if(l.messages&&l.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let s=t?this.transformTools(t):{};return new Promise(m=>{m(G(G(G(G({},this.getDefaultParams()),n),l),s));})})}transformStreamChatResponseChunk(e,o){return Mo(this,null,function*(){let t=(o+e).split(",\r").filter(n=>n.trim()!=="");for(let n of t){let l=n;if(l=l.replace(/\n/g,""),l.startsWith("["))l=l.slice(1);else if(l.endsWith("]")){if(l==="]")return;l=l.slice(0,-1);}let s;try{s=JSON.parse(l);}catch(r){if(r instanceof SyntaxError){o=l;continue}else throw r}o="";let m=xo.safeParse(s);if(m.success){let r={partialMessages:[]},p=m.data;if(p.candidates.length>0){let f=p.candidates[0].content;f&&"parts"in f&&f.parts.length>0&&f.parts.forEach((C,M)=>{if("text"in C&&C.text!==void 0&&r.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,C.text)),"functionCall"in C&&C.functionCall!==void 0){let g=C.functionCall;r.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,M,`${g.name}_${M}`,g.name,JSON.stringify(g.args)));}});}p.usageMetadata&&(r.usage={promptTokens:p.usageMetadata.promptTokenCount,completionTokens:p.usageMetadata.candidatesTokenCount,totalTokens:p.usageMetadata.totalTokenCount}),yield {partialResponse:r,buffer:o};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:m.error})}yield {partialResponse:{partialMessages:[]},buffer:o};})}};var P=class extends T{transformMessages(e){let o=super.transformMessages(e);if(o.systemInstruction){let t={role:this.modelSchema.roles[types.UserRoleLiteral],parts:o.systemInstruction.parts};o.contents.unshift(t),delete o.systemInstruction;}return o}};var Ne="gemini-pro",Kt="A model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",Fe=provider.ChatModelSchema(u,L).parse({name:Ne,description:Kt,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:I,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),qo=h,le=class extends P{constructor(e){super(Fe,e);}};var qe="gemini-pro-vision",Jt="An image understanding model to handle a broad range of applications",$e=provider.ChatModelSchema(u,re).parse({name:qe,description:Jt,maxInputTokens:12288,maxOutputTokens:4096,roles:y,modalities:ae,config:{def:c.c1(1,.4,4096,4,1,32).def,schema:c.c1(1,.4,4096,4,1,32).schema}}),$o=h,me=class extends P{constructor(e){super($e,e);}};var ze="gemini-1.0-pro",Xt="Google's predecessor to Gemini 1.5 Pro, a model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",je=provider.ChatModelSchema(u,L).parse({name:ze,description:Xt,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:I,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),zo=h,de=class extends P{constructor(e){super(je,e);}};var Be="gemini-1.0-pro-001",Zt="Google's predecessor to Gemini 1.5 Pro, a model for scaling across a wide range of tasks Optimized for natural language tasks, multi-turn text and code chat, and code generation",De=provider.ChatModelSchema(u,L).parse({name:Be,description:Zt,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:I,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),jo=h,pe=class extends P{constructor(e){super(De,e);}};var Ue="gemini-1.0-pro-latest",os="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for natural language tasks, multi-turn text and code chat, and code generation",Ae=provider.ChatModelSchema(u,L).parse({name:Ue,description:os,maxInputTokens:30720,maxOutputTokens:2048,roles:y,modalities:I,config:{def:c.base(1,.9,2048,4,1).def,schema:c.base(1,.9,2048,4,1).schema}}),Bo=h,ce=class extends P{constructor(e){super(Ae,e);}};var Ve="gemini-1.0-pro-vision",ss="Google's predecessor to Gemini 1.5 Pro, an image understanding model to handle a broad range of applications",He=provider.ChatModelSchema(u,re).parse({name:Ve,description:ss,maxInputTokens:12288,maxOutputTokens:4096,roles:y,modalities:ae,config:{def:c.c1(1,.4,4096,4,1,32).def,schema:c.c1(1,.4,4096,4,1,32).schema}}),Do=h,fe=class extends P{constructor(e){super(He,e);}};var Ke="gemini-1.5-flash",is="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",Ye=provider.ChatModelSchema(u,E).parse({name:Ke,description:is,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Uo=h,he=class extends T{constructor(e){super(Ye,e);}};var Je="gemini-1.5-flash-001",rs="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",We=provider.ChatModelSchema(u,E).parse({name:Je,description:rs,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Ao=h,ge=class extends T{constructor(e){super(We,e);}};var Xe="gemini-1.5-flash-002",ms="Google's fastest, most cost-efficient multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",Qe=provider.ChatModelSchema(u,E).parse({name:Xe,description:ms,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,40).def,schema:c.c1(2,1,8192,4,.95,40).schema}}),Vo=h,ue=class extends T{constructor(e){super(Qe,e);}};var Ze="gemini-1.5-flash-latest",ps="Google's latest multimodal model with great performance for high-frequency tasks. Optimized for fast and versatile performance across a diverse variety of tasks",eo=provider.ChatModelSchema(u,E).parse({name:Ze,description:ps,maxInputTokens:1e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Ho=h,ye=class extends T{constructor(e){super(eo,e);}};var oo="gemini-1.5-pro",fs="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",to=provider.ChatModelSchema(u,E).parse({name:oo,description:fs,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Ko=h,Ce=class extends T{constructor(e){super(to,e);}};var so="gemini-1.5-pro-001",gs="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",no=provider.ChatModelSchema(u,E).parse({name:so,description:gs,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Yo=h,Te=class extends T{constructor(e){super(no,e);}};var io="gemini-1.5-pro-002",ys="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",ao=provider.ChatModelSchema(u,E).parse({name:io,description:ys,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,40).def,schema:c.c1(2,1,8192,4,.95,40).schema}}),Jo=h,Me=class extends T{constructor(e){super(ao,e);}};var ro="gemini-1.5-pro-latest",Ts="Google's best performing multimodal model with features for a wide variety of reasoning tasks. Optimized for complex reasoning tasks requiring more intelligence",lo=provider.ChatModelSchema(u,E).parse({name:ro,description:Ts,maxInputTokens:2e6,maxOutputTokens:8192,roles:y,modalities:_,config:{def:c.c1(2,1,8192,4,.95,64).def,schema:c.c1(2,1,8192,4,.95,64).schema}}),Wo=h,Ge=class extends T{constructor(e){super(lo,e);}};var Se=[types.EmbeddingTextModalityLiteral],Re=zod.z.enum([types.EmbeddingTextModalityLiteral]);var nt=zod.z.object({embeddings:zod.z.array(zod.z.object({values:zod.z.array(zod.z.number())}))});var Gs=zod.z.object({model:zod.z.string().min(1),content:zod.z.object({parts:zod.z.array(zod.z.object({text:zod.z.string().min(1)})).min(1)})}),it=zod.z.object({model:zod.z.string().min(1).optional(),requests:zod.z.array(Gs).min(1),outputDimensionality:zod.z.number().int().min(1).optional()});var ee=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url(),getEmbeddingsUrl:zod.z.string().url().optional()}),A=class{constructor(e,o){this.version="v1";let t=ee.parse(o);this.modelSchema=e,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(t.baseUrl),this.getEmbeddingsUrl=provider.urlWithoutTrailingSlash(t.getEmbeddingsUrl||`${this.baseUrl}/models/${this.modelName}:batchEmbedContents?key=${this.apiKey}`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelName}}getRetryDelay(e){return {shouldRetry:!1,delayMs:0}}getTokenCount(e){return e.requests.reduce((o,t)=>o+t.length,0)}transformModelRequest(e){let o=it.safeParse(e);if(!o.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:o.error});let t=o.data,n=t.model,l={outputDimensionality:t.outputDimensionality},s=types.Config().parse(provider.removeUndefinedEntries(l)),m={modality:types.EmbeddingTextModalityLiteral,requests:t.requests.reduce((r,p)=>(r.push(...p.content.parts.map(f=>f.text)),r),[])};return {modelName:n,config:s,embeddingRequests:m}}transformConfig(e,o){let t=this.modelSchema.config.schema.safeParse(e);if(!t.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:t.error});let n=t.data;return Object.keys(n).forEach(s=>{if(!this.modelSchema.config.def[s])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${s}',
15
+ available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(n).reduce((s,m)=>{let p=this.modelSchema.config.def[m].param,f=n[m];return s[p]=f,s},{})}transformEmbeddingRequests(e){let o=types.EmbeddingRequests().safeParse(e);if(!o.success)throw new provider.InvalidEmbeddingRequestsError({info:"Invalid embedding requests",cause:o.error});if(e.modality!==types.EmbeddingTextModalityLiteral)throw new provider.InvalidEmbeddingRequestsError({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error(`Only '${types.EmbeddingTextModalityLiteral}' modality is supported for model : '${this.modelName}'`)});return {requests:o.data.requests.map(n=>({model:`models/${this.modelName}`,content:{parts:[{text:n}]}}))}}getGetEmbeddingsUrl(e,o){return R(this,null,function*(){return new Promise(t=>{t(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,o){return R(this,null,function*(){return new Promise(t=>{t(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,o){return R(this,null,function*(){return new Promise(t=>{let n=this.transformConfig(e),l=this.transformEmbeddingRequests(o);if(o.requests.length===0)throw new provider.InvalidEmbeddingRequestsError({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error("requests cannot be empty")});n.outputDimensionality&&(l.requests.forEach(s=>{s.outputDimensionality=n.outputDimensionality;}),delete n.outputDimensionality),t(G(G(G({},this.getDefaultParams()),n),l));})})}transformGetEmbeddingsResponse(e){let o=nt.safeParse(e);if(o.success){let n=o.data.embeddings.map((l,s)=>({index:s,embedding:l.values}));return {encodingFormat:types.FloatEmbeddingLiteral,embeddings:n}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}};var mo="text-embedding-001",xs="text-embedding-001",po=provider.EmbeddingModelSchema(Re).parse({name:mo,description:xs,modalities:Se,maxInputTokens:2048,maxOutputTokens:768,config:{def:j.base(768).def,schema:j.base(768).schema}}),Xo=ee,be=class extends A{constructor(e){super(po,e);}};var co="text-embedding-004",Is="text-embedding-004",fo=provider.EmbeddingModelSchema(Re).parse({name:co,description:Is,modalities:Se,maxInputTokens:2048,maxOutputTokens:768,config:{def:j.base(768).def,schema:j.base(768).schema}}),Qo=ee,_e=class extends A{constructor(e){super(fo,e);}};
16
16
 
17
17
  exports.BaseChatModel = T;
18
18
  exports.BaseChatModelGemini1 = P;
19
19
  exports.BaseChatModelOptions = h;
20
20
  exports.BaseEmbeddingModel = A;
21
21
  exports.BaseEmbeddingModelOptions = ee;
22
- exports.ChatModelBaseConfigDef = Eo;
23
- exports.ChatModelBaseConfigSchema = _o;
24
- exports.ChatModelC1ConfigDef = Po;
25
- exports.ChatModelC1ConfigSchema = Oo;
26
- exports.EmbeddingModelBaseConfigDef = xo;
27
- exports.EmbeddingModelBaseConfigSchema = Ro;
28
- exports.Gemini1_0Pro = pe;
29
- exports.Gemini1_0ProLatest = fe;
30
- exports.Gemini1_0ProLatestLiteral = Ve;
31
- exports.Gemini1_0ProLatestOptions = Do;
32
- exports.Gemini1_0ProLatestSchema = He;
33
- exports.Gemini1_0ProLiteral = Be;
34
- exports.Gemini1_0ProOptions = jo;
35
- exports.Gemini1_0ProSchema = De;
36
- exports.Gemini1_0ProVision = he;
37
- exports.Gemini1_0ProVisionLiteral = Ke;
38
- exports.Gemini1_0ProVisionOptions = Uo;
39
- exports.Gemini1_0ProVisionSchema = Ye;
40
- exports.Gemini1_0Pro_001 = ce;
41
- exports.Gemini1_0Pro_001Literal = Ue;
42
- exports.Gemini1_0Pro_001Options = Bo;
43
- exports.Gemini1_0Pro_001Schema = Ae;
44
- exports.Gemini1_5Flash = ge;
45
- exports.Gemini1_5Flash001 = ue;
46
- exports.Gemini1_5Flash001Literal = Xe;
47
- exports.Gemini1_5Flash001Options = Vo;
48
- exports.Gemini1_5Flash001Schema = Qe;
49
- exports.Gemini1_5Flash002 = ye;
50
- exports.Gemini1_5Flash002Literal = Ze;
51
- exports.Gemini1_5Flash002Options = Ho;
52
- exports.Gemini1_5Flash002Schema = eo;
53
- exports.Gemini1_5FlashLatest = Ce;
54
- exports.Gemini1_5FlashLatestLiteral = oo;
55
- exports.Gemini1_5FlashLatestOptions = Ko;
56
- exports.Gemini1_5FlashLatestSchema = to;
57
- exports.Gemini1_5FlashLiteral = Je;
58
- exports.Gemini1_5FlashOptions = Ao;
59
- exports.Gemini1_5FlashSchema = We;
60
- exports.Gemini1_5Pro = Te;
61
- exports.Gemini1_5Pro001 = Ge;
62
- exports.Gemini1_5Pro001Literal = io;
63
- exports.Gemini1_5Pro001Options = Jo;
64
- exports.Gemini1_5Pro001Schema = ao;
22
+ exports.ChatModelBaseConfigDef = bo;
23
+ exports.ChatModelBaseConfigSchema = Go;
24
+ exports.ChatModelC1ConfigDef = Eo;
25
+ exports.ChatModelC1ConfigSchema = _o;
26
+ exports.EmbeddingModelBaseConfigDef = So;
27
+ exports.EmbeddingModelBaseConfigSchema = Po;
28
+ exports.Gemini1_0Pro = de;
29
+ exports.Gemini1_0ProLatest = ce;
30
+ exports.Gemini1_0ProLatestLiteral = Ue;
31
+ exports.Gemini1_0ProLatestOptions = Bo;
32
+ exports.Gemini1_0ProLatestSchema = Ae;
33
+ exports.Gemini1_0ProLiteral = ze;
34
+ exports.Gemini1_0ProOptions = zo;
35
+ exports.Gemini1_0ProSchema = je;
36
+ exports.Gemini1_0ProVision = fe;
37
+ exports.Gemini1_0ProVisionLiteral = Ve;
38
+ exports.Gemini1_0ProVisionOptions = Do;
39
+ exports.Gemini1_0ProVisionSchema = He;
40
+ exports.Gemini1_0Pro_001 = pe;
41
+ exports.Gemini1_0Pro_001Literal = Be;
42
+ exports.Gemini1_0Pro_001Options = jo;
43
+ exports.Gemini1_0Pro_001Schema = De;
44
+ exports.Gemini1_5Flash = he;
45
+ exports.Gemini1_5Flash001 = ge;
46
+ exports.Gemini1_5Flash001Literal = Je;
47
+ exports.Gemini1_5Flash001Options = Ao;
48
+ exports.Gemini1_5Flash001Schema = We;
49
+ exports.Gemini1_5Flash002 = ue;
50
+ exports.Gemini1_5Flash002Literal = Xe;
51
+ exports.Gemini1_5Flash002Options = Vo;
52
+ exports.Gemini1_5Flash002Schema = Qe;
53
+ exports.Gemini1_5FlashLatest = ye;
54
+ exports.Gemini1_5FlashLatestLiteral = Ze;
55
+ exports.Gemini1_5FlashLatestOptions = Ho;
56
+ exports.Gemini1_5FlashLatestSchema = eo;
57
+ exports.Gemini1_5FlashLiteral = Ke;
58
+ exports.Gemini1_5FlashOptions = Uo;
59
+ exports.Gemini1_5FlashSchema = Ye;
60
+ exports.Gemini1_5Pro = Ce;
61
+ exports.Gemini1_5Pro001 = Te;
62
+ exports.Gemini1_5Pro001Literal = so;
63
+ exports.Gemini1_5Pro001Options = Yo;
64
+ exports.Gemini1_5Pro001Schema = no;
65
65
  exports.Gemini1_5Pro002 = Me;
66
- exports.Gemini1_5Pro002Literal = ro;
67
- exports.Gemini1_5Pro002Options = Wo;
68
- exports.Gemini1_5Pro002Schema = lo;
69
- exports.Gemini1_5ProLatest = be;
70
- exports.Gemini1_5ProLatestLiteral = mo;
71
- exports.Gemini1_5ProLatestOptions = Xo;
72
- exports.Gemini1_5ProLatestSchema = po;
73
- exports.Gemini1_5ProLiteral = no;
74
- exports.Gemini1_5ProOptions = Yo;
75
- exports.Gemini1_5ProSchema = so;
76
- exports.GeminiPro = me;
77
- exports.GeminiProLiteral = Fe;
78
- exports.GeminiProOptions = $o;
79
- exports.GeminiProSchema = $e;
80
- exports.GeminiProVision = de;
81
- exports.GeminiProVisionLiteral = ze;
82
- exports.GeminiProVisionOptions = zo;
83
- exports.GeminiProVisionSchema = je;
66
+ exports.Gemini1_5Pro002Literal = io;
67
+ exports.Gemini1_5Pro002Options = Jo;
68
+ exports.Gemini1_5Pro002Schema = ao;
69
+ exports.Gemini1_5ProLatest = Ge;
70
+ exports.Gemini1_5ProLatestLiteral = ro;
71
+ exports.Gemini1_5ProLatestOptions = Wo;
72
+ exports.Gemini1_5ProLatestSchema = lo;
73
+ exports.Gemini1_5ProLiteral = oo;
74
+ exports.Gemini1_5ProOptions = Ko;
75
+ exports.Gemini1_5ProSchema = to;
76
+ exports.GeminiPro = le;
77
+ exports.GeminiProLiteral = Ne;
78
+ exports.GeminiProOptions = qo;
79
+ exports.GeminiProSchema = Fe;
80
+ exports.GeminiProVision = me;
81
+ exports.GeminiProVisionLiteral = qe;
82
+ exports.GeminiProVisionOptions = $o;
83
+ exports.GeminiProVisionSchema = $e;
84
84
  exports.Google = Y;
85
- exports.GoogleChatAssistantRoleLiteral = St;
86
- exports.GoogleChatContent = qt;
87
- exports.GoogleChatContentPartFunctionCall = Nt;
88
- exports.GoogleChatContentPartFunctionResponse = vt;
89
- exports.GoogleChatContentPartInlineData = kt;
90
- exports.GoogleChatContentPartText = qo;
91
- exports.GoogleChatGenerationConfig = No;
85
+ exports.GoogleChatAssistantRoleLiteral = Et;
86
+ exports.GoogleChatContent = kt;
87
+ exports.GoogleChatContentPartFunctionCall = It;
88
+ exports.GoogleChatContentPartFunctionResponse = Lt;
89
+ exports.GoogleChatContentPartInlineData = wt;
90
+ exports.GoogleChatContentPartText = vo;
91
+ exports.GoogleChatGenerationConfig = Lo;
92
92
  exports.GoogleChatModelConfigs = c;
93
93
  exports.GoogleChatModelModalities = _;
94
94
  exports.GoogleChatModelModalitiesEnum = E;
95
95
  exports.GoogleChatModelRoles = u;
96
96
  exports.GoogleChatModelRolesMap = y;
97
- exports.GoogleChatModelTextModalities = is;
98
- exports.GoogleChatModelTextModalitiesEnum = as;
99
- exports.GoogleChatModelTextToolModalities = L;
100
- exports.GoogleChatModelTextToolModalitiesEnum = I;
97
+ exports.GoogleChatModelTextModalities = on;
98
+ exports.GoogleChatModelTextModalitiesEnum = tn;
99
+ exports.GoogleChatModelTextToolModalities = I;
100
+ exports.GoogleChatModelTextToolModalitiesEnum = L;
101
101
  exports.GoogleChatModelTextVisionModalities = ae;
102
102
  exports.GoogleChatModelTextVisionModalitiesEnum = re;
103
- exports.GoogleChatRequest = Fo;
104
- exports.GoogleChatSystemInstruction = Io;
105
- exports.GoogleChatTool = Ft;
106
- exports.GoogleChatToolConfig = ko;
107
- exports.GoogleChatToolRoleLiteral = Rt;
108
- exports.GoogleCompleteChatResponse = wo;
109
- exports.GoogleCompleteChatTextResponse = xt;
110
- exports.GoogleCompleteChatToolResponse = wt;
103
+ exports.GoogleChatRequest = No;
104
+ exports.GoogleChatSafetySettings = ko;
105
+ exports.GoogleChatSystemInstruction = wo;
106
+ exports.GoogleChatTool = vt;
107
+ exports.GoogleChatToolConfig = Io;
108
+ exports.GoogleChatToolRoleLiteral = Ot;
109
+ exports.GoogleCompleteChatResponse = Ro;
110
+ exports.GoogleCompleteChatTextResponse = Pt;
111
+ exports.GoogleCompleteChatToolResponse = St;
111
112
  exports.GoogleEmbeddingModelConfigs = j;
112
- exports.GoogleEmbeddingModelModalities = Re;
113
- exports.GoogleEmbeddingModelModalitiesEnum = xe;
114
- exports.GoogleEmbeddingRequest = at;
115
- exports.GoogleEmbeddingRequestInput = On;
116
- exports.GoogleGetEmbeddingsResponse = it;
117
- exports.GoogleStreamChatResponse = Lo;
118
- exports.GoogleStreamChatTextResponse = Lt;
119
- exports.GoogleStreamChatToolResponse = It;
120
- exports.ProviderLiteral = $t;
121
- exports.Text_Embedding_001 = _e;
122
- exports.Text_Embedding_001Literal = co;
123
- exports.Text_Embedding_001Options = Qo;
124
- exports.Text_Embedding_001Schema = fo;
125
- exports.Text_Embedding_004 = Ee;
126
- exports.Text_Embedding_004Literal = ho;
127
- exports.Text_Embedding_004Options = Zo;
128
- exports.Text_Embedding_004Schema = go;
129
- exports.dimensions = ve;
130
- exports.frequencyPenalty = Ie;
131
- exports.maxTokens = v;
132
- exports.presencePenalty = ke;
113
+ exports.GoogleEmbeddingModelModalities = Se;
114
+ exports.GoogleEmbeddingModelModalitiesEnum = Re;
115
+ exports.GoogleEmbeddingRequest = it;
116
+ exports.GoogleEmbeddingRequestInput = Gs;
117
+ exports.GoogleGetEmbeddingsResponse = nt;
118
+ exports.GoogleStreamChatResponse = xo;
119
+ exports.GoogleStreamChatTextResponse = Rt;
120
+ exports.GoogleStreamChatToolResponse = xt;
121
+ exports.ProviderLiteral = Nt;
122
+ exports.Text_Embedding_001 = be;
123
+ exports.Text_Embedding_001Literal = mo;
124
+ exports.Text_Embedding_001Options = Xo;
125
+ exports.Text_Embedding_001Schema = po;
126
+ exports.Text_Embedding_004 = _e;
127
+ exports.Text_Embedding_004Literal = co;
128
+ exports.Text_Embedding_004Options = Qo;
129
+ exports.Text_Embedding_004Schema = fo;
130
+ exports.dimensions = ke;
131
+ exports.frequencyPenalty = we;
132
+ exports.maxTokens = N;
133
+ exports.presencePenalty = Ie;
133
134
  exports.safetySettings = z;
134
- exports.seed = Ne;
135
- exports.stop = q;
136
- exports.temperature = N;
135
+ exports.seed = Le;
136
+ exports.stop = F;
137
+ exports.temperature = v;
137
138
  exports.toolChoice = $;
138
- exports.topK = Le;
139
- exports.topP = F;
139
+ exports.topK = xe;
140
+ exports.topP = q;
140
141
  //# sourceMappingURL=index.js.map
141
142
  //# sourceMappingURL=index.js.map