Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass through correct model name for Azure AI #344

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions llm/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ import (
func NewOpenAIProvider(apiKey string, azureBaseURL string, model, azureModelName string, name string, jsonMode bool) *openAIProvider {
var cfg openai.ClientConfig
if azureBaseURL != "" {
// override model choice with what we get from the configuration
model = azureModelName
cfg = openai.DefaultAzureConfig(apiKey, azureBaseURL)
cfg.APIVersion = "2024-05-01-preview"
cfg.AzureModelMapperFunc = func(m string) string {
return azureModelName
}
} else {
cfg = openai.DefaultConfig(apiKey)
}
Expand Down Expand Up @@ -150,8 +149,10 @@ func (c *openAIConversation) SendMessage(ctx context.Context, userMessage string
err := fmt.Errorf("failed to append message: %w", err)
// Delete the last message so we don't end up with duplicates
_, deleteErr := c.client.DeleteMessage(ctx, c.thread.ID, message.ID)
deleteErr = fmt.Errorf("failed to delete message: %w", deleteErr)
err = errors.Join(err, deleteErr)
if deleteErr != nil {
deleteErr = fmt.Errorf("failed to delete message: %w", deleteErr)
err = errors.Join(err, deleteErr)
}
return err
})

Expand Down
Loading