Skip to content

Structured outputs #52

Open
Open

Description

@CodingDive

Hello! 👋 Thank you so much for all the work on this library ❤️

Is it possible to support structured outputs based on the zod schema? https://openai.com/index/introducing-structured-outputs-in-the-api/

Right now, I'm wasting a lot of tokens trying to get the models to follow the schema, while still receiving the following error every now and then.

There seems to be a validation going on of the schema, but it just throws if it doesn't match. I'm using gpt-4o.

Error in processing: {
  type: 'xstate.error.actor.0.agent.processing',
  error: InvalidToolArgumentsError [AI_InvalidToolArgumentsError]: Invalid arguments for tool agent_prompt: Type validation failed

Activity

  1. davidkpiano commented on Sep 16, 2024

    @davidkpiano
    Member

    Yes, great idea. I'm actually working on simplifying the API (see #51) and you will be able to use generateObject directly.

    Does this happen for you during agent.decide(…)?

  2. CodingDive commented on Sep 16, 2024

    @CodingDive
    Author

    Does this happen for you during agent.decide(…)?

    Yes!

    That's some great news! 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions