mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-06-30 10:09:19 -04:00
53 lines
1.3 KiB
TOML
53 lines
1.3 KiB
TOML
schema_version = 1
|
|
|
|
name = "Ollama Base Chat"
|
|
description = "Ollama native /api/chat request body. Abstract — extend it and set model."
|
|
abstract = true
|
|
|
|
provider_instance = "Ollama (Native)"
|
|
endpoint = "/api/chat"
|
|
|
|
[body]
|
|
stream = true
|
|
messages = """
|
|
[
|
|
{% if existsIn(ctx, "system_prompt") %}
|
|
{ "role": "system", "content": {{ tojson(ctx.system_prompt) }} },
|
|
{% endif %}
|
|
{% for msg in ctx.history %}
|
|
{% set tcalls = filter_by_type(msg.content_blocks, "tool_use") %}
|
|
{% set tresults = filter_by_type(msg.content_blocks, "tool_result") %}
|
|
{% if length(tresults) > 0 %}
|
|
{% for b in tresults %}
|
|
{
|
|
"role": "tool",
|
|
"content": {{ tojson(b.content) }}
|
|
{% if b.name != "" %}
|
|
, "tool_name": {{ tojson(b.name) }}
|
|
{% endif %}
|
|
},
|
|
{% endfor %}
|
|
{% else %}
|
|
{
|
|
"role": {{ tojson(msg.role) }},
|
|
"content": {{ tojson(msg.content) }}
|
|
{% if length(tcalls) > 0 %}
|
|
, "tool_calls": [
|
|
{% for b in tcalls %}
|
|
{ "type": "function", "function": { "name": {{ tojson(b.name) }}, "arguments": {{ tojson(b.input) }} } },
|
|
{% endfor %}
|
|
]
|
|
{% endif %}
|
|
{% if existsIn(msg, "images") %}
|
|
, "images": [
|
|
{% for img in msg.images %}
|
|
{{ tojson(img.data) }},
|
|
{% endfor %}
|
|
]
|
|
{% endif %}
|
|
},
|
|
{% endif %}
|
|
{% endfor %}
|
|
]
|
|
"""
|