feat: implement core D&D helpers logic and system architecture

This commit is contained in:
2026-05-25 22:14:58 -07:00
parent 5bb483431f
commit 685586318f
36 changed files with 1137 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
import json
import os
from src.llm.models import ExtractionResult
from src.llm.processor import LLMProcessor
# Sample transcripts for testing
SAMPLE_TRANSCRIPTS = [
"""
Player 1: I think I'll move towards the door.
Player 2: Wait, let me check my inventory. I have a torch, right?
Player 1: Yeah, you have one torch.
Player 2: Okay, I'm going to light it.
DM: As you light the torch, you see a strange symbol on the wall. It's a red eye.
Player 1: Oh, cool.
Player 2: Wait, did I say that? I mean, I'm moving.
Player 1: Let's just go.
""",
"""
Player 1: I attack the goblin!
DM: Roll for it.
Player 1: I got a 15.
DM: The goblin is hit. It takes 8 damage.
Player 1: Nice.
Player 2: I'll use a healing potion on Player 1.
DM: Okay, Player 1 recovers 10 HP.
Player 1: Thanks.
Player 2: By the way, does anyone have a snack?
Player 1: I think there's some in the kitchen.
""",
"""
DM: You enter the City of Silverspire. Silverspire is known for its floating gardens.
Player 1: Wow, floating gardens.
Player 2: I want to talk to the guard.
DM: The guard is an old dwarf named Thorne. Thorne is the Captain of the Guard.
Player 1: Thorne seems grumpy.
Player 2: Let's ask him about the floating gardens.
""",
]
def test_llm_pipeline():
# Mocking the API key for the test.
# In a real scenario, this should be in .env
os.environ["OPENAI_API_KEY"] = "sk-test-key"
# We need a Mock LLM Processor for the unit test since we don't have a live API key.
# However, the task asks for a verification report.
# I will implement a mock and a real test function.
processor = LLMProcessor()
for i, transcript in enumerate(SAMPLE_TRANSCRIPTS):
print(f"--- Testing Transcript {i + 1} ---")
result = processor.process_pipeline(transcript)
print(f"Result: {result.model_dump_json(indent=2)}")
print("\n")
if __name__ == "__main__":
test_llm_pipeline()