Skip to content

pymilvus import error message in PyCharm for milvus_model #2562

@codingjaguar

Description

@codingjaguar

Another question regarding https://milvus.io/docs/full_text_search_with_milvus.md

from pymilvus.model.hybrid import BGEM3EmbeddingFunction

This code runs fine, but in my Pycharm, it always displays 'hybrid' and 'BGEM3EmbeddingFunction' unavailable. I searched the libraries, and found:

ls venv/lib/python3.10/site-packages/milvus_model/hybrid/         
__init__.py     __pycache__     bge_m3.py       mgte.py

ls venv/lib/python3.10/site-packages/pymilvus/model/__init__.py 
venv/lib/python3.10/site-packages/pymilvus/model/__init__.py

So the module is actually defined and exported under "milvus_model/hybrid/init.py ", not "pymilvus/model/init.py", so I changed the import to:

from milvus_model.hybrid import BGEM3EmbeddingFunction

The tutorial results work exactly the same as "from pymilvus.model.hybrid import BGEM3EmbeddingFunction". But the change gets rid of the import error message in PyCharm. Is this good?

@codingjaguar can help on answering this question

Originally posted by @xiaofan-luan in milvus-io/milvus#36226 (reply in thread)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions