Skip to content

Commit

Permalink
Merge pull request #800 from ibuildthecloud/asterick
Browse files Browse the repository at this point in the history
bug: fix default model provider
  • Loading branch information
ibuildthecloud authored Aug 15, 2024
2 parents 91a5df6 + 2e75740 commit 9ea9b9c
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions pkg/remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type Client struct {
clientsLock sync.Mutex
cache *cache.Client
clients map[string]clientInfo
modelToProvider map[string]string
runner *runner.Runner
envs []string
credStore credentials.CredentialStore
Expand All @@ -39,17 +38,13 @@ func New(r *runner.Runner, envs []string, cache *cache.Client, credStore credent
envs: envs,
credStore: credStore,
defaultProvider: defaultProvider,
modelToProvider: make(map[string]string),
clients: make(map[string]clientInfo),
}
}

func (c *Client) Call(ctx context.Context, messageRequest types.CompletionRequest, status chan<- types.CompletionStatus) (*types.CompletionMessage, error) {
c.clientsLock.Lock()
provider, ok := c.modelToProvider[messageRequest.Model]
c.clientsLock.Unlock()

if !ok {
_, provider := c.parseModel(messageRequest.Model)
if provider == "" {
return nil, fmt.Errorf("failed to find remote model %s", messageRequest.Model)
}

Expand Down Expand Up @@ -108,10 +103,6 @@ func (c *Client) Supports(ctx context.Context, modelString string) (bool, error)
return false, err
}

c.clientsLock.Lock()
defer c.clientsLock.Unlock()

c.modelToProvider[modelString] = providerName
return true, nil
}

Expand Down

0 comments on commit 9ea9b9c

Please sign in to comment.