[memory/RAG] Duplicated _embed() logic in MemoryVectorStore and VectorRAG with subtle differences #760
Labels
No labels
area:chat
area:core
area:llm
area:routes
area:tools
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sleepy/odysseus#760
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
"Files:
src/rag_vector.pyandservices/memory/memory_vector.pyBothVectorRAG._embed()andMemoryVectorStore._embed()implement embedding logic:python # rag_vector.py line 72 vecs = self._model.encode(texts, normalize_embeddings=True) return np.array(vecs, dtype=np.float32).tolist() # memory_vector.py line 56 vecs = self._model.encode(texts, normalize_embeddings=True) return vecs.tolist()Subtle difference:rag_vector.pyconverts through numpy first (which may already be a numpy array from the encoder), whilememory_vector.pycalls.tolist()directly. If the encoder returns an ndarray, both work, but if it returns something else, the behavior diverges. Action: Extract embedding into a shared utility or makeMemoryVectorStoreaccept the same embedding client thatVectorRAGuses. Both already useget_embedding_client()fromsrc/embeddings.pybut instantiate it independently."