"Groq" (Service Connection)
This service connection requires an external account »
Use the Groq API with the Wolfram Language.
Connecting & Authenticating
ServiceConnect["Groq"] creates a connection to the Groq API. If a previously saved connection can be found, it will be used; otherwise, a new authentication request will be launched.
Requests
ServiceExecute["Groq","request",params] sends a request to the Groq API, using parameters params. The following gives possible requests.
"TestConnection" — returns Success for working connection, Failure otherwise
Text
"Chat" — create a response for the given chat conversation
"Messages" | (required) | a list of messages in the conversation, each given as an association with "Role" and "Content" keys | |
"FrequencyPenalty" | Automatic | penalize tokens based on their existing frequency in the text so far (between -2 and 2) | |
"MaxTokens" | Automatic | maximum number of tokens to generate | |
"Model" | Automatic | name of the model to use | |
"N" | Automatic | number of completions to return | |
"PresencePenalty" | Automatic | penalize new tokens based on whether they appear in the text so far (between -2 and 2) | |
"StopTokens" | Automatic | strings where the API will stop generating further tokens | |
"Stream" | False | return the result as server-sent events | |
"Temperature" | Automatic | sampling temperature | |
"ToolChoice" | Automatic | which (if any) tool is called by the model | |
"Tools" | Automatic | one or more LLMTool objects available to the model | |
"TotalProbabilityCutoff" | Automatic | an alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with the requested probability mass | |
"User" | Automatic | unique identifier representing the end user |
Audio
"AudioTranscription" — transcribe an audio recording into the input language
"Audio" | (required) | the Audio object to transcribe | |
"Language" | Automatic | language of the input audio | |
"Model" | Automatic | name of the model to use | |
"Prompt" | None | optional text to guide the model's style or continue a previous audio segment | |
"Temperature" | Automatic | sampling temperature (between 0 and 1) | |
"TimestampGranularities" | Automatic | the timestamp granularity of transcription (either "word" or "segment") |
"AudioTranslation" — translate an audio recording into English
"Audio" | (required) | the Audio object to translate | |
"Model" | Automatic | name of the model to use | |
"Prompt" | None | optional text to guide the model's style or continue a previous audio segment | |
"Temperature" | Automatic | sampling temperature (between 0 and 1) |
Model Lists
"ChatModelList" — list models available for the "Chat" request