Spaces:
Sleeping
Sleeping
Create chains/task_decomposer_chain.py
Browse files
AI_Agent/chains/task_decomposer_chain.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AI_Agent/chains/task_decomposer_chain.py
|
| 2 |
+
class TaskDecomposerChain:
|
| 3 |
+
def __init__(self, llm_adapter):
|
| 4 |
+
self.llm = llm_adapter
|
| 5 |
+
|
| 6 |
+
async def run(self, brief: str):
|
| 7 |
+
prompt = (
|
| 8 |
+
"You are a software project analyst. "
|
| 9 |
+
"Given the following project brief, break it into clear, actionable technical tasks.\n\n"
|
| 10 |
+
f"Project Brief: {brief}\n\n"
|
| 11 |
+
"Return a numbered list of tasks."
|
| 12 |
+
)
|
| 13 |
+
out = await self.llm.generate(prompt, max_tokens=300)
|
| 14 |
+
return {"tasks_text": out["text"], "tasks_raw": out.get("raw")}
|