Solution updated with real LLM and dependencies: update hitl_agent.py
This commit is contained in:
+9
-9
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user