Skip to content

Commit 5a6fb6c

Browse files
authored
Merge pull request #276 from FullStackWithLawrence/next
refactor: add Prompting and FunctionCalling classes
2 parents c25f8b9 + 930082b commit 5a6fb6c

File tree

11 files changed

+662
-475
lines changed

11 files changed

+662
-475
lines changed
Lines changed: 59 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,60 @@
11
---
2-
# Complete search terms that will trigger the chatbot to use your customized system prompt.
3-
search_terms:
4-
strings:
5-
- Gobstopper
6-
- Gobstoppers
7-
- Gobbstopper
8-
- Gobbstoppers
9-
pairs:
10-
- - everlasting
11-
- gobstopper
12-
- - everlasting
13-
- gobstoppers
14-
function_description: Get additional information about the Everlasting Gobstopper product created by Willy Wonka Chocolate Factory. Information includes sales promotions, coupon codes, company contact information and biographical background on the company founder.
15-
system_prompt: >
16-
You are a helpful marketing agent for the [Willy Wonka Chocolate Factory](https://wwcf.com).
17-
# Information provided to the OpenAI "Function Calling" algorithm to help it generate custom responses.
18-
additional_information:
19-
contact:
20-
- name: Willy Wonka
21-
- title: Founder and CEO
22-
- location: 1234 Chocolate Factory Way, Chocolate City, Chocolate State, USA
23-
- phone: +1 123-456-7890
24-
- website: https://wwcf.com
25-
- whatsapp: +11234567890
26-
27-
biographical: >
28-
Willy Wonka is a fictional character appearing in British author Roald Dahl's 1964 children's novel Charlie and the Chocolate Factory, its 1972 sequel Charlie and the Great Glass Elevator and several films based on those books. He is the eccentric founder and proprietor of the Wonka Chocolate Factory
29-
sales_promotions:
30-
- name: Everlasting Gobstopper
31-
description: >
32-
The Everlasting Gobstopper is a candy that, according to Willy Wonka, "Never Gets Smaller Or Ever Gets Eaten". It is the main focus of Charlie and the Chocolate Factory, both the 1971 film and the 2005 film, and Willy Wonka and the Chocolate Factory, the 1971 film adaptation of the novel.
33-
price: $1.00
34-
image: https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Everlasting_Gobstopper.jpg/220px-Everlasting_Gobstopper.jpg
35-
- name: Wonka Bar
36-
description: >
37-
Wonka Bars are a fictional brand of chocolate made by Willy Wonka, and also a chocolate bar inspired by the Willy Wonka Bar from the novel and the films Willy Wonka & the Chocolate Factory and Charlie and the Chocolate Factory.
38-
price: $1.00
39-
image: https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Everlasting_Gobstopper.jpg/220px-Everlasting_Gobstopper.jpg
40-
coupon_codes:
41-
- name: 10% off
42-
code: 10OFF
43-
description: >
44-
10% off your next purchase
45-
- name: 20% off
46-
code: 20OFF
47-
description: >
48-
20% off your next purchase
2+
meta_data:
3+
config_path: aws_openai/lambda_openai_function/custom_configs/everlasting-gobstopper.yaml
4+
# The name of your chatbot.
5+
name: EverlastingGobstopper
6+
# The description of your chatbot.
7+
description: Get additional information about the Everlasting Gobstopper product created by Willy Wonka Chocolate Factory. Information includes sales promotions, coupon codes, company contact information and biographical background on the company founder.
8+
# The version of your chatbot.
9+
version: 0.1.0
10+
# The author of your chatbot.
11+
author: Lawrence McDaniel
12+
prompting:
13+
# Complete search terms that will trigger the chatbot to use your customized system prompt.
14+
search_terms:
15+
strings:
16+
- Gobstopper
17+
- Gobstoppers
18+
- Gobbstopper
19+
- Gobbstoppers
20+
pairs:
21+
- - everlasting
22+
- gobstopper
23+
- - everlasting
24+
- gobstoppers
25+
system_prompt: >
26+
You are a helpful marketing agent for the [Willy Wonka Chocolate Factory](https://wwcf.com).
27+
function_calling:
28+
function_description: Get additional information about the Everlasting Gobstopper product created by Willy Wonka Chocolate Factory. Information includes sales promotions, coupon codes, company contact information and biographical background on the company founder.
29+
# Information provided to the OpenAI "Function Calling" algorithm to help it generate custom responses.
30+
additional_information:
31+
contact:
32+
- name: Willy Wonka
33+
- title: Founder and CEO
34+
- location: 1234 Chocolate Factory Way, Chocolate City, Chocolate State, USA
35+
- phone: +1 123-456-7890
36+
- website: https://wwcf.com
37+
- whatsapp: +11234567890
38+
39+
biographical: >
40+
Willy Wonka is a fictional character appearing in British author Roald Dahl's 1964 children's novel Charlie and the Chocolate Factory, its 1972 sequel Charlie and the Great Glass Elevator and several films based on those books. He is the eccentric founder and proprietor of the Wonka Chocolate Factory
41+
sales_promotions:
42+
- name: Everlasting Gobstopper
43+
description: >
44+
The Everlasting Gobstopper is a candy that, according to Willy Wonka, "Never Gets Smaller Or Ever Gets Eaten". It is the main focus of Charlie and the Chocolate Factory, both the 1971 film and the 2005 film, and Willy Wonka and the Chocolate Factory, the 1971 film adaptation of the novel.
45+
price: $1.00
46+
image: https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Everlasting_Gobstopper.jpg/220px-Everlasting_Gobstopper.jpg
47+
- name: Wonka Bar
48+
description: >
49+
Wonka Bars are a fictional brand of chocolate made by Willy Wonka, and also a chocolate bar inspired by the Willy Wonka Bar from the novel and the films Willy Wonka & the Chocolate Factory and Charlie and the Chocolate Factory.
50+
price: $1.00
51+
image: https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Everlasting_Gobstopper.jpg/220px-Everlasting_Gobstopper.jpg
52+
coupon_codes:
53+
- name: 10% off
54+
code: 10OFF
55+
description: >
56+
10% off your next purchase
57+
- name: 20% off
58+
code: 20OFF
59+
description: >
60+
20% off your next purchase
Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
---
2-
#------------------------------------------------------------
3-
# search terms that will trigger the chatbot to use this customized configuration.
4-
#------------------------------------------------------------
5-
search_terms:
6-
strings:
7-
- example function calling configuration
8-
pairs:
9-
- - Example
10-
- configuration
11-
#------------------------------------------------------------
12-
# if this module is able to locate any of the search terms in the user prompt
13-
# then this is the system prompt will be used to generate the response, and the function_description that will be provided to OpenAI API.
14-
#------------------------------------------------------------
15-
system_prompt: >
16-
Your job is to provide helpful technical information about the OpenAI API Function Calling feature. You should include the following information in your response:
17-
"Congratulations!!! OpenAI API Function Calling chose to call this function. Here is the additional information that you requested:"
18-
function_description: an example custom configuration to integrate with OpenAI API Function Calling additional information function, in this module.
19-
#------------------------------------------------------------
20-
# if a.) this module is able to locate any of the search terms in the user prompt
21-
# b.) OpenAI API Function Calling opts to call this function
22-
# then this is the data that will be returned by function_refers_to.get_additional_info()
23-
#------------------------------------------------------------
24-
additional_information:
25-
platform_provider: OpenAI
26-
about: >
27-
In an API call, you can describe functions and have the model intelligently choose to output a JSON object containing arguments to call one or many functions. The Chat Completions API does not call the function; instead, the model generates JSON that you can use to call the function in your code.
28-
The latest models (gpt-3.5-turbo-1106 and gpt-4-1106-preview) have been trained to both detect when a function should to be called (depending on the input) and to respond with JSON that adheres to the function signature more closely than previous models. With this capability also comes potential risks. We strongly recommend building in user confirmation flows before taking actions that impact the world on behalf of users (sending an email, posting something online, making a purchase, etc).
29-
links:
30-
- documentation: https://platform.openai.com/docs/guides/function-calling
31-
- website: https://openai.com/
32-
- wikipedia: https://en.wikipedia.org/wiki/OpenAI
2+
meta_data:
3+
config_path: aws_openai/lambda_openai_function/custom_configs/example-configuration.yaml
4+
name: ExampleConfiguration
5+
description: an example custom configuration to integrate with OpenAI API Function Calling additional information function, in this module.
6+
version: 0.1.0
7+
author: Lawrence McDaniel
8+
prompting:
9+
#------------------------------------------------------------
10+
# search terms that will trigger the chatbot to use this customized configuration.
11+
#------------------------------------------------------------
12+
search_terms:
13+
strings:
14+
- example function calling configuration
15+
pairs:
16+
- - Example
17+
- configuration
18+
system_prompt: >
19+
Your job is to provide helpful technical information about the OpenAI API Function Calling feature. You should include the following information in your response:
20+
"Congratulations!!! OpenAI API Function Calling chose to call this function. Here is the additional information that you requested:"
21+
function_calling:
22+
#------------------------------------------------------------
23+
# if this module is able to locate any of the search terms in the user prompt
24+
# then this is the system prompt will be used to generate the response, and the function_description that will be provided to OpenAI API.
25+
#------------------------------------------------------------
26+
function_description: an example custom configuration to integrate with OpenAI API Function Calling additional information function, in this module.
27+
#------------------------------------------------------------
28+
# if a.) this module is able to locate any of the search terms in the user prompt
29+
# b.) OpenAI API Function Calling opts to call this function
30+
# then this is the data that will be returned by function_refers_to.get_additional_info()
31+
#------------------------------------------------------------
32+
additional_information:
33+
platform_provider: OpenAI
34+
about: >
35+
In an API call, you can describe functions and have the model intelligently choose to output a JSON object containing arguments to call one or many functions. The Chat Completions API does not call the function; instead, the model generates JSON that you can use to call the function in your code.
36+
The latest models (gpt-3.5-turbo-1106 and gpt-4-1106-preview) have been trained to both detect when a function should to be called (depending on the input) and to respond with JSON that adheres to the function signature more closely than previous models. With this capability also comes potential risks. We strongly recommend building in user confirmation flows before taking actions that impact the world on behalf of users (sending an email, posting something online, making a purchase, etc).
37+
links:
38+
- documentation: https://platform.openai.com/docs/guides/function-calling
39+
- website: https://openai.com/
40+
- wikipedia: https://en.wikipedia.org/wiki/OpenAI

0 commit comments

Comments
 (0)