Description
Currently, the Platform
class does not provide a way to inject or reference a custom Contract
service. This limitation makes it impossible to use different contract implementations per platform when configuring the bundle in Symfony.
I would like to be able to define a custom Symfony service as the contract per platform definition in the bundle configuration.
Example YAML configuration:
llm_chain:
platforms:
openai:
api_key: '%env(OPENAI_API_KEY)%'
contract: '@my_custom_openai_contract_service'
azure_openai:
api_key: '%env(AZURE_OPENAI_API_KEY)%'
contract: '@my_custom_azure_contract_service'
Acceptance Criteria
- The Contract class should implement a ContractInterface
- Add support for a
contract
key under eachplatform
in the bundle configuration. - The
contract
key when not set must default tonull
- The
contract
key must accept a reference to a Symfony service implementing the requiredContractInterface
. - The configured contract service is injected into the corresponding Platform instance at runtime.
- Update documentation and example configs.