Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add enum output parser #5165

Merged
merged 1 commit into from
May 28, 2023
Merged

add enum output parser #5165

merged 1 commit into from
May 28, 2023

Conversation

hwchase17
Copy link
Contributor

No description provided.

@hwchase17 hwchase17 added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label May 24, 2023

@root_validator()
def raise_deprecation(cls, values: Dict) -> Dict:
enum = values["enum"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this not new? what the deprecation warning?



class EnumOutputParser(BaseOutputParser):
enum: Type[Enum]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe too much but could add a strict: bool param and when not strict is one then parser just checks if any of the enum vals occur in the response (instead of exactly matching)

@hwchase17 hwchase17 merged commit 5292e85 into master May 28, 2023
@hwchase17 hwchase17 deleted the harrison/enum branch May 28, 2023 03:59
ympons pushed a commit to ympons/langchain that referenced this pull request May 28, 2023
@danielchalef danielchalef mentioned this pull request Jun 5, 2023
Undertone0809 pushed a commit to Undertone0809/langchain that referenced this pull request Jun 19, 2023
Undertone0809 pushed a commit to Undertone0809/langchain that referenced this pull request Jun 19, 2023
This was referenced Jun 25, 2023
Ulumanshu pushed a commit to Ulumanshu/langchain that referenced this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PR looks good. Use to confirm that a PR is ready for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants