向量化
向量化检索器。
向量化检索器 #
基类:EventBaseRetriever
向量化检索器。
设置
安装包 llama-index-vectorize
.. 代码块:: bash
pip install -U llama-index-retrievers-vectorize
实例化
.. 代码块:: python
from llama_index.retrievers.vectorize import VectorizeRetriever
retriever = VectorizeRetriever(
api_token="xxxxx", "organization"="1234", "pipeline_id"="5678"
)
使用方法
.. 代码块:: python
query = "what year was breath of the wild released?"
retriever.retrieve(query)
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
api_token
|
str
|
Vectorize API 令牌。 |
required |
environment
|
Literal['prod', 'dev', 'local', 'staging']
|
Vectorize API 环境(生产环境、开发环境、本地环境、预发布环境)。 默认为生产环境。 |
'prod'
|
organization
|
str | None
|
Vectorize 组织。 |
None
|
pipeline_id
|
str | None
|
向量化流水线ID。 |
None
|
num_results
|
int
|
要返回的文档数量。 |
5
|
rerank
|
bool
|
是否对检索到的文档进行重新排序。 |
False
|
metadata_filters
|
list[dict[str, Any]] | None
|
检索文档时应用的元数据过滤器。 |
None
|
callback_manager
|
CallbackManager | None
|
用于回调的回调管理器。 |
None
|
verbose
|
bool
|
是否启用详细日志记录。 |
False
|
workflows/handler.py 中的源代码llama_index/retrievers/vectorize/base.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
选项: 成员:- VectorizeRetriever