英文:
import Azure HnswVectorSearchAlgorithmConfiguration comes Error: cannot import name 'HnswVectorSearchAlgorithmConfiguration'
问题
以下是您要翻译的部分:
"Here is the reference document I follow with:
https://esteininger.medium.com/building-a-vector-search-engine-using-hnsw-and-cosine-similarity-753fb5268839
&
https://github.com/Azure/cognitive-search-vector-pr/blob/main/demo-python/code/azure-search-vector-python-sample.ipynb
from azure.search.documents.models import Vector
from azure.search.documents.indexes.models import (
SearchIndex,
SearchField,
SearchFieldDataType,
SimpleField,
SearchableField,
SearchIndex,
SemanticConfiguration,
PrioritizedFields,
SemanticField,
SearchField,
SemanticSettings,
VectorSearch,
HnswVectorSearchAlgorithmConfiguration
)
At first, I faced import error which is about import Vector. I saw its solution on stackoverflow by updating azure.search.documents to the version ==11.4.0b6; While HnswVectorSearchAlgorithmConfiguration would be alwasy error no matter which version I used. I've tried azure.search.documents 11.4.0b6 and 11.4.0b4
If the import error remain unsolved, the folling part would be error too.
vector_search = VectorSearch(
algorithm_configurations=[
HnswVectorSearchAlgorithmConfiguration(
name="my-vector-config",
kind="hnsw",
parameters={
"m": 4,
"efConstruction": 400,
"efSearch": 500,
"metric": "cosine"
}
)
]
)
I also tried to walkaround by import hnswlib
, but it didn't work...
enter image description here
If someone has conquer this issue, please let me know. Thank you!
英文:
Here is the reference document I follow with:
https://esteininger.medium.com/building-a-vector-search-engine-using-hnsw-and-cosine-similarity-753fb5268839
&
https://github.com/Azure/cognitive-search-vector-pr/blob/main/demo-python/code/azure-search-vector-python-sample.ipynb
from azure.search.documents.models import Vector
from azure.search.documents.indexes.models import (
SearchIndex,
SearchField,
SearchFieldDataType,
SimpleField,
SearchableField,
SearchIndex,
SemanticConfiguration,
PrioritizedFields,
SemanticField,
SearchField,
SemanticSettings,
VectorSearch,
HnswVectorSearchAlgorithmConfiguration
)
At first, I faced import error which is about import Vector. I saw its solution on stackoverflow by updating azure.search.documents to the version ==11.4.0b6; While HnswVectorSearchAlgorithmConfiguration would be alwasy error no matter which version I used. I've tried azure.search.documents 11.4.0b6 and 11.4.0b4
If the import error remain unsolved, the folling part would be error too.
vector_search = VectorSearch(
algorithm_configurations=[
HnswVectorSearchAlgorithmConfiguration(
name="my-vector-config",
kind="hnsw",
parameters={
"m": 4,
"efConstruction": 400,
"efSearch": 500,
"metric": "cosine"
}
)
]
)
I also tried to walkaround by import hnswlib
, but it didn't work...
enter image description here
If someone has conquer this issue, please let me know. Thank you!
答案1
得分: 2
使用 Azure Cognitive Search 的向量功能,您无需单独安装 hnswlib。
您可以确保使用最新的 azure-search-documents pip 包吗?
尝试 pip install azure-search-documents --pre --upgrade
。
包含向量搜索功能的最新 Python SDK 预发行版本可以在此处找到:https://pypi.org/project/azure-search-documents/11.4.0b8/
英文:
Using Azure Cognitive Search’s Vector feature you don’t have to install hnswlib separately.
Can you ensure you’re using the latest azure-search-documents pip package?
Try pip install azure-search-documents --pre --upgrade
.
The latest Python SDK pre-release version that includes Vector search capabilities can be found here: https://pypi.org/project/azure-search-documents/11.4.0b8/
答案2
得分: 0
继续Farzzy的有用回答:
我遇到了同样的问题,对我来说只运行以下命令并没有解决问题:
pip install azure-search-documents --pre --upgrade
所以我还运行了以下命令之一:
pip install azure-search --pre --upgrade
pip install azure-core --pre --upgrade
其中一个命令解决了这个问题。
英文:
Continuing Farzzy's helpful answer:
I had the same issue, For me just running
pip install azure-search-documents --pre --upgrade
didn't fix it, so I also ran the following commands:
pip install azure-search --pre --upgrade
pip install azure-core --pre --upgrade
And one of them fixed that.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论