package llm import "github.com/tmc/langchaingo/llms" func GetKnowledgeGraphTools() []llms.Tool { return []llms.Tool{ { Type: "Node operation", Function: &llms.FunctionDefinition{ Name: "search_nodes", Description: "当需要根据关键词在知识图谱中搜索相关节点时调用此工具", Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "query": map[string]any{ "type": "string", "description": "搜索的关键词", }, }, "required": []string{"query"}, }, }, }, { Type: "Node operation", Function: &llms.FunctionDefinition{ Name: "get_neighbors", Description: "当需要查找某个节点的相邻节点(即与该节点有直接连线的节点)时调用此工具", Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "node_id": map[string]any{ "type": "string", "description": "目标节点的唯一 ID", }, }, "required": []string{"node_id"}, }, }, }, { Type: "Node operation", Function: &llms.FunctionDefinition{ Name: "create_node", Description: "当需要在知识图谱中创建一个新的节点时调用此工具", Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "id": map[string]any{"type": "string", "description": "节点的唯一ID,格式通常为 node_xxx"}, "label": map[string]any{"type": "string", "description": "节点的名称/标签,例如:人工智能"}, "type": map[string]any{"type": "string", "description": "节点的类型,例如:概念、实体"}, "x": map[string]any{"type": "number", "description": "节点在画布上的 X 坐标 (可选,默认0)"}, "y": map[string]any{"type": "number", "description": "节点在画布上的 Y 坐标 (可选,默认0)"}, "properties": map[string]any{"type": "object", "description": "节点的额外属性键值对 (可选)"}, }, "required": []string{"id", "label", "type"}, }, }, }, { Type: "Edge operation", Function: &llms.FunctionDefinition{ Name: "create_edge", Description: "当需要在知识图谱中创建一条连线(边)连接两个节点时调用此工具", Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "id": map[string]any{"type": "string", "description": "边的唯一ID,格式通常为 edge_xxx"}, "source": map[string]any{"type": "string", "description": "起始节点的 ID"}, "target": map[string]any{"type": "string", "description": "目标节点的 ID"}, "label": map[string]any{"type": "string", "description": "连线的名称/标签,例如:包含、依赖于"}, "type": map[string]any{"type": "string", "description": "连线的类型 (可选),例如:CONTAINS"}, "properties": map[string]any{ "type": "object", "description": "边的额外属性键值对 (可选)", }, }, "required": []string{"id", "source", "target", "label"}, }, }, }, { Type: "Node operation", Function: &llms.FunctionDefinition{ Name: "delete_node", Description: "当需要从知识图谱中删除一个现有节点时调用此工具", Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "id": map[string]any{ "type": "string", "description": "要删除的节点的唯一 ID", }, }, "required": []string{"id"}, }, }, }, { Type: "Edge operation", Function: &llms.FunctionDefinition{ Name: "delete_edge", Description: "当需要从知识图谱中删除一条连线(边)时调用此工具", Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "id": map[string]any{ "type": "string", "description": "要删除的边的唯一 ID", }, }, "required": []string{"id"}, }, }, }, } }