Skip to content

Commit f1c6a4e

Browse files
authored
Merge pull request #1928 from danielaskdd/main
Fix: Update OpenAI embedding handling for both list and base64 embeddings
2 parents cf06457 + ffb642a commit f1c6a4e

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ gui/
7070
test_*
7171

7272
# Cline files
73+
memory-bank
7374
memory-bank/

lightrag/llm/openai.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,9 @@ async def openai_embed(
477477
)
478478
return np.array(
479479
[
480-
np.frombuffer(base64.b64decode(dp.embedding), dtype=np.float32)
480+
np.array(dp.embedding, dtype=np.float32)
481+
if isinstance(dp.embedding, list)
482+
else np.frombuffer(base64.b64decode(dp.embedding), dtype=np.float32)
481483
for dp in response.data
482484
]
483485
)

0 commit comments

Comments
 (0)