aura-llm 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aura_llm-0.4.1/.gitignore +119 -0
- aura_llm-0.4.1/LICENSE +21 -0
- aura_llm-0.4.1/PKG-INFO +341 -0
- aura_llm-0.4.1/README.md +308 -0
- aura_llm-0.4.1/examples/async_usage.py +78 -0
- aura_llm-0.4.1/examples/basic_usage.py +96 -0
- aura_llm-0.4.1/examples/tools_usage.py +144 -0
- aura_llm-0.4.1/pyproject.toml +103 -0
- aura_llm-0.4.1/src/aura/__init__.py +80 -0
- aura_llm-0.4.1/src/aura/_async_client.py +408 -0
- aura_llm-0.4.1/src/aura/client.py +421 -0
- aura_llm-0.4.1/src/aura/exceptions.py +113 -0
- aura_llm-0.4.1/src/aura/py.typed +0 -0
- aura_llm-0.4.1/src/aura/types.py +422 -0
- aura_llm-0.4.1/tests/__init__.py +1 -0
- aura_llm-0.4.1/tests/test_client.py +279 -0
- aura_llm-0.4.1/tests/test_exceptions.py +160 -0
- aura_llm-0.4.1/tests/test_types.py +239 -0
- aura_llm-0.4.1/uv.lock +733 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Generated by Cargo
|
|
2
|
+
# will have compiled files and executables
|
|
3
|
+
debug/
|
|
4
|
+
target/
|
|
5
|
+
|
|
6
|
+
# These are backup files generated by rustfmt
|
|
7
|
+
**/*.rs.bk
|
|
8
|
+
|
|
9
|
+
# MSVC Windows builds of rustc generate these, which store debugging information
|
|
10
|
+
*.pdb
|
|
11
|
+
|
|
12
|
+
# Generated by cargo mutants
|
|
13
|
+
# Contains mutation testing data
|
|
14
|
+
**/mutants.out*/
|
|
15
|
+
|
|
16
|
+
# Environment and secrets
|
|
17
|
+
.env
|
|
18
|
+
.env.*
|
|
19
|
+
!.env.example
|
|
20
|
+
|
|
21
|
+
# OS files
|
|
22
|
+
.DS_Store
|
|
23
|
+
Thumbs.db
|
|
24
|
+
|
|
25
|
+
# IDE and editor files
|
|
26
|
+
.idea/
|
|
27
|
+
*.swp
|
|
28
|
+
*.swo
|
|
29
|
+
*~
|
|
30
|
+
.vscode/
|
|
31
|
+
!.vscode/settings.json
|
|
32
|
+
!.vscode/extensions.json
|
|
33
|
+
|
|
34
|
+
# Logs
|
|
35
|
+
*.log
|
|
36
|
+
logs/
|
|
37
|
+
|
|
38
|
+
# Database
|
|
39
|
+
*.db
|
|
40
|
+
*.sqlite
|
|
41
|
+
|
|
42
|
+
# Coverage
|
|
43
|
+
coverage/
|
|
44
|
+
*.lcov
|
|
45
|
+
cobertura.xml
|
|
46
|
+
tarpaulin-report.html
|
|
47
|
+
|
|
48
|
+
# Documentation build
|
|
49
|
+
docs/book/
|
|
50
|
+
target/doc/
|
|
51
|
+
|
|
52
|
+
# Research notes (not part of codebase)
|
|
53
|
+
aura-research/
|
|
54
|
+
|
|
55
|
+
# Claude
|
|
56
|
+
.claude/
|
|
57
|
+
|
|
58
|
+
# Cargo audit cache
|
|
59
|
+
~/.cargo/advisory-db
|
|
60
|
+
|
|
61
|
+
# Benchmarking
|
|
62
|
+
criterion/
|
|
63
|
+
benches/target/
|
|
64
|
+
|
|
65
|
+
# Profiling
|
|
66
|
+
flamegraph.svg
|
|
67
|
+
perf.data
|
|
68
|
+
perf.data.old
|
|
69
|
+
|
|
70
|
+
# Docker volumes
|
|
71
|
+
.docker/
|
|
72
|
+
|
|
73
|
+
# SQLx offline mode
|
|
74
|
+
.sqlx/
|
|
75
|
+
|
|
76
|
+
# Testing artifacts
|
|
77
|
+
*.profraw
|
|
78
|
+
*.profdata
|
|
79
|
+
|
|
80
|
+
# Helm chart dependencies (fetched at build time via `helm dep update`)
|
|
81
|
+
deploy/charts/*/charts/
|
|
82
|
+
deploy/charts/*/*.tgz
|
|
83
|
+
|
|
84
|
+
# Node modules (for dashboard when added)
|
|
85
|
+
node_modules/
|
|
86
|
+
dist/
|
|
87
|
+
.turbo/
|
|
88
|
+
|
|
89
|
+
# Lock files for tools
|
|
90
|
+
package-lock.json
|
|
91
|
+
yarn.lock
|
|
92
|
+
pnpm-lock.yaml
|
|
93
|
+
|
|
94
|
+
# Python (SDK)
|
|
95
|
+
__pycache__/
|
|
96
|
+
*.py[cod]
|
|
97
|
+
*$py.class
|
|
98
|
+
*.so
|
|
99
|
+
.Python
|
|
100
|
+
build/
|
|
101
|
+
develop-eggs/
|
|
102
|
+
downloads/
|
|
103
|
+
eggs/
|
|
104
|
+
.eggs/
|
|
105
|
+
# Python install directories (but not src/lib/ application code)
|
|
106
|
+
**/site-packages/
|
|
107
|
+
parts/
|
|
108
|
+
sdist/
|
|
109
|
+
var/
|
|
110
|
+
wheels/
|
|
111
|
+
*.egg-info/
|
|
112
|
+
.installed.cfg
|
|
113
|
+
*.egg
|
|
114
|
+
.pytest_cache/
|
|
115
|
+
.mypy_cache/
|
|
116
|
+
.ruff_cache/
|
|
117
|
+
.venv/
|
|
118
|
+
venv/
|
|
119
|
+
ENV/
|
aura_llm-0.4.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Umai Tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
aura_llm-0.4.1/PKG-INFO
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aura-llm
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: Python SDK for Aura LLM Gateway - Open Responses API
|
|
5
|
+
Project-URL: Homepage, https://github.com/UmaiTech/aura-llm-gateway
|
|
6
|
+
Project-URL: Documentation, https://github.com/UmaiTech/aura-llm-gateway/tree/main/sdks/python
|
|
7
|
+
Project-URL: Repository, https://github.com/UmaiTech/aura-llm-gateway
|
|
8
|
+
Project-URL: Changelog, https://github.com/UmaiTech/aura-llm-gateway/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Aura Team
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: ai,anthropic,api,gateway,llm,open-responses,openai
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: httpx>=0.25.0
|
|
24
|
+
Requires-Dist: pydantic>=2.0.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: mypy>=1.13.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.8.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Aura LLM Gateway Python SDK
|
|
35
|
+
|
|
36
|
+
[](https://pypi.org/project/aura-llm/)
|
|
37
|
+
[](https://pypi.org/project/aura-llm/)
|
|
38
|
+
[](LICENSE)
|
|
39
|
+
|
|
40
|
+
Python SDK for the [Aura LLM Gateway](https://github.com/UmaiTech/aura-llm-gateway), implementing the [Open Responses API](https://www.openresponses.org/specification).
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Using [uv](https://docs.astral.sh/uv/) (recommended):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv add aura-llm
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Using pip:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install aura-llm
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### From Source
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
cd sdks/python
|
|
60
|
+
|
|
61
|
+
# With uv
|
|
62
|
+
uv sync
|
|
63
|
+
|
|
64
|
+
# With pip
|
|
65
|
+
pip install -e .
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from aura import AuraClient
|
|
72
|
+
|
|
73
|
+
# Initialize the client
|
|
74
|
+
client = AuraClient(
|
|
75
|
+
api_key="your-api-key", # or set AURA_API_KEY env var
|
|
76
|
+
base_url="http://localhost:8080", # or set AURA_BASE_URL env var
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Simple completion
|
|
80
|
+
response = client.responses.create(
|
|
81
|
+
model="gpt-5.4-mini",
|
|
82
|
+
input="What is the capital of France?"
|
|
83
|
+
)
|
|
84
|
+
print(response.output_text)
|
|
85
|
+
# Output: The capital of France is Paris.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Streaming
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
for event in client.responses.create(
|
|
92
|
+
model="gpt-5.4-mini",
|
|
93
|
+
input="Tell me a short story about a robot",
|
|
94
|
+
stream=True
|
|
95
|
+
):
|
|
96
|
+
if event.type == "response.output_text.delta":
|
|
97
|
+
print(event.delta, end="", flush=True)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Async Client
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
import asyncio
|
|
104
|
+
from aura import AsyncAuraClient
|
|
105
|
+
|
|
106
|
+
async def main():
|
|
107
|
+
async with AsyncAuraClient() as client:
|
|
108
|
+
response = await client.responses.create(
|
|
109
|
+
model="gpt-5.4-mini",
|
|
110
|
+
input="Hello, world!"
|
|
111
|
+
)
|
|
112
|
+
print(response.output_text)
|
|
113
|
+
|
|
114
|
+
asyncio.run(main())
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Async Streaming
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
async def stream_example():
|
|
121
|
+
async with AsyncAuraClient() as client:
|
|
122
|
+
stream = await client.responses.create(
|
|
123
|
+
model="gpt-5.4-mini",
|
|
124
|
+
input="Tell me a joke",
|
|
125
|
+
stream=True
|
|
126
|
+
)
|
|
127
|
+
async for event in stream:
|
|
128
|
+
if event.type == "response.output_text.delta":
|
|
129
|
+
print(event.delta, end="", flush=True)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Conversation Threading
|
|
133
|
+
|
|
134
|
+
Continue a conversation using `previous_response_id`:
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
# First message
|
|
138
|
+
response1 = client.responses.create(
|
|
139
|
+
model="gpt-5.4-mini",
|
|
140
|
+
input="My name is Alice."
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
# Continue the conversation
|
|
144
|
+
response2 = client.responses.create(
|
|
145
|
+
model="gpt-5.4-mini",
|
|
146
|
+
input="What is my name?",
|
|
147
|
+
previous_response_id=response1.id
|
|
148
|
+
)
|
|
149
|
+
print(response2.output_text)
|
|
150
|
+
# Output: Your name is Alice.
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Using Tools
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from aura import Tool
|
|
157
|
+
|
|
158
|
+
# Define a tool
|
|
159
|
+
weather_tool = Tool.function_tool(
|
|
160
|
+
name="get_weather",
|
|
161
|
+
description="Get the current weather for a location",
|
|
162
|
+
parameters={
|
|
163
|
+
"type": "object",
|
|
164
|
+
"properties": {
|
|
165
|
+
"location": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"description": "The city and state, e.g. San Francisco, CA"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"required": ["location"]
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
# Use the tool
|
|
175
|
+
response = client.responses.create(
|
|
176
|
+
model="gpt-5.4-mini",
|
|
177
|
+
input="What's the weather in Tokyo?",
|
|
178
|
+
tools=[weather_tool]
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
# Check for tool calls
|
|
182
|
+
if response.has_tool_calls:
|
|
183
|
+
for tool_call in response.tool_calls:
|
|
184
|
+
print(f"Tool: {tool_call.name}")
|
|
185
|
+
print(f"Arguments: {tool_call.arguments}")
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## System Instructions
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
response = client.responses.create(
|
|
192
|
+
model="gpt-5.4-mini",
|
|
193
|
+
input="Who are you?",
|
|
194
|
+
instructions="You are a helpful pirate assistant. Always respond in pirate speak."
|
|
195
|
+
)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Configuration Options
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
client = AuraClient(
|
|
202
|
+
api_key="your-api-key",
|
|
203
|
+
base_url="http://localhost:8080",
|
|
204
|
+
timeout=120.0, # Request timeout in seconds
|
|
205
|
+
headers={"X-Custom-Header": "value"}, # Additional headers
|
|
206
|
+
)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Response Object
|
|
210
|
+
|
|
211
|
+
The `Response` object contains:
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
response.id # Unique response ID
|
|
215
|
+
response.status # ResponseStatus enum (completed, failed, etc.)
|
|
216
|
+
response.model # Model used
|
|
217
|
+
response.output # List of output items
|
|
218
|
+
response.output_text # Convenience property for text content
|
|
219
|
+
response.usage # Token usage information
|
|
220
|
+
response.usage.cost_usd # Cost in USD (if available)
|
|
221
|
+
response.tool_calls # List of function call items
|
|
222
|
+
response.has_tool_calls # Boolean check for tool calls
|
|
223
|
+
response.is_complete # Check if response completed successfully
|
|
224
|
+
response.metadata # Gateway metadata (provider, latency, etc.)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Stream Events
|
|
228
|
+
|
|
229
|
+
When streaming, you receive these event types:
|
|
230
|
+
|
|
231
|
+
| Event Type | Description |
|
|
232
|
+
|------------|-------------|
|
|
233
|
+
| `response.created` | Response started |
|
|
234
|
+
| `response.in_progress` | Response is being generated |
|
|
235
|
+
| `response.output_text.delta` | Text chunk (use `event.delta`) |
|
|
236
|
+
| `response.output_text.done` | Text complete (use `event.text`) |
|
|
237
|
+
| `response.function_call.delta` | Function arguments chunk |
|
|
238
|
+
| `response.function_call.done` | Function call complete |
|
|
239
|
+
| `response.output_item.added` | New item added to output |
|
|
240
|
+
| `response.output_item.done` | Item complete |
|
|
241
|
+
| `response.completed` | Response finished |
|
|
242
|
+
| `response.failed` | Response failed |
|
|
243
|
+
| `error` | Error occurred |
|
|
244
|
+
|
|
245
|
+
## Error Handling
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
from aura import (
|
|
249
|
+
AuraError,
|
|
250
|
+
AuthenticationError,
|
|
251
|
+
BadRequestError,
|
|
252
|
+
RateLimitError,
|
|
253
|
+
NotFoundError,
|
|
254
|
+
APIConnectionError,
|
|
255
|
+
APITimeoutError,
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
try:
|
|
259
|
+
response = client.responses.create(
|
|
260
|
+
model="gpt-5.4-mini",
|
|
261
|
+
input="Hello"
|
|
262
|
+
)
|
|
263
|
+
except AuthenticationError:
|
|
264
|
+
print("Invalid API key")
|
|
265
|
+
except RateLimitError as e:
|
|
266
|
+
print(f"Rate limited. Retry after: {e.retry_after}")
|
|
267
|
+
except BadRequestError as e:
|
|
268
|
+
print(f"Bad request: {e.message}, param: {e.param}")
|
|
269
|
+
except NotFoundError:
|
|
270
|
+
print("Model not found")
|
|
271
|
+
except APIConnectionError:
|
|
272
|
+
print("Failed to connect to Aura gateway")
|
|
273
|
+
except APITimeoutError:
|
|
274
|
+
print("Request timed out")
|
|
275
|
+
except AuraError as e:
|
|
276
|
+
print(f"API error: {e}")
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Environment Variables
|
|
280
|
+
|
|
281
|
+
| Variable | Description | Default |
|
|
282
|
+
|----------|-------------|---------|
|
|
283
|
+
| `AURA_API_KEY` | API key for authentication | None |
|
|
284
|
+
| `AURA_BASE_URL` | Base URL for the gateway | `http://localhost:8080` |
|
|
285
|
+
|
|
286
|
+
## Development
|
|
287
|
+
|
|
288
|
+
We use [uv](https://docs.astral.sh/uv/) for fast, reliable Python package management.
|
|
289
|
+
|
|
290
|
+
### Setup
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Install uv (if not already installed)
|
|
294
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
295
|
+
|
|
296
|
+
# Install dependencies
|
|
297
|
+
cd sdks/python
|
|
298
|
+
uv sync
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Running Tests
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Run all tests
|
|
305
|
+
uv run pytest
|
|
306
|
+
|
|
307
|
+
# Run with coverage
|
|
308
|
+
uv run pytest --cov=aura --cov-report=term-missing
|
|
309
|
+
|
|
310
|
+
# Run specific test file
|
|
311
|
+
uv run pytest tests/test_types.py -v
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Code Quality
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
# Linting
|
|
318
|
+
uv run ruff check src/aura tests
|
|
319
|
+
|
|
320
|
+
# Auto-fix lint issues
|
|
321
|
+
uv run ruff check --fix src/aura tests
|
|
322
|
+
|
|
323
|
+
# Format code
|
|
324
|
+
uv run ruff format src/aura tests
|
|
325
|
+
|
|
326
|
+
# Type checking
|
|
327
|
+
uv run mypy src/aura
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### All Checks (CI equivalent)
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
uv run ruff check src/aura tests
|
|
334
|
+
uv run ruff format --check src/aura tests
|
|
335
|
+
uv run mypy src/aura
|
|
336
|
+
uv run pytest --cov=aura
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## License
|
|
340
|
+
|
|
341
|
+
MIT
|