Skip to content

Commit

Permalink
docstrings langchain update (#14870)
Browse files Browse the repository at this point in the history
Added missed docstrings
  • Loading branch information
leo-gan authored Dec 19, 2023
1 parent ea331f3 commit 6577b0d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 10 additions & 0 deletions libs/langchain/langchain/chains/openai_tools/extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion libs/langchain/langchain/retrievers/self_query/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


class RedisTranslator(Visitor):
"""Translate"""
"""Visitor for translating structured queries to Redis filter expressions."""

allowed_comparators = (
Comparator.EQ,
Expand Down
2 changes: 2 additions & 0 deletions libs/langchain/langchain/smith/evaluation/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
2 changes: 2 additions & 0 deletions libs/langchain/langchain/tools/retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@


class RetrieverInput(BaseModel):
"""Input to the retriever."""

query: str = Field(description="query to look up in retriever")


Expand Down

0 comments on commit 6577b0d

Please sign in to comment.