Add: Json Parsing to solve Hallucination Errors (#3013)
This commit is contained in:
@@ -11,6 +11,7 @@ import numpy as np
|
||||
|
||||
from mem0.configs.embeddings.base import BaseEmbedderConfig
|
||||
from mem0.embeddings.base import EmbeddingBase
|
||||
from mem0.memory.utils import extract_json
|
||||
|
||||
|
||||
class AWSBedrockEmbedding(EmbeddingBase):
|
||||
@@ -74,7 +75,7 @@ class AWSBedrockEmbedding(EmbeddingBase):
|
||||
contentType="application/json",
|
||||
)
|
||||
|
||||
response_body = json.loads(response.get("body").read())
|
||||
response_body = json.loads(extract_json(response.get("body").read()))
|
||||
|
||||
if provider == "cohere":
|
||||
embeddings = response_body.get("embeddings")[0]
|
||||
|
||||
Reference in New Issue
Block a user