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 serialisable support for Replicate #8525

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libs/langchain/langchain/llms/replicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ class Config:

extra = Extra.forbid

@property
def lc_secrets(self) -> Dict[str, str]:
return {"replicate_api_token": "REPLICATE_API_TOKEN"}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: It seems like LangchainJS uses REPLICATE_API_KEY instead of REPLICATE_API_TOKEN. Haven't changed that as this would be a breaking change I assume?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yea would be breaking. if we wanted could unify the secrets (to be TOKEN or API_KEY, no strong preference) and update the constructor (of whichever class we change) to accept both params/env vars, and just log a deprecation warning if they use the old one

Copy link
Collaborator

Choose a reason for hiding this comment

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

can also do that in a later PR


@property
def lc_serializable(self) -> bool:
return True

@root_validator(pre=True)
def build_extra(cls, values: Dict[str, Any]) -> Dict[str, Any]:
"""Build extra kwargs from additional params that were passed in."""
Expand Down