Mark some output parsers as serializable (cross-checked w/ JS) (#7083)

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: a description of the change, 
  - Issue: the issue # it fixes (if applicable),
  - Dependencies: any dependencies required for this change,
- Tag maintainer: for a quicker response, tag the relevant maintainer
(see below),
- Twitter handle: we announce bigger features on Twitter. If your PR
gets announced and you'd like a mention, we'll gladly shout you out!

If you're adding a new integration, please include:
1. a test for the integration, preferably unit tests that do not rely on
network access,
  2. an example notebook showing its use.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @dev2049
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @dev2049
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @vowelparrot
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the
same people again.

See contribution guidelines for more information on how to write/run
tests, lint, etc:
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
wfh/skip_no_output
Nuno Campos 1 year ago committed by GitHub
parent 4c1c05c2c7
commit e4459e423b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,6 +10,10 @@ from langchain.schema import BaseOutputParser
class CombiningOutputParser(BaseOutputParser):
"""Class to combine multiple output parsers into one."""
@property
def lc_serializable(self) -> bool:
return True
parsers: List[BaseOutputParser]
@root_validator()

@ -13,6 +13,10 @@ T = TypeVar("T")
class OutputFixingParser(BaseOutputParser[T]):
"""Wraps a parser and tries to fix parsing errors."""
@property
def lc_serializable(self) -> bool:
return True
parser: BaseOutputParser[T]
retry_chain: LLMChain

@ -21,6 +21,10 @@ class ListOutputParser(BaseOutputParser):
class CommaSeparatedListOutputParser(ListOutputParser):
"""Parse out comma separated lists."""
@property
def lc_serializable(self) -> bool:
return True
def get_format_instructions(self) -> str:
return (
"Your response should be a list of comma separated values, "

@ -9,6 +9,10 @@ from langchain.schema import BaseOutputParser
class RegexParser(BaseOutputParser):
"""Class to parse the output into a dictionary."""
@property
def lc_serializable(self) -> bool:
return True
regex: str
output_keys: List[str]
default_output_key: Optional[str] = None

Loading…
Cancel
Save