Pei*_*aLi 4 vector azure importerror azure-cognitive-search hnswlib
这是我遵循的参考文档: 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
)
Run Code Online (Sandbox Code Playgroud)
起初,我遇到了关于导入 Vector 的导入错误。我在 stackoverflow 上看到了它的解决方案,将 azure.search.documents 更新到版本 ==11.4.0b6; 而无论我使用哪个版本,HnswVectorSearchAlgorithmConfiguration 总是会出错。我尝试过 azure.search.documents 11.4.0b6 和 11.4.0b4
如果导入错误仍未解决,则以下部分也会出现错误。
vector_search = VectorSearch(
algorithm_configurations=[
HnswVectorSearchAlgorithmConfiguration(
name="my-vector-config",
kind="hnsw",
parameters={
"m": 4,
"efConstruction": 400,
"efSearch": 500,
"metric": "cosine"
}
)
]
)
Run Code Online (Sandbox Code Playgroud)
我也尝试绕过import hnswlib,但没有成功...
在此处输入图像描述
如果有人解决了这个问题,请告诉我。谢谢你!
小智 5
使用 Azure 认知搜索\xe2\x80\x99s 矢量功能,您不需要\xe2\x80\x99s 单独安装 hnswlib。
\n您能否确保\xe2\x80\x99使用最新的 azure-search-documents pip 包?
\n尝试pip install azure-search-documents --pre --upgrade。
可以在此处找到包含矢量搜索功能的最新 Python SDK 预发布版本: https: //pypi.org/project/azure-search-documents/11.4.0b8/
\n| 归档时间: |
|
| 查看次数: |
5478 次 |
| 最近记录: |