You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several integrations inherit from OpenAIChatGenerator.
Currently, the base class calls some functions defined at the module level (e.g. _convert_chat_completion_to_chat_message, _convert_chat_completion_chunk_to_streaming_chunk, ...).
This makes it hard for subclasses to customize specific parts and leads to significant code duplication; in addition, the integration implementing this duplicate logic is also forced to test it, so this also costs unnecessary CI runs.
If they were methods of OpenAIChatGenerator, it would be much easier to override them and avoid duplication.
Some integrations worth investigating: Mistral, OpenRouter, STACKIT.
Since some integrations already import these functions, we cannot easily delete them, so an idea might be just exposing them as (static) methods:
The exact design needs investigation, as there could be additional extension points worth introducing.
The goal would be letting integrations customize provider-specific behaviors but reusing more of the parent logic: less duplication and testing of copied code.
👋 Hello there! This issue will be handled internally and isn't open for external contributions. If you'd like to contribute, please take a look at issues labeled contributions welcome or good first issue. We'd really appreciate it!
Activity
[-]# Make `OpenAIChatGenerator` easier to extend[/-][+]Make `OpenAIChatGenerator` easier to extend[/+]