feat: groq support via official tool-calling API #1257
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our current Groq integration was developed before Groq added tool-calling to the API (https://console.groq.com/docs/tool-use). Groq also does not support
/completions
(only/chat/completions
), so to add tool calling support we had to "hijack" the/chat/completions
endpoint by packing the entire prompt chain into the initial message (similar to the earlier LM Studio integration).This PR adds a new Groq integration that uses the tool-calling API (effectively treating Groq as a complete OpenAI proxy that has tool-calling support).
Outstanding issues:
content != null
whentool_calls != null
. Because we're usingcontent
for CoT / inner thoughts, this means we need to pack the inner thoughts into the params of the function calling (or split the generation in two, or do some other prompt parsing).send_message
) we get a failed tool call generation. This may be due to a bug in the message dict preparation?Example failed generation:
Message list:
Tool list:
Response: