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* 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