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

Pass pydantic json schema to argument response_model #1384

Open
andrader opened this issue Mar 7, 2025 · 0 comments
Open

Pass pydantic json schema to argument response_model #1384

andrader opened this issue Mar 7, 2025 · 0 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@andrader
Copy link

andrader commented Mar 7, 2025

Is your feature request related to a problem? Please describe.
I am in a situation where I do not have access to the pydantic model itself, only the json schema of that model (from MyModel.model_json_schema()) my_json_schema_dict

Describe the solution you'd like

And I would like to be able to use

instructor_client.chat.completions.create(
    response_model=my_json_schema_dict, 
    messages=messages, 
    **create_kwargs,
)

Describe alternatives you've considered

I tried to recreate the model from the json, but pdantic does not offer a feature out of the box for that and also tried implementing it.
But from my understanding, doesn't Instructor converts the Model to a json schema under the hood to then pass it to the llm? Shouldn't/couldn't it also accept a json schema?

@github-actions github-actions bot added enhancement New feature or request question Further information is requested labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant