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

Think about structured data #31

Closed
hadley opened this issue Sep 23, 2024 · 1 comment · Fixed by #113
Closed

Think about structured data #31

hadley opened this issue Sep 23, 2024 · 1 comment · Fixed by #113

Comments

@hadley
Copy link
Member

hadley commented Sep 23, 2024

Either show some examples of using tools + side-effects, or create top-level method to help.

e.g. https://github.com/anthropics/anthropic-cookbook/blob/main/tool_use/extracting_structured_json.ipynb — basic idea is to define a "print" call and then explicitly request that the model use it. Then you parse the response, either parsing the json or erroring.

@hadley
Copy link
Member Author

hadley commented Oct 9, 2024

Gemini and OpenAI have specific structured data modes, but Claude does not (so you have to (ab)use tool calling).

Gemini schema:

  • Basic: STRING, NUMBER, INTEGER, BOOLEAN
  • Arrays: ARRAY + minItems, maxItems, + optional items, which define the schema.
  • Structs: OBJECT + properties (name: schema) + required

OpenAI schema:

  • Basic: String, Number, Boolean, Integer, Enum
  • Arrays: Array. Use items to specify item type. Doesn't support min/max items.
  • Objects: Object. Specify struct of properties.
  • Null (for optional args)

@hadley hadley mentioned this issue Oct 16, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant