Skip to content

Conversation

@Dominic-Wagner
Copy link
Contributor

@Dominic-Wagner Dominic-Wagner commented Oct 23, 2025

Q A
Bug fix? no
New feature? yes
Docs? no
Issues Fix #806
License MIT

This PR adds the processing of ToolCalls to the convertStream function within the OllamaResultConverter.
Currently, no processing of ToolCalls is done, and Tool Calls are handed to the StreamResult as a OIllamaMessageChunk instead of returning a ToolCallResult.

@carsonbot carsonbot added Bug Something isn't working Platform Issues & PRs about the AI Platform component Status: Needs Review labels Oct 23, 2025
@carsonbot carsonbot changed the title [platform] add ollama toolcall support for streaming [Platform] add ollama toolcall support for streaming Oct 23, 2025
@OskarStark
Copy link
Contributor

Needs tests and an example in examples/ folder please

@Dominic-Wagner
Copy link
Contributor Author

Dominic-Wagner commented Oct 23, 2025

@OskarStark
I've added an example to the example folder.
But i'm unable to provide tests for the convertStream()-function.
The current tests for streaming for ollama only support a check for the first convert()-function, which returns a StreamResult.

The convertStream function only gets testet when we try to get the chunks:

foreach ($result->getContent() as $chunk) {
     $chunks[] = $chunk;
}

I suspect because of the created EventSourceHttpClient we get the following error.

TypeError: Symfony\Component\HttpClient\Response\AsyncResponse::stream(): Argument #1 ($responses) must be of type Traversable|array, Symfony\Component\HttpClient\Response\MockResponse given, called in /home/dominic/ai/src/platform/vendor/symfony/http-client/AsyncDecoratorTrait.php on line 39

I can't find an example for this type of Mocking neither within the existing tests for other ResultConverter which support ToolCalls in Streams as DeepSeek, Mistral or Anthropic nor in the MockHttpClient docs.

@chr-hertel chr-hertel removed the Bug Something isn't working label Oct 23, 2025
@chr-hertel chr-hertel force-pushed the ollama_stream_toolcalls branch from b13d8a2 to 6a9eb70 Compare October 23, 2025 18:42
@chr-hertel chr-hertel added the Feature New feature label Oct 23, 2025
@chr-hertel
Copy link
Member

Thank you @Dominic-Wagner.

@chr-hertel chr-hertel merged commit 07603cf into symfony:main Oct 23, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature Platform Issues & PRs about the AI Platform component Status: Reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Platform] Ollama streaming not working with toolcalls.

4 participants