mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-17 02:03:44 +00:00
Upgrade experimental package dependencies and use Poetry 1.6.1. (#11339)
Part of upgrading our CI to use Poetry 1.6.1.
This commit is contained in:
parent
c2c0814a94
commit
7c0f1bf23f
@ -12,7 +12,30 @@ from langchain_experimental.autonomous_agents.autogpt.prompt_generator import ge
|
||||
from langchain_experimental.pydantic_v1 import BaseModel
|
||||
|
||||
|
||||
class AutoGPTPrompt(BaseChatPromptTemplate, BaseModel):
|
||||
# This class has a metaclass conflict: both `BaseChatPromptTemplate` and `BaseModel`
|
||||
# define a metaclass to use, and the two metaclasses attempt to define
|
||||
# the same functions but in mutually-incompatible ways.
|
||||
# It isn't clear how to resolve this, and this code predates mypy
|
||||
# beginning to perform that check.
|
||||
#
|
||||
# Mypy errors:
|
||||
# ```
|
||||
# Definition of "__private_attributes__" in base class "BaseModel" is
|
||||
# incompatible with definition in base class "BaseModel" [misc]
|
||||
# Definition of "__repr_name__" in base class "Representation" is
|
||||
# incompatible with definition in base class "BaseModel" [misc]
|
||||
# Definition of "__pretty__" in base class "Representation" is
|
||||
# incompatible with definition in base class "BaseModel" [misc]
|
||||
# Definition of "__repr_str__" in base class "Representation" is
|
||||
# incompatible with definition in base class "BaseModel" [misc]
|
||||
# Definition of "__rich_repr__" in base class "Representation" is
|
||||
# incompatible with definition in base class "BaseModel" [misc]
|
||||
# Metaclass conflict: the metaclass of a derived class must be
|
||||
# a (non-strict) subclass of the metaclasses of all its bases [misc]
|
||||
# ```
|
||||
#
|
||||
# TODO: look into refactoring this class in a way that avoids the mypy type errors
|
||||
class AutoGPTPrompt(BaseChatPromptTemplate, BaseModel): # type: ignore[misc]
|
||||
"""Prompt for AutoGPT."""
|
||||
|
||||
ai_name: str
|
||||
|
@ -19,7 +19,27 @@ from langchain_experimental.autonomous_agents.baby_agi.task_prioritization impor
|
||||
from langchain_experimental.pydantic_v1 import BaseModel, Field
|
||||
|
||||
|
||||
class BabyAGI(Chain, BaseModel):
|
||||
# This class has a metaclass conflict: both `Chain` and `BaseModel` define a metaclass
|
||||
# to use, and the two metaclasses attempt to define the same functions but
|
||||
# in mutually-incompatible ways. It isn't clear how to resolve this,
|
||||
# and this code predates mypy beginning to perform that check.
|
||||
#
|
||||
# Mypy errors:
|
||||
# ```
|
||||
# Definition of "__repr_str__" in base class "Representation" is
|
||||
# incompatible with definition in base class "BaseModel" [misc]
|
||||
# Definition of "__repr_name__" in base class "Representation" is
|
||||
# incompatible with definition in base class "BaseModel" [misc]
|
||||
# Definition of "__rich_repr__" in base class "Representation" is
|
||||
# incompatible with definition in base class "BaseModel" [misc]
|
||||
# Definition of "__pretty__" in base class "Representation" is
|
||||
# incompatible with definition in base class "BaseModel" [misc]
|
||||
# Metaclass conflict: the metaclass of a derived class must be
|
||||
# a (non-strict) subclass of the metaclasses of all its bases [misc]
|
||||
# ```
|
||||
#
|
||||
# TODO: look into refactoring this class in a way that avoids the mypy type errors
|
||||
class BabyAGI(Chain, BaseModel): # type: ignore[misc]
|
||||
"""Controller model for the BabyAGI agent."""
|
||||
|
||||
task_list: deque = Field(default_factory=deque)
|
||||
|
@ -139,7 +139,9 @@ class StoryModel(BaseModel):
|
||||
# TODO: when langchain adopts pydantic.v2 replace w/ `__post_init__`
|
||||
# misses hints github.com/pydantic/pydantic/issues/1729#issuecomment-1300576214
|
||||
|
||||
@root_validator
|
||||
# TODO: move away from `root_validator` since it is deprecated in pydantic v2
|
||||
# and causes mypy type-checking failures (hence the `type: ignore`)
|
||||
@root_validator # type: ignore[call-overload]
|
||||
def check_intervention_is_valid(cls, values: dict) -> dict:
|
||||
valid_names = [e.name for e in values["causal_operations"].entities]
|
||||
for setting in values["intervention"].entity_settings:
|
||||
|
@ -56,7 +56,9 @@ class LLMBashChain(Chain):
|
||||
values["llm_chain"] = LLMChain(llm=values["llm"], prompt=prompt)
|
||||
return values
|
||||
|
||||
@root_validator
|
||||
# TODO: move away from `root_validator` since it is deprecated in pydantic v2
|
||||
# and causes mypy type-checking failures (hence the `type: ignore`)
|
||||
@root_validator # type: ignore[call-overload]
|
||||
def validate_prompt(cls, values: Dict) -> Dict:
|
||||
if values["llm_chain"].prompt.output_parser is None:
|
||||
raise ValueError(
|
||||
|
@ -37,7 +37,9 @@ class JsonFormer(HuggingFacePipeline):
|
||||
)
|
||||
debug: bool = Field(default=False, description="Debug mode.")
|
||||
|
||||
@root_validator
|
||||
# TODO: move away from `root_validator` since it is deprecated in pydantic v2
|
||||
# and causes mypy type-checking failures (hence the `type: ignore`)
|
||||
@root_validator # type: ignore[call-overload]
|
||||
def check_jsonformer_installation(cls, values: dict) -> dict:
|
||||
import_jsonformer()
|
||||
return values
|
||||
|
@ -39,7 +39,9 @@ class RELLM(HuggingFacePipeline):
|
||||
default=200, description="Maximum number of new tokens to generate."
|
||||
)
|
||||
|
||||
@root_validator
|
||||
# TODO: move away from `root_validator` since it is deprecated in pydantic v2
|
||||
# and causes mypy type-checking failures (hence the `type: ignore`)
|
||||
@root_validator # type: ignore[call-overload]
|
||||
def check_rellm_installation(cls, values: dict) -> dict:
|
||||
import_rellm()
|
||||
return values
|
||||
|
@ -154,7 +154,13 @@ class PALChain(Chain):
|
||||
)
|
||||
_run_manager.on_text(code, color="green", end="\n", verbose=self.verbose)
|
||||
PALChain.validate_code(code, self.code_validations)
|
||||
repl = PythonREPL(_globals=self.python_globals, _locals=self.python_locals)
|
||||
|
||||
# TODO: look into why mypy thinks PythonREPL's type here is `Any`
|
||||
# and therefore not callable
|
||||
repl = PythonREPL(
|
||||
_globals=self.python_globals,
|
||||
_locals=self.python_locals,
|
||||
) # type: ignore[misc]
|
||||
res = repl.run(code + f"\n{self.get_answer_expr}", timeout=self.timeout)
|
||||
output = {self.output_key: res.strip()}
|
||||
if self.return_intermediate_steps:
|
||||
|
@ -83,7 +83,9 @@ class SmartLLMChain(Chain):
|
||||
class Config:
|
||||
extra = Extra.forbid
|
||||
|
||||
@root_validator
|
||||
# TODO: move away from `root_validator` since it is deprecated in pydantic v2
|
||||
# and causes mypy type-checking failures (hence the `type: ignore`)
|
||||
@root_validator # type: ignore[call-overload]
|
||||
@classmethod
|
||||
def validate_inputs(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""Ensure we have an LLM for each step."""
|
||||
|
2935
libs/experimental/poetry.lock
generated
2935
libs/experimental/poetry.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user