Spaces:
Sleeping
Sleeping
Update kig_core/planner.py
Browse files- kig_core/planner.py +7 -0
kig_core/planner.py
CHANGED
|
@@ -118,6 +118,12 @@ class KeyIssue(BaseModel):
|
|
| 118 |
class KeyIssueList(BaseModel):
|
| 119 |
key_issues: List[KeyIssue] = Field(description="List of key issues")
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
def generate_structured_issues(state: PlannerState) -> Dict[str, Any]:
|
| 123 |
"""Generates the final structured Key Issues based on all gathered context."""
|
|
@@ -157,6 +163,7 @@ def generate_structured_issues(state: PlannerState) -> Dict[str, Any]:
|
|
| 157 |
})
|
| 158 |
print(f"structured_issues_obj => type : {type(structured_issues_obj)}, value : {structured_issues_obj}")
|
| 159 |
structured_issues = structured_issues_obj #.key_issues
|
|
|
|
| 160 |
# Ensure IDs are sequential if the LLM didn't assign them correctly
|
| 161 |
for i, issue in enumerate(structured_issues):
|
| 162 |
issue.id = i + 1
|
|
|
|
| 118 |
class KeyIssueList(BaseModel):
|
| 119 |
key_issues: List[KeyIssue] = Field(description="List of key issues")
|
| 120 |
|
| 121 |
+
class KeyIssueInvoke(BaseModel):
|
| 122 |
+
id: int
|
| 123 |
+
title: str
|
| 124 |
+
description: str
|
| 125 |
+
challenges: List[str]
|
| 126 |
+
potential_impact: Optional[str] = None
|
| 127 |
|
| 128 |
def generate_structured_issues(state: PlannerState) -> Dict[str, Any]:
|
| 129 |
"""Generates the final structured Key Issues based on all gathered context."""
|
|
|
|
| 163 |
})
|
| 164 |
print(f"structured_issues_obj => type : {type(structured_issues_obj)}, value : {structured_issues_obj}")
|
| 165 |
structured_issues = structured_issues_obj #.key_issues
|
| 166 |
+
key_issues_list = [KeyIssueInvoke(**issue_dict) for issue_dict in structured_issues_obj]
|
| 167 |
# Ensure IDs are sequential if the LLM didn't assign them correctly
|
| 168 |
for i, issue in enumerate(structured_issues):
|
| 169 |
issue.id = i + 1
|