Hmmm there is not π€ But you can use any LLM for structured outputs like this in llama-index
from llama_index.program import LLMTextCompletionProgram
from llama_index.output_parsers import PydanticOutputParser
from pydantic import BaseModel
class Album(BaseModel):
"""Data model for an album."""
name: str
artist: str
prompt_template_str = """\
Generate an example album, with an artist and a list of songs. \
Using the movie {movie_name} as inspiration.\
"""
program= LLMTextCompletionProgram.from_defaults(
output_parser=PydanticOutputParser(Album),
prompt_template_str=prompt_template_str,
llm=openai_llm,
verbose=True,
)
response = program(movie_name="The Shining")
print(str(response))
Or using an external library that offers a bit more control
https://docs.llamaindex.ai/en/stable/examples/output_parsing/lmformatenforcer_pydantic_program.html