Update OpenAI embedding handling for both list and base64 embeddings
- Fix OpenAI embedding array parsing - Improve embedding data type safety
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -70,4 +70,5 @@ gui/
|
||||
test_*
|
||||
|
||||
# Cline files
|
||||
memory-bank
|
||||
memory-bank/
|
||||
|
||||
@@ -477,7 +477,8 @@ async def openai_embed(
|
||||
)
|
||||
return np.array(
|
||||
[
|
||||
np.frombuffer(base64.b64decode(dp.embedding), dtype=np.float32)
|
||||
np.array(dp.embedding, dtype=np.float32) if isinstance(dp.embedding, list)
|
||||
else np.frombuffer(base64.b64decode(dp.embedding), dtype=np.float32)
|
||||
for dp in response.data
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user