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

Support OpenAI structured output #3013

Open
madroidmaq opened this issue Nov 19, 2024 · 3 comments
Open

Support OpenAI structured output #3013

madroidmaq opened this issue Nov 19, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@madroidmaq
Copy link

In the structured output API, OpenAI provides a parse function that can directly receive an entity class, as shown below:

response = client.beta.chat.completions.parse(
            model="gpt-4o-2024-08-06",
            messages=[
                {"role": "system", "content": SYSTEM_PROMPT},
                {"role": "user", "content": content}
            ],
            response_format=FoodNameScore,
            temperature=0
        )

But the current writing will not be automatically recorded like the client.chat.completions.create() function, and it is hoped that the automatic recording feature of the client.beta.chat.completions.parse() function can be supported.

@jwlee64
Copy link
Contributor

jwlee64 commented Nov 21, 2024

Hi @madroidmaq, I can make a note, and raise this to the team tomorrow.

@jwlee64 jwlee64 added the enhancement New feature or request label Nov 21, 2024
@andrewtruong
Copy link
Collaborator

Hey @madroidmaq , this should be resolved with the latest release. Can you try weave==0.51.22 and see if it works for you?

@madroidmaq
Copy link
Author

I tried, but my project will encounter loop dependence problems and cannot run successfully.

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