-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add ContractInterface
for more flexible normalizer configuration
#372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ContractInterface
for more flexible normalizer configuration
use PhpLlm\LlmChain\Platform\Bridge\Anthropic\Contract\MessageBagNormalizer; | ||
use PhpLlm\LlmChain\Platform\Bridge\Anthropic\Contract\ToolCallMessageNormalizer; | ||
use PhpLlm\LlmChain\Platform\Bridge\Anthropic\Contract\ToolNormalizer; | ||
use PhpLlm\LlmChain\Platform\Bridge\Anthropic\Contract\AnthropicSet as AnthropicContractSet; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the alias?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. Removed it.
/** | ||
* @author Denis Zunke <[email protected]> | ||
*/ | ||
final readonly class AnthropicSet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final readonly class AnthropicSet | |
final readonly class AnthropicDefaultContract |
final readonly class AnthropicSet | |
final readonly class AnthropicContract |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it is not a contract yet, hmm 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I have seen that there are Contract Builds that combine mixed model contract normalizers so my thought here was to give them as a "set" like rector is doing it for some tools. So you could combine the set. Maybe this is too much? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
dd80885
to
c5a5d9b
Compare
Looks great at the first glance - need to give it a proper read later - thanks already @DZunke! |
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
or, totally flexible:
Maybe this could be a way for more flexibility with the combination of non configurable normalizer and "unknown" message input?