Ollama max_tokens settings (#17025)
- Support `available_models` for Ollama - Clamp default max tokens (context length) to 16384. - Add documentation for ollama context configuration.
This commit is contained in:
parent
d401ab1efc
commit
b62e63349b
5 changed files with 92 additions and 35 deletions
|
@ -152,6 +152,7 @@ pub struct AnthropicSettingsContentV1 {
|
|||
pub struct OllamaSettingsContent {
|
||||
pub api_url: Option<String>,
|
||||
pub low_speed_timeout_in_seconds: Option<u64>,
|
||||
pub available_models: Option<Vec<provider::ollama::AvailableModel>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema)]
|
||||
|
@ -276,6 +277,9 @@ impl settings::Settings for AllLanguageModelSettings {
|
|||
anthropic.as_ref().and_then(|s| s.available_models.clone()),
|
||||
);
|
||||
|
||||
// Ollama
|
||||
let ollama = value.ollama.clone();
|
||||
|
||||
merge(
|
||||
&mut settings.ollama.api_url,
|
||||
value.ollama.as_ref().and_then(|s| s.api_url.clone()),
|
||||
|
@ -288,6 +292,10 @@ impl settings::Settings for AllLanguageModelSettings {
|
|||
settings.ollama.low_speed_timeout =
|
||||
Some(Duration::from_secs(low_speed_timeout_in_seconds));
|
||||
}
|
||||
merge(
|
||||
&mut settings.ollama.available_models,
|
||||
ollama.as_ref().and_then(|s| s.available_models.clone()),
|
||||
);
|
||||
|
||||
// OpenAI
|
||||
let (openai, upgraded) = match value.openai.clone().map(|s| s.upgrade()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue