llm, handle max_tokens a little more dynamically, likely only affects the smaller models.

This commit is contained in:
me
2026-10-16 09:46:46 -07:00
parent bedfbe566d
commit 6a446a8383
+13 -8
View File
@@ -832,11 +832,13 @@
{% if llm.model in llm_models.stdout %}
{% if "chat" in llm.purpose %}
[providers.models.ollama.{{ llm.provider }}]
[providers.models.ollama.{{ llm.provider }}_{{ 'CODE' if "code" in llm.purpose else 'CHAT'
}}{{ '' if llm.model in llm_models.stdout else '-MISSING'
}}]
model = "{{ llm.model }}"
timeout_secs = 3600 # 1 hour, default is 120 (2 minutes), issue happens between 5 and 6 minutes though.
context_window = {{ [llm.context] | min | int }}
max_tokens = {{ [(llm.context / 8)] | min | int }}
max_tokens = {{ [(llm.context / 8), 16000] | min | int }}
{% endif %}
{% endif %}
@@ -865,19 +867,22 @@
{% if llm.model in llm_models.stdout %}
{% if "code" in llm.purpose %}
- name: {{ llm.provider }}_CHAT
- name: {{ llm.provider }}_{{ 'CODE' if "code" in llm.purpose else 'CHAT'
}}{{ '' if llm.model in llm_models.stdout else '-MISSING'
}}
provider: ollama
model: {{ llm.model }}
defaultCompletionOptions:
contextLength: {{ [llm.context] | min | int }}
maxTokens: {{ [16000] | min | int }}
maxTokens: {{ [(llm.context / 8), 16000] | min | int }}
- name: {{ llm.provider }}_AUTO
- name: {{ llm.provider }}_AUTO{{ '' if llm.model in llm_models.stdout else '-MISSING'
}}
provider: ollama
model: {{ llm.model }}
defaultCompletionOptions:
contextLength: {{ [llm.context] | min | int }}
maxTokens: {{ [4000] | min | int }}
maxTokens: {{ [(llm.context / 8), 4000] | min | int }}
roles:
- autocomplete
@@ -918,10 +923,10 @@
},
"timeout": 600000,
"streamIdleTimeoutMs": 600000,
"contextWindowSize": {{ llm.context }},
"contextWindowSize": {{ [llm.context] | min | int }},
"maxRetries": 3,
"samplingParams": {
"max_tokens": 8000
"max_tokens": {{ [(llm.context / 8), 16000] | min | int }}
,"temperature": 0.7
}
}