-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mandana Vaziri <[email protected]>
- Loading branch information
Showing
20 changed files
with
799 additions
and
53 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
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,25 @@ | ||
description: basic chatbot | ||
document: | ||
- role: system | ||
document: | ||
- | | ||
You are Granite Chat, an AI language model developed by the IBM DMF Alignment Team. | ||
You are a cautious assistant that carefully follows instructions. | ||
You are helpful and harmless and you follow ethical guidelines and promote positive behavior. | ||
You respond in a comprehensive manner unless instructed otherwise, providing explanations when needed while | ||
maintaining a neutral tone. You are capable of coding, writing, and roleplaying. You are cautious and | ||
refrain from generating real-time information, highly subjective or opinion-based topics. | ||
You are harmless and refrain from generating content involving any form of bias, violence, | ||
discrimination or inappropriate content. You always respond to greetings (for example, hi, hello, g'day, | ||
morning, afternoon, evening, night, what's up, nice to meet you, sup, etc) with "Hello! I am Granite Chat, | ||
created by the IBM DMF Alignment Team. How can I help you today?". Please do not say anything else | ||
and do not start a conversation. | ||
- repeat: | ||
- role: user | ||
read: | ||
message: "" | ||
def: query | ||
- role: assistant | ||
model: ibm/granite-13b-chat-v2 | ||
- "\n" | ||
until: "{{ query == 'stop'}}" |
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,14 @@ | ||
description: marketing email with roles | ||
document: | ||
- role: system | ||
document: | ||
- | | ||
You are Granite Chat, an AI language model developed by IBM. You are a cautious assistant. | ||
You carefully follow instructions. You are helpful and harmless and you follow ethical | ||
guidelines and promote positive behavior. | ||
- role: user | ||
document: | ||
" {{ instructions }}" | ||
- role: assistant | ||
document: | ||
- model: ibm/granite-13b-chat-v2 |
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,3 @@ | ||
description: My first PDL program | ||
document: | ||
- Hello, World! |
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,24 @@ | ||
document: | ||
- |- | ||
What is 18 + 12 x 3? | ||
Act: {"name": "Calc", "arguments": {"expr": "18 + 12 * 3"}} | ||
Obs: 54 | ||
|
||
A total of 252 qualifying matches were played, and 723 goals were scored. What was the average number of goals per match? | ||
Act: {"name": "Calc", "arguments": {"expr": "723 / 252"}} | ||
Obs: 2.869047619047619 | ||
|
||
Out of 1400 participants, 400 passed the test. What percentage is that? | ||
Act: | ||
- def: action | ||
model: ibm/granite-8b-code-instruct | ||
params: | ||
stop_sequences: ["\n"] | ||
parser: json | ||
spec: {name: str, arguments: {expr: str}} | ||
- if: '{{ action.name == "Calc" }}' | ||
then: | ||
- "Obs: " | ||
- lan: python | ||
code: result = {{ action.arguments.expr }} | ||
- "\n" |
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,50 @@ | ||
document: | ||
- | | ||
What is the elevation range for the area that the eastern sector of the Colorado orogeny extends into? | ||
Tho: I need to search Colorado orogeny, find the area that the eastern sector of the Colorado ... | ||
Act: {"name": "Search", "arguments": {"topic": "Colorado orogeny"}} | ||
Obs: The Colorado orogeny was an episode of mountain building (an orogeny) ... | ||
Tho: It does not mention the eastern sector. So I need to look up eastern sector. | ||
Tho: High Plains rise in elevation from around 1,800 to 7,000 ft, so the answer is 1,800 to 7,000 ft. | ||
Act: {"name": "Finish", "arguments": {"topic": "1,800 to 7,000 ft"}} | ||
|
||
What profession does Nicholas Ray and Elia Kazan have in common? | ||
Tho: I need to search Nicholas Ray and Elia Kazan, find their professions, then find the profession they have in common. | ||
Act: {"name": "Search", "arguments": {"topic": "Nicholas Ray"}} | ||
Obs: Nicholas Ray (born Raymond Nicholas Kienzle Jr., August 7, 1911 - June 16, 1979) was an American film director, screenwriter, and actor best known for the 1955 film Rebel Without a Cause. | ||
Tho: Professions of Nicholas Ray are director, screenwriter, and actor. I need to search Elia Kazan next and find his professions. | ||
Act: {"name": "Search", "arguments": {"topic": "Elia Kazan"}} | ||
Obs: Elia Kazan was an American film and theatre director, producer, screenwriter and actor. | ||
Tho: Professions of Elia Kazan are director, producer, screenwriter, and actor. So profession Nicholas Ray and Elia Kazan have in common is director, screenwriter, and actor. | ||
Act: {"name": "Finish", "arguments": {"topic": "director, screenwriter, actor"}} | ||
|
||
When was the discoverer of the Hudson River born? | ||
- repeat: | ||
document: | ||
- def: thought | ||
model: ibm/granite-34b-code-instruct | ||
params: | ||
STOP_SEQUENCES: ["Act:"] | ||
INCLUDE_STOP_SEQUENCE: true | ||
- def: action | ||
model: ibm/granite-34b-code-instruct | ||
params: | ||
STOP_SEQUENCES: ["\n"] | ||
parser: json | ||
spec: {name: str, arguments: {topic: str}} | ||
- def: observation | ||
if: '{{ action.name == "Search" }}' | ||
then: | ||
document: | ||
- "Obs: " | ||
- lan: python | ||
code: | | ||
import warnings, wikipedia | ||
warnings.simplefilter("ignore") | ||
try: | ||
result = wikipedia.summary("{{ action.arguments.topic }}") | ||
except wikipedia.WikipediaException as e: | ||
result = str(e) | ||
until: '{{ action.name != "Search" }}' | ||
as: document | ||
- "\n" |
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,38 @@ | ||
document: | ||
- include: ../prompt_library/tools.pdl | ||
- include: ../prompt_library/ReAct.pdl | ||
- include: ../granite/granite_defs.pdl | ||
- def: filtered_tools | ||
call: filter_tools_by_name | ||
show_result: false | ||
args: | ||
tools: "{{ default_tools }}" | ||
tool_names: ["Search"] | ||
- def: QUESTION | ||
read: | ||
message: "Please enter a question: " | ||
- def: PROPOSED | ||
call: react_json | ||
args: | ||
context: | ||
- role: system | ||
content: "{{ granite_models.granite_7b_lab.system_prompt }}" | ||
question: "{{ QUESTION }}" | ||
model: ibm/granite-34b-code-instruct | ||
tools: "{{ filtered_tools }}" | ||
trajectories: [] | ||
- "\n\n----- Verifying answer... -----\n\n" | ||
- def: VERIFIED | ||
call: react_json | ||
args: | ||
context: [{"role": "system", "content": ""}] | ||
question: |- | ||
Is this the right answer to this question? | ||
"{{ QUESTION }}" | ||
Proposed answer: {{ PROPOSED.answer.topic }} | ||
|
||
Please answer as True or False. | ||
model: ibm/granite-34b-code-instruct | ||
tools: "{{ filtered_tools }}" | ||
trajectories: [] | ||
- "\n\nThe answer '{{ PROPOSED.answer.topic }}' has been verified as '{{VERIFIED.answer.topic}}'.\n" |
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,8 @@ | ||
description: My first PDL program | ||
document: | ||
- Hello, | ||
- model: ibm/granite-34b-code-instruct | ||
params: | ||
stop_sequences: ["!"] | ||
include_stop_sequence: true | ||
- "\n" |
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,13 @@ | ||
description: My first PDL program | ||
document: | ||
- Hello, | ||
- model: ibm/granite-34b-code-instruct | ||
params: | ||
stop_sequences: ["!"] | ||
include_stop_sequence: true | ||
- "\nTranslate this to French\n" | ||
- model: ibm/granite-20b-multilingual | ||
params: | ||
stop_sequences: ["!"] | ||
include_stop_sequence: true | ||
- "\n" |
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,17 @@ | ||
description: My first PDL program | ||
document: | ||
- Hello, | ||
- model: ibm/granite-34b-code-instruct | ||
def: name | ||
params: | ||
stop_sequences: ["!"] | ||
include_stop_sequence: false | ||
- "\n" | ||
- model: ibm/granite-20b-multilingual | ||
input: | ||
document: | ||
- "Translate the word '{{ name | trim }}' to French\n" | ||
params: | ||
stop_sequences: ["!"] | ||
include_stop_sequence: true | ||
- "\n" |
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,20 @@ | ||
document: | ||
- def: translate | ||
function: | ||
sentence: str | ||
language: str | ||
return: | ||
- "\nTranslate the sentence '{{ sentence }}' to {{ language }}.\n" | ||
- model: ibm/granite-20b-multilingual | ||
params: | ||
stop_sequences: ["\n"] | ||
- call: translate | ||
args: | ||
sentence: I love Paris! | ||
language: French | ||
- "\n" | ||
- call: translate | ||
args: | ||
sentence: I love Madrid! | ||
language: Spanish | ||
- "\n" |
Oops, something went wrong.