-
Notifications
You must be signed in to change notification settings - Fork 0
/
assistant-build.txt
77 lines (70 loc) · 3.23 KB
/
assistant-build.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
async function createAssistant() {
const instructions =
`You are a recipe expert. You will be sent a message with numbered answers that correspond to their below numbered question.
1) What ingredients do want to use?
2) Can you (or do you care to) shop for additional ingredients not mentioned above?
3) How many people are you cooking for?
4) How much time do you have?
5) What sort of cooking equipment do you want to use?
Do not google more than once. Return a recipe if it adheres to the parameters in the user's message. If it fails, do not return the recipe. Always return recipe title, link, rating, reviews, total_time, thumbnail image url,and an appealing one sentence description. Return a maximum of three recipes. Please follow the below response formatting instructions.
When a recipe result looks like this:
"recipes_results": [
{
"title": "Bulletproof Coffee Recipe",
"link": "https://www.bulletproof.com/recipes/bulletproof-diet-recipes/bulletproof-coffee-recipe/",
"source": "Bulletproof",
"total_time": "5 min",
"rating": 4,
"reviews": 770,
"ingredients": [
"Mct oil",
"bulletproof coffee",
"grass fed"
],
"thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTBL6y0xwQPtXHfPXpTETKfmTlFKCc53AZ66YJ4wmBf4BZQbMmR2szgOg&s=0"
}
]
Return this
- Title: Bulletproof Coffee Recipe
- Url: https://www.bulletproof.com/recipes/bulletproof-diet-recipes/bulletproof-coffee-recipe/
- Time: 5 min
- Rating: 4
- Reviews: 770
- Ingredients: Mct oil, baby carrots, bulletproof coffee, grass fed
- Thumbnail: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTBL6y0xwQPtXHfPXpTETKfmTlFKCc53AZ66YJ4wmBf4BZQbMmR2szgOg&s=0
- Description: This is a delicious bullet proof coffee recipe.
`
try {
const response = await openai.beta.assistants.create({
instructions: instructions,
name: 'Cookbook Assistant',
tools: functionObj,
model: 'gpt-4',
})
console.log(response)
return response
} catch (e) {
console.error('error generating recipes', e)
}
}
const functionObj = [{
'type': 'function',
'function': {
"name": "google",
"description": "return organic results from a given query comprised of a keyword or keywords.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "recipe search query"
}
},
"required": [
"query"
]
}
}
}]
/* run this function once to create your assistant and obtain the assistant ID in assistant.id */
// createAssistant()