[GH-ISSUE #13148] Add ToolCalls to ChatResponse #34456

Closed
opened 2026-04-22 18:03:31 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @seven1240 on GitHub (Nov 19, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/13148

Hi,

This is great but I found a problem:

ChatResponse has no ToolCalls, while ChatRequest has Tools

GenerateResponse has ToolCalls, but GenerateRequest has no Tools

How to call Generate or Chat with ToolCalls? Thanks.

Originally created by @seven1240 on GitHub (Nov 19, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/13148 Hi, This is great but I found a problem: ChatResponse has no ToolCalls, while ChatRequest has Tools GenerateResponse has ToolCalls, but GenerateRequest has no Tools How to call Generate or Chat with ToolCalls? Thanks.
GiteaMirror added the feature request label 2026-04-22 18:03:31 -05:00
Author
Owner

@rick-github commented on GitHub (Nov 19, 2025):

The generate endpoint doesn't support tools. See here for an example of using tools with the chat endpoint.

<!-- gh-comment-id:3552168401 --> @rick-github commented on GitHub (Nov 19, 2025): The generate endpoint doesn't support tools. See [here](https://github.com/ollama/ollama/blob/main/docs/api.md#chat-request-streaming-with-tools) for an example of using tools with the chat endpoint.
Author
Owner

@seven1240 commented on GitHub (Nov 20, 2025):

The generate endpoint doesn't support tools. See here for an example of using tools with the chat endpoint.

Thanks for the Answer, but the ChatResponse struct has no ToolCalls field, can you add that, or need a PR ?

<!-- gh-comment-id:3555606106 --> @seven1240 commented on GitHub (Nov 20, 2025): > The generate endpoint doesn't support tools. See [here](https://github.com/ollama/ollama/blob/main/docs/api.md#chat-request-streaming-with-tools) for an example of using tools with the chat endpoint. Thanks for the Answer, but the ChatResponse struct has no ToolCalls field, can you add that, or need a PR ?
Author
Owner

@rick-github commented on GitHub (Nov 20, 2025):

Why? What are you trying to achieve?

<!-- gh-comment-id:3558316466 --> @rick-github commented on GitHub (Nov 20, 2025): Why? What are you trying to achieve?
Author
Owner

@seven1240 commented on GitHub (Nov 21, 2025):

Why? What are you trying to achieve?

Sorry, I didn't mention I was trying to use https://github.com/ollama/ollama/tree/main/api

I use the following code the Find out ToolCalls from the ChatResponse, or is there any easier way to do this?

	respFunc := func(resp api.ChatResponse) error {
		log.Info("response", resp)
                 // I want to get ToolsCalls from resp here ....
	}

	go func() {
		err := client.Chat(context.Background(), request, respFunc)
<!-- gh-comment-id:3560962597 --> @seven1240 commented on GitHub (Nov 21, 2025): > Why? What are you trying to achieve? Sorry, I didn't mention I was trying to use https://github.com/ollama/ollama/tree/main/api I use the following code the Find out ToolCalls from the ChatResponse, or is there any easier way to do this? ``` respFunc := func(resp api.ChatResponse) error { log.Info("response", resp) // I want to get ToolsCalls from resp here .... } go func() { err := client.Chat(context.Background(), request, respFunc) ```
Author
Owner

@rick-github commented on GitHub (Nov 21, 2025):

	respFunc := func(resp api.ChatResponse) error {
		log.Info("response", resp)
		toolCalls := resp.Message.ToolCalls
	}

	go func() {
		err := client.Chat(context.Background(), request, respFunc)
<!-- gh-comment-id:3563066628 --> @rick-github commented on GitHub (Nov 21, 2025): ```go respFunc := func(resp api.ChatResponse) error { log.Info("response", resp) toolCalls := resp.Message.ToolCalls } go func() { err := client.Chat(context.Background(), request, respFunc) ```
Author
Owner

@seven1240 commented on GitHub (Nov 23, 2025):

Indeed, it works, thanks.

<!-- gh-comment-id:3567559458 --> @seven1240 commented on GitHub (Nov 23, 2025): Indeed, it works, thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#34456