langchain[patch]: oai tools output parser nit (#16540)

allow positional init args
pull/16550/head
Bagatur 5 months ago committed by GitHub
parent f9976b9630
commit c173a69908
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -72,6 +72,10 @@ class JsonOutputKeyToolsParser(JsonOutputToolsParser):
return_single: bool = False
"""Whether to return only the first tool call."""
def __init__(self, key_name: str, **kwargs: Any) -> None:
"""Allow init with positional args."""
super().__init__(key_name=key_name, **kwargs)
def parse_result(self, result: List[Generation], *, partial: bool = False) -> Any:
results = super().parse_result(result)
results = [res for res in results if res["type"] == self.key_name]

Loading…
Cancel
Save