Skip to content

Commit 4d9c9bd

Browse files
authored
fix: add unsafe=True to make code properly run (#10172)
Without this change, `OutputAdapter` has an output of type string, which results in the following error: > Error: SentenceTransformersDocumentEmbedder expects a list of Documents as input.In case you want to embed a string, please use the SentenceTransformersTextEmbedder. _Note: the cookbook repo's Jupyter Notebook should also be updated._
1 parent 93edaeb commit 4d9c9bd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs-website/versioned_docs/version-2.20/optimization/advanced-rag-techniques/hypothetical-document-embeddings-hyde.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ prompt_builder = PromptBuilder(
5353
adapter = OutputAdapter(
5454
template="{{answers | build_doc}}",
5555
output_type=List[Document],
56-
custom_filters={"build_doc": lambda data: [Document(content=d) for d in data]}
56+
custom_filters={"build_doc": lambda data: [Document(content=d) for d in data]},
57+
unsafe=True
5758
)
5859

5960
embedder = SentenceTransformersDocumentEmbedder(model="sentence-transformers/all-MiniLM-L6-v2")

0 commit comments

Comments
 (0)