Skip to content

Commit 68dfcee

Browse files
nievespg1Gabriel Nieves-PonceAlonsoGuevara
authored
Updated the variable names within the for-loop to differentiate betwe… (#1356)
* Updated the variable names within the for-loop to differentiate between them and the original title variable used in the dataframe. This avoids corrupting the original column-name defined in the title variable. * Semver and formart --------- Co-authored-by: Gabriel Nieves-Ponce <[email protected]> Co-authored-by: Alonso Guevara <[email protected]>
1 parent 634e3ed commit 68dfcee

File tree

3 files changed

+275
-275
lines changed

3 files changed

+275
-275
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "patch",
3+
"description": "Fix embeddings faulty assignments"
4+
}

graphrag/index/operations/embed_text/embed_text.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,16 @@ async def _text_embed_with_vector_store(
193193

194194
vectors = result.embeddings or []
195195
documents: list[VectorStoreDocument] = []
196-
for id, text, title, vector in zip(ids, texts, titles, vectors, strict=True):
197-
if type(vector) is np.ndarray:
198-
vector = vector.tolist()
196+
for doc_id, doc_text, doc_title, doc_vector in zip(
197+
ids, texts, titles, vectors, strict=True
198+
):
199+
if type(doc_vector) is np.ndarray:
200+
doc_vector = doc_vector.tolist()
199201
document = VectorStoreDocument(
200-
id=id,
201-
text=text,
202-
vector=vector,
203-
attributes={"title": title},
202+
id=doc_id,
203+
text=doc_text,
204+
vector=doc_vector,
205+
attributes={"title": doc_title},
204206
)
205207
documents.append(document)
206208

0 commit comments

Comments
 (0)