[GH-ISSUE #7510] Add support for function call (response back) (message.role=tool) #66833

Open
opened 2026-05-04 08:18:40 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @rogerbarreto on GitHub (Nov 5, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7510

Add support for function call (response back)

  1. Currently there's no support for sending back the function call result to the model using the role=tool messages.
  2. Using the native API (not openai), function tool calls don't have an identifier associated tool_call_id, this is present in the openai API, and is important to be available on both APIs.

Important

This ID is very when providing the result back to the model (in a chat history where the same function was invoked multiple times in a chat history with different results) for the model to reason about.

image

Originally created by @rogerbarreto on GitHub (Nov 5, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7510 # Add support for function call (response back) 1. Currently there's no support for sending back the function call result to the model using the `role=tool` messages. 2. Using the native API (not openai), function tool calls don't have an identifier associated `tool_call_id`, this is present in the `openai` API, and is important to be available on both APIs. > [!IMPORTANT] > This ID is very when providing the result back to the model (in a chat history where the same function was invoked multiple times in a chat history with different results) for the model to reason about. ![image](https://private-user-images.githubusercontent.com/175953664/375331649-63b89254-3e2a-41e4-89dc-1b0fa5a675bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzA4MTI3ODIsIm5iZiI6MTczMDgxMjQ4MiwicGF0aCI6Ii8xNzU5NTM2NjQvMzc1MzMxNjQ5LTYzYjg5MjU0LTNlMmEtNDFlNC04OWRjLTFiMGZhNWE2NzViZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMTA1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MTEwNVQxMzE0NDJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01YWVhMmY4YTQ3MjJjNjZiYTAzMmJiNGM0ZDNhMWNkNmMzZGYzNWE4M2RlZTBlYjBjYmJiMDBkZDY0NmZiYTRjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.l4MCxuSbdUftdj4wx5hWLP63e16PNn6zNb9fZaFsoIQ)
GiteaMirror added the feature requestapi labels 2026-05-04 08:18:41 -05:00
Author
Owner

@rick-github commented on GitHub (Nov 5, 2024):

Broken image link.

Function call results can use role=tool if the template supports it, eg {{- else if eq .Role "tool" }} in the llama3.2 template.

The tool id would be nice to have, in practice I haven't found it an issue, probably because in my use cases, the completion contains only one or two tool calls.

<!-- gh-comment-id:2457331170 --> @rick-github commented on GitHub (Nov 5, 2024): Broken image link. Function call results can use `role=tool` if the template supports it, eg `{{- else if eq .Role "tool" }}` in the [llama3.2 template](https://ollama.com/library/llama3.2/blobs/966de95ca8a6). The tool id would be nice to have, in practice I haven't found it an issue, probably because in my use cases, the completion contains only one or two tool calls.
Author
Owner

@toomeenoo commented on GitHub (Dec 6, 2024):

Hi, any update on this?

I have probably the same issue, using default models (templates) provided with models by ollama.

Using the native API, role=tool response message are present in history, but multiple tried models (lama3.1, qwen2.5), are responding that they don't see tool response, when asked. Unless provided with comment as role=user, which should not be the correct way.

(Tested models are able to make valid tool calls)

Thanks in advance.

<!-- gh-comment-id:2523833386 --> @toomeenoo commented on GitHub (Dec 6, 2024): Hi, any update on this? I have probably the same issue, using default models (templates) provided with models by ollama. Using the native API, `role=tool` response message are present in history, but multiple tried models (lama3.1, qwen2.5), are responding that they don't see tool response, when asked. Unless provided with comment as `role=user`, which should not be the correct way. (Tested models are able to make valid tool calls) Thanks in advance.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#66833