chore: Refactor error handling in OutputParser for improved readability (#3985)
Refactor: improve readability of error handling in OutputParser
This commit is contained in:
parent
0d2a03920d
commit
e710b457c3
1 changed files with 4 additions and 4 deletions
|
|
@ -34,11 +34,11 @@ class OutputParserComponent(Component):
|
||||||
def build_parser(self) -> OutputParser:
|
def build_parser(self) -> OutputParser:
|
||||||
if self.parser_type == "CSV":
|
if self.parser_type == "CSV":
|
||||||
return CommaSeparatedListOutputParser()
|
return CommaSeparatedListOutputParser()
|
||||||
else:
|
msg = "Unsupported or missing parser"
|
||||||
raise ValueError("Unsupported or missing parser")
|
raise ValueError(msg)
|
||||||
|
|
||||||
def format_instructions(self) -> Message:
|
def format_instructions(self) -> Message:
|
||||||
if self.parser_type == "CSV":
|
if self.parser_type == "CSV":
|
||||||
return Message(text=CommaSeparatedListOutputParser().get_format_instructions())
|
return Message(text=CommaSeparatedListOutputParser().get_format_instructions())
|
||||||
else:
|
msg = "Unsupported or missing parser"
|
||||||
raise ValueError("Unsupported or missing parser")
|
raise ValueError(msg)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue