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
feat: open contract for more flexible normalizer configuration (#372)
Could fix part of #371 - the question for flexibility.
Why? Messages are given on platform calls and are given with the
`MessageInterface`. So it is very flexible what could be given on call.
Normalizers are only configured once, internally. So one side is highly
flexible, the other side not.
Giving the contract an interface allows creating own contracts with
whatever backed technology one wants. So more flexible. Additionally it
allows to add a contract that has an amount of normalizers one wants.
For making it easier i thought about having model contract sets. I did
it for anthropic, google and the platform itself.
So a custom contract could look like
```php
use PhpLlm\LlmChain\Platform\Bridge\OpenAI\PlatformFactory;
use PhpLlm\LlmChain\Platform\Contract;
$platform = PlatformFactory::create(
'my-api-key',
contract: Contract::create(new MyOwnMessageBagNormalizer(), new MyOwnMessageThingyNormalizer()),
);
```
or, totally flexible:
```php
use PhpLlm\LlmChain\Platform\Bridge\OpenAI\PlatformFactory;
$platform = PlatformFactory::create(
'my-api-key',
contract: new MyVeryOwnContractUtilizingJsonStreamer(),
);
```
Maybe this could be a way for more flexibility with the combination of
non configurable normalizer and "unknown" message input?
0 commit comments