zed/crates/language_models
Bennet Bo Fenner 3d5ddcccf0
ollama: Resolve context window size via API (#39941)
Previously we were guessing the context window size here:
8c3f09e31e/crates/ollama/src/ollama.rs (L22)

This is inaccurate and must be updated manually. This PR ensures that we
extract the context window size from the request in the same way that
the Ollama CLI does when running `ollama show <model-name>` (Relevant
code is
[here](3d32249c74/cmd/cmd.go (L860)))

The format looks like this:

```json
{
  "model_info": {
    "general.architecture": "llama",
    "llama.context_length": 132000
  }
}
```

Once this PR is merged we could technically remove the old code
8c3f09e31e/crates/ollama/src/ollama.rs (L22)
I decided to keep it for now, as it is unclear if the necessary fields
are available via the API on older Ollama versions.

Release Notes:

- Fixed an issue where Ollama models would use the wrong context window
size
2025-10-10 12:59:52 +00:00
..
src ollama: Resolve context window size via API (#39941) 2025-10-10 12:59:52 +00:00
Cargo.toml provider configuration: Use SingleLineInput instead of Editor (#38814) 2025-09-25 22:38:27 +00:00
LICENSE-GPL Add language_models crate to house language model providers (#20945) 2024-11-20 18:49:34 -05:00