mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-13 08:27:03 +00:00
parent
ea331f3136
commit
6577b0d987
@ -55,8 +55,12 @@ def _get_chat_history(chat_history: List[CHAT_TURN_TYPE]) -> str:
|
|||||||
|
|
||||||
|
|
||||||
class InputType(BaseModel):
|
class InputType(BaseModel):
|
||||||
|
"""Input type for ConversationalRetrievalChain."""
|
||||||
|
|
||||||
question: str
|
question: str
|
||||||
|
"""The question to answer."""
|
||||||
chat_history: List[CHAT_TURN_TYPE] = Field(default_factory=list)
|
chat_history: List[CHAT_TURN_TYPE] = Field(default_factory=list)
|
||||||
|
"""The chat history to use for retrieval."""
|
||||||
|
|
||||||
|
|
||||||
class BaseConversationalRetrievalChain(Chain):
|
class BaseConversationalRetrievalChain(Chain):
|
||||||
|
@ -19,6 +19,16 @@ def create_extraction_chain_pydantic(
|
|||||||
llm: BaseLanguageModel,
|
llm: BaseLanguageModel,
|
||||||
system_message: str = _EXTRACTION_TEMPLATE,
|
system_message: str = _EXTRACTION_TEMPLATE,
|
||||||
) -> Runnable:
|
) -> 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):
|
if not isinstance(pydantic_schemas, list):
|
||||||
pydantic_schemas = [pydantic_schemas]
|
pydantic_schemas = [pydantic_schemas]
|
||||||
prompt = ChatPromptTemplate.from_messages(
|
prompt = ChatPromptTemplate.from_messages(
|
||||||
|
@ -34,7 +34,7 @@ _COMPARATOR_TO_BUILTIN_METHOD = {
|
|||||||
|
|
||||||
|
|
||||||
class RedisTranslator(Visitor):
|
class RedisTranslator(Visitor):
|
||||||
"""Translate"""
|
"""Visitor for translating structured queries to Redis filter expressions."""
|
||||||
|
|
||||||
allowed_comparators = (
|
allowed_comparators = (
|
||||||
Comparator.EQ,
|
Comparator.EQ,
|
||||||
|
@ -55,6 +55,8 @@ class EvalConfig(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class SingleKeyEvalConfig(EvalConfig):
|
class SingleKeyEvalConfig(EvalConfig):
|
||||||
|
"""Configuration for a run evaluator that only requires a single key."""
|
||||||
|
|
||||||
reference_key: Optional[str] = None
|
reference_key: Optional[str] = None
|
||||||
"""The key in the dataset run to use as the reference string.
|
"""The key in the dataset run to use as the reference string.
|
||||||
If not provided, we will attempt to infer automatically."""
|
If not provided, we will attempt to infer automatically."""
|
||||||
|
@ -5,6 +5,8 @@ from langchain.tools import Tool
|
|||||||
|
|
||||||
|
|
||||||
class RetrieverInput(BaseModel):
|
class RetrieverInput(BaseModel):
|
||||||
|
"""Input to the retriever."""
|
||||||
|
|
||||||
query: str = Field(description="query to look up in retriever")
|
query: str = Field(description="query to look up in retriever")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user