Find answers from the community

Updated 12 months ago

AttributeError

At a glance

The post discusses an issue with the llama_index.core.version attribute, which is no longer available. The community members are trying to initialize an ElasticsearchStore object, but are encountering an AttributeError. One community member flags that the post contains sensitive information and advises caution. Another community member suggests that the Elasticsearch index needs to be updated, as the llama_index.core.__version no longer exists. A third community member offers to update the code the next morning or invites a pull request in the meantime. The fourth community member thanks the others for the feedback and mentions that they had forgotten to remove the sensitive information.

AttributeError
Cell In[1], line 26
21 from llama_index.core.vector_stores import ExactMatchFilter, MetadataFilters
25 # Initialize the vector store
---> 26 vector_store = ElasticsearchStore(
27 index_name="",
28 es_cloud_id="",
29 es_user="",
30 es_password="",
33 )
/venv/lib/python3.11/site-packages/llama_index/vector_stores/elasticsearch/base.py:197, in ElasticsearchStore.init(self, index_name, es_client, es_url, es_cloud_id, es_api_key, es_user, es_password, text_field, vector_field, batch_size, distance_strategy)
193 self._client = es_client.options(
194 headers={"user-agent": self.get_user_agent()}
195 )
196 elif es_url is not None or es_cloud_id is not None:
--> 197 self._client = _get_elasticsearch_client(
198 es_url=es_url,
199 username=es_user,
200 password=es_password,
...
230 """Get user agent for elasticsearch client."""
231 import llama_index
--> 233 return f"llama_index-py-vs/{llama_index.core.version}"
AttributeError: module 'llama_index.core' has no attribute 'version'
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
The code is given below:
from llama_index.vector_stores.elasticsearch import ElasticsearchStore
from llama_index.core import VectorStoreIndex, StorageContext
from llama_index.core.vector_stores import ExactMatchFilter, MetadataFilters

Initialize the vector store

vector_store = ElasticsearchStore(
index_name="",
es_cloud_id="",
es_user="",
es_password="",
)
v
L
n
4 comments
Hi! Your message contains sensitive information! Be careful with that πŸ™‚
Seems like the elastic search index needs to be updated, llama_index.core.__version no longer exists
thanks for flagging, I can update tomorrow morning (or feel free to make a PR in the meantime)
Thank you! I totally forgot to remove that.πŸ₯Ή
Add a reply
Sign up and join the conversation on Discord