Playgrounds
PlaygroundsSubgraphConnectorToolSpec #
通过 Playgrounds API 连接到 The Graph 去中心化网络上的子图。
属性
名称 | 类型 | 描述 |
---|---|---|
spec_functions |
list
|
指定工具能力的函数列表。 |
url |
str
|
GraphQL 请求的端点 URL。 |
headers |
dict
|
用于 GraphQL 请求的请求头。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_connector/base.py
9 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 |
|
graphql_request #
graphql_request(query: str, variables: Optional[dict] = None, operation_name: Optional[str] = None) -> Union[dict, str]
执行 GraphQL 查询。
参数
名称 | 类型 | 描述 | 默认 |
---|---|---|---|
query
|
str
|
要执行的 GraphQL 查询字符串。 |
必需 |
variables
|
dict
|
GraphQL 查询的变量。默认值为 None。 |
None
|
operation_name
|
str
|
操作名称,如果查询中存在多个操作。默认值为 None。 |
None
|
返回值
名称 | 类型 | 描述 |
---|---|---|
dict |
联合类型[字典, 字符串]
|
如果成功,返回 GraphQL 服务器的响应。 |
str |
联合类型[字典, 字符串]
|
如果请求失败,返回错误消息。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_connector/base.py
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 |
|
PlaygroundsSubgraphInspectorToolSpec #
通过 Playgrounds API 连接到 The Graph 去中心化网络上的子图并自省子图。提供处理和总结自省 Schema 的功能,以便于理解。
属性
名称 | 类型 | 描述 |
---|---|---|
spec_functions |
list
|
指定工具能力的函数列表。 |
url |
str
|
GraphQL 请求的端点 URL。 |
headers |
dict
|
用于 GraphQL 请求的请求头。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_inspector/base.py
7 8 9 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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|
introspect_and_summarize_subgraph #
introspect_and_summarize_subgraph() -> str
自省子图并将其 Schema 总结为文本类别。
返回值
名称 | 类型 | 描述 |
---|---|---|
str |
str
|
自省子图 Schema 的文本摘要。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_inspector/base.py
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 |
|
format_section #
format_section(category: str, description: str, example: str, entities: dict) -> str
将子图自省结果的给定部分格式化为可读的字符串格式。
参数
名称 | 类型 | 描述 | 默认 |
---|---|---|---|
category
|
str
|
实体的类别名称。 |
必需 |
description
|
str
|
解释该类别的描述。 |
必需 |
example
|
str
|
与该类别相关的通用 GraphQL 查询示例。 |
必需 |
entities
|
dict
|
包含与该类别相关的实体及其字段的字典。 |
必需 |
返回值
名称 | 类型 | 描述 |
---|---|---|
str |
str
|
提供部分数据的格式化字符串表示。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_inspector/base.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
subgraph_to_text #
subgraph_to_text(subgraph: dict) -> str
将处理后的子图表示转换为基于实体类别的文本摘要。
参数
名称 | 类型 | 描述 | 默认 |
---|---|---|---|
subgraph
|
dict
|
自省 Schema 的处理表示,按特定实体查询、列表实体查询和其他实体进行分类。 |
必需 |
返回值
名称 | 类型 | 描述 |
---|---|---|
str |
str
|
处理后的子图 Schema 的文本摘要。 |
源代码位于 llama-index-integrations/tools/llama-index-tools-playgrounds/llama_index/tools/playgrounds/subgraph_inspector/base.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|