lightweight gigachat api wrapper for smolagents
Overview
gigasmol serves two primary purposes:
- Provides direct, lightweight access to GigaChat models through GigaChat API without unnecessary abstractions
- Creates a smolagents-compatible wrapper that lets you use GigaChat within agent systems
No complex abstractions — just clean, straightforward access to GigaChat's capabilities through smolagents.
GigaChat API + smolagents = gigasmol 💀
Why gigasmol 💀?
- Tiny Footprint: Less than 1K lines of code total
- Simple Structure: Just 4 core files
- Zero Bloat: Only essential dependencies
- Easy to Understand: Read and comprehend the entire codebase in minutes
- Maintainable: Small, focused codebase means fewer bugs and easier updates
Installation
API-Only Installation (default)
python>=3.8
pip install gigasmol
Full Installation with Agent Support
python>=3.10
pip install "gigasmol[agent]"
Quick Start
Raw GigaChat API
gigasmol
import json
from gigasmol import GigaChat
# Direct access to GigaChat API
gigachat = GigaChat(
auth_data="YOUR_AUTH_TOKEN",
model_name="GigaChat-Max",
)
# Generate a response
response = gigachat.chat([
{"role": "user", "content": "What is the capital of Russia?"}
])
print(response['answer']) # or print(response['response']['choices'][0]['message']['content'])
Usage with smolagents
gigasmol[agent]
from gigasmol import GigaChatSmolModel
from smolagents import CodeAgent, ToolCallingAgent, DuckDuckGoSearchTool
# Initialize the GigaChat model with your credentials
model = GigaChatSmolModel(
auth_data="YOUR_AUTH_TOKEN",
model_name="GigaChat-Max"
)
# Create a CodeAgent with the model
code_agent = CodeAgent(
tools=[DuckDuckGoSearchTool()],
model=model
)
# Run the code_agent
code_agent.run("What are the main tourist attractions in Moscow?")
# Create a ToolCallingAgent with the model
tool_calling_agent = ToolCallingAgent(
tools=[DuckDuckGoSearchTool()],
model=model
)
# Run the tool_calling_agent
tool_calling_agent.run("What are the main tourist attractions in Moscow?")
How It Works
GigaSmol provides two layers of functionality:
┌───────────────────────────────────────────────────┐
│ gigasmol │
├───────────────────────────────────────────────────┤
│ ┌───────────────┐ ┌───────────────────┐ │
│ │ Direct │ │ smolagents │ │
│ │ GigaChat API │ │ compatibility │ │
│ │ access │ │ layer │ │
│ └───────────────┘ └───────────────────┘ │
└───────────────────────────────────────────────────┘
│ │
▼ ▼
┌─────────────┐ ┌────────────────┐
│ GigaChat API│ │ Agent systems │
└─────────────┘ └────────────────┘
- Direct API Access: Use
GigaChatfor clean, direct access to the API - smolagents Integration: Use
GigaChatSmolModelto plug GigaChat into smolagents
Examples
Check the examples directory:
structured_output.ipynb: Using GigaChat API and function_calling for structured outputagents.ipynb: Building code and tool agents with GigaChat and smolagents
Acknowledgements
- SberDevices for creating the GigaChat API
- Hugging Face for the smolagents framework
Metadata
Release files for gigasmol 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gigasmol-0.0.8.tar.gz | 18.0 kB | Without provenance | Details for gigasmol-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gigasmol-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for gigasmol-0.0.8-py3-none-any.whl |
Total release size: 35.9 kB
Release files / gigasmol-0.0.8.tar.gz
| Download URL | gigasmol-0.0.8.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6d121cf61a35811b9fe6254de6394e1fe5fd25bbe3cab4c013af89ba5444bf9
|
|
BLAKE2b-256 checksum How to use checksums |
a5d9460cc00362c1e53931faa609e61d867f16713ab7715d04ffd72c95289831
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / gigasmol-0.0.8-py3-none-any.whl
| Download URL | gigasmol-0.0.8-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e279f779af4c17dbca32d83c55af6c3b930e6aef4313f584778beb485290afd
|
|
BLAKE2b-256 checksum How to use checksums |
0fe9528d8b14955dc11a55baf72e87134dca9162ff9dea6f6334b711d71cb438
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for gigasmol 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.