main
黄海 5 months ago
parent 63ad0c068f
commit 910c86bb33

@ -80,15 +80,15 @@ class KnowledgeGraph:
ability_samples = '\n'.join([f"AB_{a[3:]}: {v}" for a, v in list(self.existing_ability.items())[:5]])
system_prompt = f''' 将题目中涉及到的小学数学知识点、能力点进行总结并且按照以下格式生成在neo4j-community-5.26.2上的语句:
请严格使用以下已有节点ID不要创建新ID
请严格使用以下已有节点ID一定不要创建新ID
现有知识点示例KP_后接6位小写字母/数字
{knowledge_samples}
现有能力点示例AB_后接6位小写字母/数字
{ability_samples}
生成格式要求
MERGE (q:Question {{id: "{self.question_id}"}})
SET q.content = "...",
q.name = substring(q.content, 0, 10) // 新增name属性
SET q.content = "...",
q.name = "{self.content[:10]}" // 直接截取前10字符
// ... rest of the template ...
'''

@ -35,9 +35,9 @@ if __name__ == '__main__':
print("-" * 50)
try:
kg = KnowledgeGraph(block)
# 替换一些特殊符号
block = block.replace('```neo4j', '').replace('```', '').replace('```cypher', '')
success, cypher = kg.run()
# 替换一些特殊符号
cypher = cypher.replace('```neo4j', '').replace('```', '').replace('```cypher', '')
print(cypher)
res = executor.execute_cypher_text(cypher)
print("恭喜,执行数据插入完成!")

Loading…
Cancel
Save