Add custom Contract service injection support for Platform configurations #96
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements support for injecting custom Contract services into Platform instances via bundle configuration, enabling platform-specific customization of request/response handling, authentication, and other contract logic.
Changes
Core Implementation
ContractInterface
- New interface that custom contract services must implement for type safetycontract
key to all platform configurations (anthropic, azure, google, openai, mistral, openrouter)ContractInterface
for automatic service discoveryConfiguration Example
Key Features
null
, existing configurations work unchangedContractInterface
@service_name
)Usage
ContractInterface
llm_chain.platform.contract
tag)contract: '@your_service_name'
Testing
Documentation
Fixes #95.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/OskarStark/enum-helper/zipball/adccc8c099db61cb26497a1e1987fc95ebda02a9
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/eea219a577085bd13ff0cb644a422c20798316c7
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963
/usr/bin/php8.3 -n -c /tmp/QkJ5qa /usr/bin/composer install
(http block)/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/php-llm/llm-chain/zipball/dbd6ff8e728a2736cd2b4f49b3e272ec82225824
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/92dde6a5919e34835c506ac8c523ef095a95ed62
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/679e3ce485b99e84c775d28e2e96fade9a7fb50a
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9b30d6fd026b2c132b3985ce6b23bec09ab3aa68
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/type/zipball/a8a7e30534b0eb0c77cd9d07e82de1a114389f5e
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/clock/zipball/b81435fbd6648ea425d1ee96a2d8e68f4ceacd24
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
/usr/bin/php8.3 -n -c /tmp/QkJ5qa /usr/bin/composer install
(http block)/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/http-client-contracts/zipball/75d7043853a42837e68111812f4d964b01e5101c
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/http-client/zipball/57e4fb86314015a695a750ace358d07a7e37b8a9
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/polyfill-uuid/zipball/21533be36c24be3f4b1669c4725c7d1d2bab4ae2
/usr/bin/php8.3 -n -c /tmp/QkJ5qa /usr/bin/composer install
(http block)/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/property-access/zipball/3bcf43665d6aff90547b005348e1e351f4e2174b
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/property-info/zipball/200d230d8553610ada73ac557501dc4609aad31f
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/serializer/zipball/2d86f81b1c506d7e1578789f93280dab4b8411bb
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/string/zipball/f3570b8c61ca887a9e2938e85cb6458515d2b125
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/type-info/zipball/bc9af22e25796d98078f69c0749ab3a9d3454786
/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/symfony/uid/zipball/7beeb2b885cd584cd01e126c5777206ae4c3c6a3
/usr/bin/php8.3 -n -c /tmp/QkJ5qa /usr/bin/composer install
(http block)/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991
/usr/bin/php8.3 -n -c /tmp/QkJ5qa /usr/bin/composer install
(http block)/usr/bin/php8.3 -n -c /tmp/keoyLK /usr/bin/composer install --no-interaction
(http block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.