-
-
Notifications
You must be signed in to change notification settings - Fork 140
[Platform] Centralize default model clients and converters for OpenAI based standards #938
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
Conversation
ef1d230 to
8d30c6a
Compare
|
Alternative namespace structure could be
|
750c161 to
6cfa831
Compare
6cfa831 to
2a92d13
Compare
This PR was merged into the main branch. Discussion ---------- Ease LiteLLM setup for examples | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | | License | MIT Trying to get this started as example for #938. `@welcoMattic` does that make sense to you? was just wondering if there's a different way than another postgres container Commits ------- 67637b9 Ease LiteLLM setup for examples
I like the current structure in the PR (and not the suggestion). Keep in mind, that the Completions API is "old" and the new Responses API would be the "next" one, that need to fit in the namespace structure. Perhaps it is easier to understand, if there is NO "Responses" folder directly in the platform component, because this sound very general. I would prefer ...
instead of...
Additionally, in the suggested approach all classes would have the same name again (without namespace), and when the namespaces are imported in the concrete implementations, it's not immediately clear which object is currently being used (#autocomplete). There are already issues related to "all classes have the same name" #926 I'm really looking forward to seeing this patch in the component :) - independent of the class name structure :) |
…ai embeddings- and completions-based platforms (chr-hertel) This PR was merged into the main branch. Discussion ---------- [Platform][Generic] Introduce generic platform for openai embeddings- and completions-based platforms | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | yes | Issues | Fix #114 | License | MIT Replaces #938 and unblocks #871 - diff looks a bit weird due to git mixing up removed classes and new generic bridge. - [x] Tests - [x] Docs - [x] Bundle This enables to use tools like Litellm without specific bridge with a configuration like this: ```yaml # config/packages/ai.yaml ai: platform: generic: litellm: base_url: '%env(LITELLM_HOST_URL)%' # e.g. http://localhost:4000 api_key: '%env(LITELLM_API_KEY)%' # e.g. sk-1234 model_catalog: 'Symfony\AI\Platform\Bridge\Generic\ModelCatalog' # see below agent: test: platform: 'ai.platform.generic.litellm' model: 'mistral-small-latest' tools: false services: Symfony\AI\Platform\Bridge\Generic\ModelCatalog: $models: mistral-small-latest: class: 'Symfony\AI\Platform\Bridge\Generic\CompletionsModel' capabilities: - !php/const 'Symfony\AI\Platform\Capability::INPUT_MESSAGES' - !php/const 'Symfony\AI\Platform\Capability::OUTPUT_TEXT' - !php/const 'Symfony\AI\Platform\Capability::OUTPUT_STREAMING' - !php/const 'Symfony\AI\Platform\Capability::OUTPUT_STRUCTURED' - !php/const 'Symfony\AI\Platform\Capability::INPUT_IMAGE' - !php/const 'Symfony\AI\Platform\Capability::TOOL_CALLING' ``` <img width="1216" height="635" alt="image" src="https://github.com/user-attachments/assets/7984afb3-40f9-454f-9d3d-6abdba1c828a" /> Commits ------- a42f298 Introduce generic platform for openai embeddings- and completions-based platforms
|
Closed in favor of #1052 |
We need a short term solution for this issue to unblock merging #871 without destroying a couple of bridges that are currently coupled to that "de facto standard" of OpenAI-based contracts.
This also will make it more obvious that our current ModelCatalog + Model class + neglected Capabilities need some love.
Introducing
Symfony\AI\Platform\Model\CompletionsModelandSymfony\AI\Platform\Model\EmbeddingsModelResultConverterInterfaceinto newSymfony\AI\ResultConverternamespaceModelClientInterfaceinto newSymfony\AI\ModelClientnamespaceSymfony\AI\Platform\ModelClient\CompletionsModelClientSymfony\AI\Platform\ModelClient\EmbeddingsModelClientSymfony\AI\Platform\ResultConverter\CompletionsResultConverterSymfony\AI\Platform\ResultConverter\EmbeddingsResultConverterLeads to removal of unspecific usage of OpenAI bridge implementations and basic Model subclasses in favor of specific ones if possible.