heymenn commited on
Commit
0832978
·
verified ·
1 Parent(s): 155912c

Update kig_core/graph_operations.py

Browse files
Files changed (1) hide show
  1. kig_core/graph_operations.py +9 -1
kig_core/graph_operations.py CHANGED
@@ -31,7 +31,15 @@ def format_doc_for_llm(doc: Dict[str, Any]) -> str:
31
  print(f"Format doc for llm, DOC : {doc}")
32
  return "\n".join(f"**{key}**: {value}" for key, value in doc.items() if value)
33
 
34
-
 
 
 
 
 
 
 
 
35
  # --- Cypher Generation ---
36
  def generate_cypher_auto(question: str) -> str:
37
  """Generates Cypher using the 'auto' method."""
 
31
  print(f"Format doc for llm, DOC : {doc}")
32
  return "\n".join(f"**{key}**: {value}" for key, value in doc.items() if value)
33
 
34
+ def format_summary_for_llm(doc: Dict[str, Any]) -> str:
35
+ """Formats a document dictionnary to retrieve the summary of each document into a string for LLM context."""
36
+ for key, value in doc.items():
37
+ data = ""
38
+ if key == "s.summary" and value != None:
39
+ data += f"Solution of the key issue summarized : {value}"
40
+ if key == "n.summary" and value != None:
41
+ data += f"Key issue summarized : {value}"
42
+ return data
43
  # --- Cypher Generation ---
44
  def generate_cypher_auto(question: str) -> str:
45
  """Generates Cypher using the 'auto' method."""