Key Concepts
Key Components of curator.LLM
class Poem(BaseModel):
poem: str = Field(description="A poem.")
class Poems(BaseModel):
poems_list: List[Poem] = Field(description="A list of poems.")
class Poet(curator.LLM):
response_format = Poems
def prompt(self, input: Dict) -> str:
return f"Write two poems about {input['topic']}."
def parse(self, input: Dict, response: Poems) -> Dict:
return [{"topic": input["topic"], "poem": p.poem} for p in response.poems]
prompt
parse
Returns
Data Flow Example
Last updated