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 llm.model in llm_models.stdout %}
{% if "chat" in llm.purpose %} {% 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 }}" model = "{{ llm.model }}"
timeout_secs = 3600 # 1 hour, default is 120 (2 minutes), issue happens between 5 and 6 minutes though. timeout_secs = 3600 # 1 hour, default is 120 (2 minutes), issue happens between 5 and 6 minutes though.
context_window = {{ [llm.context] | min | int }} context_window = {{ [llm.context] | min | int }}
max_tokens = {{ [(llm.context / 8)] | min | int }} max_tokens = {{ [(llm.context / 8), 16000] | min | int }}
{% endif %} {% endif %}
{% endif %} {% endif %}
@@ -865,19 +867,22 @@
{% if llm.model in llm_models.stdout %} {% if llm.model in llm_models.stdout %}
{% if "code" in llm.purpose %} {% 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 provider: ollama
model: {{ llm.model }} model: {{ llm.model }}
defaultCompletionOptions: defaultCompletionOptions:
contextLength: {{ [llm.context] | min | int }} 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 provider: ollama
model: {{ llm.model }} model: {{ llm.model }}
defaultCompletionOptions: defaultCompletionOptions:
contextLength: {{ [llm.context] | min | int }} contextLength: {{ [llm.context] | min | int }}
maxTokens: {{ [4000] | min | int }} maxTokens: {{ [(llm.context / 8), 4000] | min | int }}
roles: roles:
- autocomplete - autocomplete
@@ -918,10 +923,10 @@
}, },
"timeout": 600000, "timeout": 600000,
"streamIdleTimeoutMs": 600000, "streamIdleTimeoutMs": 600000,
"contextWindowSize": {{ llm.context }}, "contextWindowSize": {{ [llm.context] | min | int }},
"maxRetries": 3, "maxRetries": 3,
"samplingParams": { "samplingParams": {
"max_tokens": 8000 "max_tokens": {{ [(llm.context / 8), 16000] | min | int }}
,"temperature": 0.7 ,"temperature": 0.7
} }
} }