groq-python  by groq

Python SDK for the Groq API

created 1 year ago
530 stars

Top 60.5% on sourcepulse

GitHubView on GitHub
Project Summary

This Python library provides convenient access to the Groq REST API for developers building applications with LLMs. It offers both synchronous and asynchronous clients, type-hinted requests and responses for improved developer experience, and robust error handling.

How It Works

The library leverages httpx for both synchronous and asynchronous HTTP requests, ensuring efficient and modern network communication. It's generated using Stainless, which likely contributes to its comprehensive type definitions (using TypedDict for requests and Pydantic models for responses). This approach enhances code maintainability, enables editor autocompletion, and aids in early bug detection through type checking.

Quick Start & Requirements

  • Install from PyPI: pip install groq
  • Requirements: Python 3.8+
  • API Key: Required, recommended to manage via environment variables (GROQ_API_KEY) or .env files.
  • Documentation: console.groq.com, api.md

Highlighted Details

  • Supports both synchronous and asynchronous API interactions.
  • Responses are Pydantic models with methods for serialization (to_json, to_dict).
  • File uploads handled via bytes, PathLike, or (filename, contents, media type) tuples.
  • Automatic retries for connection errors, timeouts, and server errors (configurable).
  • Configurable timeouts and advanced logging via GROQ_LOG environment variable.
  • Ability to access raw response data and stream responses.
  • Supports making requests to undocumented endpoints and passing undocumented parameters.

Maintenance & Community

  • Follows SemVer conventions with a commitment to backward compatibility.
  • Open to feedback and contributions via GitHub issues.

Licensing & Compatibility

  • License: Not explicitly stated in the README.
  • Compatibility: Designed for Python 3.8+.

Limitations & Caveats

The README does not specify the license, which is crucial for commercial use or closed-source integration. While it mentions SemVer, it notes that some backward-incompatible changes might be released as minor versions, requiring user vigilance.

Health Check
Last commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
0
Star History
25 stars in the last 90 days

Explore Similar Projects

Starred by Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera) and Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems).

bytewax by bytewax

0.2%
2k
Python framework for stateful stream processing
created 3 years ago
updated 4 months ago
Starred by Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers) and Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera).

client-python by mistralai

0.3%
628
Python SDK for Mistral AI platform
created 1 year ago
updated 1 week ago
Starred by Adam Wolff Adam Wolff(Claude Code Core; MTS at Anthropic), Samuel Colvin Samuel Colvin(Author of Pydantic, Pydantic Logfire, PydanticAI), and
3 more.

anthropic-sdk-python by anthropics

0.6%
2k
Python SDK for Anthropic's REST API
created 2 years ago
updated 10 hours ago
Feedback? Help us improve.