Solution updated with real LLM and dependencies: update hitl_agent.py

This commit is contained in:
2026-06-03 09:51:34 +00:00
parent 391a396148
commit bf7b3f433c
+9 -9
View File
@@ -19,16 +19,16 @@ class GameState(TypedDict):
ending: str ending: str
# LLM instance # LLM instance
class DummyLLM: # Use real LLM
def invoke(self, prompt: str): import os
# Very simple deterministic responses based on prompt content from langchain_openai import ChatOpenAI
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": ""})
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: def generate_scene(state: GameState) -> GameState: