aisberg 0.1.0__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.
- aisberg-0.1.0/LICENSE +9 -0
- aisberg-0.1.0/PKG-INFO +212 -0
- aisberg-0.1.0/README.md +183 -0
- aisberg-0.1.0/aisberg/__init__.py +7 -0
- aisberg-0.1.0/aisberg/abstract/__init__.py +0 -0
- aisberg-0.1.0/aisberg/abstract/modules.py +57 -0
- aisberg-0.1.0/aisberg/api/__init__.py +0 -0
- aisberg-0.1.0/aisberg/api/async_endpoints.py +333 -0
- aisberg-0.1.0/aisberg/api/endpoints.py +328 -0
- aisberg-0.1.0/aisberg/async_client.py +107 -0
- aisberg-0.1.0/aisberg/client.py +108 -0
- aisberg-0.1.0/aisberg/config.py +17 -0
- aisberg-0.1.0/aisberg/exceptions.py +22 -0
- aisberg-0.1.0/aisberg/models/__init__.py +0 -0
- aisberg-0.1.0/aisberg/models/chat.py +143 -0
- aisberg-0.1.0/aisberg/models/collections.py +36 -0
- aisberg-0.1.0/aisberg/models/embeddings.py +92 -0
- aisberg-0.1.0/aisberg/models/models.py +39 -0
- aisberg-0.1.0/aisberg/models/requests.py +11 -0
- aisberg-0.1.0/aisberg/models/token.py +11 -0
- aisberg-0.1.0/aisberg/models/tools.py +73 -0
- aisberg-0.1.0/aisberg/models/workflows.py +66 -0
- aisberg-0.1.0/aisberg/modules/__init__.py +23 -0
- aisberg-0.1.0/aisberg/modules/chat.py +403 -0
- aisberg-0.1.0/aisberg/modules/collections.py +117 -0
- aisberg-0.1.0/aisberg/modules/document.py +117 -0
- aisberg-0.1.0/aisberg/modules/embeddings.py +309 -0
- aisberg-0.1.0/aisberg/modules/me.py +77 -0
- aisberg-0.1.0/aisberg/modules/models.py +108 -0
- aisberg-0.1.0/aisberg/modules/tools.py +78 -0
- aisberg-0.1.0/aisberg/modules/workflows.py +140 -0
- aisberg-0.1.0/aisberg/requests/__init__.py +0 -0
- aisberg-0.1.0/aisberg/requests/async_requests.py +85 -0
- aisberg-0.1.0/aisberg/requests/sync_requests.py +85 -0
- aisberg-0.1.0/aisberg/utils.py +111 -0
- aisberg-0.1.0/aisberg.egg-info/PKG-INFO +212 -0
- aisberg-0.1.0/aisberg.egg-info/SOURCES.txt +46 -0
- aisberg-0.1.0/aisberg.egg-info/dependency_links.txt +1 -0
- aisberg-0.1.0/aisberg.egg-info/requires.txt +13 -0
- aisberg-0.1.0/aisberg.egg-info/top_level.txt +4 -0
- aisberg-0.1.0/pyproject.toml +47 -0
- aisberg-0.1.0/setup.cfg +4 -0
- aisberg-0.1.0/tests/integration/test_collections_integration.py +115 -0
- aisberg-0.1.0/tests/unit/test_collections_sync.py +104 -0
- aisberg-0.1.0/tmp/test.py +33 -0
- aisberg-0.1.0/tmp/test_async.py +126 -0
- aisberg-0.1.0/tmp/test_doc_parse.py +12 -0
- aisberg-0.1.0/tmp/test_sync.py +146 -0
aisberg-0.1.0/LICENSE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Copyright © 2025 Free Pro. All rights reserved.
|
2
|
+
|
3
|
+
This software and its source code are the exclusive property of Free Pro and are intended for internal use only.
|
4
|
+
|
5
|
+
Unauthorized copying, distribution, modification, or use of this software, in whole or in part, is strictly prohibited without prior written permission from Free Pro.
|
6
|
+
|
7
|
+
For questions or requests, contact:
|
8
|
+
Free Pro
|
9
|
+
[mathis.lambert@freepro.com]
|
aisberg-0.1.0/PKG-INFO
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: aisberg
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: Aisberg SDK for Python - A simple and powerful SDK to interact with the Aisberg API
|
5
|
+
Author: Free Pro
|
6
|
+
Author-email: Mathis Lambert <mathis.lambert@freepro.com>
|
7
|
+
License: Private License
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
11
|
+
Classifier: Operating System :: OS Independent
|
12
|
+
Classifier: License :: Other/Proprietary License
|
13
|
+
Requires-Python: >=3.10
|
14
|
+
Description-Content-Type: text/markdown
|
15
|
+
License-File: LICENSE
|
16
|
+
Requires-Dist: httpx>=0.28.1
|
17
|
+
Requires-Dist: pydantic>=2.11.7
|
18
|
+
Requires-Dist: pydantic-settings>=2.10.1
|
19
|
+
Provides-Extra: dev
|
20
|
+
Requires-Dist: pytest>=8.4.1; extra == "dev"
|
21
|
+
Requires-Dist: pytest-asyncio>=1.0.0; extra == "dev"
|
22
|
+
Requires-Dist: pytest-cov>=6.2.1; extra == "dev"
|
23
|
+
Requires-Dist: pytest-mock>=3.14.1; extra == "dev"
|
24
|
+
Requires-Dist: black>=25.1.0; extra == "dev"
|
25
|
+
Requires-Dist: isort>=6.0.1; extra == "dev"
|
26
|
+
Requires-Dist: mypy>=1.16.1; extra == "dev"
|
27
|
+
Requires-Dist: flake8>=7.3.0; extra == "dev"
|
28
|
+
Dynamic: license-file
|
29
|
+
|
30
|
+
# Aisberg Python SDK
|
31
|
+
|
32
|
+

|
33
|
+

|
34
|
+
|
35
|
+
Aisberg SDK for Python is a robust and easy-to-use library for interacting with the Aisberg API.
|
36
|
+
It provides **synchronous** and **asynchronous** clients, advanced module abstractions, and built-in support for
|
37
|
+
conversational LLM workflows, collections, embeddings, and more.
|
38
|
+
|
39
|
+
---
|
40
|
+
|
41
|
+
## Features
|
42
|
+
|
43
|
+
- **Sync & Async clients**: Use with regular scripts or async frameworks
|
44
|
+
- **Auto tool execution** for LLM flows (tool calls, results integration)
|
45
|
+
- **Modular architecture**: Collections, chat, models, workflows, embeddings, and more
|
46
|
+
- **Strong typing** via Pydantic models
|
47
|
+
- **Environment-based configuration** (supports `.env` files and system environment variables)
|
48
|
+
- **Context manager support** for easy resource management
|
49
|
+
- **Custom tool registration**: Easily extend LLM capabilities with your own functions
|
50
|
+
|
51
|
+
---
|
52
|
+
|
53
|
+
## Installation
|
54
|
+
|
55
|
+
```sh
|
56
|
+
pip install aisberg
|
57
|
+
````
|
58
|
+
|
59
|
+
Or, for local development:
|
60
|
+
|
61
|
+
```sh
|
62
|
+
git clone https://your.git.repo/aisberg.git
|
63
|
+
cd aisberg
|
64
|
+
pip install -e .
|
65
|
+
```
|
66
|
+
|
67
|
+
---
|
68
|
+
|
69
|
+
## Quickstart
|
70
|
+
|
71
|
+
### 1. **Configure your API key and base URL**
|
72
|
+
|
73
|
+
You can set them as environment variables, or in a `.env` file:
|
74
|
+
|
75
|
+
```env
|
76
|
+
AISBERG_API_KEY=...
|
77
|
+
AISBERG_BASE_URL=https://url
|
78
|
+
```
|
79
|
+
|
80
|
+
### 2. **Synchronous Usage**
|
81
|
+
|
82
|
+
```python
|
83
|
+
from aisberg import AisbergClient
|
84
|
+
|
85
|
+
with AisbergClient() as client:
|
86
|
+
me = client.me.info()
|
87
|
+
print(me)
|
88
|
+
|
89
|
+
chat_response = client.chat.complete(
|
90
|
+
input="Bonjour, qui es-tu ?",
|
91
|
+
model="llm-aisberg",
|
92
|
+
)
|
93
|
+
print(chat_response.choices[0].message.content)
|
94
|
+
```
|
95
|
+
|
96
|
+
### 3. **Asynchronous Usage**
|
97
|
+
|
98
|
+
```python
|
99
|
+
import asyncio
|
100
|
+
from aisberg import AisbergAsyncClient
|
101
|
+
|
102
|
+
|
103
|
+
async def main():
|
104
|
+
async with AisbergAsyncClient() as client:
|
105
|
+
await client.initialize()
|
106
|
+
me = await client.me.info()
|
107
|
+
print(me)
|
108
|
+
|
109
|
+
chat_response = await client.chat.complete(
|
110
|
+
input="Hello, who are you?",
|
111
|
+
model="llm-aisberg",
|
112
|
+
)
|
113
|
+
print(chat_response.choices[0].message.content)
|
114
|
+
|
115
|
+
|
116
|
+
asyncio.run(main())
|
117
|
+
```
|
118
|
+
|
119
|
+
---
|
120
|
+
|
121
|
+
## Modules
|
122
|
+
|
123
|
+
* `client.me` — User/account info
|
124
|
+
* `client.chat` — Conversational LLM completions and streaming
|
125
|
+
* `client.collections` — Manage data collections
|
126
|
+
* `client.embeddings` — Encode texts to embeddings
|
127
|
+
* `client.models` — Model discovery & info
|
128
|
+
* `client.workflows` — Workflow management & execution
|
129
|
+
* `client.tools` — Register and execute tools for LLM tool calls
|
130
|
+
|
131
|
+
Each module is available both in the sync and async clients with similar APIs.
|
132
|
+
|
133
|
+
---
|
134
|
+
|
135
|
+
## Tool Calls and Automatic Execution
|
136
|
+
|
137
|
+
The SDK supports **tool-augmented LLM workflows**.
|
138
|
+
Register your own functions for use in chat:
|
139
|
+
|
140
|
+
```python
|
141
|
+
def my_tool(args):
|
142
|
+
# Custom business logic
|
143
|
+
return {"result": "tool output"}
|
144
|
+
|
145
|
+
|
146
|
+
client.tools.register("my_tool", my_tool)
|
147
|
+
response = client.chat.complete(
|
148
|
+
input="Use the tool please.",
|
149
|
+
model="llm-aisberg",
|
150
|
+
tools=[{"name": "my_tool", ...}],
|
151
|
+
auto_execute_tools=True,
|
152
|
+
)
|
153
|
+
```
|
154
|
+
|
155
|
+
---
|
156
|
+
|
157
|
+
## Advanced Usage
|
158
|
+
|
159
|
+
### **Custom Configuration**
|
160
|
+
|
161
|
+
You can override configuration when instantiating the client:
|
162
|
+
|
163
|
+
```python
|
164
|
+
client = AisbergClient(
|
165
|
+
api_key="...",
|
166
|
+
base_url="https://url",
|
167
|
+
timeout=60,
|
168
|
+
)
|
169
|
+
```
|
170
|
+
|
171
|
+
### **Environment Variables Supported**
|
172
|
+
|
173
|
+
* `AISBERG_API_KEY`
|
174
|
+
* `AISBERG_BASE_URL`
|
175
|
+
* `AISBERG_TIMEOUT` (optional)
|
176
|
+
|
177
|
+
### **Using in a Context Manager**
|
178
|
+
|
179
|
+
Both clients are context manager compatible:
|
180
|
+
|
181
|
+
```python
|
182
|
+
with AisbergClient() as client:
|
183
|
+
# Sync usage
|
184
|
+
...
|
185
|
+
|
186
|
+
async with AisbergAsyncClient() as client:
|
187
|
+
# Async usage
|
188
|
+
...
|
189
|
+
```
|
190
|
+
|
191
|
+
---
|
192
|
+
|
193
|
+
## License
|
194
|
+
|
195
|
+
**Private License — Not for public distribution or resale.**
|
196
|
+
|
197
|
+
For enterprise/commercial use, please contact [Mathis Lambert](mailto:mathis.lambert@freepro.com) or Free Pro.
|
198
|
+
|
199
|
+
---
|
200
|
+
|
201
|
+
## Authors
|
202
|
+
|
203
|
+
* Mathis Lambert
|
204
|
+
* Free Pro
|
205
|
+
|
206
|
+
---
|
207
|
+
|
208
|
+
## Support
|
209
|
+
|
210
|
+
For support, bug reports, or feature requests, please contact your technical representative.
|
211
|
+
|
212
|
+
---
|
aisberg-0.1.0/README.md
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
# Aisberg Python SDK
|
2
|
+
|
3
|
+

|
4
|
+

|
5
|
+
|
6
|
+
Aisberg SDK for Python is a robust and easy-to-use library for interacting with the Aisberg API.
|
7
|
+
It provides **synchronous** and **asynchronous** clients, advanced module abstractions, and built-in support for
|
8
|
+
conversational LLM workflows, collections, embeddings, and more.
|
9
|
+
|
10
|
+
---
|
11
|
+
|
12
|
+
## Features
|
13
|
+
|
14
|
+
- **Sync & Async clients**: Use with regular scripts or async frameworks
|
15
|
+
- **Auto tool execution** for LLM flows (tool calls, results integration)
|
16
|
+
- **Modular architecture**: Collections, chat, models, workflows, embeddings, and more
|
17
|
+
- **Strong typing** via Pydantic models
|
18
|
+
- **Environment-based configuration** (supports `.env` files and system environment variables)
|
19
|
+
- **Context manager support** for easy resource management
|
20
|
+
- **Custom tool registration**: Easily extend LLM capabilities with your own functions
|
21
|
+
|
22
|
+
---
|
23
|
+
|
24
|
+
## Installation
|
25
|
+
|
26
|
+
```sh
|
27
|
+
pip install aisberg
|
28
|
+
````
|
29
|
+
|
30
|
+
Or, for local development:
|
31
|
+
|
32
|
+
```sh
|
33
|
+
git clone https://your.git.repo/aisberg.git
|
34
|
+
cd aisberg
|
35
|
+
pip install -e .
|
36
|
+
```
|
37
|
+
|
38
|
+
---
|
39
|
+
|
40
|
+
## Quickstart
|
41
|
+
|
42
|
+
### 1. **Configure your API key and base URL**
|
43
|
+
|
44
|
+
You can set them as environment variables, or in a `.env` file:
|
45
|
+
|
46
|
+
```env
|
47
|
+
AISBERG_API_KEY=...
|
48
|
+
AISBERG_BASE_URL=https://url
|
49
|
+
```
|
50
|
+
|
51
|
+
### 2. **Synchronous Usage**
|
52
|
+
|
53
|
+
```python
|
54
|
+
from aisberg import AisbergClient
|
55
|
+
|
56
|
+
with AisbergClient() as client:
|
57
|
+
me = client.me.info()
|
58
|
+
print(me)
|
59
|
+
|
60
|
+
chat_response = client.chat.complete(
|
61
|
+
input="Bonjour, qui es-tu ?",
|
62
|
+
model="llm-aisberg",
|
63
|
+
)
|
64
|
+
print(chat_response.choices[0].message.content)
|
65
|
+
```
|
66
|
+
|
67
|
+
### 3. **Asynchronous Usage**
|
68
|
+
|
69
|
+
```python
|
70
|
+
import asyncio
|
71
|
+
from aisberg import AisbergAsyncClient
|
72
|
+
|
73
|
+
|
74
|
+
async def main():
|
75
|
+
async with AisbergAsyncClient() as client:
|
76
|
+
await client.initialize()
|
77
|
+
me = await client.me.info()
|
78
|
+
print(me)
|
79
|
+
|
80
|
+
chat_response = await client.chat.complete(
|
81
|
+
input="Hello, who are you?",
|
82
|
+
model="llm-aisberg",
|
83
|
+
)
|
84
|
+
print(chat_response.choices[0].message.content)
|
85
|
+
|
86
|
+
|
87
|
+
asyncio.run(main())
|
88
|
+
```
|
89
|
+
|
90
|
+
---
|
91
|
+
|
92
|
+
## Modules
|
93
|
+
|
94
|
+
* `client.me` — User/account info
|
95
|
+
* `client.chat` — Conversational LLM completions and streaming
|
96
|
+
* `client.collections` — Manage data collections
|
97
|
+
* `client.embeddings` — Encode texts to embeddings
|
98
|
+
* `client.models` — Model discovery & info
|
99
|
+
* `client.workflows` — Workflow management & execution
|
100
|
+
* `client.tools` — Register and execute tools for LLM tool calls
|
101
|
+
|
102
|
+
Each module is available both in the sync and async clients with similar APIs.
|
103
|
+
|
104
|
+
---
|
105
|
+
|
106
|
+
## Tool Calls and Automatic Execution
|
107
|
+
|
108
|
+
The SDK supports **tool-augmented LLM workflows**.
|
109
|
+
Register your own functions for use in chat:
|
110
|
+
|
111
|
+
```python
|
112
|
+
def my_tool(args):
|
113
|
+
# Custom business logic
|
114
|
+
return {"result": "tool output"}
|
115
|
+
|
116
|
+
|
117
|
+
client.tools.register("my_tool", my_tool)
|
118
|
+
response = client.chat.complete(
|
119
|
+
input="Use the tool please.",
|
120
|
+
model="llm-aisberg",
|
121
|
+
tools=[{"name": "my_tool", ...}],
|
122
|
+
auto_execute_tools=True,
|
123
|
+
)
|
124
|
+
```
|
125
|
+
|
126
|
+
---
|
127
|
+
|
128
|
+
## Advanced Usage
|
129
|
+
|
130
|
+
### **Custom Configuration**
|
131
|
+
|
132
|
+
You can override configuration when instantiating the client:
|
133
|
+
|
134
|
+
```python
|
135
|
+
client = AisbergClient(
|
136
|
+
api_key="...",
|
137
|
+
base_url="https://url",
|
138
|
+
timeout=60,
|
139
|
+
)
|
140
|
+
```
|
141
|
+
|
142
|
+
### **Environment Variables Supported**
|
143
|
+
|
144
|
+
* `AISBERG_API_KEY`
|
145
|
+
* `AISBERG_BASE_URL`
|
146
|
+
* `AISBERG_TIMEOUT` (optional)
|
147
|
+
|
148
|
+
### **Using in a Context Manager**
|
149
|
+
|
150
|
+
Both clients are context manager compatible:
|
151
|
+
|
152
|
+
```python
|
153
|
+
with AisbergClient() as client:
|
154
|
+
# Sync usage
|
155
|
+
...
|
156
|
+
|
157
|
+
async with AisbergAsyncClient() as client:
|
158
|
+
# Async usage
|
159
|
+
...
|
160
|
+
```
|
161
|
+
|
162
|
+
---
|
163
|
+
|
164
|
+
## License
|
165
|
+
|
166
|
+
**Private License — Not for public distribution or resale.**
|
167
|
+
|
168
|
+
For enterprise/commercial use, please contact [Mathis Lambert](mailto:mathis.lambert@freepro.com) or Free Pro.
|
169
|
+
|
170
|
+
---
|
171
|
+
|
172
|
+
## Authors
|
173
|
+
|
174
|
+
* Mathis Lambert
|
175
|
+
* Free Pro
|
176
|
+
|
177
|
+
---
|
178
|
+
|
179
|
+
## Support
|
180
|
+
|
181
|
+
For support, bug reports, or feature requests, please contact your technical representative.
|
182
|
+
|
183
|
+
---
|
File without changes
|
@@ -0,0 +1,57 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from abc import ABC
|
4
|
+
from typing import TYPE_CHECKING, Union, Optional
|
5
|
+
|
6
|
+
if TYPE_CHECKING:
|
7
|
+
from ..client import AisbergClient
|
8
|
+
from ..async_client import AisbergAsyncClient
|
9
|
+
from httpx import Client as HttpClient
|
10
|
+
from httpx import AsyncClient as AsyncHttpClient
|
11
|
+
|
12
|
+
|
13
|
+
class BaseModule(ABC):
|
14
|
+
"""Abstract base class for modules in the Aisberg framework."""
|
15
|
+
|
16
|
+
def __init__(
|
17
|
+
self,
|
18
|
+
parent: Union["AisbergClient", "AisbergAsyncClient"],
|
19
|
+
http_client: Optional[Union["HttpClient", "AsyncHttpClient"]] = None,
|
20
|
+
):
|
21
|
+
"""
|
22
|
+
Initialize the BaseModule.
|
23
|
+
|
24
|
+
Args:
|
25
|
+
parent (Any): Parent client or module.
|
26
|
+
http_client (Any): HTTP client for making requests.
|
27
|
+
"""
|
28
|
+
self._parent = parent
|
29
|
+
self._client = http_client
|
30
|
+
|
31
|
+
|
32
|
+
class SyncModule(BaseModule):
|
33
|
+
"""Abstract base class for synchronous modules in the Aisberg framework."""
|
34
|
+
|
35
|
+
def __init__(self, parent: "AisbergClient", http_client: "HttpClient"):
|
36
|
+
"""
|
37
|
+
Initialize the SyncModule.
|
38
|
+
|
39
|
+
Args:
|
40
|
+
parent (Any): Parent client or module.
|
41
|
+
http_client (Any): HTTP client for making requests.
|
42
|
+
"""
|
43
|
+
super().__init__(parent, http_client)
|
44
|
+
|
45
|
+
|
46
|
+
class AsyncModule(BaseModule):
|
47
|
+
"""Abstract base class for asynchronous modules in the Aisberg framework."""
|
48
|
+
|
49
|
+
def __init__(self, parent: "AisbergAsyncClient", http_client: "AsyncHttpClient"):
|
50
|
+
"""
|
51
|
+
Initialize the AsyncModule.
|
52
|
+
|
53
|
+
Args:
|
54
|
+
parent (Any): Parent client or module.
|
55
|
+
http_client (Any): HTTP client for making requests.
|
56
|
+
"""
|
57
|
+
super().__init__(parent, http_client)
|
File without changes
|