Skip to content

Commit 4a34b84

Browse files
fix(embedding): riduce EMBEDDING_BATCH_SIZE a 3 per evitare fallback lento su file grandi
1 parent 4b7a680 commit 4a34b84

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [1.3.2] - 2025-12-04
11+
12+
### Fixed
13+
- Further reduced default EMBEDDING_BATCH_SIZE from 10 to 3 (batch_size × chunk_tokens must be < 2048)
14+
1015
## [1.3.1] - 2025-12-04
1116

1217
### Fixed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ docker compose up -d
9494
| `OLLAMA_MODEL` | `nomic-embed-text` | Embedding model |
9595
| `CHUNK_SIZE` | `400` | Target chunk size in tokens |
9696
| `CHUNK_MAX_TOKENS` | `1500` | Maximum chunk size (safe margin for nomic-embed-text 2048 limit) |
97-
| `EMBEDDING_BATCH_SIZE` | `10` | Chunks per embedding API call (reduce if Ollama errors) |
97+
| `EMBEDDING_BATCH_SIZE` | `3` | Chunks per embedding API call (batch_size × chunk_tokens < 2048) |
9898

9999
## Features
100100

lib/embedding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
OLLAMA_URL = os.getenv('OLLAMA_URL', 'http://localhost:11434')
1818
EMBEDDING_MODEL = os.getenv('EMBEDDING_MODEL', 'nomic-embed-text')
1919
MAX_TOKENS = 2048 # nomic-embed-text context limit (configurable models may differ)
20-
EMBEDDING_BATCH_SIZE = int(os.getenv('EMBEDDING_BATCH_SIZE', '10')) # Reduced from 32 to avoid Ollama batch decode errors
20+
EMBEDDING_BATCH_SIZE = int(os.getenv('EMBEDDING_BATCH_SIZE', '3')) # Low default: batch_size * avg_chunk_tokens must be < 2048
2121

2222

2323
def get_embedding(text: str, timeout: int = 60, max_retries: int = 3) -> Optional[list[float]]:

0 commit comments

Comments
 (0)