Metaphor
MetaphorToolSpec #
基类:BaseToolSpec
Metaphor 工具规范。
源代码位于 llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
search #
search(query: str, num_results: Optional[int] = 10, include_domains: Optional[List[str]] = None, exclude_domains: Optional[List[str]] = None, start_published_date: Optional[str] = None, end_published_date: Optional[str] = None) -> str
Metaphor 允许您使用自然语言查询来搜索互联网。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
query
|
str
|
自然语言查询,表达为链接提供内容的答案,例如:“这是关于太空的最新消息:” |
必需的 |
num_results
|
Optional[int]
|
返回结果的数量。默认为 10。 |
10
|
include_domains
|
Optional[List(str)]
|
顶级域名列表,例如 ["wsj.com"],用于将搜索限制到特定网站。 |
无
|
exclude_domains
|
Optional[List(str)]
|
要排除的顶级域名。 |
无
|
start_published_date
|
Optional[str]
|
日期字符串,例如 “2020-06-15”。从 |
无
|
end_published_date
|
Optional[str]
|
结束日期字符串 |
无
|
源代码位于 llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/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 |
|
retrieve_documents #
retrieve_documents(ids: List[str]) -> List[Document]
使用 ID 字段,检索 metaphor_search
返回的文档摘要列表。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
ids
|
List(str
|
要检索的文档 ID |
必需的 |
源代码位于 llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
65 66 67 68 69 70 71 72 73 74 |
|
find_similar #
find_similar(url: str, num_results: Optional[int] = 3, start_published_date: Optional[str] = None, end_published_date: Optional[str] = None) -> str
检索与给定 URL 相似的文档列表。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
url
|
str
|
要查找相似结果的网页 |
必需的 |
num_results
|
Optional[int]
|
返回结果的数量。默认为 3。 |
3
|
start_published_date
|
Optional[str]
|
日期字符串,例如 “2020-06-15” |
无
|
end_published_date
|
Optional[str]
|
结束日期字符串 |
无
|
源代码位于 llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
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 |
|
search_and_retrieve_documents #
search_and_retrieve_documents(query: str, num_results: Optional[int] = 10, include_domains: Optional[List[str]] = None, exclude_domains: Optional[List[str]] = None, start_published_date: Optional[str] = None, end_published_date: Optional[str] = None) -> str
结合了 search
和 retrieve_documents
的功能。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
query
|
str
|
自然语言查询 |
必需的 |
num_results
|
Optional[int]
|
结果数量。默认为 10。 |
10
|
include_domains
|
Optional[List(str)]
|
要搜索的顶级域名列表,例如 ["wsj.com"] |
无
|
exclude_domains
|
Optional[List(str)]
|
要排除的顶级域名。 |
无
|
start_published_date
|
Optional[str]
|
日期字符串,例如 “2020-06-15”。 |
无
|
end_published_date
|
Optional[str]
|
结束日期字符串 |
无
|
源代码位于 llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
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 129 130 131 132 133 134 135 136 137 138 |
|
current_date #
current_date()
一个返回今天日期的函数。在调用任何其他接受时间戳作为参数的函数之前调用此函数。
源代码位于 llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/base.py
140 141 142 143 144 145 |
|