|
|
|
@ -172,15 +172,12 @@ class SimpleJsonOutputParser(BaseOutputParser[Any]):
|
|
|
|
|
return "simple_json_output_parser"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PartialJsonOutputParser(BaseCumulativeTransformOutputParser[Any]):
|
|
|
|
|
from_function_args: bool = False
|
|
|
|
|
|
|
|
|
|
class PartialFunctionsJsonOutputParser(BaseCumulativeTransformOutputParser[Any]):
|
|
|
|
|
@property
|
|
|
|
|
def _type(self) -> str:
|
|
|
|
|
return "partial_json"
|
|
|
|
|
return "partial_functions_json"
|
|
|
|
|
|
|
|
|
|
def parse_result(self, result: List[Generation]) -> Any:
|
|
|
|
|
if self.from_function_args:
|
|
|
|
|
if len(result) != 1:
|
|
|
|
|
raise OutputParserException(
|
|
|
|
|
f"Expected exactly one result, but got {len(result)}"
|
|
|
|
@ -202,3 +199,12 @@ class PartialJsonOutputParser(BaseCumulativeTransformOutputParser[Any]):
|
|
|
|
|
|
|
|
|
|
def parse(self, text: str) -> Any:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PartialJsonOutputParser(BaseCumulativeTransformOutputParser[Any]):
|
|
|
|
|
@property
|
|
|
|
|
def _type(self) -> str:
|
|
|
|
|
return "partial_functions_json"
|
|
|
|
|
|
|
|
|
|
def parse(self, text: str) -> Any:
|
|
|
|
|
return parse_json_markdown(text)
|
|
|
|
|