Skip to content

Commit b9591d6

Browse files
authored
Rename lan to lang in code blocks (#123)
1 parent ee6c556 commit b9591d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+136
-136
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ text:
278278
EVALUATION:
279279
The similarity (Levenshtein) between this answer and the ground truth is:
280280
- def: EVAL
281-
lan: python
281+
lang: python
282282
code: |
283283
import textdistance
284284
expl = """
@@ -348,7 +348,7 @@ text:
348348
${ CODE.source_code }```
349349
- def: EVAL
350350
contribute: []
351-
lan: python
351+
lang: python
352352
code:
353353
|
354354
import textdistance

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ text:
283283
EVALUATION:
284284
The similarity (Levenshtein) between this answer and the ground truth is:
285285
- def: EVAL
286-
lan: python
286+
lang: python
287287
code: |
288288
import textdistance
289289
expl = """
@@ -353,7 +353,7 @@ text:
353353
${ CODE.source_code }```
354354
- def: EVAL
355355
contribute: []
356-
lan: python
356+
lang: python
357357
code:
358358
|
359359
import textdistance

docs/tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ See for example: ([file](https://github.com/IBM/prompt-declaration-language//blo
349349
description: Hello world showing call to python code
350350
text:
351351
- "Hello, "
352-
- lan: python
352+
- lang: python
353353
code:
354354
|
355355
import random
@@ -390,7 +390,7 @@ text:
390390
include_stop_sequence: false
391391
def: LOCATION
392392
contribute: []
393-
- lan: python
393+
- lang: python
394394
code: |
395395
import requests
396396
response = requests.get('https://api.weatherapi.com/v1/current.json?key=cf601276764642cb96224947230712&q=${ LOCATION }')
@@ -438,7 +438,7 @@ text:
438438
${ CODE.source_code }```
439439
- def: EVAL
440440
contribute: []
441-
lan: python
441+
lang: python
442442
code:
443443
|
444444
import textdistance
@@ -552,7 +552,7 @@ text:
552552
include_stop_sequence: false
553553
- '= '
554554
- def: RESULT
555-
lan: python
555+
lang: python
556556
code: result = ${ EXPR }
557557
- ' >>'
558558
until: ${ "The answer is" in REASON_OR_CALC }

docs/viewer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ hide:
147147
"input": {
148148
"kind": "text",
149149
"defs": {},
150-
"text": ["Question: Write the following prompts in PDL:\nHello world!\nThis is your first prompt descriptor!\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"Hello, world!\\n\"\n- \"This is your first prompt descriptor!\\n\" \n```\n\nQuestion: Turn the code into PDL:\ncontents = []\nwhile True:\ntry:\n line = input()\nexcept EOFError:\n break\ncontents.append(line + \"\\n\")\nresult = ''.join(contents)\n\nAnswer:\n```\ndescription: Example of PDL code block\ntext:\n- lan: python\n code:\n - |\n contents = []\n while True:\n try:\n line = input()\n except EOFError:\n break\n contents.append(line + \"\\n\")\n result = ''.join(contents)\n```\n\nQuestion: Write the following in PDL where the parts in << >> are done in Python.\nHello world!\nThis is your << expr >> prompt descriptor!\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"Hello, world!\\n\"\n- \"This is your \"\n- lan: python\n code:\n - |\n result = expr\n- \" prompt descriptor!\"\n```\nQuestion: Write the following in PDL where the parts in << >> are done in Python.\nWhat is << 67+ 67 - 78 + 2 >>\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"What is \"\n- lan: python\n code:\n - |\n result = 67+ 67 - 78 + 2\n```\n\n\nQuestion: Write the following in PDL with parts << >> written in Python", {
150+
"text": ["Question: Write the following prompts in PDL:\nHello world!\nThis is your first prompt descriptor!\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"Hello, world!\\n\"\n- \"This is your first prompt descriptor!\\n\" \n```\n\nQuestion: Turn the code into PDL:\ncontents = []\nwhile True:\ntry:\n line = input()\nexcept EOFError:\n break\ncontents.append(line + \"\\n\")\nresult = ''.join(contents)\n\nAnswer:\n```\ndescription: Example of PDL code block\ntext:\n- lang: python\n code:\n - |\n contents = []\n while True:\n try:\n line = input()\n except EOFError:\n break\n contents.append(line + \"\\n\")\n result = ''.join(contents)\n```\n\nQuestion: Write the following in PDL where the parts in << >> are done in Python.\nHello world!\nThis is your << expr >> prompt descriptor!\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"Hello, world!\\n\"\n- \"This is your \"\n- lang: python\n code:\n - |\n result = expr\n- \" prompt descriptor!\"\n```\nQuestion: Write the following in PDL where the parts in << >> are done in Python.\nWhat is << 67+ 67 - 78 + 2 >>\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"What is \"\n- lang: python\n code:\n - |\n result = 67+ 67 - 78 + 2\n```\n\n\nQuestion: Write the following in PDL with parts << >> written in Python", {
151151
"kind": "get",
152152
"defs": {},
153153
"get": "QUERY1",
154154
"result": "\nAnswer:\nBobby had 3 apples. He then added 2. Hence 3 + 2 = 5 How many apple did Bobby have?",
155155
}, "\n\n"],
156-
"result": "Question: Write the following prompts in PDL:\nHello world!\nThis is your first prompt descriptor!\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"Hello, world!\\n\"\n- \"This is your first prompt descriptor!\\n\" \n```\n\nQuestion: Turn the code into PDL:\ncontents = []\nwhile True:\ntry:\n line = input()\nexcept EOFError:\n break\ncontents.append(line + \"\\n\")\nresult = ''.join(contents)\n\nAnswer:\n```\ndescription: Example of PDL code block\ntext:\n- lan: python\n code:\n - |\n contents = []\n while True:\n try:\n line = input()\n except EOFError:\n break\n contents.append(line + \"\\n\")\n result = ''.join(contents)\n```\n\nQuestion: Write the following in PDL where the parts in << >> are done in Python.\nHello world!\nThis is your << expr >> prompt descriptor!\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"Hello, world!\\n\"\n- \"This is your \"\n- lan: python\n code:\n - |\n result = expr\n- \" prompt descriptor!\"\n```\nQuestion: Write the following in PDL where the parts in << >> are done in Python.\nWhat is << 67+ 67 - 78 + 2 >>\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"What is \"\n- lan: python\n code:\n - |\n result = 67+ 67 - 78 + 2\n```\n\n\nQuestion: Write the following in PDL with parts << >> written in Python\nAnswer:\nBobby had 3 apples. He then added 2. Hence 3 + 2 = 5 How many apple did Bobby have?\n\n",
156+
"result": "Question: Write the following prompts in PDL:\nHello world!\nThis is your first prompt descriptor!\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"Hello, world!\\n\"\n- \"This is your first prompt descriptor!\\n\" \n```\n\nQuestion: Turn the code into PDL:\ncontents = []\nwhile True:\ntry:\n line = input()\nexcept EOFError:\n break\ncontents.append(line + \"\\n\")\nresult = ''.join(contents)\n\nAnswer:\n```\ndescription: Example of PDL code block\ntext:\n- lang: python\n code:\n - |\n contents = []\n while True:\n try:\n line = input()\n except EOFError:\n break\n contents.append(line + \"\\n\")\n result = ''.join(contents)\n```\n\nQuestion: Write the following in PDL where the parts in << >> are done in Python.\nHello world!\nThis is your << expr >> prompt descriptor!\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"Hello, world!\\n\"\n- \"This is your \"\n- lang: python\n code:\n - |\n result = expr\n- \" prompt descriptor!\"\n```\nQuestion: Write the following in PDL where the parts in << >> are done in Python.\nWhat is << 67+ 67 - 78 + 2 >>\n\nAnswer:\n```\ndescription: Hello world!\ntext:\n- \"What is \"\n- lang: python\n code:\n - |\n result = 67+ 67 - 78 + 2\n```\n\n\nQuestion: Write the following in PDL with parts << >> written in Python\nAnswer:\nBobby had 3 apples. He then added 2. Hence 3 + 2 = 5 How many apple did Bobby have?\n\n",
157157
},
158158
"parameters": {
159159
"decoding_method": "greedy",
@@ -167,7 +167,7 @@ hide:
167167
}, {
168168
"kind": "code",
169169
"defs": {},
170-
"lan": "python",
170+
"lang": "python",
171171
"code": ["from pdl import pdl_ast, pdl_interpreter\nfrom pdl.pdl_ast import Program\nfrom pdl.pdl_interpreter import process_prog\nfrom pdl.pdl_interpreter import InterpreterState\nfrom pdl.pdl_interpreter import empty_scope\nimport re\nimport yaml\ns = \"\"\"'\n", {
172172
"kind": "get",
173173
"defs": {},

examples/arith/Arith-simple.pdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ text:
3636
post_message: ""
3737
- '= '
3838
- def: RESULT
39-
lan: python
39+
lang: python
4040
code: result = ${ EXPR }
4141
- ' >>'
4242
until: ${ "The answer is" in REASON_OR_CALC }

examples/arith/arith.pdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ text:
3535
include_stop_sequence: false
3636
- '= '
3737
- def: RESULT
38-
lan: python
38+
lang: python
3939
code: result = ${ EXPR }
4040
- ' >>'
4141
until: ${ "The answer is" in REASON_OR_CALC }

examples/cldk/cldk-assistant.pdl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ text:
55
message: "Please enter the path to your Java project:\n"
66
contribute: []
77
- "***Analyzing...\n"
8-
- lan: python
8+
- lang: python
99
def: analysis
1010
contribute: []
1111
code: |
@@ -42,7 +42,7 @@ text:
4242
Answer:
4343
```
4444
text:
45-
- lan: python
45+
- lang: python
4646
code:
4747
- |
4848
classes = PDL_SESSION.cldk_state.get_classes().keys()
@@ -53,7 +53,7 @@ text:
5353
Answer:
5454
```
5555
text:
56-
- lan: python
56+
- lang: python
5757
code:
5858
- |
5959
constructors = PDL_SESSION.cldk_state.get_constructors("org.ibm.App")
@@ -64,7 +64,7 @@ text:
6464
Answer:
6565
```
6666
text:
67-
- lan: python
67+
- lang: python
6868
code:
6969
- |
7070
fields = PDL_SESSION.cldk_state.get_fields("org.ibm.App")
@@ -76,7 +76,7 @@ text:
7676
Answer:
7777
```
7878
text:
79-
- lan: python
79+
- lang: python
8080
code:
8181
- |
8282
methods = PDL_SESSION.cldk_state.get_methods_in_class("org.ibm.App")
@@ -87,7 +87,7 @@ text:
8787
Answer:
8888
```
8989
text:
90-
- lan: python
90+
- lang: python
9191
code:
9292
- |
9393
graph = PDL_SESSION.cldk_state.get_class_call_graph("org.ibm.App", method_name=None)
@@ -98,7 +98,7 @@ text:
9898
Answer:
9999
```
100100
text:
101-
- lan: python
101+
- lang: python
102102
code:
103103
- |
104104
method = PDL_SESSION.cldk_state.get_method("org.ibm.App", "Foo(string)")
@@ -109,7 +109,7 @@ text:
109109
Answer:
110110
```
111111
text:
112-
- lan: python
112+
- lang: python
113113
code:
114114
- |
115115
method = PDL_SESSION.cldk_state.get_method("org.ibm.App", "Foo(string)")
@@ -122,7 +122,7 @@ text:
122122
Answer:
123123
```
124124
text:
125-
- lan: python
125+
- lang: python
126126
code:
127127
- |
128128
method = PDL_SESSION.cldk_state.get_method("org.ibm.App", "Foo(string)")
@@ -140,7 +140,7 @@ text:
140140
stop_sequence: ["Question"]
141141
include_stop_sequence: false
142142
- "\n\n***Executing the above PDL code:\n\n"
143-
- lan: python
143+
- lang: python
144144
contribute: []
145145
code: |
146146
from pdl import pdl_ast, pdl_interpreter

examples/code/code-eval.pdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ text:
2626
EVALUATION:
2727
The similarity (Levenshtein) between this answer and the ground truth is:
2828
- def: EVAL
29-
lan: python
29+
lang: python
3030
code: |
3131
import textdistance
3232
expl = """

examples/code/code-json.pdl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ text:
2323
${ CODE.source_code }```
2424
- def: EVAL
2525
contribute: []
26-
lan: python
26+
lang: python
2727
code:
2828
|
2929
import textdistance

examples/demo/2-teacher.pdl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ defs:
102102
icl_answer: ${example.answer}
103103
join:
104104
as: array
105-
- lan: python
105+
- lang: python
106106
code: | # flatten list_of_lists into simple list
107107
result = [q for qs in ${list_of_lists} for q in qs]
108108

@@ -188,7 +188,7 @@ defs:
188188
join:
189189
as: array
190190
filtered:
191-
lan: python
191+
lang: python
192192
code: | # keep only if "keep" column is non-zero
193193
result = [p["question"] for p in ${ list_of_pairs } if p["keep"]]
194194
- ${filtered}
@@ -255,7 +255,7 @@ defs:
255255
include_stop_sequence: false
256256
max_new_tokens: ${prompt_data.max_new_tokens}
257257
parsed_answer:
258-
lan: python
258+
lang: python
259259
code: | # parse model output
260260
result = """ ${teacher_output} """.strip()
261261
if "[Response]" in result:
@@ -282,7 +282,7 @@ defs:
282282
question: ${question}
283283
join:
284284
as: array
285-
- lan: python
285+
- lang: python
286286
spec: [{question: str, answer: str}]
287287
code: | # keep only if answer non-empty
288288
result = [r for r in ${all_results} if len(r["answer"]) > 0]
@@ -369,7 +369,7 @@ defs:
369369
join:
370370
as: array
371371
filtered:
372-
lan: python
372+
lang: python
373373
spec: [{question: str, answer: str}]
374374
code: | # keep only if rating is at least two
375375
result = [p["qa_pair"] for p in ${ratings} if p["rating"] >= 2]

0 commit comments

Comments
 (0)