themissingCRAM
commited on
Commit
·
f1d9f2e
1
Parent(s):
5520644
recipes
Browse files
app.py
CHANGED
|
@@ -30,6 +30,117 @@ load_dotenv()
|
|
| 30 |
# What is the average each customer paid?
|
| 31 |
# Create a sql statement and invoke your sql_engine tool
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
@spaces.GPU
|
| 35 |
def dummy():
|
|
@@ -56,7 +167,7 @@ def sql_engine_tool(query: str) -> str:
|
|
| 56 |
for row in rows:
|
| 57 |
output += "\n" + str(row)
|
| 58 |
return output
|
| 59 |
-
|
| 60 |
class RetrieverTool(Tool):
|
| 61 |
"""Since we need to add a vectordb as an attribute of the tool,
|
| 62 |
we cannot simply use the simple tool constructor with a @tool decorator
|
|
|
|
| 30 |
# What is the average each customer paid?
|
| 31 |
# Create a sql statement and invoke your sql_engine tool
|
| 32 |
|
| 33 |
+
baking_recipes = [
|
| 34 |
+
{
|
| 35 |
+
"name": "Lemon Blueberry Muffins",
|
| 36 |
+
"ingredients": [
|
| 37 |
+
"1 1/2 cups all-purpose flour",
|
| 38 |
+
"1/2 cup sugar",
|
| 39 |
+
"2 tsp baking powder",
|
| 40 |
+
"1/2 tsp salt",
|
| 41 |
+
"1/2 cup milk",
|
| 42 |
+
"1/3 cup vegetable oil",
|
| 43 |
+
"1 large egg",
|
| 44 |
+
"1 tsp vanilla extract",
|
| 45 |
+
"1 cup fresh blueberries",
|
| 46 |
+
"Zest of 1 lemon",
|
| 47 |
+
"Juice of 1 lemon"
|
| 48 |
+
],
|
| 49 |
+
"instructions": [
|
| 50 |
+
"Preheat the oven to 375°F (190°C) and line a muffin tin with paper liners.",
|
| 51 |
+
"In a bowl, mix flour, sugar, baking powder, and salt.",
|
| 52 |
+
"In another bowl, whisk together milk, oil, egg, vanilla, lemon zest, and lemon juice.",
|
| 53 |
+
"Combine wet and dry ingredients until just mixed, then fold in blueberries.",
|
| 54 |
+
"Spoon the batter into the muffin tin and bake for 18-20 minutes."
|
| 55 |
+
]
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"name": "Chocolate Chip Cookies",
|
| 59 |
+
"ingredients": [
|
| 60 |
+
"1 cup unsalted butter, softened",
|
| 61 |
+
"3/4 cup sugar",
|
| 62 |
+
"3/4 cup brown sugar",
|
| 63 |
+
"1 tsp vanilla extract",
|
| 64 |
+
"2 large eggs",
|
| 65 |
+
"2 1/4 cups all-purpose flour",
|
| 66 |
+
"1 tsp baking soda",
|
| 67 |
+
"1/2 tsp salt",
|
| 68 |
+
"2 cups chocolate chips"
|
| 69 |
+
],
|
| 70 |
+
"instructions": [
|
| 71 |
+
"Preheat the oven to 350°F (175°C).",
|
| 72 |
+
"In a bowl, cream together butter, sugar, and brown sugar until smooth.",
|
| 73 |
+
"Beat in vanilla and eggs one at a time.",
|
| 74 |
+
"In another bowl, combine flour, baking soda, and salt.",
|
| 75 |
+
"Gradually blend dry ingredients into the wet mixture.",
|
| 76 |
+
"Stir in chocolate chips.",
|
| 77 |
+
"Drop by rounded tablespoons onto ungreased baking sheets and bake for 9-11 minutes."
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"name": "Banana Bread",
|
| 82 |
+
"ingredients": [
|
| 83 |
+
"3 ripe bananas, mashed",
|
| 84 |
+
"1/3 cup melted butter",
|
| 85 |
+
"1 tsp baking soda",
|
| 86 |
+
"Pinch of salt",
|
| 87 |
+
"3/4 cup sugar",
|
| 88 |
+
"1 large egg, beaten",
|
| 89 |
+
"1 tsp vanilla extract",
|
| 90 |
+
"1 1/2 cups all-purpose flour"
|
| 91 |
+
],
|
| 92 |
+
"instructions": [
|
| 93 |
+
"Preheat the oven to 350°F (175°C) and grease a 4x8 inch loaf pan.",
|
| 94 |
+
"In a mixing bowl, mix the mashed bananas with the melted butter.",
|
| 95 |
+
"Stir in baking soda and salt.",
|
| 96 |
+
"Add sugar, egg, and vanilla, and mix well.",
|
| 97 |
+
"Finally, mix in the flour until just incorporated.",
|
| 98 |
+
"Pour the batter into the prepared loaf pan and bake for 60-65 minutes."
|
| 99 |
+
]
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"name": "Cinnamon Rolls",
|
| 103 |
+
"ingredients": [
|
| 104 |
+
"4 cups all-purpose flour",
|
| 105 |
+
"1/4 cup sugar",
|
| 106 |
+
"1 packet (2 1/4 tsp) active dry yeast",
|
| 107 |
+
"1 tsp salt",
|
| 108 |
+
"1 cup milk, warmed",
|
| 109 |
+
"1/4 cup unsalted butter, melted",
|
| 110 |
+
"2 large eggs",
|
| 111 |
+
"1/2 cup brown sugar",
|
| 112 |
+
"2 tbsp cinnamon",
|
| 113 |
+
"1/4 cup unsalted butter, softened (for filling)",
|
| 114 |
+
"1 cup powdered sugar (for icing)",
|
| 115 |
+
"2-3 tbsp milk (for icing)"
|
| 116 |
+
],
|
| 117 |
+
"instructions": [
|
| 118 |
+
"In a bowl, combine flour, sugar, yeast, and salt.",
|
| 119 |
+
"In another bowl, mix warm milk, melted butter, and eggs.",
|
| 120 |
+
"Combine wet and dry ingredients and knead until smooth.",
|
| 121 |
+
"Let the dough rise for 1 hour.",
|
| 122 |
+
"Roll out the dough, spread softened butter, and sprinkle with brown sugar and cinnamon.",
|
| 123 |
+
"Roll up the dough and cut into slices.",
|
| 124 |
+
"Place in a greased baking dish and let rise for another 30 minutes.",
|
| 125 |
+
"Bake at 350°F (175°C) for 25-30 minutes.",
|
| 126 |
+
"Mix powdered sugar and milk to make icing and drizzle over warm rolls."
|
| 127 |
+
]
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"name": "Pumpkin Pie",
|
| 131 |
+
"ingredients": [
|
| 132 |
+
"1 (9-inch) pie crust",
|
| 133 |
+
"1 can (15 oz) pumpkin puree",
|
| 134 |
+
"3/4 cup sugar",
|
| 135 |
+
"1/2 tsp salt",
|
| 136 |
+
"1 tsp ground cinnamon",
|
| 137 |
+
"1/2 tsp ground ginger",
|
| 138 |
+
"1/4 tsp ground nutmeg",
|
| 139 |
+
"1/4 tsp ground cloves",
|
| 140 |
+
"3 large eggs",
|
| 141 |
+
"1 can (12 oz) evaporated milk"
|
| 142 |
+
]},]
|
| 143 |
+
|
| 144 |
|
| 145 |
@spaces.GPU
|
| 146 |
def dummy():
|
|
|
|
| 167 |
for row in rows:
|
| 168 |
output += "\n" + str(row)
|
| 169 |
return output
|
| 170 |
+
|
| 171 |
class RetrieverTool(Tool):
|
| 172 |
"""Since we need to add a vectordb as an attribute of the tool,
|
| 173 |
we cannot simply use the simple tool constructor with a @tool decorator
|