File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import asyncio
34import os
45import tempfile
56import uuid
@@ -131,10 +132,10 @@ async def run_contract(
131132
132133 # "provider": "openai" with no OPENAI_API_KEY triggers heuristic fallback.
133134 # To use a real LLM, set the relevant API key in the environment.
134- # TODO: wrap in asyncio.to_thread() if adding real LLM support (blocking call).
135- graph .invoke (
135+ await asyncio .to_thread (
136+ graph .invoke ,
136137 {"contract_path" : str (tmp_path ), "provider" : "openai" },
137- config = config ,
138+ config ,
138139 )
139140
140141 interrupt_payload = _get_interrupt_payload (config )
@@ -192,8 +193,7 @@ async def resume_contract(
192193 "edited_risks" : body .edited_risks ,
193194 }
194195
195- # TODO: wrap in asyncio.to_thread() if adding real LLM support.
196- graph .invoke (Command (resume = resume_value ), config = config )
196+ await asyncio .to_thread (graph .invoke , Command (resume = resume_value ), config )
197197
198198 final_state = graph .get_state (config ).values
199199 return ResumeResponse (
You can’t perform that action at this time.
0 commit comments