From bf7b3f433c5b41def54670ef651fea2c83357311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B8=D0=BD=D0=B0=D1=80=20=D0=9C=D0=B8=D1=80=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D0=B8=D1=82=D0=BE=D0=B2?= Date: Wed, 3 Jun 2026 09:51:34 +0000 Subject: [PATCH] Solution updated with real LLM and dependencies: update hitl_agent.py --- hitl_agent.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hitl_agent.py b/hitl_agent.py index e7ba8a3..c9582a9 100644 --- a/hitl_agent.py +++ b/hitl_agent.py @@ -19,16 +19,16 @@ class GameState(TypedDict): ending: str # LLM instance -class DummyLLM: - def invoke(self, prompt: str): - # Very simple deterministic responses based on prompt content - if "Generate a short hook" in prompt: - return type("Resp", (), {"content": "A mysterious cat appears on a spaceship.\nOPTIONS:\n1) Open the door\n2) Look around\n3) Sleep deeper"}) - if "Write a short ending" in prompt: - return type("Resp", (), {"content": "The cat discovers a hidden alien artifact.\nThe end."}) - return type("Resp", (), {"content": ""}) +# Use real LLM +import os +from langchain_openai import ChatOpenAI -llm = DummyLLM() +llm = ChatOpenAI( + model=os.getenv("OPENAI_MODEL", "gpt-3.5-turbo"), + base_url=os.getenv("OPENAI_BASE_URL") or None, + api_key=os.getenv("OPENAI_API_KEY", "not-needed"), + temperature=0, +) def generate_scene(state: GameState) -> GameState: