UNPKG

@adaline/groq

Version:
735 lines (722 loc) 23.5 kB
import { ChatModelSchemaType, ParamsType, ProviderV1, ChatModelV1, EmbeddingModelSchemaType, EmbeddingModelV1 } from '@adaline/provider'; import { z } from 'zod'; import { BaseChatModel } from '@adaline/openai'; import { MessageType, ChatModelPriceType } from '@adaline/types'; declare const BaseChatModelOptions: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type BaseChatModelOptionsType = z.infer<typeof BaseChatModelOptions>; declare class BaseChatModelGroq extends BaseChatModel { readonly version: "v1"; modelSchema: ChatModelSchemaType; readonly modelName: string; private readonly groqApiKey; constructor(modelSchema: ChatModelSchemaType, options: BaseChatModelOptionsType); transformMessages(messages: MessageType[]): ParamsType; getModelPricing(): ChatModelPriceType; } declare const Gemma2_9b_ITLiteral: "gemma2-9b-it"; declare const Gemma2_9b_ITSchema: { name: string; description: string; roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>; modalities: ["text" | "tool-call" | "tool-response", ...("text" | "tool-call" | "tool-response")[]]; maxInputTokens: number; maxOutputTokens: number; config: { def: Record<string, { type: "multi-string"; param: string; title: string; description: string; max: number; } | { type: "object-schema"; param: string; title: string; description: string; objectSchema?: any; } | { type: "range"; param: string; title: string; description: string; max: number; default: number; min: number; step: number; } | { type: "select-boolean"; param: string; title: string; description: string; default: boolean | null; } | { type: "select-string"; param: string; title: string; description: string; default: string; choices: string[]; }>; schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>; }; price: { modelName: string; currency: string; tokenRanges: { minTokens: number; prices: { base: { inputPricePerMillion: number; outputPricePerMillion: number; }; }; maxTokens?: number | null | undefined; }[]; }; maxReasoningTokens?: number | undefined; }; declare const Gemma2_9b_ITOptions: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Gemma2_9b_ITOptionsType = z.infer<typeof Gemma2_9b_ITOptions>; declare class Gemma2_9b_IT extends BaseChatModelGroq { constructor(options: Gemma2_9b_ITOptionsType); } declare const Llama_3_1_8bLiteral: "llama-3.1-8b-instant"; declare const Llama_3_1_8bSchema: { name: string; description: string; roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>; modalities: ["text" | "tool-call" | "tool-response", ...("text" | "tool-call" | "tool-response")[]]; maxInputTokens: number; maxOutputTokens: number; config: { def: Record<string, { type: "multi-string"; param: string; title: string; description: string; max: number; } | { type: "object-schema"; param: string; title: string; description: string; objectSchema?: any; } | { type: "range"; param: string; title: string; description: string; max: number; default: number; min: number; step: number; } | { type: "select-boolean"; param: string; title: string; description: string; default: boolean | null; } | { type: "select-string"; param: string; title: string; description: string; default: string; choices: string[]; }>; schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>; }; price: { modelName: string; currency: string; tokenRanges: { minTokens: number; prices: { base: { inputPricePerMillion: number; outputPricePerMillion: number; }; }; maxTokens?: number | null | undefined; }[]; }; maxReasoningTokens?: number | undefined; }; declare const Llama_3_1_8b_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_3_1_8b_OptionsType = z.infer<typeof Llama_3_1_8b_Options>; declare class Llama_3_1_8b extends BaseChatModelGroq { constructor(options: Llama_3_1_8b_OptionsType); } declare const Llama_3_2_11b_VisionLiteral: "llama-3.2-11b-vision-preview"; declare const Llama_3_2_11b_VisionSchema: { name: string; description: string; roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>; modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]]; maxInputTokens: number; maxOutputTokens: number; config: { def: Record<string, { type: "multi-string"; param: string; title: string; description: string; max: number; } | { type: "object-schema"; param: string; title: string; description: string; objectSchema?: any; } | { type: "range"; param: string; title: string; description: string; max: number; default: number; min: number; step: number; } | { type: "select-boolean"; param: string; title: string; description: string; default: boolean | null; } | { type: "select-string"; param: string; title: string; description: string; default: string; choices: string[]; }>; schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>; }; price: { modelName: string; currency: string; tokenRanges: { minTokens: number; prices: { base: { inputPricePerMillion: number; outputPricePerMillion: number; }; }; maxTokens?: number | null | undefined; }[]; }; maxReasoningTokens?: number | undefined; }; declare const Llama_3_2_11b_VisionOptions: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_3_2_11b_VisionOptionsType = z.infer<typeof Llama_3_2_11b_VisionOptions>; declare class Llama_3_2_11b_Vision extends BaseChatModelGroq { constructor(options: Llama_3_2_11b_VisionOptionsType); } declare const Llama_3_2_1bLiteral: "llama-3.2-1b-preview"; declare const Llama_3_2_1bSchema: { name: string; description: string; roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>; modalities: ["text" | "tool-call" | "tool-response", ...("text" | "tool-call" | "tool-response")[]]; maxInputTokens: number; maxOutputTokens: number; config: { def: Record<string, { type: "multi-string"; param: string; title: string; description: string; max: number; } | { type: "object-schema"; param: string; title: string; description: string; objectSchema?: any; } | { type: "range"; param: string; title: string; description: string; max: number; default: number; min: number; step: number; } | { type: "select-boolean"; param: string; title: string; description: string; default: boolean | null; } | { type: "select-string"; param: string; title: string; description: string; default: string; choices: string[]; }>; schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>; }; price: { modelName: string; currency: string; tokenRanges: { minTokens: number; prices: { base: { inputPricePerMillion: number; outputPricePerMillion: number; }; }; maxTokens?: number | null | undefined; }[]; }; maxReasoningTokens?: number | undefined; }; declare const Llama_3_2_1b_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_3_2_1b_OptionsType = z.infer<typeof Llama_3_2_1b_Options>; declare class Llama_3_2_1b extends BaseChatModelGroq { constructor(options: Llama_3_2_1b_OptionsType); } declare const Llama_3_2_3bLiteral: "llama-3.2-3b-preview"; declare const Llama_3_2_3bSchema: { name: string; description: string; roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>; modalities: ["text" | "tool-call" | "tool-response", ...("text" | "tool-call" | "tool-response")[]]; maxInputTokens: number; maxOutputTokens: number; config: { def: Record<string, { type: "multi-string"; param: string; title: string; description: string; max: number; } | { type: "object-schema"; param: string; title: string; description: string; objectSchema?: any; } | { type: "range"; param: string; title: string; description: string; max: number; default: number; min: number; step: number; } | { type: "select-boolean"; param: string; title: string; description: string; default: boolean | null; } | { type: "select-string"; param: string; title: string; description: string; default: string; choices: string[]; }>; schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>; }; price: { modelName: string; currency: string; tokenRanges: { minTokens: number; prices: { base: { inputPricePerMillion: number; outputPricePerMillion: number; }; }; maxTokens?: number | null | undefined; }[]; }; maxReasoningTokens?: number | undefined; }; declare const Llama_3_2_3b_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_3_2_3b_OptionsType = z.infer<typeof Llama_3_2_3b_Options>; declare class Llama_3_2_3b extends BaseChatModelGroq { constructor(options: Llama_3_2_3b_OptionsType); } declare const Llama_3_2_90b_VisionLiteral: "llama-3.2-90b-vision-preview"; declare const Llama_3_2_90b_VisionSchema: { name: string; description: string; roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>; modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]]; maxInputTokens: number; maxOutputTokens: number; config: { def: Record<string, { type: "multi-string"; param: string; title: string; description: string; max: number; } | { type: "object-schema"; param: string; title: string; description: string; objectSchema?: any; } | { type: "range"; param: string; title: string; description: string; max: number; default: number; min: number; step: number; } | { type: "select-boolean"; param: string; title: string; description: string; default: boolean | null; } | { type: "select-string"; param: string; title: string; description: string; default: string; choices: string[]; }>; schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>; }; price: { modelName: string; currency: string; tokenRanges: { minTokens: number; prices: { base: { inputPricePerMillion: number; outputPricePerMillion: number; }; }; maxTokens?: number | null | undefined; }[]; }; maxReasoningTokens?: number | undefined; }; declare const Llama_3_2_90b_VisionOptions: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_3_2_90b_VisionOptionsType = z.infer<typeof Llama_3_2_90b_VisionOptions>; declare class Llama_3_2_90b_Vision extends BaseChatModelGroq { constructor(options: Llama_3_2_90b_VisionOptionsType); } declare const Llama_3_70bLiteral: "llama3-70b-8192"; declare const Llama_3_70bSchema: { name: string; description: string; roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>; modalities: ["text" | "tool-call" | "tool-response", ...("text" | "tool-call" | "tool-response")[]]; maxInputTokens: number; maxOutputTokens: number; config: { def: Record<string, { type: "multi-string"; param: string; title: string; description: string; max: number; } | { type: "object-schema"; param: string; title: string; description: string; objectSchema?: any; } | { type: "range"; param: string; title: string; description: string; max: number; default: number; min: number; step: number; } | { type: "select-boolean"; param: string; title: string; description: string; default: boolean | null; } | { type: "select-string"; param: string; title: string; description: string; default: string; choices: string[]; }>; schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>; }; price: { modelName: string; currency: string; tokenRanges: { minTokens: number; prices: { base: { inputPricePerMillion: number; outputPricePerMillion: number; }; }; maxTokens?: number | null | undefined; }[]; }; maxReasoningTokens?: number | undefined; }; declare const Llama_3_70bOptions: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_3_70bOptionsType = z.infer<typeof Llama_3_70bOptions>; declare class Llama_3_70b extends BaseChatModelGroq { constructor(options: Llama_3_70bOptionsType); } declare const Llama_3_8bLiteral: "llama3-8b-8192"; declare const Llama_3_8bSchema: { name: string; description: string; roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>; modalities: ["text" | "tool-call" | "tool-response", ...("text" | "tool-call" | "tool-response")[]]; maxInputTokens: number; maxOutputTokens: number; config: { def: Record<string, { type: "multi-string"; param: string; title: string; description: string; max: number; } | { type: "object-schema"; param: string; title: string; description: string; objectSchema?: any; } | { type: "range"; param: string; title: string; description: string; max: number; default: number; min: number; step: number; } | { type: "select-boolean"; param: string; title: string; description: string; default: boolean | null; } | { type: "select-string"; param: string; title: string; description: string; default: string; choices: string[]; }>; schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>; }; price: { modelName: string; currency: string; tokenRanges: { minTokens: number; prices: { base: { inputPricePerMillion: number; outputPricePerMillion: number; }; }; maxTokens?: number | null | undefined; }[]; }; maxReasoningTokens?: number | undefined; }; declare const Llama_3_8bOptions: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_3_8bOptionsType = z.infer<typeof Llama_3_8bOptions>; declare class Llama_3_8b extends BaseChatModelGroq { constructor(options: Llama_3_8bOptionsType); } declare const LlamaGuard_3_8bLiteral: "llama-guard-3-8b"; declare const LlamaGuard_3_8bSchema: { name: string; description: string; roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>; modalities: ["text" | "tool-call" | "tool-response", ...("text" | "tool-call" | "tool-response")[]]; maxInputTokens: number; maxOutputTokens: number; config: { def: Record<string, { type: "multi-string"; param: string; title: string; description: string; max: number; } | { type: "object-schema"; param: string; title: string; description: string; objectSchema?: any; } | { type: "range"; param: string; title: string; description: string; max: number; default: number; min: number; step: number; } | { type: "select-boolean"; param: string; title: string; description: string; default: boolean | null; } | { type: "select-string"; param: string; title: string; description: string; default: string; choices: string[]; }>; schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>; }; price: { modelName: string; currency: string; tokenRanges: { minTokens: number; prices: { base: { inputPricePerMillion: number; outputPricePerMillion: number; }; }; maxTokens?: number | null | undefined; }[]; }; maxReasoningTokens?: number | undefined; }; declare const LlamaGuard_3_8bOptions: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type LlamaGuard_3_8bOptionsType = z.infer<typeof LlamaGuard_3_8bOptions>; declare class LlamaGuard_3_8b extends BaseChatModelGroq { constructor(options: LlamaGuard_3_8bOptionsType); } declare class Groq<C extends BaseChatModelOptionsType, E extends Record<string, any> = Record<string, any>> implements ProviderV1<C, E> { readonly version: "v1"; readonly name = "groq"; static readonly baseUrl = "https://api.groq.com/openai/v1"; private readonly chatModelFactories; private readonly embeddingModelFactories; chatModelLiterals(): string[]; chatModelSchemas(): Record<string, ChatModelSchemaType>; chatModel(options: C): ChatModelV1; embeddingModelLiterals(): string[]; embeddingModelSchemas(): Record<string, EmbeddingModelSchemaType>; embeddingModel(options: E): EmbeddingModelV1; } export { BaseChatModelGroq, BaseChatModelOptions, type BaseChatModelOptionsType, Gemma2_9b_IT, Gemma2_9b_ITLiteral, Gemma2_9b_ITOptions, type Gemma2_9b_ITOptionsType, Gemma2_9b_ITSchema, Groq, LlamaGuard_3_8b, LlamaGuard_3_8bLiteral, LlamaGuard_3_8bOptions, type LlamaGuard_3_8bOptionsType, LlamaGuard_3_8bSchema, Llama_3_1_8b, Llama_3_1_8bLiteral, Llama_3_1_8bSchema, Llama_3_1_8b_Options, type Llama_3_1_8b_OptionsType, Llama_3_2_11b_Vision, Llama_3_2_11b_VisionLiteral, Llama_3_2_11b_VisionOptions, type Llama_3_2_11b_VisionOptionsType, Llama_3_2_11b_VisionSchema, Llama_3_2_1b, Llama_3_2_1bLiteral, Llama_3_2_1bSchema, Llama_3_2_1b_Options, type Llama_3_2_1b_OptionsType, Llama_3_2_3b, Llama_3_2_3bLiteral, Llama_3_2_3bSchema, Llama_3_2_3b_Options, type Llama_3_2_3b_OptionsType, Llama_3_2_90b_Vision, Llama_3_2_90b_VisionLiteral, Llama_3_2_90b_VisionOptions, type Llama_3_2_90b_VisionOptionsType, Llama_3_2_90b_VisionSchema, Llama_3_70b, Llama_3_70bLiteral, Llama_3_70bOptions, type Llama_3_70bOptionsType, Llama_3_70bSchema, Llama_3_8b, Llama_3_8bLiteral, Llama_3_8bOptions, type Llama_3_8bOptionsType, Llama_3_8bSchema };