UNPKG

@adaline/groq

Version:
889 lines (874 loc) 29.1 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 Gpt_Oss_20bLiteral: "openai/gpt-oss-20b"; declare const Gpt_Oss_20bSchema: { 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 Gpt_Oss_20b_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Gpt_Oss_20b_OptionsType = z.infer<typeof Gpt_Oss_20b_Options>; declare class Gpt_Oss_20b extends BaseChatModelGroq { constructor(options: Gpt_Oss_20b_OptionsType); } declare const Gpt_Oss_120bLiteral: "openai/gpt-oss-120b"; declare const Gpt_Oss_120bSchema: { 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 Gpt_Oss_120b_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Gpt_Oss_120b_OptionsType = z.infer<typeof Gpt_Oss_120b_Options>; declare class Gpt_Oss_120b extends BaseChatModelGroq { constructor(options: Gpt_Oss_120b_OptionsType); } 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_3_70b_VersatileLiteral: "llama-3.3-70b-versatile"; declare const Llama_3_3_70b_VersatileSchema: { 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_3_70b_Versatile_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_3_3_70b_Versatile_OptionsType = z.infer<typeof Llama_3_3_70b_Versatile_Options>; declare class Llama_3_3_70b_Versatile extends BaseChatModelGroq { constructor(options: Llama_3_3_70b_Versatile_OptionsType); } declare const Llama_Guard_4_12bLiteral: "meta-llama/llama-guard-4-12b"; declare const Llama_Guard_4_12bSchema: { 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_Guard_4_12b_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_Guard_4_12b_OptionsType = z.infer<typeof Llama_Guard_4_12b_Options>; declare class Llama_Guard_4_12b extends BaseChatModelGroq { constructor(options: Llama_Guard_4_12b_OptionsType); } declare const Qwen3_32bLiteral: "qwen/qwen3-32b"; declare const Qwen3_32bSchema: { 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 Qwen3_32b_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Qwen3_32b_OptionsType = z.infer<typeof Qwen3_32b_Options>; declare class Qwen3_32b extends BaseChatModelGroq { constructor(options: Qwen3_32b_OptionsType); } declare const Deepseek_R1_Distill_Llama_70bLiteral: "deepseek-r1-distill-llama-70b"; declare const Deepseek_R1_Distill_Llama_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 Deepseek_R1_Distill_Llama_70b_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Deepseek_R1_Distill_Llama_70b_OptionsType = z.infer<typeof Deepseek_R1_Distill_Llama_70b_Options>; declare class Deepseek_R1_Distill_Llama_70b extends BaseChatModelGroq { constructor(options: Deepseek_R1_Distill_Llama_70b_OptionsType); } declare const Kimi_K2_InstructLiteral: "moonshotai/kimi-k2-instruct"; declare const Kimi_K2_InstructSchema: { 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 Kimi_K2_Instruct_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Kimi_K2_Instruct_OptionsType = z.infer<typeof Kimi_K2_Instruct_Options>; declare class Kimi_K2_Instruct extends BaseChatModelGroq { constructor(options: Kimi_K2_Instruct_OptionsType); } declare const Llama_4_Maverick_17b_128e_InstructLiteral: "meta-llama/llama-4-maverick-17b-128e-instruct"; declare const Llama_4_Maverick_17b_128e_InstructSchema: { 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_4_Maverick_17b_128e_Instruct_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_4_Maverick_17b_128e_Instruct_OptionsType = z.infer<typeof Llama_4_Maverick_17b_128e_Instruct_Options>; declare class Llama_4_Maverick_17b_128e_Instruct extends BaseChatModelGroq { constructor(options: Llama_4_Maverick_17b_128e_Instruct_OptionsType); } declare const Llama_4_Scout_17b_16e_InstructLiteral: "meta-llama/llama-4-scout-17b-16e-instruct"; declare const Llama_4_Scout_17b_16e_InstructSchema: { 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_4_Scout_17b_16e_Instruct_Options: z.ZodObject<{ modelName: z.ZodString; apiKey: z.ZodString; }, "strip", z.ZodTypeAny, { modelName: string; apiKey: string; }, { modelName: string; apiKey: string; }>; type Llama_4_Scout_17b_16e_Instruct_OptionsType = z.infer<typeof Llama_4_Scout_17b_16e_Instruct_Options>; declare class Llama_4_Scout_17b_16e_Instruct extends BaseChatModelGroq { constructor(options: Llama_4_Scout_17b_16e_Instruct_OptionsType); } 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, Deepseek_R1_Distill_Llama_70b, Deepseek_R1_Distill_Llama_70bLiteral, Deepseek_R1_Distill_Llama_70bSchema, Deepseek_R1_Distill_Llama_70b_Options, type Deepseek_R1_Distill_Llama_70b_OptionsType, Gemma2_9b_IT, Gemma2_9b_ITLiteral, Gemma2_9b_ITOptions, type Gemma2_9b_ITOptionsType, Gemma2_9b_ITSchema, Gpt_Oss_120b, Gpt_Oss_120bLiteral, Gpt_Oss_120bSchema, Gpt_Oss_120b_Options, type Gpt_Oss_120b_OptionsType, Gpt_Oss_20b, Gpt_Oss_20bLiteral, Gpt_Oss_20bSchema, Gpt_Oss_20b_Options, type Gpt_Oss_20b_OptionsType, Groq, Kimi_K2_Instruct, Kimi_K2_InstructLiteral, Kimi_K2_InstructSchema, Kimi_K2_Instruct_Options, type Kimi_K2_Instruct_OptionsType, 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_3_70b_Versatile, Llama_3_3_70b_VersatileLiteral, Llama_3_3_70b_VersatileSchema, Llama_3_3_70b_Versatile_Options, type Llama_3_3_70b_Versatile_OptionsType, Llama_4_Maverick_17b_128e_Instruct, Llama_4_Maverick_17b_128e_InstructLiteral, Llama_4_Maverick_17b_128e_InstructSchema, Llama_4_Maverick_17b_128e_Instruct_Options, type Llama_4_Maverick_17b_128e_Instruct_OptionsType, Llama_4_Scout_17b_16e_Instruct, Llama_4_Scout_17b_16e_InstructLiteral, Llama_4_Scout_17b_16e_InstructSchema, Llama_4_Scout_17b_16e_Instruct_Options, type Llama_4_Scout_17b_16e_Instruct_OptionsType, Llama_Guard_4_12b, Llama_Guard_4_12bLiteral, Llama_Guard_4_12bSchema, Llama_Guard_4_12b_Options, type Llama_Guard_4_12b_OptionsType, Qwen3_32b, Qwen3_32bLiteral, Qwen3_32bSchema, Qwen3_32b_Options, type Qwen3_32b_OptionsType };