Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docstrings langchain update #14870

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading