ragit 0.7.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ragit
3
- Version: 0.7.2
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>
@@ -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,6 +165,10 @@ 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
174
  f"{self.embedding_url}/api/embeddings",
@@ -199,6 +206,10 @@ class OllamaProvider(BaseLLMProvider, BaseEmbeddingProvider):
199
206
  results = []
200
207
  try:
201
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
+
202
213
  response = requests.post(
203
214
  f"{self.embedding_url}/api/embeddings",
204
215
  headers=self._get_headers(include_auth=False),
@@ -2,4 +2,4 @@
2
2
  # Copyright RODMENA LIMITED 2025
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
  #
5
- __version__ = "0.7.2"
5
+ __version__ = "0.7.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ragit
3
- Version: 0.7.2
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>
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