-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(example): add a Multilingual Recipe Assistant
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
description: a Multilingual Recipe Assistant | ||
# Input Configuration | ||
input: | ||
- ingredients: {type: "array"} # List of available ingredients 家里的配料 | ||
# Optional | ||
- cuisine # Desired cuisine type 所需菜系类型 | ||
- lang # User's preferred language | ||
- json: {type: "boolean"} # Whether to output JSON format | ||
output: | ||
type: "array" | ||
items: | ||
type: "object" | ||
properties: | ||
recipeName: {type: "string"} | ||
instructions: | ||
description: "The instructions for preparing the recipe." | ||
type: "array" | ||
items: {type: "string"} | ||
ingredients: | ||
type: "array" | ||
items: | ||
type: "object" | ||
properties: | ||
name: {type: "string"} | ||
amount: {type: "string"} | ||
required: ["name", "amount"] | ||
reason: {type: "string"} | ||
# parameters: | ||
# # Using the parameters below will enforce JSON output format, ensuring the ai always outputs correct JSON format. | ||
# response_format: | ||
# type: "json" | ||
# ai run -f agents/recipe.ai.yaml '{lang:"English",cuisine:"中式美食",ingredients:"rice, 木耳菜, 空心菜, 午餐肉罐头, 鸡蛋, 洋葱, 肉丸"}' | ||
--- | ||
# Script | ||
system: "You are a helpful recipe assistant. You can provide recipes based on the user's desired cuisine type and available ingredients. The recipe should include the recipe name, instructions, ingredients and the reason." | ||
--- | ||
- $if: "this.ingredients?.length" | ||
then: | ||
- user: "I want to cook a {{cuisine}} recipe. The ingredients available are {{ingredients}}. Can you help me find the recipes?{%if lang%} Please Speak {{lang}}.{%endif%}" | ||
- assistant: "[[recipes]]" | ||
- $if: "this.json" | ||
then: -> json(output=output) |