Skip to content

Commit 7646c4b

Browse files
committed
fix: ensure default model is parsed when using default model provider
When using the default model provider flag, the default model will be gpt-4o. However, when it is parsed, the expected format is 'gpt-4p from my-model-provider'. When using a default model provider, the 'gpt-4o' was being parsed and the model was set to the empty string. After this change, if the model name is empty after parsing, then we know that the model from the request doesn't have a 'from' in it and the first part of the split reference should be used. Signed-off-by: Donnie Adams <[email protected]>
1 parent 498381d commit 7646c4b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/remote/remote.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ func (c *Client) Call(ctx context.Context, messageRequest types.CompletionReques
5151
return nil, fmt.Errorf("failed to find remote model %s", messageRequest.Model)
5252
}
5353

54-
_, modelName := types.SplitToolRef(messageRequest.Model)
54+
toolName, modelName := types.SplitToolRef(messageRequest.Model)
55+
if modelName == "" {
56+
// modelName is empty, then the messageRequest.Model is not of the form 'modelName from provider'
57+
// Therefore, the modelName is the toolName
58+
modelName = toolName
59+
}
5560
messageRequest.Model = modelName
5661
return client.Call(ctx, messageRequest, status)
5762
}

0 commit comments

Comments
 (0)