Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PineconeApiAttributeError: ScoredVector has no attribute 'metadata' at ['['received_data', 'matches', 0]']['metadata'] #1

Open
pratim808 opened this issue Oct 29, 2024 · 0 comments

Comments

@pratim808
Copy link

pratim808 commented Oct 29, 2024

After executing this code
query = "Django javascript integration"

docs = docsearch.similarity_search(query, k=3)
print("Result:", docs)

I am getting this error how can i solve this error

PineconeApiAttributeError Traceback (most recent call last)
Cell In[25], line 3
1 query = "Django javascript integration"
----> 3 docs = docsearch.similarity_search(query, k=3)
4 print("Result:", docs)

File /opt/conda/lib/python3.10/site-packages/langchain_community/vectorstores/pinecone.py:234, in Pinecone.similarity_search(self, query, k, filter, namespace, **kwargs)
215 def similarity_search(
216 self,
217 query: str,
(...)
221 **kwargs: Any,
222 ) -> List[Document]:
223 """Return pinecone documents most similar to query.
224
225 Args:
(...)
232 List of Documents most similar to the query and score for each
233 """
--> 234 docs_and_scores = self.similarity_search_with_score(
235 query, k=k, filter=filter, namespace=namespace, **kwargs
236 )
237 return [doc for doc, _ in docs_and_scores]

File /opt/conda/lib/python3.10/site-packages/langchain_community/vectorstores/pinecone.py:179, in Pinecone.similarity_search_with_score(self, query, k, filter, namespace)
161 def similarity_search_with_score(
162 self,
163 query: str,
(...)
166 namespace: Optional[str] = None,
167 ) -> List[Tuple[Document, float]]:
168 """Return pinecone documents most similar to query, along with scores.
169
170 Args:
(...)
177 List of Documents most similar to the query and score for each
178 """
--> 179 return self.similarity_search_by_vector_with_score(
180 self._embed_query(query), k=k, filter=filter, namespace=namespace
181 )

File /opt/conda/lib/python3.10/site-packages/langchain_community/vectorstores/pinecone.py:204, in Pinecone.similarity_search_by_vector_with_score(self, embedding, k, filter, namespace)
196 results = self._index.query(
197 vector=[embedding],
198 top_k=k,
(...)
201 filter=filter,
202 )
203 for res in results["matches"]:
--> 204 metadata = res["metadata"]
205 if self._text_key in metadata:
206 text = metadata.pop(self._text_key)

File /opt/conda/lib/python3.10/site-packages/pinecone/core/openapi/shared/model_utils.py:446, in ModelNormal.getitem(self, name)
443 if name in self:
444 return self.get(name)
--> 446 raise PineconeApiAttributeError(
447 "{0} has no attribute '{1}'".format(type(self).name, name), [e for e in [self._path_to_item, name] if e]
448 )

PineconeApiAttributeError: ScoredVector has no attribute 'metadata' at ['['received_data', 'matches', 0]']['metadata']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant