ragit 0.7.1__tar.gz → 0.7.3__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.
- {ragit-0.7.1 → ragit-0.7.3}/PKG-INFO +5 -1
- {ragit-0.7.1 → ragit-0.7.3}/pyproject.toml +6 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/providers/ollama.py +41 -25
- {ragit-0.7.1 → ragit-0.7.3}/ragit/version.py +1 -1
- {ragit-0.7.1 → ragit-0.7.3}/ragit.egg-info/PKG-INFO +5 -1
- {ragit-0.7.1 → ragit-0.7.3}/ragit.egg-info/requires.txt +5 -0
- {ragit-0.7.1 → ragit-0.7.3}/LICENSE +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/README.md +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/__init__.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/assistant.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/config.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/core/__init__.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/core/experiment/__init__.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/core/experiment/experiment.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/core/experiment/results.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/loaders.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/providers/__init__.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/providers/base.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit/utils/__init__.py +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit.egg-info/SOURCES.txt +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit.egg-info/dependency_links.txt +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/ragit.egg-info/top_level.txt +0 -0
- {ragit-0.7.1 → ragit-0.7.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ragit
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: Automatic RAG Pattern Optimization Engine
|
|
5
5
|
Author: RODMENA LIMITED
|
|
6
6
|
Maintainer-email: RODMENA LIMITED <info@rodmena.co.uk>
|
|
@@ -37,6 +37,10 @@ Provides-Extra: test
|
|
|
37
37
|
Requires-Dist: pytest; extra == "test"
|
|
38
38
|
Requires-Dist: pytest-cov; extra == "test"
|
|
39
39
|
Requires-Dist: pytest-mock; extra == "test"
|
|
40
|
+
Provides-Extra: docs
|
|
41
|
+
Requires-Dist: sphinx>=7.0; extra == "docs"
|
|
42
|
+
Requires-Dist: sphinx-rtd-theme>=2.0; extra == "docs"
|
|
43
|
+
Requires-Dist: sphinx-copybutton>=0.5; extra == "docs"
|
|
40
44
|
Dynamic: license-file
|
|
41
45
|
|
|
42
46
|
# ragit
|
|
@@ -56,6 +56,9 @@ class OllamaProvider(BaseLLMProvider, BaseEmbeddingProvider):
|
|
|
56
56
|
"qwen3-embedding:8b": 4096,
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
# Max characters per embedding request (safe limit for 512 token models)
|
|
60
|
+
MAX_EMBED_CHARS = 1500
|
|
61
|
+
|
|
59
62
|
def __init__(
|
|
60
63
|
self,
|
|
61
64
|
base_url: str | None = None,
|
|
@@ -162,17 +165,21 @@ class OllamaProvider(BaseLLMProvider, BaseEmbeddingProvider):
|
|
|
162
165
|
self._current_embed_model = model
|
|
163
166
|
self._current_dimensions = self.EMBEDDING_DIMENSIONS.get(model, 768)
|
|
164
167
|
|
|
168
|
+
# Truncate oversized inputs to prevent context length errors
|
|
169
|
+
if len(text) > self.MAX_EMBED_CHARS:
|
|
170
|
+
text = text[: self.MAX_EMBED_CHARS]
|
|
171
|
+
|
|
165
172
|
try:
|
|
166
173
|
response = requests.post(
|
|
167
|
-
f"{self.embedding_url}/api/
|
|
174
|
+
f"{self.embedding_url}/api/embeddings",
|
|
168
175
|
headers=self._get_headers(include_auth=False),
|
|
169
|
-
json={"model": model, "
|
|
176
|
+
json={"model": model, "prompt": text},
|
|
170
177
|
timeout=self.timeout,
|
|
171
178
|
)
|
|
172
179
|
response.raise_for_status()
|
|
173
180
|
data = response.json()
|
|
174
181
|
|
|
175
|
-
embedding = data.get("
|
|
182
|
+
embedding = data.get("embedding", [])
|
|
176
183
|
if not embedding:
|
|
177
184
|
raise ValueError("Empty embedding returned from Ollama")
|
|
178
185
|
|
|
@@ -189,33 +196,42 @@ class OllamaProvider(BaseLLMProvider, BaseEmbeddingProvider):
|
|
|
189
196
|
raise ConnectionError(f"Ollama embed failed: {e}") from e
|
|
190
197
|
|
|
191
198
|
def embed_batch(self, texts: list[str], model: str) -> list[EmbeddingResponse]:
|
|
192
|
-
"""Generate embeddings for multiple texts (uses embedding_url, no auth for local).
|
|
199
|
+
"""Generate embeddings for multiple texts (uses embedding_url, no auth for local).
|
|
200
|
+
|
|
201
|
+
Note: Ollama /api/embeddings only supports single prompts, so we loop.
|
|
202
|
+
"""
|
|
193
203
|
self._current_embed_model = model
|
|
194
204
|
self._current_dimensions = self.EMBEDDING_DIMENSIONS.get(model, 768)
|
|
195
205
|
|
|
206
|
+
results = []
|
|
196
207
|
try:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
208
|
+
for text in texts:
|
|
209
|
+
# Truncate oversized inputs to prevent context length errors
|
|
210
|
+
if len(text) > self.MAX_EMBED_CHARS:
|
|
211
|
+
text = text[: self.MAX_EMBED_CHARS]
|
|
212
|
+
|
|
213
|
+
response = requests.post(
|
|
214
|
+
f"{self.embedding_url}/api/embeddings",
|
|
215
|
+
headers=self._get_headers(include_auth=False),
|
|
216
|
+
json={"model": model, "prompt": text},
|
|
217
|
+
timeout=self.timeout,
|
|
218
|
+
)
|
|
219
|
+
response.raise_for_status()
|
|
220
|
+
data = response.json()
|
|
221
|
+
|
|
222
|
+
embedding = data.get("embedding", [])
|
|
223
|
+
if embedding:
|
|
224
|
+
self._current_dimensions = len(embedding)
|
|
225
|
+
|
|
226
|
+
results.append(
|
|
227
|
+
EmbeddingResponse(
|
|
228
|
+
embedding=tuple(embedding),
|
|
229
|
+
model=model,
|
|
230
|
+
provider=self.provider_name,
|
|
231
|
+
dimensions=len(embedding),
|
|
232
|
+
)
|
|
216
233
|
)
|
|
217
|
-
|
|
218
|
-
]
|
|
234
|
+
return results
|
|
219
235
|
except requests.RequestException as e:
|
|
220
236
|
raise ConnectionError(f"Ollama batch embed failed: {e}") from e
|
|
221
237
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ragit
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: Automatic RAG Pattern Optimization Engine
|
|
5
5
|
Author: RODMENA LIMITED
|
|
6
6
|
Maintainer-email: RODMENA LIMITED <info@rodmena.co.uk>
|
|
@@ -37,6 +37,10 @@ Provides-Extra: test
|
|
|
37
37
|
Requires-Dist: pytest; extra == "test"
|
|
38
38
|
Requires-Dist: pytest-cov; extra == "test"
|
|
39
39
|
Requires-Dist: pytest-mock; extra == "test"
|
|
40
|
+
Provides-Extra: docs
|
|
41
|
+
Requires-Dist: sphinx>=7.0; extra == "docs"
|
|
42
|
+
Requires-Dist: sphinx-rtd-theme>=2.0; extra == "docs"
|
|
43
|
+
Requires-Dist: sphinx-copybutton>=0.5; extra == "docs"
|
|
40
44
|
Dynamic: license-file
|
|
41
45
|
|
|
42
46
|
# ragit
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|