mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-12 15:59:56 +00:00
parent
ea331f3136
commit
6577b0d987
@ -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):
|
||||
|
@ -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(
|
||||
|
@ -34,7 +34,7 @@ _COMPARATOR_TO_BUILTIN_METHOD = {
|
||||
|
||||
|
||||
class RedisTranslator(Visitor):
|
||||
"""Translate"""
|
||||
"""Visitor for translating structured queries to Redis filter expressions."""
|
||||
|
||||
allowed_comparators = (
|
||||
Comparator.EQ,
|
||||
|
@ -55,6 +55,8 @@ class EvalConfig(BaseModel):
|
||||
|
||||
|
||||
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."""
|
||||
|
@ -5,6 +5,8 @@ from langchain.tools import Tool
|
||||
|
||||
|
||||
class RetrieverInput(BaseModel):
|
||||
"""Input to the retriever."""
|
||||
|
||||
query: str = Field(description="query to look up in retriever")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user