22 lines
799 B
Python
22 lines
799 B
Python
import dspy
|
|
from typing import List
|
|
|
|
class IngestionSignature(dspy.Signature):
|
|
"""You are an expert Dungeon Master's assistant.
|
|
Analyze the provided notes and extract a concise synopsis and relevant metadata.
|
|
synopsis = A one-sentence summary of the document.
|
|
tags = Relevant tags (NPCs, Locations, Items, Plot Points).
|
|
entities = Key names of people, places, or factions.
|
|
"note -> synopsis:str, tags: list[str], entities: list[str]"
|
|
/no_think
|
|
"""
|
|
|
|
note: str = dspy.InputField(desc="The DM notes or session recap content.")
|
|
answer: dict[str,str|List] = dspy.OutputField(desc="the metadata dictionary with the keys; synopsis, tags, entities")
|
|
|
|
|
|
|
|
class IngestionAgent(dspy.Module):
|
|
def __init__(self):
|
|
self.ingest = dspy.Predict(IngestionSignature)
|