Skip to content

[Platform] Add tooling support for ollama to allow agent and toolbox usage #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2025

Conversation

JoshuaBehrens
Copy link
Contributor

Q A
Bug fix? no
New feature? yes?
Docs? no
License MIT

Running a toolbox agent with ollama was not yet supported. This ensures, that tool messages and responses work with a locally hosted ollama instance. It seems not to be a fix as it was not meant to work and it is not really a mentionable feature as one could expect it to work like the others so I am not really sure to work where to add more content for humans. I tested it with the given new example in examples/ollama/toolcall.php.

A current design decision had me struggling a bit. I was not yet able to solve in a good way the fact, that ollama itself cannot claim every model to have tool support. So someone who uses a model needs to know before its usage whether it has model support. This can be queried easily but the capabilities are part of the model, that you need to create before using the platform to query in the name of the model. So this is like hen-egg. If the model itself would not know its capabilities but there is a service, that has model and platform at hand, could evaluate it (and cache it). Is this something we want to establish?

Possible query:

curl http://localhost:11434/api/chat -d '{
  "model": "llama3:8b-instruct-q6_K",
  "tools": [{}],
  "stream": false
}'
{"error":"llama3:8b-instruct-q6_K does not support tools"}

@JoshuaBehrens JoshuaBehrens force-pushed the feature/ollama-tool-support branch from 18409bb to e89ead3 Compare July 26, 2025 18:22
@OskarStark OskarStark added the Platform Issues & PRs about the AI Platform component label Jul 26, 2025
@chr-hertel chr-hertel changed the title Add tooling support for ollama to allow agent and toolbox usage [Platform] Add tooling support for ollama to allow agent and toolbox usage Jul 27, 2025
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I general this looks pretty clean and not like your first contribution here - thanks kicking this off - great work!

I made a few comments - can see where your thoughts are coming from - this is between those axis in Platform - working with two bridges.

And rolling out tool calling support to more bridges is def a new feature 👍

Copy link
Contributor Author

@JoshuaBehrens JoshuaBehrens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I general this looks pretty clean and not like your first contribution here - thanks kicking this off - great work!

ty :) likely not my last one. already looking into ollama embeddings

And rolling out tool calling support to more bridges is def a new feature 👍

anything more you need to have written out for a zero-ver? :D

@chr-hertel
Copy link
Member

Please rebase on main and adopt the changed test style, switching from #[Test] attribute to test method prefix, see #214.

@Kocal Kocal added Agent Issues & PRs about the AI Agent component and removed Agent Issues & PRs about the AI Agent component labels Jul 27, 2025
@JoshuaBehrens JoshuaBehrens force-pushed the feature/ollama-tool-support branch from e89ead3 to 22509a7 Compare July 27, 2025 19:31
@JoshuaBehrens
Copy link
Contributor Author

I rebased, changed the test and renamed the class. Anything more :) ?

@JoshuaBehrens JoshuaBehrens force-pushed the feature/ollama-tool-support branch 2 times, most recently from 341184a to bbca652 Compare July 28, 2025 00:40
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This! Looks! Great! :)

I believe your regex model work deserves some simple unit testing, but will give it a local test already

@chr-hertel
Copy link
Member

Tested with mistral, deepseek and llama - works 👍

@JoshuaBehrens
Copy link
Contributor Author

Great I will fix phpstan, rebase and we can get this merged. The new pull request for the model usage can follow after that :)

@chr-hertel
Copy link
Member

And that unit test for Symfony\AI\Platform\Bridge\Ollama\Ollama please :)

@JoshuaBehrens JoshuaBehrens force-pushed the feature/ollama-tool-support branch 4 times, most recently from b60271b to 4db83e7 Compare July 30, 2025 11:27
@JoshuaBehrens
Copy link
Contributor Author

Sorry for the repetetive pushes. fabpot had some remarks I was not aware of. Especially this is confusing in the config:
grafik
grafik
At one part the suggestion is to have a FQCN on global functions and in another place they don't.

Apart from that I should not have any open tasks on this pull request

@OskarStark
Copy link
Contributor

At one part the suggestion is to have a FQCN on global functions and in another place they don't.

We only use the one which have an optimized usage afterwards, but yes, sometimes its hard to guess :-)

@OskarStark OskarStark requested a review from chr-hertel July 30, 2025 11:52
@JoshuaBehrens JoshuaBehrens force-pushed the feature/ollama-tool-support branch 2 times, most recently from 82da054 to 983ee7a Compare July 30, 2025 12:49
@chr-hertel chr-hertel force-pushed the feature/ollama-tool-support branch from 983ee7a to 8201f6b Compare July 30, 2025 12:54
@chr-hertel
Copy link
Member

Thank you @JoshuaBehrens.

@chr-hertel chr-hertel merged commit edf2f33 into symfony:main Jul 30, 2025
11 of 12 checks passed
@JoshuaBehrens JoshuaBehrens deleted the feature/ollama-tool-support branch July 30, 2025 13:04
@JoshuaBehrens
Copy link
Contributor Author

Thank you for the good exchange and merge :) next pull requests are in the making

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform Issues & PRs about the AI Platform component Status: Needs Work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants