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

community[minor]: Fix pydantic ForwardRef error in BedrockBase #17416

Merged
merged 3 commits into from
Feb 14, 2024

Conversation

nat-n
Copy link
Contributor

@nat-n nat-n commented Feb 12, 2024

  • Description: Fixes a type annotation issue in the definition of BedrockBase. This issue was that the annotation for the config attribute includes a ForwardRef to botocore.client.Config which is only imported when TYPE_CHECKING. This can cause pydantic to raise an error like pydantic.errors.ConfigError: field "config" not yet prepared so type is still a ForwardRef, ....
  • Issue: N/A
  • Dependencies: N/A
  • Twitter handle: @__nat_n__

Fix an issue that can cause errors when working with BedrockBase
due to the config field annonation containing a ForwardRef that
is never available at runtime (only when TYPE_CHECKING).

Also see Config.arbitrary_types_allowed on the model, to make it
accept botocore.client.Config in an annotation.
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 12, 2024
Copy link

vercel bot commented Feb 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Feb 13, 2024 8:29pm

@dosubot dosubot bot added 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature 🔌: aws Primarily related to Amazon Web Services (AWS) integrations labels Feb 12, 2024
Copy link
Collaborator

@baskaryan baskaryan left a comment

Choose a reason for hiding this comment

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

maybe better to just remove the Config typing in L231 from pydantic class, doesn't add much

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 13, 2024
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Feb 13, 2024
@baskaryan baskaryan merged commit 8a3b74f into langchain-ai:master Feb 14, 2024
58 checks passed
@baskaryan
Copy link
Collaborator

thank you @nat-n!

@nat-n nat-n deleted the fix_bedrockbase branch February 14, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔌: aws Primarily related to Amazon Web Services (AWS) integrations 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature lgtm PR looks good. Use to confirm that a PR is ready for merging. size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants