fix: missing parenthesis

This commit is contained in:
LUIS NOVO 2025-10-18 13:22:39 -03:00
parent 8b5daa86bc
commit a51bb9d792

View file

@ -26,9 +26,8 @@ class ThreadState(TypedDict):
def call_model_with_messages(state: ThreadState, config: RunnableConfig) -> dict:
system_prompt = Prompter(prompt_template="chat").render(data=state) # type: ignore[arg-type]
payload = [SystemMessage(content=system_prompt)] + state.get("messages", [])
model_id = (
config.get("configurable", {}).get("model_id")
or state.get("model_override")
model_id = config.get("configurable", {}).get("model_id") or state.get(
"model_override"
)
# Handle async model provisioning from sync context
@ -39,10 +38,8 @@ def call_model_with_messages(state: ThreadState, config: RunnableConfig) -> dict
asyncio.set_event_loop(new_loop)
return new_loop.run_until_complete(
provision_langchain_model(
str(payload),
model_id,
"chat",
max_tokens=8192
str(payload), model_id, "chat", max_tokens=8192
)
)
finally:
new_loop.close()
@ -53,6 +50,7 @@ def call_model_with_messages(state: ThreadState, config: RunnableConfig) -> dict
asyncio.get_running_loop()
# If we're in an event loop, run in a thread with a new loop
import concurrent.futures
with concurrent.futures.ThreadPoolExecutor() as executor:
future = executor.submit(run_in_new_loop)
model = future.result()