{
"name": "ValidationError",
"message": "2 validation errors for DocArrayDoc
text
Field required [type=missing, input_value={'embedding': [-0.0021856... -0.020489846465678658]}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.6/v/missing
metadata
Field required [type=missing, input_value={'embedding': [-0.0021856... -0.020489846465678658]}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.6/v/missing",
"stack": "---------------------------------------------------------------------------
ValidationError Traceback (most recent call last)
Cell In[28], line 1
----> 1 docs = db.similarity_search(query)
File ~/miniconda3/envs/deeplearning-ng/lib/python3.10/site-packages/langchain_community/vectorstores/docarray/base.py:127, in DocArrayIndex.similarity_search(self, query, k, **kwargs)
115 def similarity_search(
116 self, query: str, k: int = 4, **kwargs: Any
117 ) -> List[Document]:
118 \"\"\"Return docs most similar to query.
119
120 Args:
(...)
125 List of Documents most similar to the query.
126 \"\"\"
--> 127 results = self.similarity_search_with_score(query, k=k, **kwargs)
128 return [doc for doc, _ in results]
File ~/miniconda3/envs/deeplearning-ng/lib/python3.10/site-packages/langchain_community/vectorstores/docarray/base.py:106, in DocArrayIndex.similarity_search_with_score(self, query, k, **kwargs)
94 \"\"\"Return docs most similar to query.
95
96 Args:
(...)
103 Lower score represents more similarity.
104 \"\"\"
105 query_embedding = self.embedding.embed_query(query)
--> 106 query_doc = self.doc_cls(embedding=query_embedding) # type: ignore
107 docs, scores = self.doc_index.find(query_doc, search_field=\"embedding\", limit=k)
109 result = [
110 (Document(page_content=doc.text, metadata=doc.metadata), score)
111 for doc, score in zip(docs, scores)
112 ]
File ~/miniconda3/envs/deeplearning-ng/lib/python3.10/site-packages/pydantic/main.py:171, in BaseModel.__init__(self, **data)
169 # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
170 __tracebackhide__ = True
--> 171 self.__pydantic_validator__.validate_python(data, self_instance=self)
ValidationError: 2 validation errors for DocArrayDoc
text
Field required [type=missing, input_value={'embedding': [-0.0021856... -0.020489846465678658]}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.6/v/missing
metadata
Field required [type=missing, input_value={'embedding': [-0.0021856... -0.020489846465678658]}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.6/v/missing"
}```
on this cell:
docs = db.similarity_search(query)