Skip to content

The agent engineering platform.

core[patch]: Sort Config attributes (#25127)

Eugene Yurtsev4d28c70000e3
diff --git a/libs/core/langchain_core/example_selectors/semantic_similarity.py b/libs/core/langchain_core/example_selectors/semantic_similarity.py
index b4d8d0cc1c..c14428a0c1 100644
--- a/libs/core/langchain_core/example_selectors/semantic_similarity.py
+++ b/libs/core/langchain_core/example_selectors/semantic_similarity.py
@@ -43,10 +43,8 @@ class _VectorStoreExampleSelector(BaseExampleSelector, BaseModel, ABC):
"""Extra arguments passed to similarity_search function of the vectorstore."""
class Config:
- """Configuration for this pydantic object."""
-
- extra = Extra.forbid
arbitrary_types_allowed = True
+ extra = Extra.forbid
@staticmethod
def _example_to_text(
diff --git a/libs/core/langchain_core/language_models/chat_models.py b/libs/core/langchain_core/language_models/chat_models.py
index bc6630858a..b4d367572a 100644
--- a/libs/core/langchain_core/language_models/chat_models.py
+++ b/libs/core/langchain_core/language_models/chat_models.py
@@ -236,8 +236,6 @@ class BaseChatModel(BaseLanguageModel[BaseMessage], ABC):
return values
class Config:
- """Configuration for this pydantic object."""
-
arbitrary_types_allowed = True
# --- Runnable methods ---
diff --git a/libs/core/langchain_core/language_models/llms.py b/libs/core/langchain_core/language_models/llms.py
index 1b1e014a8e..03ae2be5e2 100644
--- a/libs/core/langchain_core/language_models/llms.py
+++ b/libs/core/langchain_core/language_models/llms.py
@@ -298,8 +298,6 @@ class BaseLLM(BaseLanguageModel[str], ABC):
"""[DEPRECATED]"""
class Config:
- """Configuration for this pydantic object."""
-
arbitrary_types_allowed = True
@root_validator(pre=True)
diff --git a/libs/core/langchain_core/memory.py b/libs/core/langchain_core/memory.py
index 34a90d879e..743c68b68b 100644
--- a/libs/core/langchain_core/memory.py
+++ b/libs/core/langchain_core/memory.py
@@ -48,8 +48,6 @@ class BaseMemory(Serializable, ABC):
""" # noqa: E501
class Config:
- """Configuration for this pydantic object."""
-
arbitrary_types_allowed = True
@property
diff --git a/libs/core/langchain_core/prompts/base.py b/libs/core/langchain_core/prompts/base.py
index a58f916d4a..8ba8e56071 100644
--- a/libs/core/langchain_core/prompts/base.py
+++ b/libs/core/langchain_core/prompts/base.py
@@ -100,8 +100,6 @@ class BasePromptTemplate(
return True
class Config:
- """Configuration for this pydantic object."""
-
arbitrary_types_allowed = True
@property
diff --git a/libs/core/langchain_core/prompts/few_shot.py b/libs/core/langchain_core/prompts/few_shot.py
index d750851f46..934ac88a81 100644
--- a/libs/core/langchain_core/prompts/few_shot.py
+++ b/libs/core/langchain_core/prompts/few_shot.py
@@ -33,10 +33,8 @@ class _FewShotPromptTemplateMixin(BaseModel):
Either this or examples should be provided."""
class Config:
- """Configuration for this pydantic object."""
-
- extra = Extra.forbid
arbitrary_types_allowed = True
+ extra = Extra.forbid
@root_validator(pre=True)
def check_examples_and_selector(cls, values: Dict) -> Dict:
@@ -161,10 +159,8 @@ class FewShotPromptTemplate(_FewShotPromptTemplateMixin, StringPromptTemplate):
return values
class Config:
- """Configuration for this pydantic object."""
-
- extra = Extra.forbid
arbitrary_types_allowed = True
+ extra = Extra.forbid
def format(self, **kwargs: Any) -> str:
"""Format the prompt with inputs generating a string.
@@ -370,10 +366,8 @@ class FewShotChatMessagePromptTemplate(
return False
class Config:
- """Configuration for this pydantic object."""
-
- extra = Extra.forbid
arbitrary_types_allowed = True
+ extra = Extra.forbid
def format_messages(self, **kwargs: Any) -> List[BaseMessage]:
"""Format kwargs into a list of messages.
diff --git a/libs/core/langchain_core/prompts/few_shot_with_templates.py b/libs/core/langchain_core/prompts/few_shot_with_templates.py
index 8e5db1a81f..6b98694d44 100644
--- a/libs/core/langchain_core/prompts/few_shot_with_templates.py
+++ b/libs/core/langchain_core/prompts/few_shot_with_templates.py
@@ -86,10 +86,8 @@ class FewShotPromptWithTemplates(StringPromptTemplate):
return values
class Config:
- """Configuration for this pydantic object."""
-
- extra = Extra.forbid
arbitrary_types_allowed = True
+ extra = Extra.forbid
def _get_examples(self, **kwargs: Any) -> List[dict]:
if self.examples is not None:
diff --git a/libs/core/langchain_core/retrievers.py b/libs/core/langchain_core/retrievers.py
index efce96bdad..6bbf34072b 100644
--- a/libs/core/langchain_core/retrievers.py
+++ b/libs/core/langchain_core/retrievers.py
@@ -112,8 +112,6 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):
""" # noqa: E501
class Config:
- """Configuration for this pydantic object."""
-
arbitrary_types_allowed = True
_new_arg_supported: bool = False
diff --git a/libs/core/langchain_core/tools.py b/libs/core/langchain_core/tools.py
index 729d68ffc3..98a86b0aaf 100644
--- a/libs/core/langchain_core/tools.py
+++ b/libs/core/langchain_core/tools.py
@@ -374,8 +374,6 @@ class ChildTool(BaseTool):
super().__init__(**kwargs)
class Config(Serializable.Config):
- """Configuration for this pydantic object."""
-
arbitrary_types_allowed = True
@property
diff --git a/libs/core/langchain_core/vectorstores/base.py b/libs/core/langchain_core/vectorstores/base.py
index 8868889496..f6f3f37772 100644
--- a/libs/core/langchain_core/vectorstores/base.py
+++ b/libs/core/langchain_core/vectorstores/base.py
@@ -1208,8 +1208,6 @@ class VectorStoreRetriever(BaseRetriever):
)
class Config:
- """Configuration for this pydantic object."""
-
arbitrary_types_allowed = True
@root_validator(pre=True)