(It has also a nice benefit that IDE (like VS code) will display the prompt properly (not trying to parse it as markdown, and thus not showing new lines properly))
    """
    pass
the roles here are model native roles (assistant, user, system for chatGPT)
Optional sections#
you can define a whole sections of your prompt that should be optional
if any input in the section is missing, the whole section wont be rendered
the syntax for this is as follows:
@llm_prompt
def prompt_with_optional_partials():
    """
    this text will be rendered always, but
    {? anything inside this block will be rendered only if all the {value}s parameters are not empty (None | "")   ?}
    you can also place it in between the words
    this too will be rendered{? , but
        this  block will be rendered only if {this_value} and {this_value}
        is not empty?} !
    """
Output parsers#
llm_prompt decorator natively tries to detect the best output parser based on the output type. (if not set, it returns the raw string)
list, dict and pydantic outputs are also supported natively (automaticaly)
# this code example is complete and should run as it is
from langchain_decorators import llm_prompt
@llm_prompt
def write_name_suggestions(company_business:str, count:int)->list:
    """ Write me {count} good name suggestions for company that {company_business}
    """
    pass
write_name_suggestions(company_business="sells cookies", count=5)
More complex structures#
for dict / pydantic you need to specify the formatting instructions…
this can be tedious, that’s why you can let the output parser gegnerate you the instructions based on the model (pydantic)
rtdocs_stable/api.python.langchain.com/en/stable/integrations/langchain_decorators.html