Neo4j
Neo4jQueryToolSpec #
Bases: BaseToolSpec
This class is responsible for querying a Neo4j graph database based on a provided schema definition.
Source code in 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 |
|
get_system_message #
get_system_message()
Generates a system message detailing the task and schema.
Returns:
Name | Type | Description |
---|---|---|
str |
The system message. |
Source code in llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/base.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
query_graph_db #
query_graph_db(neo4j_query, params=None)
Queries the Neo4j database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
neo4j_query |
str
|
The Cypher query to be executed. |
required |
params |
dict
|
Parameters for the Cypher query. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
list |
The query results. |
Source code in llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/base.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
construct_cypher_query #
construct_cypher_query(question, history=None)
Constructs a Cypher query based on a given question and history.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
question |
str
|
The question to construct the Cypher query for. |
required |
history |
list
|
A list of previous interactions for context. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
str |
The constructed Cypher query. |
Source code in llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/base.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
run_request #
run_request(question, history=None, retry=True)
Executes a Cypher query based on a given question.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
question |
str
|
The question to execute the Cypher query for. |
required |
history |
list
|
A list of previous interactions for context. Defaults to None. |
None
|
retry |
bool
|
Whether to retry in case of a syntax error. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
list/str: The query results or an error message. |
Source code in llama-index-integrations/tools/llama-index-tools-neo4j/llama_index/tools/neo4j/base.py
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 |
|