datacoder 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl
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.
- datacoder/__init__.py +3 -3
- datacoder/client.py +10 -10
- {datacoder-0.2.0.dist-info → datacoder-0.2.1.dist-info}/METADATA +7 -7
- datacoder-0.2.1.dist-info/RECORD +6 -0
- datacoder-0.2.0.dist-info/RECORD +0 -6
- {datacoder-0.2.0.dist-info → datacoder-0.2.1.dist-info}/WHEEL +0 -0
- {datacoder-0.2.0.dist-info → datacoder-0.2.1.dist-info}/top_level.txt +0 -0
datacoder/__init__.py
CHANGED
datacoder/client.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""DataCoder
|
|
1
|
+
"""DataCoder client."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -55,7 +55,7 @@ class QuotaInfo:
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
class DataCoderError(Exception):
|
|
58
|
-
"""Base exception for DataCoder
|
|
58
|
+
"""Base exception for DataCoder errors."""
|
|
59
59
|
|
|
60
60
|
def __init__(self, message: str, status_code: int = 0, response: dict | None = None):
|
|
61
61
|
super().__init__(message)
|
|
@@ -84,14 +84,14 @@ class ForbiddenError(DataCoderError):
|
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
@dataclass
|
|
87
|
-
class
|
|
88
|
-
"""DataCoder
|
|
87
|
+
class DataCoder:
|
|
88
|
+
"""DataCoder — programmatic access to RAG knowledge bases.
|
|
89
89
|
|
|
90
90
|
Usage::
|
|
91
91
|
|
|
92
|
-
from
|
|
92
|
+
from datacoder import DataCoder
|
|
93
93
|
|
|
94
|
-
sdk =
|
|
94
|
+
sdk = DataCoder(
|
|
95
95
|
api_key="dc_sk_...",
|
|
96
96
|
base_url="https://datacoder.clouditia.com",
|
|
97
97
|
)
|
|
@@ -119,7 +119,7 @@ class DataCoderSDK:
|
|
|
119
119
|
self._session.headers.update({
|
|
120
120
|
"Authorization": f"Bearer {self.api_key}",
|
|
121
121
|
"Content-Type": "application/json",
|
|
122
|
-
"User-Agent": f"datacoder-
|
|
122
|
+
"User-Agent": f"datacoder-python/0.2.1",
|
|
123
123
|
})
|
|
124
124
|
|
|
125
125
|
def _request(self, method: str, path: str, **kwargs) -> dict:
|
|
@@ -136,7 +136,7 @@ class DataCoderSDK:
|
|
|
136
136
|
|
|
137
137
|
if resp.status_code == 401:
|
|
138
138
|
raise AuthenticationError(
|
|
139
|
-
"Invalid or expired
|
|
139
|
+
"Invalid or expired API key",
|
|
140
140
|
status_code=401,
|
|
141
141
|
response=resp.json() if resp.text else {},
|
|
142
142
|
)
|
|
@@ -182,9 +182,9 @@ class DataCoderSDK:
|
|
|
182
182
|
RAGResult with matching chunks, sources and scores.
|
|
183
183
|
|
|
184
184
|
Raises:
|
|
185
|
-
AuthenticationError: Invalid
|
|
185
|
+
AuthenticationError: Invalid API key.
|
|
186
186
|
QuotaExceededError: Daily quota or rate limit reached.
|
|
187
|
-
ForbiddenError:
|
|
187
|
+
ForbiddenError: API key doesn't have access to this folder.
|
|
188
188
|
NotFoundError: Folder not found.
|
|
189
189
|
"""
|
|
190
190
|
data = self._request("POST", "/sdk/rag/query/", json={
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datacoder
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Python SDK for DataCoder — AI Data Analyst Platform (RAG API)
|
|
5
5
|
Author-email: Clouditia <contact@clouditia.com>
|
|
6
6
|
License: MIT
|
|
@@ -36,10 +36,10 @@ pip install datacoder
|
|
|
36
36
|
## Quick Start
|
|
37
37
|
|
|
38
38
|
```python
|
|
39
|
-
from datacoder import
|
|
39
|
+
from datacoder import DataCoder
|
|
40
40
|
|
|
41
41
|
# Initialize with your SDK key and server URL
|
|
42
|
-
sdk =
|
|
42
|
+
sdk = DataCoder(
|
|
43
43
|
api_key="dc_sk_your_key_here",
|
|
44
44
|
base_url="https://datacoder.clouditia.com",
|
|
45
45
|
)
|
|
@@ -66,7 +66,7 @@ print(f"SDK remaining today: {quota.sdk_remaining}")
|
|
|
66
66
|
|
|
67
67
|
## API Reference
|
|
68
68
|
|
|
69
|
-
### `
|
|
69
|
+
### `DataCoder(api_key, base_url, timeout=30)`
|
|
70
70
|
|
|
71
71
|
Initialize the SDK client.
|
|
72
72
|
|
|
@@ -127,7 +127,7 @@ Test if the API is reachable and the key is valid. Returns `True` or `False`.
|
|
|
127
127
|
## Error Handling
|
|
128
128
|
|
|
129
129
|
```python
|
|
130
|
-
from datacoder import
|
|
130
|
+
from datacoder import DataCoder
|
|
131
131
|
from datacoder.client import (
|
|
132
132
|
AuthenticationError,
|
|
133
133
|
QuotaExceededError,
|
|
@@ -136,7 +136,7 @@ from datacoder.client import (
|
|
|
136
136
|
DataCoderError,
|
|
137
137
|
)
|
|
138
138
|
|
|
139
|
-
sdk =
|
|
139
|
+
sdk = DataCoder(api_key="dc_sk_...", base_url="https://...")
|
|
140
140
|
|
|
141
141
|
try:
|
|
142
142
|
result = sdk.query(folder_id="...", query="...")
|
|
@@ -164,7 +164,7 @@ except DataCoderError as e:
|
|
|
164
164
|
DataCoder can be deployed on your own infrastructure. Point `base_url` to your self-hosted instance:
|
|
165
165
|
|
|
166
166
|
```python
|
|
167
|
-
sdk =
|
|
167
|
+
sdk = DataCoder(
|
|
168
168
|
api_key="dc_sk_...",
|
|
169
169
|
base_url="https://datacoder.your-company.com",
|
|
170
170
|
)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
datacoder/__init__.py,sha256=_zzR0i28w8hzjQn3Ep09TG7td1_QPAfJj2jDItNOjNY,149
|
|
2
|
+
datacoder/client.py,sha256=H7VAf5YlQs5oSx_M8cHkq1LapD8KwVazAA6sFzgALcA,7076
|
|
3
|
+
datacoder-0.2.1.dist-info/METADATA,sha256=vuPR6PrLQ6ZXsnvjhA55D1u2g7u3R_EPTAlX_e1vZHM,5276
|
|
4
|
+
datacoder-0.2.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
5
|
+
datacoder-0.2.1.dist-info/top_level.txt,sha256=1KTmDuB8GVRNTSmq-K2E9h_FGVE9qIcaN2XUcMZ3Lx0,10
|
|
6
|
+
datacoder-0.2.1.dist-info/RECORD,,
|
datacoder-0.2.0.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
datacoder/__init__.py,sha256=gsCovq75F7z2glRlvuQ4_uF67M5BuGE27V7YlYkhUhE,155
|
|
2
|
-
datacoder/client.py,sha256=fS4R6k9QNT-NpMUgBx9cnnlxuYHOBiVOVVBA_Ln1utw,7105
|
|
3
|
-
datacoder-0.2.0.dist-info/METADATA,sha256=Bn4O6ILm3A7xuerCpgQ9-zie_oUqyxdNgmkxwUEbGcM,5294
|
|
4
|
-
datacoder-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
5
|
-
datacoder-0.2.0.dist-info/top_level.txt,sha256=1KTmDuB8GVRNTSmq-K2E9h_FGVE9qIcaN2XUcMZ3Lx0,10
|
|
6
|
-
datacoder-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|