Skip to content

Allow custom Contract service injection in Platform class via bundle config #95

@llupa

Description

@llupa

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 each platform in the bundle configuration.
  • The contract key when not set must default to null
  • The contract key must accept a reference to a Symfony service implementing the required ContractInterface.
  • The configured contract service is injected into the corresponding Platform instance at runtime.
  • Update documentation and example configs.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions