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

Schema support #8

Closed
simonw opened this issue Mar 13, 2025 · 4 comments
Closed

Schema support #8

simonw opened this issue Mar 13, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Mar 13, 2025

https://docs.cohere.com/v2/docs/structured-outputs

@simonw simonw added the enhancement New feature or request label Mar 13, 2025
@simonw simonw closed this as completed in 55cc4ef Mar 13, 2025
@simonw
Copy link
Owner Author

simonw commented Mar 13, 2025

It's a bit weird. This works:

llm -m command-r 'invent a dog' \
  --schema 'name,age int,bio'
{
  "name": "Puppers",
  "age": 1,
  "bio": "Puppers is a very special doggo who loves nothing more than snuggling up to their favorite human. With fluffy fur as white as snow and a black button nose, this good boy has won the hearts of many. Puppers is an expert at fetching sticks, and their favorite toy is a red ball. Very energetic and always up for a game of catch, Puppers is the perfect companion for a game of fetch in the park. Although Puppers can be a bit shy at first, once they warm up to you, you've got a friend for life! Don't be fooled by their cute face, though - Puppers has a huge appetite and will never say no to a treat. Woof!"
}

But if you have the integer field as the last one it goes very wrong:

llm -m command-r 'invent a dog' \
  --schema 'name,age int'
{
"name": "Snazzle",
"age": 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

@simonw
Copy link
Owner Author

simonw commented Mar 13, 2025

That bug doesn't affect R7B:

llm-command-r % llm -m command-r7b 'invent a dog' --schema 'name,age int'
{ "name": "Luna", "age": 3 }

But it does affect the new Command A #9 :

llm -m command-a 'invent a dog' --schema 'name,age int'
{
  "name": "Luminoodle",
  "age": 2400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

@simonw
Copy link
Owner Author

simonw commented Mar 13, 2025

I'm not going to bother documenting this, hopefully Cohere will fix it.

simonw added a commit that referenced this issue Mar 13, 2025
@pascalandy
Copy link

Thanks for this release Simon. I would have never tried Cohere without LLM.

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

2 participants