A powerful and flexible LLM interface library for Gemini and other models.
Project description
RAW Library
A powerful and flexible LLM interface library for Gemini and other models, designed for modern Python applications.
Features
- Gemini Integration: Seamless support for Google's Gemini models (including
gemini-3-flash-preview). - Unified Interface: Clean, consistent API for chat, completion, and tool usage.
- Async Support: Fully asynchronous implementation using
httpxandasyncio. - Tool Calling: Easy-to-use function calling/tool usage.
- Streaming: Native support for streaming responses.
- Vision Support: Simple API for multimodal (text + image) inputs.
Installation
pip install raw
or with uv:
uv add raw
Quick Start
Configuration
Set your Gemini API key as an environment variable:
export GEMINI_API_KEY="your-api-key-here"
Basic Usage
import asyncio
import os
from RAW.llms.gemini import GeminiLLM
async def main():
api_key = os.getenv("GEMINI_API_KEY")
llm = GeminiLLM(api_key=api_key)
response = await llm.generate("Explain quantum computing in one sentence.")
print(response)
asyncio.run(main())
Chat with Tools
from RAW.llms.gemini import GeminiLLM
from RAW.modals import Message, Tool, ToolParam
# Define a tool
def get_weather(city: str):
return f"The weather in {city} is sunny."
tool = Tool(
name="get_weather",
description="Get weather for a city",
parameters=[ToolParam(name="city", type="string", required=True)],
function=get_weather
)
# Chat with tool
messages = [Message(role="user", content="What's the weather in Tokyo?")]
response = await llm.chat(messages, tools=[tool])
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
raw_agents-0.1.0.tar.gz
(48.9 kB
view details)
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 raw_agents-0.1.0.tar.gz.
File metadata
- Download URL: raw_agents-0.1.0.tar.gz
- Upload date:
- Size: 48.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5df310a9c1afc66491bb4a1a9f67fb1f1968464e8d35ab31b256e570501f4c5
|
|
| MD5 |
1aec73230053fd0c73cfd5813c50202a
|
|
| BLAKE2b-256 |
b47664ef41f9bba28919b6b04f9a0d6da76f346126399407221afa89e7e7d185
|
File details
Details for the file raw_agents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: raw_agents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68e57b0fee194b25fddad02366fa956c5d523fe9968296e35fd2fb2576db46b2
|
|
| MD5 |
ec5b39c927ff271271b0e1507074e5b0
|
|
| BLAKE2b-256 |
2ae90ed2691ad936b49fec118cf873ac8f78a83b50201719ca194af42cfb9ba0
|