Skip to content

Commit

Permalink
#29: fix Implicit memory aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrueger12 committed Dec 20, 2023
1 parent 843997d commit 4f9eda0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/providers/openai/openai_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func TestOpenAIClient(t *testing.T) {
// Initialize the OpenAI client

_ = t
var _ = t

poolName := "default"
modelName := "gpt-3.5-turbo"
Expand Down
12 changes: 7 additions & 5 deletions pkg/providers/openai/openaiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ func (c *Client) NewClient(poolName string, modelName string) (*Client, error) {

// Find the pool with the specified name
var selectedPool *providers.Pool
for _, pool := range config.Gateway.Pools {
for i := range config.Gateway.Pools {
pool := &config.Gateway.Pools[i]
if pool.Name == poolName {
selectedPool = &pool
selectedPool = pool
break
}
}
}

// Check if the pool was found
if selectedPool == nil {
Expand All @@ -121,9 +122,10 @@ func (c *Client) NewClient(poolName string, modelName string) (*Client, error) {

// Find the OpenAI provider in the selected pool with the specified model
var selectedProvider *providers.Provider
for _, provider := range selectedPool.Providers {
for i := range selectedPool.Providers {
provider := &selectedPool.Providers[i]
if provider.Provider == providerName && provider.Model == modelName {
selectedProvider = &provider
selectedProvider = provider
break
}
}
Expand Down

0 comments on commit 4f9eda0

Please sign in to comment.