Harrison/output error (#3094)

Co-authored-by: yummydum <sumita@nowcast.co.jp>
This commit is contained in:
Harrison Chase
2023-04-18 08:59:56 -07:00
committed by GitHub
parent 1c1b77bbfe
commit aad0a498ac
12 changed files with 57 additions and 32 deletions

View File

@@ -9,7 +9,7 @@ from langchain.agents.mrkl.output_parser import MRKLOutputParser
from langchain.agents.mrkl.prompt import FORMAT_INSTRUCTIONS, PREFIX, SUFFIX
from langchain.agents.tools import Tool
from langchain.prompts import PromptTemplate
from langchain.schema import AgentAction
from langchain.schema import AgentAction, OutputParserException
from tests.unit_tests.llms.fake_llm import FakeLLM
@@ -98,7 +98,7 @@ def test_get_final_answer_multiline() -> None:
def test_bad_action_input_line() -> None:
"""Test handling when no action input found."""
llm_output = "Thought: I need to search for NBA\n" "Action: Search\n" "Thought: NBA"
with pytest.raises(ValueError):
with pytest.raises(OutputParserException):
get_action_and_input(llm_output)
@@ -107,7 +107,7 @@ def test_bad_action_line() -> None:
llm_output = (
"Thought: I need to search for NBA\n" "Thought: Search\n" "Action Input: NBA"
)
with pytest.raises(ValueError):
with pytest.raises(OutputParserException):
get_action_and_input(llm_output)