Skip to content

Commit

Permalink
Exclude Bedrock client and credentials_profile_name fields from seria…
Browse files Browse the repository at this point in the history
…lisation (#13603)
  • Loading branch information
dqbd committed Nov 28, 2023
1 parent 48fbc55 commit 947daaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions libs/langchain/langchain/chat_models/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ def is_lc_serializable(cls) -> bool:
def lc_attributes(self) -> Dict[str, Any]:
attributes: Dict[str, Any] = {}

print(self.region_name)

if self.region_name:
attributes["region_name"] = self.region_name

Expand Down
6 changes: 3 additions & 3 deletions libs/langchain/langchain/llms/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Any, Dict, Iterator, List, Mapping, Optional

from langchain_core.outputs import GenerationChunk
from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator
from langchain_core.pydantic_v1 import BaseModel, Extra, Field, root_validator

from langchain.callbacks.manager import CallbackManagerForLLMRun
from langchain.llms.base import LLM
Expand Down Expand Up @@ -148,14 +148,14 @@ def prepare_output_stream(
class BedrockBase(BaseModel, ABC):
"""Base class for Bedrock models."""

client: Any #: :meta private:
client: Any = Field(exclude=True) #: :meta private:

region_name: Optional[str] = None
"""The aws region e.g., `us-west-2`. Fallsback to AWS_DEFAULT_REGION env variable
or region specified in ~/.aws/config in case it is not provided here.
"""

credentials_profile_name: Optional[str] = None
credentials_profile_name: Optional[str] = Field(default=None, exclude=True)
"""The name of the profile in the ~/.aws/credentials or ~/.aws/config files, which
has either access keys or role information specified.
If not specified, the default credential profile or, if on an EC2 instance,
Expand Down

0 comments on commit 947daaf

Please sign in to comment.