From e4b4930fa7f0d593e2142dfa94aaca3682932387 Mon Sep 17 00:00:00 2001 From: "Ed Zynda\" (aider)" Date: Sun, 23 Feb 2025 12:40:35 +0300 Subject: [PATCH 1/2] feat: Add method to initialize OpenAI client with custom base URL --- openai.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openai.go b/openai.go index 9d12ad6..28c44e4 100644 --- a/openai.go +++ b/openai.go @@ -24,6 +24,14 @@ func NewOpenAILLM(apiKey string) *OpenAILLM { return &OpenAILLM{client: client} } +// NewOpenAILLMWithBaseURL creates a new OpenAI LLM client with a custom base URL +func NewOpenAILLMWithBaseURL(apiKey string, baseURL string) *OpenAILLM { + config := openai.DefaultConfig(apiKey) + config.BaseURL = baseURL + client := openai.NewClientWithConfig(config) + return &OpenAILLM{client: client} +} + func NewAzureLLM(apiKey string, azureOpenAIEndpoint string) *OpenAILLM { // The latest API versions, including previews, can be found here: // https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#rest-api-versioning From d3c144ff683a15928721b3a3dcd94eadb531d283 Mon Sep 17 00:00:00 2001 From: Ed Zynda Date: Sun, 23 Feb 2025 12:41:54 +0300 Subject: [PATCH 2/2] Add .aider* to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a054c49..52732d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store .vscode .env -google.json \ No newline at end of file +google.json +.aider*