-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Add component config support #4757
Conversation
def _to_config(self) -> Config:
return Config(value=self.value)
@classmethod
def _from_config(cls, config: Config) -> MyComponent:
return cls(value=config.value) This returns a Pydantic basemodel, but as we discussed earlier Component types might be an implementation detail. @jackgerrits @victordibia let's discuss this so we have a coherent way across configs and states. |
These are only ever called as part of the framework so it is safe to use full types here |
I think the distinction between config and state is an important one. I added a section in the docs about it with my take but I think we should talk more about it!
|
...n/packages/autogen-core/docs/src/user-guide/core-user-guide/framework/component-config.ipynb
Outdated
Show resolved
Hide resolved
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.
Created a separate PR for the ChatCompletionClient argument list: #4774
@jackgerrits Some solutions
|
Pydantic loosened their requirements of naming in 2.10, so we now require >=2.10 for pydantic to avoid these warnings. See this PR: #4811 The warnings all go away with that version, you might need to |
Ah .. got it! |
Component config adds a generic way for classes to opt in to being declaratively specified.
For example:
An example component config json:
Which is a dump of: