Previously we were guessing the context window size here: https://github.com/zed-industries/zed/blob/8c3f09e31e3588a2494042dfe77bb3dccab1f7ba/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](https://github.com/ollama/ollama/blob/3d32249c749c6f77c1dc8a7cb55ae74fc2f4c08b/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 https://github.com/zed-industries/zed/blob/8c3f09e31e3588a2494042dfe77bb3dccab1f7ba/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