[Platform][Ollama] Add support for generation endpoint#1762
Conversation
f387b67 to
9d53fb5
Compare
|
Was working perfectly yesterday, I'll take a look at it tomorrow |
|
Found the issue, the |
9d53fb5 to
5e7d7df
Compare
|
@chr-hertel Fixed, examples are working like a charm now thanks to the new |
30ef6c1 to
f32de29
Compare
5fdce7f to
12b01f7
Compare
12b01f7 to
fe20df7
Compare
e64d0ef to
ea72901
Compare
…kingone) This PR was merged into the main branch. Discussion ---------- [Platform][Ollama] Remove prefix for ScopingHttpClient | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | yes | Issues | Discussed in #1762 (comment). | License | MIT Commits ------- 7c1024a refactor(ollama): remove prefix for ScopingHttpClient
ea72901 to
7ebe685
Compare
04b6699 to
e56eb4a
Compare
|
@chr-hertel I updated the PR following the one you merged, same for tests, ready for review when you have time 🙂 |
ff9a46f to
a034898
Compare
b1f52ec to
2476e26
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the Platform’s Ollama bridge to support the /api/generate text-generation endpoint (including streaming), updates capability detection from the Ollama model catalog, and adds new documentation/examples while increasing PHPStan strictness for the bridge.
Changes:
- Add
/api/generatehandling in the Ollama client and result converter (plus related tests). - Expand model capability mapping (including new
Capability::OUTPUT_EMBEDDINGS) and adjust catalog tests. - Add Ollama-specific docs and runnable examples; raise Ollama bridge PHPStan level to 10.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| src/platform/src/Capability.php | Adds OUTPUT_EMBEDDINGS capability; minor comment normalization. |
| src/platform/src/Bridge/Ollama/phpstan.dist.neon | Raises PHPStan level from 6 to 10 for the Ollama bridge. |
| src/platform/src/Bridge/Ollama/TokenUsageExtractor.php | Tightens token usage extraction to require integer counts. |
| src/platform/src/Bridge/Ollama/OllamaResultConverter.php | Routes conversion based on endpoint URL; adds generate + improved streaming handling. |
| src/platform/src/Bridge/Ollama/OllamaClient.php | Introduces generation requests and refactors chat/embed request payload construction. |
| src/platform/src/Bridge/Ollama/OllamaPayload.php | New helper for distinguishing generation vs completion payload shapes. |
| src/platform/src/Bridge/Ollama/ModelCatalog.php | Revises mapping from Ollama API “capabilities” to Platform Capability set. |
| src/platform/src/Bridge/Ollama/Tests/OllamaResultConverterTest.php | Adds generation + endpoint-aware conversion tests; adjusts streaming/vector tests. |
| src/platform/src/Bridge/Ollama/Tests/OllamaClientTest.php | Updates request URL expectations and adds generation coverage. |
| src/platform/src/Bridge/Ollama/Tests/ModelCatalogTest.php | Updates/expands expected capabilities and renames the test class. |
| src/platform/src/Bridge/Ollama/CHANGELOG.md | Documents /api/generate support under 0.9. |
| examples/ollama/text-generation.php | New basic text generation example. |
| examples/ollama/text-generation-as-stream.php | New streaming text generation example. |
| examples/ollama/text-generation-structured-output-math.php | New structured output example for generation. |
| docs/components/platform/ollama.rst | New end-user documentation page for the Ollama bridge. |
2476e26 to
2cb53f5
Compare
|
@OskarStark Fixes applied on Copilot review, totally forgot about the new public API for the platform, sorry 😅 |
…kingone) This PR was merged into the main branch. Discussion ---------- [Platform][Ollama] Remove prefix for ScopingHttpClient | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | yes | Issues | Discussed in symfony/ai#1762 (comment). | License | MIT Commits ------- 7c1024a0 refactor(ollama): remove prefix for ScopingHttpClient
2cb53f5 to
fa47ad7
Compare
|
This really got me thinking ... do we want to provide all kind of endpoint per provider/bridge? yes, i agree nowadays on that :D with all bridges, and especially ModelClient implementations, that gets messy tho. i was tinkering around a bit with claude about that topic, and we ended up with #2029 don't think all the naming is great, and the PR needs slicing down, but was curious what you think about that? |
|
Hi @chr-hertel #2029 make sense, especially the "per endpoint split" plus it could open the door for a better separation between HTTP handling and websockets (huge part for certain bridges), it could also ease the maintenance of "per endpoint" bugs / improvements, a huge win for future bridges / features IMHO 🤔 |
fa47ad7 to
ad18673
Compare
|
@chr-hertel Saw that |
ad18673 to
55ada32
Compare

/api/generateendpoint10(a few issues were detected)