A perl script to interact with the Groq API using a chain-of-thought reasoning strategy.
This script sends prompts to the Groq API and receives responses.
It supports multiple rounds of thinking and can format the output using glow if installed.
- Make sure
perlis installed on your system and is at least versionv5.14(check withperl -v). - Set your Groq API key as an environment variable:
export GROQ_API_KEY='your_api_key_here'. - Make the script executable:
chmod +x groq - Optionally install glow for formatted output.
List available models:
groq --modelsSend a query:
groq --query "What is the meaning of life?"Specify a different model:
groq --query "What is the airspeed velocity of an unladen swallow?" --model "deepseek-r1-distill-llama-70b"Specify the number of thinking rounds:
groq --query "What is the meaning of life?" --rounds 5Pipe multiple queries:
echo -e "What is the meaning of life?\nWhat is the airspeed velocity of an unladen swallow?" | groqInclude a file in the prompt:
groq --query "Walk me through the behavior of this script." --file ./groqList conversations:
groq --conversationsContinue a conversation:
$ groq -q "What is the airspeed velocity of an unladen swallow?"
Save conversation? [y/N] y
Saved conversation: deadbeef
$ groq -c deadbeef -q "Yes, sorry, I did mean African."- Perl v5.14 or higher
- glow (optional; for formatted output)
GROQ_API_KEY: Your Groq API key.
This project is licensed under the MIT License.