mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:51:57 +00:00
Add unit test for modelconfig converting starcoder completion model (#64160)
There was some confusion about how a starcoder model would "come out" of the modelconfig system. Added a unit test and some clarifying comments to hopefully help out. ## Test plan Just add tests for the sake of clarifying the code. ## Changelog NA
This commit is contained in:
parent
84e28998e9
commit
3b3749f559
@ -398,4 +398,31 @@ func TestConvertCompletionsConfig(t *testing.T) {
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("Starcoder", func(t *testing.T) {
|
||||
compConfig := loadCompletionsConfig(schema.Completions{
|
||||
Provider: "sourcegraph",
|
||||
CompletionModel: "fireworks/starcoder",
|
||||
})
|
||||
require.NotNil(t, compConfig)
|
||||
|
||||
siteModelConfig, err := convertCompletionsConfig(compConfig)
|
||||
require.NoError(t, err)
|
||||
|
||||
// DefaultModels. Claude is used for chat, but the code completions were explicitly set
|
||||
// to StarCoder.
|
||||
require.NotNil(t, siteModelConfig.DefaultModels)
|
||||
assert.EqualValues(t, "anthropic::unknown::claude-3-sonnet-20240229", siteModelConfig.DefaultModels.Chat)
|
||||
assert.EqualValues(t, "fireworks::unknown::starcoder", siteModelConfig.DefaultModels.CodeCompletion)
|
||||
assert.EqualValues(t, "anthropic::unknown::claude-3-haiku-20240307", siteModelConfig.DefaultModels.FastChat)
|
||||
|
||||
// We set the modle's name to just "starcoder" because that's all the information we have
|
||||
// available. But on the Cody Gateway side, it is virtualized. And will actually use a
|
||||
// "real" model name like "starcoder2-7b" when resolving the request.
|
||||
//
|
||||
// See `pickStarCoderModel` in the Cody Gateway code.
|
||||
scModel := siteModelConfig.ModelOverrides[2]
|
||||
assert.EqualValues(t, "fireworks::unknown::starcoder", scModel.ModelRef)
|
||||
assert.EqualValues(t, "starcoder", scModel.ModelName)
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user