Skip to content

Commit 8c60414

Browse files
authored
updated examples for talk (#58)
Signed-off-by: Mandana Vaziri <[email protected]>
1 parent cd79aba commit 8c60414

13 files changed

+67
-46
lines changed

examples/talk/1-hello.pdl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
description: A simple prompt
1+
description: Model call
22
document:
3-
- Hello, World!
3+
- Hello,
4+
- model: watsonx/ibm/granite-34b-code-instruct
5+
parameters:
6+
stop: ["!"]
7+
include_stop_sequence: true
8+

examples/talk/2-hello.pdl

Lines changed: 0 additions & 8 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

examples/talk/4-code-json.pdl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
description: Code explanation example
2+
defs:
3+
CODE:
4+
read: ./data.yaml
5+
parser: yaml
6+
TRUTH:
7+
read: ./ground_truth.txt
8+
document:
9+
- model: watsonx/ibm/granite-34b-code-instruct
10+
def: EXPLANATION
11+
contribute: []
12+
input:
13+
|
14+
Here is some info about the location of the function in the repo.
15+
repo:
16+
{{ CODE.repo_info.repo }}
17+
path: {{ CODE.repo_info.path }}
18+
Function_name: {{ CODE.repo_info.function_name }}
19+
20+
21+
Explain the following code:
22+
```
23+
{{ CODE.source_code }}```
24+
- def: EVAL
25+
contribute: []
26+
lan: python
27+
code:
28+
|
29+
import textdistance
30+
expl = """
31+
{{ EXPLANATION }}
32+
"""
33+
truth = """
34+
{{ TRUTH }}
35+
"""
36+
result = textdistance.levenshtein.normalized_similarity(expl, truth)
37+
- data:
38+
input: "{{ CODE }}"
39+
output: "{{ EXPLANATION }}"
40+
metric: "{{ EVAL }}"

examples/talk/5-chatbot-roles.pdl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
description: chatbot, control structures, roles, contribute
2+
document:
3+
- include: ../granite/granite_defs.pdl
4+
- role: system
5+
contribute: [context]
6+
document: "{{ SYSTEM_CONTENT_CHAT }}"
7+
- "Type `quit` to exit this chatbot.\n"
8+
- repeat:
9+
document:
10+
- read:
11+
message: ">>> "
12+
def: query
13+
contribute: [context]
14+
- model: watsonx/ibm/granite-13b-chat-v2
15+
- "\n\n"
16+
until: "{{ query == 'quit'}}"
17+
as: document
18+
role: user
19+

examples/talk/6-chatbot-roles.pdl

Lines changed: 0 additions & 36 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)