-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
241 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from mirascope.core import prompt_template | ||
|
||
|
||
@prompt_template( | ||
""" | ||
Book themes: | ||
{themes:list} | ||
Character analysis: | ||
{characters:lists} | ||
""" | ||
) | ||
def analyze_book(themes: list[str], characters: list[list[str]]): ... | ||
|
||
|
||
prompt = analyze_book( | ||
themes=["redemption", "power", "friendship"], | ||
characters=[ | ||
["Name: Frodo", "Role: Protagonist"], | ||
["Name: Gandalf", "Role: Mentor"], | ||
], | ||
) | ||
|
||
print(prompt[0].content) | ||
# Output: | ||
# Book themes: | ||
# redemption | ||
# power | ||
# friendship | ||
|
||
# Character analysis: | ||
# Name: Frodo | ||
# Role: Protagonist | ||
|
||
# Name: Gandalf | ||
# Role: Mentor |
55 changes: 0 additions & 55 deletions
55
examples/learn/prompts/format_specifiers/lists_format/base_message_param.py
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
examples/learn/prompts/format_specifiers/lists_format/messages.py
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
examples/learn/prompts/format_specifiers/lists_format/shorthand.py
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
examples/learn/prompts/format_specifiers/lists_format/string_template.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from mirascope.core import prompt_template | ||
from mirascope.core.base import TextPart | ||
|
||
|
||
@prompt_template( | ||
""" | ||
Book themes: | ||
{themes:text} | ||
Character analysis: | ||
{characters:texts} | ||
""" | ||
) | ||
def analyze_book(themes: TextPart, characters: list[TextPart]): ... | ||
|
||
|
||
prompt = analyze_book( | ||
themes=TextPart(type="text", text="redemption, power, friendship"), | ||
characters=[ | ||
TextPart(type="text", text="Name: Frodo, Role: Protagonist"), | ||
TextPart(type="text", text="Name: Gandalf, Role: Mentor"), | ||
], | ||
) | ||
|
||
print(prompt[0].content) | ||
# Output: | ||
# [ | ||
# TextPart(type="text", text="Book themes:"), | ||
# TextPart(type="text", text="redemption, power, friendship"), | ||
# TextPart(type="text", text="Character analysis:"), | ||
# TextPart(type="text", text="Name: Frodo, Role: Protagonist"), | ||
# TextPart(type="text", text="Name: Gandalf, Role: Mentor"), | ||
# ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from mirascope.core import prompt_template | ||
|
||
|
||
@prompt_template( | ||
""" | ||
Book themes: | ||
{themes:text} | ||
Character analysis: | ||
{characters:texts} | ||
""" | ||
) | ||
def analyze_book(themes: str, characters: list[str]): ... | ||
|
||
|
||
prompt = analyze_book( | ||
themes="redemption, power, friendship", | ||
characters=[ | ||
"Name: Frodo, Role: Protagonist", | ||
"Name: Gandalf, Role: Mentor", | ||
], | ||
) | ||
|
||
print(prompt[0].content) | ||
# Output: | ||
# [ | ||
# TextPart(type="text", text="Book themes:"), | ||
# TextPart(type="text", text="redemption, power, friendship"), | ||
# TextPart(type="text", text="Character analysis:"), | ||
# TextPart(type="text", text="Name: Frodo, Role: Protagonist"), | ||
# TextPart(type="text", text="Name: Gandalf, Role: Mentor"), | ||
# ] |
Oops, something went wrong.