mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:31:43 +00:00
This PR sets the defaults for "Sourcegraph supplied LLM models".
## When will these "defaults" be used?
These models will _only_ be used IFF the Sourcegraph instance is
_explicitly_ using the newer "modelConfiguration" site configuration
data. (And opts into using Sourcegraph-supplied LLM models.)
If the Sourcegraph instance is using the older "completions"
configuration blob, then _only_ the user-supplied models will be used.
(Or, based on the specific defaults defined in the code for the
completions provider.)
## What about Cody Free or Cody Pro?
😬 yeah, we're going to need to deal with that later. Currently
Sourcegraph.com is _not_ using the newer "modelConfiguration" site
configuration, and instead we have some hacks in the code to ignore the
internal modelconfig. See this "super-shady hack":
|
||
|---|---|---|
| .. | ||
| BUILD.bazel | ||
| dotcom_models.go | ||
| main.go | ||
| providers.go | ||
| README.md | ||
| utils.go | ||
Cody Gateway Config
This tool generates the JSON ModelConfiguration data which describes the set of LLM models that Cody Gateway currently supports. This information is used by Sourcegraph instances so they can pick up on any new LLM models as they get released.
The output of this tool is a .json file which we check into this repo. It will
be embedded in Go binaries as a simple way of deploying the configuration blob.
Usage
# First do a dry run, and confirm any changes are reflected in the output.
go run ./cmd/cody-gateway-config -dry-run=true
# Run the tool and overwrite the existing file in your repo.
go run ./cmd/cody-gateway-config \
-dry-run=false \
-confirm-overwrite=true \
-output-file="./internal/modelconfig/embedded/models.json"
# Run the unit tests which among other things verifies that the static
# ModelConfiguration document is well-formed.
go test ./cmd/frontend/internal/modelconfig/...
go test ./internal/modelconfig/...
# And finally, rerun the `sg lint` command, to ensure it is formatted
# as expected.
sg lint --fix format