You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
I am sure that this is a bug in LangChain rather than my code.
The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
I've setup an AWS DocumentDB cluster, using pure pymongo code works for vector search, but using langchain not. I have no clues why, could you help me?
pymongo.errors.OperationFailure: Invalid type for vector, full error: {'ok': 0.0, 'operationTime': Timestamp(1729159273, 1), 'code': 9, 'errmsg': 'Invalid type for vector'}
Error Message and Stack Trace (if applicable)
client: MongoClient = MongoClient(connection_string)
Traceback (most recent call last):
File "/app/test.py", line 22, in <module>
docs = vectorstore.similarity_search("Test queryl")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/langchain_community/vectorstores/documentdb.py", line 369, in similarity_search
docs = self._similarity_search_without_score(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/langchain_community/vectorstores/documentdb.py", line 349, in _similarity_search_without_score
cursor = self._collection.aggregate(pipeline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/collection.py", line 2696, in aggregate
return self._aggregate(
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/_csot.py", line 108, in csot_wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/collection.py", line 2604, in _aggregate
return self.__database.client._retryable_read(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/mongo_client.py", line 1534, in _retryable_read
return self._retry_internal(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/_csot.py", line 108, in csot_wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/mongo_client.py", line 1501, in _retry_internal
).run()
^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/mongo_client.py", line 2347, in run
return self._read() if self._is_read else self._write()
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/mongo_client.py", line 2485, in _read
return self._func(self._session, self._server, conn, read_pref) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/aggregation.py", line 162, in get_cursor
result = conn.command(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/helpers.py", line 327, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/pool.py", line 985, in command
return command(
^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pymongo/network.py", line 212, in command
helpers._check_command_response(
File "/usr/local/lib/python3.12/site-packages/pymongo/helpers.py", line 233, in _check_command_response
raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Invalid type for vector, full error: {'ok': 0.0, 'operationTime': Timestamp(1729159273, 1), 'code': 9, 'errmsg': 'Invalid type for vector'}
Description
See "Example Code" part for what I'm doing, I expected the langchain version should also work, I've verified that the data, the vector search index and the embedding generated by bge-m3 are all right. Please suggest what else I need to check, thanks.
System Info
System Information
OS: Linux
OS Version: #1 SMP Tue Sep 10 22:02:55 UTC 2024
Python Version: 3.12.7 (main, Oct 1 2024, 22:28:49) [GCC 12.2.0]
Checked other resources
Example Code
I've setup an AWS DocumentDB cluster, using pure pymongo code works for vector search, but using langchain not. I have no clues why, could you help me?
Working code:
Not working code:
The error I got (see full stack trace below):
Error Message and Stack Trace (if applicable)
Description
See "Example Code" part for what I'm doing, I expected the langchain version should also work, I've verified that the data, the vector search index and the embedding generated by bge-m3 are all right. Please suggest what else I need to check, thanks.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: