Files
project-lyra/cortex/reasoning/reasoning.py
2025-11-25 20:50:05 -05:00

34 lines
1.0 KiB
Python

# reasoning.py
from llm_router import call_llm
async def reason_check(user_prompt: str,
identity_block: dict | None,
rag_block: dict | None,
reflection_notes: list[str]) -> str:
"""
Generate a first draft using identity, RAG, and reflection notes.
No critique loop yet.
"""
# Build internal notes section
notes_section = ""
if reflection_notes:
notes_section = "Reflection Notes (internal, do NOT show to user):\n"
for n in reflection_notes:
notes_section += f"- {n}\n"
notes_section += "\n"
identity_txt = f"Identity: {identity_block}\n\n" if identity_block else ""
rag_txt = f"Relevant info: {rag_block}\n\n" if rag_block else ""
prompt = (
f"{notes_section}"
f"{identity_txt}"
f"{rag_txt}"
f"User said:\n{user_prompt}\n\n"
"Draft the best possible internal answer."
)
draft = await call_llm(prompt)
return draft