Open Aydin-ab opened 2 weeks ago
Hello, @Aydin-ab! I'm here to help you with any bugs, questions, or contributions. Let's take a look at the issue you've shared and see how we can resolve it.
To fix the issue with initializing the OpensearchVectorClient
using an AWS endpoint and an async connection with connection_class=AsyncHttpConnection
, you need to modify the _get_opensearch_version
method to use the asynchronous client instead of the synchronous one. Here's how you can do it:
async def _get_opensearch_version(self) -> str:
info = await self._os_async_client.info()
return info["version"]["number"]
Make sure to call this method in an asynchronous context since it now uses the async client. This change ensures that the version check is performed using the asynchronous client, which should resolve the issue [1].
To continue talking to Dosu, mention @dosu.
@Aydin-ab I encourage you to make a PR for this 🙏🏻
Bug Description
Hello,
If you try to initialize the OpensearchVectorClient using an AWS endpoint -and- an async connection
connection_class=AsyncHttpConnection
you will get an errorAfter debugging, the source of the issue is this last commit https://github.com/run-llama/llama_index/commit/c872b5857e059ba29318693785d3c053d01cdfb5
Because we set
connection_class=AsyncHttpConnection
only the async clientself._os_async_client
is valid to use. But the version is checked using the sync clientself._os_client.info()
which causes the error.At the moment this is fixed by reverting to
llama-index-vector-stores-opensearch==0.2.2
To fix it, we could check the
connection_class
of the init kwargs and use the correct client when querying the versionVersion
0.11.20
Steps to Reproduce
initialize the OpensearchVectorClient using an AWS endpoint -and- an async connection
connection_class=AsyncHttpConnection
. But it's probably more about the async parameter than the AWS part.Relevant Logs/Tracbacks