Neo4j
Neo4jQueryToolSpec #
基类: BaseToolSpec
此类负责根据提供的模式定义查询 Neo4j 图数据库。
源代码位于 llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/base.py
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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
get_system_message #
get_system_message()
生成详细说明任务和模式的系统消息。
返回
名称 | 类型 | 描述 |
---|---|---|
str |
系统消息。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/base.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
query_graph_db #
query_graph_db(neo4j_query, params=None)
查询 Neo4j 数据库。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
neo4j_query
|
str
|
要执行的 Cypher 查询。 |
必需 |
params
|
dict
|
Cypher 查询的参数。默认为 None。 |
无
|
返回
名称 | 类型 | 描述 |
---|---|---|
list |
查询结果。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/base.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
construct_cypher_query #
construct_cypher_query(question, history=None)
根据给定问题和历史记录构建 Cypher 查询。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
question
|
str
|
要为其构建 Cypher 查询的问题。 |
必需 |
history
|
list
|
用于上下文的先前交互列表。默认为 None。 |
无
|
返回
名称 | 类型 | 描述 |
---|---|---|
str |
构建的 Cypher 查询。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/base.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
run_request #
run_request(question, history=None, retry=True)
根据给定问题执行 Cypher 查询。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
question
|
str
|
要为其执行 Cypher 查询的问题。 |
必需 |
history
|
list
|
用于上下文的先前交互列表。默认为 None。 |
无
|
retry
|
bool
|
是否在语法错误时重试。默认为 True。 |
True
|
返回
类型 | 描述 |
---|---|
list/str:查询结果或错误消息。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/base.py
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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|