Skip to content
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

[Feature Request]: Support for Loading response_format as a Pydantic Model from Configuration Files #152

Open
sternakt opened this issue Dec 5, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@sternakt
Copy link
Collaborator

sternakt commented Dec 5, 2024

Is your feature request related to a problem? Please describe.

Currently, when loading configurations using config_list_from_json, the response_format must be dynamically added to each configuration in the code. For example:

config_list = autogen.config_list_from_json(
    "OAI_CONFIG_LIST",
    filter_dict={
        "model": ["gpt-4o", "gpt-4o-mini"],
    },
)

for config in config_list:
    config["response_format"] = MathReasoning

While this approach works, it would be beneficial to explore whether response_format could be specified directly in the configuration file.

Describe the solution you'd like

We could support defining and generating a Pydantic model from JSON schema when response_format is provided in the configuration file.

Tools like [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator) exist for generating Pydantic models dynamically, we could use something like that.

Additional context

Only consideration is the feasibility of defining and generating a Pydantic model from JSON schema when response_format is provided in the configuration file. This functionality was discussed before in Pydantic, but implementing it was deferred at that time.

@sternakt sternakt added the enhancement New feature or request label Dec 5, 2024
@sternakt sternakt self-assigned this Dec 5, 2024
@ohdearquant
Copy link
Collaborator

ohdearquant commented Dec 5, 2024

@sternakt i like this, can you load validator from schema as well?

@marklysze
Copy link
Collaborator

Thanks @sternakt, also if there's an option for a helper function to apply response_format to an LLM config for a specific agent would be great. Particularly useful when a response format is for a specific agent and the llm config is shared amongst many agents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants