Spaces:
Sleeping
Sleeping
Update kig_core/graph_operations.py
Browse files
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."""
|