diff --git a/libs/langchain/langchain/agents/agent.py b/libs/langchain/langchain/agents/agent.py index a28377625315c..f500d697f91f5 100644 --- a/libs/langchain/langchain/agents/agent.py +++ b/libs/langchain/langchain/agents/agent.py @@ -390,10 +390,7 @@ async def aplan( intermediate_steps: List[Tuple[AgentAction, str]], callbacks: Callbacks = None, **kwargs: Any, - ) -> Union[ - AgentAction, - AgentFinish, - ]: + ) -> Union[AgentAction, AgentFinish,]: """Given input, decided what to do. Args: @@ -442,10 +439,7 @@ def plan( intermediate_steps: List[Tuple[AgentAction, str]], callbacks: Callbacks = None, **kwargs: Any, - ) -> Union[ - List[AgentAction], - AgentFinish, - ]: + ) -> Union[List[AgentAction], AgentFinish,]: """Given input, decided what to do. Args: @@ -466,10 +460,7 @@ async def aplan( intermediate_steps: List[Tuple[AgentAction, str]], callbacks: Callbacks = None, **kwargs: Any, - ) -> Union[ - List[AgentAction], - AgentFinish, - ]: + ) -> Union[List[AgentAction], AgentFinish,]: """Given input, decided what to do. Args: diff --git a/libs/langchain/langchain/chains/conversational_retrieval/base.py b/libs/langchain/langchain/chains/conversational_retrieval/base.py index dbe28df9b2783..0b15f4e41c9a9 100644 --- a/libs/langchain/langchain/chains/conversational_retrieval/base.py +++ b/libs/langchain/langchain/chains/conversational_retrieval/base.py @@ -55,8 +55,12 @@ def _get_chat_history(chat_history: List[CHAT_TURN_TYPE]) -> str: class InputType(BaseModel): + """Input type for ConversationalRetrievalChain.""" + question: str + """The question to answer.""" chat_history: List[CHAT_TURN_TYPE] = Field(default_factory=list) + """The chat history to use for retrieval.""" class BaseConversationalRetrievalChain(Chain): diff --git a/libs/langchain/langchain/chains/openai_tools/extraction.py b/libs/langchain/langchain/chains/openai_tools/extraction.py index a644d5768c5cf..6e7ebe65a07cc 100644 --- a/libs/langchain/langchain/chains/openai_tools/extraction.py +++ b/libs/langchain/langchain/chains/openai_tools/extraction.py @@ -19,6 +19,16 @@ def create_extraction_chain_pydantic( llm: BaseLanguageModel, system_message: str = _EXTRACTION_TEMPLATE, ) -> Runnable: + """Creates a chain that extracts information from a passage. + + Args: + pydantic_schemas: The schema of the entities to extract. + llm: The language model to use. + system_message: The system message to use for extraction. + + Returns: + A runnable that extracts information from a passage. + """ if not isinstance(pydantic_schemas, list): pydantic_schemas = [pydantic_schemas] prompt = ChatPromptTemplate.from_messages( diff --git a/libs/langchain/langchain/retrievers/self_query/redis.py b/libs/langchain/langchain/retrievers/self_query/redis.py index 963b58aa688e3..a13eb73407c60 100644 --- a/libs/langchain/langchain/retrievers/self_query/redis.py +++ b/libs/langchain/langchain/retrievers/self_query/redis.py @@ -34,7 +34,7 @@ class RedisTranslator(Visitor): - """Translate""" + """Visitor for translating structured queries to Redis filter expressions.""" allowed_comparators = ( Comparator.EQ, diff --git a/libs/langchain/langchain/smith/evaluation/config.py b/libs/langchain/langchain/smith/evaluation/config.py index 4db1f0c512b83..cbdd790e22861 100644 --- a/libs/langchain/langchain/smith/evaluation/config.py +++ b/libs/langchain/langchain/smith/evaluation/config.py @@ -55,6 +55,8 @@ def get_kwargs(self) -> Dict[str, Any]: class SingleKeyEvalConfig(EvalConfig): + """Configuration for a run evaluator that only requires a single key.""" + reference_key: Optional[str] = None """The key in the dataset run to use as the reference string. If not provided, we will attempt to infer automatically.""" diff --git a/libs/langchain/langchain/text_splitter.py b/libs/langchain/langchain/text_splitter.py index c0ce1c74facb3..f84b6bec64a01 100644 --- a/libs/langchain/langchain/text_splitter.py +++ b/libs/langchain/langchain/text_splitter.py @@ -420,7 +420,8 @@ def split_text(self, text: str) -> List[Document]: if stripped_line.startswith(sep) and ( # Header with no text OR header is followed by space # Both are valid conditions that sep is being used a header - len(stripped_line) == len(sep) or stripped_line[len(sep)] == " " + len(stripped_line) == len(sep) + or stripped_line[len(sep)] == " " ): # Ensure we are tracking the header as metadata if name is not None: diff --git a/libs/langchain/langchain/tools/retriever.py b/libs/langchain/langchain/tools/retriever.py index 1f613cf44fab6..a4ed55e96b9b4 100644 --- a/libs/langchain/langchain/tools/retriever.py +++ b/libs/langchain/langchain/tools/retriever.py @@ -5,6 +5,8 @@ class RetrieverInput(BaseModel): + """Input to the retriever.""" + query: str = Field(description="query to look up in retriever")