Skip to content

Commit

Permalink
Fix object streaming example in README (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmpcollins authored Sep 10, 2023
1 parent c056d17 commit 81fadb2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ Structured outputs can also be streamed from the LLM by using the return type an
from collections.abc import Iterable
from time import time

from magentic import prompt
from pydantic import BaseModel


class Superhero(BaseModel):
name: str
age: int
power: str
enemies: list[str]


@prompt("Create a Superhero team named {name}.")
def create_superhero_team(name: str) -> Iterable[Superhero]:
Expand Down

0 comments on commit 81fadb2

Please sign in to comment.