Provider-specific Swarmauri import package for Groq OpenAI-compatible chat, tool use, vision-language, streaming, and audio transcription workflows.
Project description
Swarmauri Groq LLM
swarmauri_llm_groq provides provider-specific Groq imports for Swarmauri
applications that need fast OpenAI-compatible inference. The package exports
chat, tool-calling, vision, and audio adapters while keeping their runtime
implementations aligned with swarmauri_standard.
Groq's public API documentation describes an OpenAI-compatible base URL at
https://api.groq.com/openai/v1, with endpoints for chat completions, audio
transcriptions, and audio translations. This package maps those API surfaces
into Swarmauri components:
GroqModelfor chat completions, streaming, JSON responses, and batch helper workflows.GroqToolModelfor function/tool calling through SwarmauriToolkitinstances.GroqVisionModelfor vision-language chat completion payloads.GroqAIAudiofor transcription and translation with Groq-hosted Whisper models.
Why Use This Package?
- Keep Groq-specific model dependencies explicit while preserving common Swarmauri conversation and toolkit patterns.
- Use Groq's low-latency OpenAI-compatible chat completions without rewriting application code around raw HTTP payloads.
- Add tool calling, vision-language prompts, or speech-to-text workflows from one provider package.
- Swap between Groq and other Swarmauri LLM provider packages while retaining
familiar
predict,stream,apredict,astream,batch, andabatchworkflows.
FAQ
What does swarmauri_llm_groq install?
It installs provider package entry points for GroqModel, GroqToolModel,
GroqVisionModel, and GroqAIAudio.
Which Groq endpoints does it call?
The chat, tool, and vision adapters post to
https://api.groq.com/openai/v1/chat/completions. The audio adapter uses
https://api.groq.com/openai/v1/audio/transcriptions and
https://api.groq.com/openai/v1/audio/translations.
Does it support tool calling?
Yes. GroqToolModel converts Swarmauri toolkit schemas to Groq-compatible tool
definitions, sends them with chat completions, executes returned tool calls, and
can perform a follow-up model call with tool results.
Does it support vision?
Yes. GroqVisionModel accepts Swarmauri message content that can include
structured content lists for OpenAI-compatible vision chat payloads. The runtime
also emits a deprecation warning that new projects should review the newer
Swarmauri VLM imports when available.
Does audio streaming work?
No. GroqAIAudio supports file-based transcription and translation through
predict, apredict, batch, and abatch. Its stream and astream methods
raise NotImplementedError.
Features
GroqModelfor synchronous, asynchronous, streaming, JSON, and batch chat completion workflows.GroqToolModelfor Groq tool use with SwarmauriToolkitschemas.GroqVisionModelfor OpenAI-compatible vision-language chat payloads.GroqAIAudiofor Whisper transcription and translation tasks.- Usage metadata support where Groq chat responses include usage data.
- Model discovery through Groq's OpenAI-compatible models endpoint for chat.
- Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.
Installation
uv add swarmauri_llm_groq
pip install swarmauri_llm_groq
Prerequisites
Create a Groq API key in the Groq console and pass it to the model constructor
as api_key=.... Package live tests are skipped unless provider credentials are
available in the environment.
Usage
from swarmauri_llm_groq import GroqModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage
conversation = Conversation()
conversation.add_message(HumanMessage(content="Write a one-sentence release note."))
model = GroqModel(api_key="GROQ_API_KEY")
result = model.predict(conversation=conversation, max_tokens=120)
print(result.get_last().content)
Streaming Chat Completion
from swarmauri_llm_groq import GroqModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage
conversation = Conversation()
conversation.add_message(HumanMessage(content="List three build pipeline risks."))
model = GroqModel(api_key="GROQ_API_KEY")
for token in model.stream(conversation=conversation):
print(token, end="")
Tool Calling
from swarmauri_llm_groq import GroqToolModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage
from swarmauri_standard.toolkits.Toolkit import Toolkit
conversation = Conversation()
conversation.add_message(HumanMessage(content="Use a tool if one is relevant."))
toolkit = Toolkit()
model = GroqToolModel(api_key="GROQ_API_KEY")
result = model.predict(conversation=conversation, toolkit=toolkit)
print(result.get_last().content)
Audio Transcription
from swarmauri_llm_groq import GroqAIAudio
audio = GroqAIAudio(api_key="GROQ_API_KEY")
text = audio.predict("meeting.wav", task="transcription")
print(text)
Vision-Language Prompt
from swarmauri_llm_groq import GroqVisionModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage
conversation = Conversation()
conversation.add_message(
HumanMessage(
content=[
{"type": "text", "text": "Describe the image."},
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}},
]
)
)
model = GroqVisionModel(api_key="GROQ_API_KEY")
result = model.predict(conversation=conversation)
print(result.get_last().content)
Related Packages
- swarmauri_llm_anthropic
- swarmauri_llm_deepinfra
- swarmauri_llm_deepseek
- swarmauri_llm_gemini
- swarmauri_llm_mistral
- swarmauri_llm_openai
- swarmauri_llm_whisper
Foundational Swarmauri Packages
Provider Documentation
Best Practices
- Store Groq API keys in environment variables or a secrets manager.
- Confirm model availability against Groq's current model catalog before production deployment.
- Use
GroqToolModelonly when tools are needed; plain chat requests are simpler withGroqModel. - Use
GroqAIAudiofor file-based transcription and translation, not streaming audio. - Prefer newer Swarmauri VLM and STT imports for new projects when available.
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_llm_groq-0.11.0.dev1.tar.gz.
File metadata
- Download URL: swarmauri_llm_groq-0.11.0.dev1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c5c916d20ab1d7dfa83ef8d1ce071f3e7426110867ce494b574b4bfa8b050f8
|
|
| MD5 |
39b4b6bc7ec0192483050e7c66697faa
|
|
| BLAKE2b-256 |
b405f39e4e1a9bebe37f43b5f9500e0c5a4df1a2c091ea05d7f58951c9974f80
|
File details
Details for the file swarmauri_llm_groq-0.11.0.dev1-py3-none-any.whl.
File metadata
- Download URL: swarmauri_llm_groq-0.11.0.dev1-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4716d7cda5952870a300e21567296e0ed047d5943530169f264525cc26107dd
|
|
| MD5 |
a1cdfd5c83b52ab53a18f425562a9526
|
|
| BLAKE2b-256 |
57de2a36c1b2bcc54aa2740b9042dcd2fafc5bbf74ac0af91ca44a42b5be46b7
|