Spaces:
Sleeping
Sleeping
| # AI_Agent/chains/reasoning_chain.py | |
| class ReasoningChain: | |
| def __init__(self, llm_adapter): | |
| self.llm = llm_adapter | |
| async def run(self, prompt, contexts): | |
| reasoning_prompt = ( | |
| "You are a reasoning assistant.\n" | |
| f"User prompt:\n{prompt}\n\n" | |
| f"Context documents:\n" + "\n".join([f"- {c}" for c in contexts]) + | |
| "\n\nProvide step-by-step reasoning and intermediate conclusions." | |
| ) | |
| out = await self.llm.generate(reasoning_prompt) | |
| return {"reasoning": out["text"], "raw": out.get("raw")} | |