Skip to content

Enable structured chat for Groq models#934

Merged
hadley merged 4 commits intotidyverse:mainfrom
CoryMcCartan:fix-930
Mar 2, 2026
Merged

Enable structured chat for Groq models#934
hadley merged 4 commits intotidyverse:mainfrom
CoryMcCartan:fix-930

Conversation

@CoryMcCartan
Copy link
Contributor

This PR fixes #930.

I added a test for this use case, which requires using a different model than the default. The existing test doesn't require a different default, so I wasn't sure if I should add a chat_groq_test() function like some other providers have. I also notice the tool-calling test doesn't seem to reliably pass with the default model.

description = x@description,
properties = as_json(provider, x@properties, ...),
required = as.list(names2(x@properties)[required])
required = as.list(names2(x@properties)[required]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind checking to see if it's now possible to just delete this method? i.e. maybe grok is now sufficiently OpenAI compatible that we don't need any customisation here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it looks like both this method and the as_json method for Turn objects are no longer needed. The tool calling and structured data tests pass when using the default OpenAICompatible provider

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay, deleting code is my favourite 😄

@CoryMcCartan CoryMcCartan requested a review from hadley February 23, 2026 20:38
@hadley
Copy link
Member

hadley commented Feb 24, 2026

One last thing and we should be good to merge: Can you please add a bullet to the top of NEWS.md? It should briefly describe the change and end with (@yourname, #issuenumber).

@CoryMcCartan
Copy link
Contributor Author

Thanks for your patience!

@hadley hadley merged commit f1ab286 into tidyverse:main Mar 2, 2026
11 checks passed
@hadley
Copy link
Member

hadley commented Mar 2, 2026

Thank you!

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 this pull request may close these issues.

Structured chat does not work with Groq models

2 participants