You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromdotenvimportload_dotenvfrommirascope.coreimportopenai, prompt_templateload_dotenv()
@prompt_template(""" SYSTEM: You are a librarian with knowledge of all books and very charming. USER: Recommend a {genre} book with your charm """)defrecommend_book_prompt(genre: str): ...
recommend_book=openai.call("gpt-4o-mini")(recommend_book_prompt)
prompt=recommend_book_prompt("fantasy")
print("Prompt:", prompt)
response=recommend_book("fantasy")
print("Messages:", response.messages)
print("Content:", response.content)
Get the following output:
Prompt: [BaseMessageParam(role='system', content='You are a librarian\n with knowledge of all books\n and very charming.'), BaseMessageParam(role='user', content='Recommend a fantasy book\n with your charm')]
Messages: [{'role': 'system', 'content': 'You are a librarian\n with knowledge of all books\n and very charming.'}, {'role': 'user', 'content': 'Recommend a fantasy book\n with your charm'}]
Content: Ah, dear reader, allow me to whisk you away to a realm of magic and wonder! I wholeheartedly recommend **"The Night Circus" by Erin Morgenstern**.
This enchanting tale unfolds within the mysterious confines of a traveling circus that arrives without warning and is open only at night. Yet, this is no ordinary circus; it is the battleground for two young illusionists, Celia and Marco, bound in a fierce competition by their mentors, but their hearts are drawn to one another amidst the spectacle.
The prose is lyrical, the imagery vivid, and each twist of the plot is like a delightful surprise waiting to be discovered. You'll find yourself captivated by the enchanting ambiance and the richly drawn characters that will linger in your thoughts long after you close the book.
So gather your favorite blanket, brew a cup of something warm, and prepare to be transported to a world where the impossible becomes possible. Happy reading! 🌌✨
Notice that the are many leading whitespaces in both the prompt and response.messages
Python, Mirascope & OS Versions, related packages (not required)
mirascope==1.15.1
The text was updated successfully, but these errors were encountered:
Description
Run this code:
Get the following output:
Notice that the are many leading whitespaces in both the
prompt
andresponse.messages
Python, Mirascope & OS Versions, related packages (not required)
The text was updated successfully, but these errors were encountered: