diff --git a/src/handlers/anthropic.ts b/src/handlers/anthropic.ts index 3fed753..8ce5335 100644 --- a/src/handlers/anthropic.ts +++ b/src/handlers/anthropic.ts @@ -87,10 +87,10 @@ export async function AnthropicHandler( export async function AnthropicHandler( params: HandlerParams, ): Promise { - const api_key = params.api_key ?? process.env.ANTHROPIC_API_KEY; + const apiKey = params. apiKey ?? process.env.ANTHROPIC_API_KEY; const anthropic = new Anthropic({ - apiKey: api_key, + apiKey: apiKey, }); const prompt = toAnthropicPrompt(params.messages); diff --git a/src/handlers/cohere.ts b/src/handlers/cohere.ts index 2c36e34..8d64ab0 100644 --- a/src/handlers/cohere.ts +++ b/src/handlers/cohere.ts @@ -51,9 +51,9 @@ export async function CohereHandler( export async function CohereHandler( params: HandlerParams, ): Promise { - const api_key = params.api_key ?? process.env.COHERE_API_KEY!; + const apiKey = params. apiKey ?? process.env.COHERE_API_KEY!; - cohere.init(api_key); + cohere.init(apiKey); const textsCombined = combinePrompts(params.messages); const config = { diff --git a/src/handlers/deepinfra.ts b/src/handlers/deepinfra.ts index 379a66b..d1b19d5 100644 --- a/src/handlers/deepinfra.ts +++ b/src/handlers/deepinfra.ts @@ -36,14 +36,14 @@ async function getDeepInfraResponse( model: string, messages: Message[], baseUrl: string, - api_key: string, + apiKey: string, stream: boolean, ): Promise { return fetch(`${baseUrl}/v1/openai/chat/completions`, { method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${api_key}`, + Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ messages, @@ -69,14 +69,14 @@ export async function DeepInfraHandler( params: HandlerParams, ): Promise { const baseUrl = params.baseUrl ?? 'https://api.deepinfra.com'; - const api_key = params.api_key ?? process.env.DEEPINFRA_API_KEY!; + const apiKey = params. apiKey ?? process.env.DEEPINFRA_API_KEY!; const model = params.model.split('deepinfra/')[1]; const res = await getDeepInfraResponse( model, params.messages, baseUrl, - api_key, + apiKey, params.stream ?? false, ); diff --git a/src/handlers/mistral.ts b/src/handlers/mistral.ts index a8767bf..52af9de 100644 --- a/src/handlers/mistral.ts +++ b/src/handlers/mistral.ts @@ -37,14 +37,14 @@ async function getMistralResponse( model: string, messages: Message[], baseUrl: string, - api_key: string, + apiKey: string, stream: boolean, ): Promise { return fetch(`${baseUrl}/v1/chat/completions`, { method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${api_key}`, + Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ messages, @@ -70,14 +70,14 @@ export async function MistralHandler( params: HandlerParams, ): Promise { const baseUrl = params.baseUrl ?? 'https://api.mistral.ai'; - const api_key = params.api_key ?? process.env.MISTRAL_API_KEY!; + const apiKey = params. apiKey ?? process.env.MISTRAL_API_KEY!; const model = params.model.split('mistral/')[1]; const res = await getMistralResponse( model, params.messages, baseUrl, - api_key, + apiKey, params.stream ?? false, ); diff --git a/src/handlers/mistralEmbedding.ts b/src/handlers/mistralEmbedding.ts index 726ece0..47273fa 100644 --- a/src/handlers/mistralEmbedding.ts +++ b/src/handlers/mistralEmbedding.ts @@ -5,13 +5,13 @@ async function getMistralResponse( model: string, input: EmbeddingParams['input'], baseUrl: string, - api_key: string, + apiKey: string, ): Promise { return fetch(`${baseUrl}/v1/embeddings`, { method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${api_key}`, + Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ model, @@ -25,12 +25,12 @@ export async function MistralEmbeddingHandler( ): Promise { const model = params.model.split('mistral/')[1]; const baseUrl = params.baseUrl ?? 'https://api.mistral.ai'; - const api_key = params.api_key ?? process.env.MISTRAL_API_KEY!; + const apiKey = params. apiKey ?? process.env.MISTRAL_API_KEY!; const response = await getMistralResponse( model, params.input, baseUrl, - api_key, + apiKey, ); if (!response.ok) { diff --git a/src/handlers/openai.ts b/src/handlers/openai.ts index cfbf9e4..6cf6f2b 100644 --- a/src/handlers/openai.ts +++ b/src/handlers/openai.ts @@ -45,7 +45,7 @@ export async function OpenAIHandler( export async function OpenAIHandler( params: HandlerParams, ): Promise { - const api_key = params.api_key ?? process.env.OPENAI_API_KEY; + const apiKey = params. apiKey ?? process.env.OPENAI_API_KEY; const openai = new OpenAI({ apiKey: apiKey,