diff --git a/extensions/void/package.json b/extensions/void/package.json index f7cd1e0f..0f9105b2 100644 --- a/extensions/void/package.json +++ b/extensions/void/package.json @@ -19,7 +19,7 @@ "void.whichApi": { "type": "string", "default": "anthropic", - "description": "Choose a model to use", + "description": "Choose an API provider", "enum": [ "anthropic", "openai", @@ -32,6 +32,14 @@ "default": "", "description": "Anthropic API Key" }, + "void.anthropicModel": { + "type": "string", + "default": "claude-3-5-sonnet-20240620", + "description": "Anthropic Model to use", + "enum": [ + "claude-3-5-sonnet-20240620" + ] + }, "void.openAIApiKey": { "type": "string", "default": "", diff --git a/extensions/void/src/common/sendLLMMessage.ts b/extensions/void/src/common/sendLLMMessage.ts index ca3c34bd..9e47a80a 100644 --- a/extensions/void/src/common/sendLLMMessage.ts +++ b/extensions/void/src/common/sendLLMMessage.ts @@ -6,6 +6,8 @@ import OpenAI from 'openai'; export type ApiConfig = { anthropic: { apikey: string, + model: string, + maxTokens: string }, openai: { apikey: string @@ -60,12 +62,11 @@ type SendLLMMessageFnTypeExternal = (params: { // Claude const sendClaudeMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinalMessage, apiConfig }) => { - const anthropic = new Anthropic({ apiKey: apiConfig.anthropic.apikey, dangerouslyAllowBrowser: true }); // defaults to process.env["ANTHROPIC_API_KEY"] const stream = anthropic.messages.stream({ - model: "claude-3-5-sonnet-20240620", - max_tokens: 1024, + model: apiConfig.anthropic.model, + max_tokens: parseInt(apiConfig.anthropic.maxTokens), messages: messages, }); diff --git a/extensions/void/src/extension.ts b/extensions/void/src/extension.ts index 489dc2a3..2d7e85a1 100644 --- a/extensions/void/src/extension.ts +++ b/extensions/void/src/extension.ts @@ -13,7 +13,11 @@ const readFileContentOfUri = async (uri: vscode.Uri) => { const getApiConfig = () => { const apiConfig: ApiConfig = { - anthropic: { apikey: vscode.workspace.getConfiguration('void').get('anthropicApiKey') ?? '' }, + anthropic: { + apikey: vscode.workspace.getConfiguration('void').get('anthropicApiKey') ?? '', + model: vscode.workspace.getConfiguration('void').get('anthropicModel') ?? '', + maxTokens: vscode.workspace.getConfiguration('void').get('anthropicMaxToken') ?? '', + }, openai: { apikey: vscode.workspace.getConfiguration('void').get('openAIApiKey') ?? '' }, greptile: { apikey: vscode.workspace.getConfiguration('void').get('greptileApiKey') ?? '', diff --git a/void b/void new file mode 160000 index 00000000..6d513a1e --- /dev/null +++ b/void @@ -0,0 +1 @@ +Subproject commit 6d513a1e602c8dea3f89f85cc5a04d840a0abfa9