diff --git a/examples/callback/repair_prompt.pdl b/examples/callback/repair_prompt.pdl index bc795842e..2bc6796b5 100644 --- a/examples/callback/repair_prompt.pdl +++ b/examples/callback/repair_prompt.pdl @@ -11,7 +11,6 @@ lastOf: - def: raw_output model: ollama_chat/granite3.2:2b parameters: - #stop_sequences: "\n\n" temperature: 0 - lang: python diff --git a/examples/cldk/cldk-assistant.pdl b/examples/cldk/cldk-assistant.pdl index 339790d0d..0253724e8 100644 --- a/examples/cldk/cldk-assistant.pdl +++ b/examples/cldk/cldk-assistant.pdl @@ -130,7 +130,7 @@ text: parameters: - stop_sequences: "Question" + stop: ["Question"] temperature: 0 - "\n\n***Executing the above PDL code:\n\n" - lang: python diff --git a/examples/demo/10-sdg.pdl b/examples/demo/10-sdg.pdl index 68dbe11db..ac1ba52ea 100644 --- a/examples/demo/10-sdg.pdl +++ b/examples/demo/10-sdg.pdl @@ -68,7 +68,7 @@ defs: input: ${teacher_input} parameters: temperature: 0 - stop_sequences: "${teacher_stop_token}" + stop: ["${teacher_stop_token}"] max_new_tokens: ${prompt_data.max_new_tokens} parser: regex: '### Question [0-9]+:\s*([^#\n]+)' @@ -156,7 +156,7 @@ defs: model: ${teacher_model} input: ${teacher_input} parameters: - stop_sequences: "${teacher_stop_token}" + stop: ["${teacher_stop_token}"] max_new_tokens: ${prompt_data.max_new_tokens} temperature: 0 parser: @@ -252,7 +252,7 @@ defs: model: ${teacher_model} input: ${teacher_input} parameters: - stop_sequences: ${ ([teacher_stop_token] + prompt_data.additional_stop_tokens) | join(',') } + stop: ["${ ([teacher_stop_token] + prompt_data.additional_stop_tokens) | join(',') }"] max_new_tokens: ${prompt_data.max_new_tokens} temperature: 0 parsed_answer: @@ -339,7 +339,7 @@ defs: model: ${teacher_model} input: ${teacher_input} parameters: - stop_sequences: "${teacher_stop_token}" + stop: ["${teacher_stop_token}"] max_new_tokens: ${prompt_data.max_new_tokens} temperature: 0 parser: diff --git a/examples/notebooks/demo.ipynb b/examples/notebooks/demo.ipynb index 87b0f63be..251f99fb9 100644 --- a/examples/notebooks/demo.ipynb +++ b/examples/notebooks/demo.ipynb @@ -347,7 +347,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "dfef7096-b7a6-4966-8356-a306e701974b", "metadata": { "scrolled": true @@ -395,12 +395,12 @@ " - def: thought\n", " model: replicate/ibm-granite/granite-3.1-8b-instruct\n", " parameters:\n", - " stop_sequences: \"Act:\"\n", + " stop: [\"Act:\"]\n", " temperature: 0\n", " - def: rawAction\n", " model: replicate/ibm-granite/granite-3.1-8b-instruct\n", " parameters:\n", - " stop_sequences: \"\\n\"\n", + " stop: [\"\\n\"]\n", " temperature: 0\n", " - def: action\n", " lang: python\n", diff --git a/examples/notebooks/notebook.ipynb b/examples/notebooks/notebook.ipynb index d384c5dde..03586e617 100644 --- a/examples/notebooks/notebook.ipynb +++ b/examples/notebooks/notebook.ipynb @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "f3c62df1-0347-4711-acd7-3892cfd5df30", "metadata": {}, "outputs": [ @@ -32,7 +32,7 @@ "- \"Hello\\n\"\n", "- model: \"replicate/ibm-granite/granite-3.1-8b-instruct\"\n", " parameters:\n", - " stop_sequences: \"!\"\n", + " stop: [\"!\"]\n", " " ] }, diff --git a/examples/notebooks/notebook_debug.ipynb b/examples/notebooks/notebook_debug.ipynb index 0287f66a0..b1b45accc 100644 --- a/examples/notebooks/notebook_debug.ipynb +++ b/examples/notebooks/notebook_debug.ipynb @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "f3c62df1-0347-4711-acd7-3892cfd5df30", "metadata": {}, "outputs": [ @@ -166,7 +166,7 @@ "- Hello,\n", "- model: \"replicate/ibm-granite/granite-3.1-8b-instruct\"\n", " parameters:\n", - " stop_sequences: \"!\"" + " stop: [\"!\"]" ] }, { diff --git a/examples/notebooks/pdl.ipynb b/examples/notebooks/pdl.ipynb index 461415e4e..e644721e5 100644 --- a/examples/notebooks/pdl.ipynb +++ b/examples/notebooks/pdl.ipynb @@ -46,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "f3c62df1-0347-4711-acd7-3892cfd5df30", "metadata": {}, "outputs": [ @@ -75,7 +75,7 @@ "- \"What is the meaning of life?\\n\"\n", "- model: replicate/ibm-granite/granite-3.2-8b-instruct\n", " parameters:\n", - " stop_sequences: \"!\"\n", + " stop: [\"!\"]\n", " include_stop_sequence: true" ] }, @@ -153,7 +153,7 @@ ] }, { - "name": "stdin", + "name": "stdout", "output_type": "stream", "text": [ ">>> What is APR?\n" @@ -169,7 +169,7 @@ ] }, { - "name": "stdin", + "name": "stdout", "output_type": "stream", "text": [ ">>> say it like a poem\n" @@ -200,7 +200,7 @@ ] }, { - "name": "stdin", + "name": "stdout", "output_type": "stream", "text": [ ">>> quit\n" diff --git a/examples/sdk/hello_dict.py b/examples/sdk/hello_dict.py index b83c22493..4313898ce 100644 --- a/examples/sdk/hello_dict.py +++ b/examples/sdk/hello_dict.py @@ -4,8 +4,10 @@ "text": [ "Hello\n", { - "model": "ollama_chat/granite3.2:8b", - "parameters": {"stop_sequences": "!"}, + "model": "ollama_chat/granite3.2:2b", + "parameters": { + "stop": ["!"], + }, }, ] } diff --git a/examples/sdk/hello_prog.py b/examples/sdk/hello_prog.py index f33718656..de0c8b8e8 100644 --- a/examples/sdk/hello_prog.py +++ b/examples/sdk/hello_prog.py @@ -6,8 +6,8 @@ text=[ "Hello\n", LitellmModelBlock( - model="ollama_chat/granite3.2:8b", - parameters=LitellmParameters(stop_sequences="!"), # pyright: ignore + model="ollama_chat/granite3.2:2b", + parameters=LitellmParameters(stop=["!"]), # pyright: ignore ), ] ) diff --git a/examples/sdk/hello_str.py b/examples/sdk/hello_str.py index b0711587e..8a6b52c90 100644 --- a/examples/sdk/hello_str.py +++ b/examples/sdk/hello_str.py @@ -3,9 +3,9 @@ HELLO = """ text: - "Hello\n" -- model: ollama_chat/granite3.2:8b +- model: ollama_chat/granite3.2:2b parameters: - stop_sequences: '!' + stop: ['!'] """ diff --git a/examples/teacher/teacher.pdl b/examples/teacher/teacher.pdl index 68dbe11db..ac1ba52ea 100644 --- a/examples/teacher/teacher.pdl +++ b/examples/teacher/teacher.pdl @@ -68,7 +68,7 @@ defs: input: ${teacher_input} parameters: temperature: 0 - stop_sequences: "${teacher_stop_token}" + stop: ["${teacher_stop_token}"] max_new_tokens: ${prompt_data.max_new_tokens} parser: regex: '### Question [0-9]+:\s*([^#\n]+)' @@ -156,7 +156,7 @@ defs: model: ${teacher_model} input: ${teacher_input} parameters: - stop_sequences: "${teacher_stop_token}" + stop: ["${teacher_stop_token}"] max_new_tokens: ${prompt_data.max_new_tokens} temperature: 0 parser: @@ -252,7 +252,7 @@ defs: model: ${teacher_model} input: ${teacher_input} parameters: - stop_sequences: ${ ([teacher_stop_token] + prompt_data.additional_stop_tokens) | join(',') } + stop: ["${ ([teacher_stop_token] + prompt_data.additional_stop_tokens) | join(',') }"] max_new_tokens: ${prompt_data.max_new_tokens} temperature: 0 parsed_answer: @@ -339,7 +339,7 @@ defs: model: ${teacher_model} input: ${teacher_input} parameters: - stop_sequences: "${teacher_stop_token}" + stop: ["${teacher_stop_token}"] max_new_tokens: ${prompt_data.max_new_tokens} temperature: 0 parser: diff --git a/tests/results/examples/demo/9-react.0.result b/tests/results/examples/demo/9-react.0.result index 553886bd1..679bcf2cd 100644 --- a/tests/results/examples/demo/9-react.0.result +++ b/tests/results/examples/demo/9-react.0.result @@ -1,16 +1,14 @@ -How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. -Thought: I need to find out who discovered the Hudson River and then calculate how many years ago they were born, given that it's currently 2025. +How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. When searching for a birthday for a person, simply ask for the name of that person. +Thought: I need to find out who discovered the Hudson River and then calculate how many years ago their birthdate was. Action: -[{"name": "Search", "arguments": {"topic": "Hudson River discoverer"}}] -Observation: The Hudson River was discovered by Henry Hudson in 1609. -Thought: Henry Hudson was born around 1565 to 1570. I need to find the exact birth year and then calculate how many years ago it was from 2025. +[{"name": "Search", "arguments": {"topic": "Henry Hudson"}}] +Observation: Henry Hudson (c. 1565 – disappeared 23 June 1611) was an English sea explorer and navigator during the early 17th century, best known for his explorations of present-day Canada and parts of the Northeastern United States. +In 1607 and 1608, Hudson made two attempts on behalf of English merchants to find a rumoured Northeast Passage to Cathay via a route above the Arctic Circle. In 1609, he landed in North America on behalf of the Dutch East India Company and explored the region around the modern New York metropolitan area. Looking for a Northwest Passage to Asia on his ship Halve Maen ("Half Moon"), he sailed up the Hudson River, which was later named after him, and thereby laid the foundation for Dutch colonization of the region. His contributions to the exploration of the New World were significant and lasting. His voyages helped to establish European contact with the native peoples of North America and contributed to the development of trade and commerce. +On his final expedition, while still searching for the Northwest Passage, Hudson became the first European to see Hudson Strait and the immense Hudson Bay. In 1611, after wintering on the shore of James Bay, Hudson wanted to press on to the west, but most of his crew mutinied. The mutineers cast Hudson, his son, and six others adrift; what then happened to the Hudsons and their companions is unknown. +Thought: Henry Hudson discovered the Hudson River in 1609. He was born around 1565. Action: -[{"name": "Search", "arguments": {"topic": "Henry Hudson birth year"}}] -Observation: Henry Hudson was born in 1565. -Thought: To find out how many years ago he was born, I subtract his birth year from the current year (2025). -Action: -[{"name": "Calc", "arguments": {"expr": "2025 - 1565"}}] -Observation: The result of the calculation is 460. -Thought: Henry Hudson was born 460 years ago.Action: -[{"name": "Finish", "arguments": {"topic": "460 years ago"}}] +[{"name": "Calc", "arguments": {"expr": "2025 - 1565"}}] +Observation: 460 +Henry Hudson was born around 1565, so he was approximately 460 years ago.Action: +[{"name": "Finish", "arguments": {"topic": "460"}}] Observation: diff --git a/tests/results/examples/react/demo.0.result b/tests/results/examples/react/demo.0.result index 2623d9115..ce67247d3 100644 --- a/tests/results/examples/react/demo.0.result +++ b/tests/results/examples/react/demo.0.result @@ -1,15 +1,13 @@ -How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. -Thought: I need to find out who discovered the Hudson River and then calculate how many years ago they were born, given that it's currently 2025. +How many years ago was the discoverer of the Hudson River born? Keep in mind we are in 2025. When searching for a birthday for a person, simply ask for the name of that person. +Thought: I need to find out who discovered the Hudson River and then calculate how many years ago their birthdate was. Action: -[{"name": "Search", "arguments": {"topic": "Hudson River discoverer"}}] -Observation: The Hudson River was discovered by Henry Hudson in 1609. -Thought: Henry Hudson was born around 1565 to 1570. I need to find the exact birth year and then calculate how many years ago it was from 2025. +[{"name": "Search", "arguments": {"topic": "Henry Hudson"}}] +Observation: Henry Hudson (c. 1565 – disappeared 23 June 1611) was an English sea explorer and navigator during the early 17th century, best known for his explorations of present-day Canada and parts of the Northeastern United States. +In 1607 and 1608, Hudson made two attempts on behalf of English merchants to find a rumoured Northeast Passage to Cathay via a route above the Arctic Circle. In 1609, he landed in North America on behalf of the Dutch East India Company and explored the region around the modern New York metropolitan area. Looking for a Northwest Passage to Asia on his ship Halve Maen ("Half Moon"), he sailed up the Hudson River, which was later named after him, and thereby laid the foundation for Dutch colonization of the region. His contributions to the exploration of the New World were significant and lasting. His voyages helped to establish European contact with the native peoples of North America and contributed to the development of trade and commerce. +On his final expedition, while still searching for the Northwest Passage, Hudson became the first European to see Hudson Strait and the immense Hudson Bay. In 1611, after wintering on the shore of James Bay, Hudson wanted to press on to the west, but most of his crew mutinied. The mutineers cast Hudson, his son, and six others adrift; what then happened to the Hudsons and their companions is unknown. +Thought: Henry Hudson discovered the Hudson River in 1609. He was born around 1565. Action: -[{"name": "Search", "arguments": {"topic": "Henry Hudson birth year"}}] -Observation: Henry Hudson was born in 1565. -Thought: To find out how many years ago he was born, I subtract his birth year from the current year (2025). -Action: -[{"name": "Calc", "arguments": {"expr": "2025 - 1565"}}] -Observation: The result of the calculation is 460. -Thought: Henry Hudson was born 460 years ago.Action: -[{"name": "Finish", "arguments": {"topic": "460 years ago"}}] +[{"name": "Calc", "arguments": {"expr": "2025 - 1565"}}] +Observation: 460 +Henry Hudson was born around 1565, so he was approximately 460 years ago.Action: +[{"name": "Finish", "arguments": {"topic": "460"}}]