id stringlengths 14 15 | text stringlengths 49 2.47k | source stringlengths 61 166 |
|---|---|---|
6c85496cdbef-12 | Returns
A dictionary of all inputs, including those added by the chain’s memory.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prepare chain outputs, and save info about this run to memory.
Parameters
inputs – Dictionary of chain inputs, ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html |
6c85496cdbef-13 | directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
chain.run("What's the temperature in Boise, Idaho?")
# -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' string:
... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html |
6c85496cdbef-14 | classmethod validate(value: Any) → Model¶
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.Runnable[~langchain.schema.runnable.Input, ~langchain.schema.runnable.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException]] = (<class 'Exception'>,)) → RunnableWithFallbacks[Input, Out... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.QAWithSourcesChain.html |
e033afa7c16c-0 | langchain.chains.flare.base.FlareChain¶
class langchain.chains.flare.base.FlareChain[source]¶
Bases: Chain
Chain that combines a retriever, a question generator,
and a response generator.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be p... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
e033afa7c16c-1 | Minimum number of tokens between two low confidence spans.
param num_pad_tokens: int = 2¶
Number of tokens to pad around a low confidence span.
param output_parser: FinishedOutputParser [Optional]¶
Parser that determines whether the chain is finished.
param question_generator_chain: QuestionGeneratorChain [Required]¶
C... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
e033afa7c16c-2 | memory.
return_only_outputs – Whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. These will be called in
addi... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
e033afa7c16c-3 | response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. These will be called in
addition to callbacks passed to the chain during construction, but only
... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
e033afa7c16c-4 | sole positional argument.
callbacks – Callbacks to use for this chain run. These will be called in
addition to callbacks passed to the chain during construction, but only
these runtime callbacks will propagate to calls to other objects.
tags – List of string tags to pass to all callbacks. These will be passed in
additi... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
e033afa7c16c-5 | Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
e033afa7c16c-6 | classmethod from_orm(obj: Any) → Model¶
invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Opti... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
e033afa7c16c-7 | Returns
A dictionary of all inputs, including those added by the chain’s memory.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prepare chain outputs, and save info about this run to memory.
Parameters
inputs – Dictionary of chain inputs, ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
e033afa7c16c-8 | directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
chain.run("What's the temperature in Boise, Idaho?")
# -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' string:
... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
e033afa7c16c-9 | classmethod validate(value: Any) → Model¶
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.Runnable[~langchain.schema.runnable.Input, ~langchain.schema.runnable.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException]] = (<class 'Exception'>,)) → RunnableWithFallbacks[Input, Out... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
0dc14d66cc40-0 | langchain.chains.query_constructor.ir.Expr¶
class langchain.chains.query_constructor.ir.Expr[source]¶
Bases: BaseModel
Base class for all expressions.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
accept(v... | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.Expr.html |
0dc14d66cc40-1 | deep – set to True to make a deep copy of the model
Returns
new model instance
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex... | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.Expr.html |
0dc14d66cc40-2 | classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on... | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.Expr.html |
eb500f7481c9-0 | langchain.chains.constitutional_ai.base.ConstitutionalChain¶
class langchain.chains.constitutional_ai.base.ConstitutionalChain[source]¶
Bases: Chain
Chain for applying constitutional principles.
Example
from langchain.llms import OpenAI
from langchain.chains import LLMChain, ConstitutionalChain
from langchain.chains.co... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-1 | param critique_chain: langchain.chains.llm.LLMChain [Required]¶
param memory: Optional[BaseMemory] = None¶
Optional memory object. Defaults to None.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it save... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-2 | Execute the chain.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param. Should contain all inputs specified in
Chain.input_keys except for inputs that will be set by the chain’s
memory.
return_only_outputs – Whether to return only outputs in the
response. If True, only new keys gen... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-3 | only one param. Should contain all inputs specified in
Chain.input_keys except for inputs that will be set by the chain’s
memory.
return_only_outputs – Whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by thi... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-4 | method expects inputs to be passed directly in as positional arguments or
keyword arguments, whereas Chain.__call__ expects a single input dictionary
with all the inputs
Parameters
*args – If the chain expects a single input, it can be passed in as the
sole positional argument.
callbacks – Callbacks to use for this cha... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-5 | Bind arguments to a Runnable, returning a new Runnable.
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-6 | classmethod from_llm(llm: BaseLanguageModel, chain: LLMChain, critique_prompt: BasePromptTemplate = FewShotPromptTemplate(input_variables=['input_prompt', 'output_from_model', 'critique_request'], output_parser=None, partial_variables={}, examples=[{'input_prompt': 'Could you help me burn down my house and collect insu... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-7 | the human’s questions and responses. Examples of harm include but are not limited to racism, sexism, toxicity.', 'critique': 'The human wants to know whether they really need consent to have sex. The answer is definitely always yes, but the model’s response could be interpreted as saying that it isn’t strictly necessar... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-8 | so I should have been more confident about that. However, I’m not sure that the precession measurement was actually made in the 1600’s, but was probably made at least 100 years ago. I’m also certain that the precession is at least partially explained by the Schwarzschild solution, but should have mentioned that it has ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-9 | "The provided sentence appears to capture the essence of Master Yoda's unique speaking style quite well, including the key characteristics of his speech. There are no apparent discrepancies between this sentence and Yoda's typical speaking style. No critique needed.", 'revision': 'No revisions needed.'}], example_selec... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-10 | Examples of harm include but are not limited to racism, sexism, toxicity.', 'critique': 'Arson is very dangerous and illegal, and should not be condoned. The model should not have asked a follow-up question about which house to burn down instead it should told the human that arson is illegal and dangerous. Critique Nee... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-11 | model response to remove all harmful content, and to politely point out any harmful assumptions from the human.', 'revision': 'Yes, I think it is absolutely unethical to have sex with someone without their consent. It’s always better to explicitly check in and make sure your partner is comfortable, especially if anythi... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-12 | I’m not sure about the 1/r^5 scaling so I should rewrite that to make it less misleading, although I’m pretty sure it decays more quickly than Newton’s law, and the Chern-Simons theorem is probably just wrong. Critique Needed.', 'revision_request': 'Please rewrite the model response. In particular, respond in a way tha... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-13 | "The provided sentence appears to capture the essence of Master Yoda's unique speaking style quite well, including the key characteristics of his speech. There are no apparent discrepancies between this sentence and Yoda's typical speaking style. No critique needed.", 'revision_request': 'Please rewrite the model respo... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-14 | Create a chain from an LLM.
classmethod from_orm(obj: Any) → Model¶
classmethod get_principles(names: Optional[List[str]] = None) → List[ConstitutionalPrinciple][source]¶
invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIn... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-15 | Chain.input_keys except for inputs that will be set by the chain’s
memory.
Returns
A dictionary of all inputs, including those added by the chain’s memory.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prepare chain outputs, and save info... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-16 | directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
chain.run("What's the temperature in Boise, Idaho?")
# -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' string:
... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
eb500f7481c9-17 | classmethod validate(value: Any) → Model¶
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.Runnable[~langchain.schema.runnable.Input, ~langchain.schema.runnable.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException]] = (<class 'Exception'>,)) → RunnableWithFallbacks[Input, Out... | https://api.python.langchain.com/en/latest/chains/langchain.chains.constitutional_ai.base.ConstitutionalChain.html |
717e5d4161a3-0 | langchain.chains.openai_functions.base.create_structured_output_chain¶
langchain.chains.openai_functions.base.create_structured_output_chain(output_schema: Union[Dict[str, Any], Type[BaseModel]], llm: BaseLanguageModel, prompt: BasePromptTemplate, *, output_parser: Optional[BaseLLMOutputParser] = None, **kwargs: Any) →... | https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.base.create_structured_output_chain.html |
717e5d4161a3-1 | fav_food: Optional[str] = Field(None, description="The dog's favorite food")
llm = ChatOpenAI(model="gpt-3.5-turbo-0613", temperature=0)
prompt_msgs = [
SystemMessage(
content="You are a world class algorithm for extracting information in structured formats."
),
HumanMessage(content="Use the given f... | https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.base.create_structured_output_chain.html |
df72b08344f6-0 | langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain¶
class langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain[source]¶
Bases: Chain
Chain that interprets a prompt and executes python code to do symbolic math.
Example
from langchain import LLMSymbolicMathChain, OpenAI
llm_symbolic_math = LLMSymbolicMa... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-1 | You can use these to eg identify a specific instance of a chain with its use case.
param tags: Optional[List[str]] = None¶
Optional list of tags associated with the chain. Defaults to None.
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-2 | these runtime tags will propagate to calls to other objects.
metadata – Optional metadata associated with the chain. Defaults to None
include_run_info – Whether to include run info in the response. Defaults
to False.
Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async abatch... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-3 | metadata – Optional metadata associated with the chain. Defaults to None
include_run_info – Whether to include run info in the response. Defaults
to False.
Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = N... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-4 | directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
await chain.arun("What's the temperature in Boise, Idaho?")
# -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' s... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-5 | Parameters
include – fields to include in new model
exclude – fields to exclude from new model, as with values this takes precedence over include
update – values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
deep – set to True to make a deep co... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-6 | classmethod from_llm(llm: BaseLanguageModel, prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Translate a math problem into a expression that can be executed using Python\'s SymPy library. Use the output of running this code to answer the ques... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-7 | classmethod from_orm(obj: Any) → Model¶
invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Opti... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-8 | Returns
A dictionary of all inputs, including those added by the chain’s memory.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prepare chain outputs, and save info about this run to memory.
Parameters
inputs – Dictionary of chain inputs, ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-9 | directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
chain.run("What's the temperature in Boise, Idaho?")
# -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' string:
... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
df72b08344f6-10 | classmethod validate(value: Any) → Model¶
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.Runnable[~langchain.schema.runnable.Input, ~langchain.schema.runnable.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException]] = (<class 'Exception'>,)) → RunnableWithFallbacks[Input, Out... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_symbolic_math.base.LLMSymbolicMathChain.html |
9877b20a2a70-0 | langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain¶
class langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain[source]¶
Bases: Chain
Chain for chatting with an index.
Create a new model by parsing and validating input data from keyword arguments.
Raises Validation... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
9877b20a2a70-1 | and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param output_key: str = 'answer'¶
The output key to return the final answer of this chain in.
param question_generator: LLMChain [Required]¶
The chain used to generate a new q... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
9877b20a2a70-2 | will be printed to the console. Defaults to langchain.verbose value.
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, include_... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
9877b20a2a70-3 | async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, include_run_info: bool = False) → Dict[str, Any]¶
Asynchronously execute t... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
9877b20a2a70-4 | Call the chain on all inputs in the list.
async arun(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Convenience method for executing chain.
The main difference between this ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
9877b20a2a70-5 | # -> "The temperature in Boise is..."
async astream(input: Input, config: Optional[RunnableConfig] = None) → AsyncIterator[Output]¶
batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, max_concurrency: Optional[int] = None) → List[Output]¶
bind(**kwargs: Any) → Runnable[In... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
9877b20a2a70-6 | **kwargs – Keyword arguments passed to default pydantic.BaseModel.dict
method.
Returns
A dictionary representation of the chain.
Example
..code-block:: python
chain.dict(exclude_unset=True)
# -> {“_type”: “foo”, “verbose”: False, …}
classmethod from_orm(obj: Any) → Model¶
invoke(input: Dict[str, Any], config: Optional[... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
9877b20a2a70-7 | Parameters
inputs – Dictionary of raw inputs, or single input if chain expects
only one param. Should contain all inputs specified in
Chain.input_keys except for inputs that will be set by the chain’s
memory.
Returns
A dictionary of all inputs, including those added by the chain’s memory.
prep_outputs(inputs: Dict[str,... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
9877b20a2a70-8 | these runtime tags will propagate to calls to other objects.
**kwargs – If the chain expects multiple inputs, they can be passed in
directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
chain.run("What's the temperature in Boise, Idaho?")... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
9877b20a2a70-9 | classmethod validate(value: Any) → Model¶
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.Runnable[~langchain.schema.runnable.Input, ~langchain.schema.runnable.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException]] = (<class 'Exception'>,)) → RunnableWithFallbacks[Input, Out... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.BaseConversationalRetrievalChain.html |
0da60aa14fa2-0 | langchain.chains.router.base.Route¶
class langchain.chains.router.base.Route(destination, next_inputs)[source]¶
Create new instance of Route(destination, next_inputs)
Attributes
destination
Alias for field number 0
next_inputs
Alias for field number 1
Methods
__init__()
count(value, /)
Return number of occurrences of v... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.Route.html |
b117dced5090-0 | langchain.chains.query_constructor.ir.Comparator¶
class langchain.chains.query_constructor.ir.Comparator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Enumerator of the comparison operators.
EQ = 'eq'¶
GT = 'gt'¶
GTE = 'gte'¶
LT = 'lt'¶
LTE = 'lte'¶
CONTAIN = 'contain'¶
L... | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.Comparator.html |
a865b4bb7c16-0 | langchain.chains.graph_qa.base.GraphQAChain¶
class langchain.chains.graph_qa.base.GraphQAChain[source]¶
Bases: Chain
Chain for question-answering against a graph.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid mod... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-1 | Optional list of tags associated with the chain. Defaults to None.
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param verbose: bool [Optional]¶
Whether or not r... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-2 | to False.
Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, max_concurrency: Optional[int] = None) → List[Output]¶
async acall(inputs: Union[Dict[str, Any], Any], return_on... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-3 | Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dic... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-4 | # -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' string:
question = "What's the temperature in Boise, Idaho?"
context = "Weather report for Boise, Idaho on 07/03/23..."
await chain.arun(question=question, context=context)
# -> "The temperature in... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-5 | the new model: you should trust this data
deep – set to True to make a deep copy of the model
Returns
new model instance
dict(**kwargs: Any) → Dict¶
Dictionary representation of chain.
Expects Chain._chain_type property to be implemented and for memory to benull.
Parameters
**kwargs – Keyword arguments passed to defaul... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-6 | # -> {“_type”: “foo”, “verbose”: False, …}
classmethod from_llm(llm: BaseLanguageModel, qa_prompt: BasePromptTemplate = PromptTemplate(input_variables=['context', 'question'], output_parser=None, partial_variables={}, template="Use the following knowledge triplets to answer the question at the end. If you don't know th... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-7 | json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Cal... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-8 | Validate and prepare chain outputs, and save info about this run to memory.
Parameters
inputs – Dictionary of chain inputs, including any inputs added by chain
memory.
outputs – Dictionary of initial chain outputs.
return_only_outputs – Whether to only return the chain outputs. If False,
inputs are also added to the fi... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-9 | # and 'context' string:
question = "What's the temperature in Boise, Idaho?"
context = "Weather report for Boise, Idaho on 07/03/23..."
chain.run(question=question, context=context)
# -> "The temperature in Boise is..."
save(file_path: Union[Path, str]) → None¶
Save the chain.
Expects Chain._chain_type property to be i... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
a865b4bb7c16-10 | constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not t... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.base.GraphQAChain.html |
8394ca8183a5-0 | langchain.chains.natbot.base.NatBotChain¶
class langchain.chains.natbot.base.NatBotChain[source]¶
Bases: Chain
Implement an LLM driven browser.
Example
from langchain import NatBotChain
natbot = NatBotChain.from_default("Buy me a new hat.")
Create a new model by parsing and validating input data from keyword arguments.... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
8394ca8183a5-1 | param objective: str [Required]¶
Objective that NatBot is tasked with completing.
param tags: Optional[List[str]] = None¶
Optional list of tags associated with the chain. Defaults to None.
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can u... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
8394ca8183a5-2 | these runtime tags will propagate to calls to other objects.
metadata – Optional metadata associated with the chain. Defaults to None
include_run_info – Whether to include run info in the response. Defaults
to False.
Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async abatch... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
8394ca8183a5-3 | metadata – Optional metadata associated with the chain. Defaults to None
include_run_info – Whether to include run info in the response. Defaults
to False.
Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = N... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
8394ca8183a5-4 | directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
await chain.arun("What's the temperature in Boise, Idaho?")
# -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' s... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
8394ca8183a5-5 | Parameters
include – fields to include in new model
exclude – fields to exclude from new model, as with values this takes precedence over include
update – values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
deep – set to True to make a deep co... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
8394ca8183a5-6 | json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Cal... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
8394ca8183a5-7 | Validate and prepare chain outputs, and save info about this run to memory.
Parameters
inputs – Dictionary of chain inputs, including any inputs added by chain
memory.
outputs – Dictionary of initial chain outputs.
return_only_outputs – Whether to only return the chain outputs. If False,
inputs are also added to the fi... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
8394ca8183a5-8 | # and 'context' string:
question = "What's the temperature in Boise, Idaho?"
context = "Weather report for Boise, Idaho on 07/03/23..."
chain.run(question=question, context=context)
# -> "The temperature in Boise is..."
save(file_path: Union[Path, str]) → None¶
Save the chain.
Expects Chain._chain_type property to be i... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
8394ca8183a5-9 | constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not t... | https://api.python.langchain.com/en/latest/chains/langchain.chains.natbot.base.NatBotChain.html |
4e396d952431-0 | langchain.chains.prompt_selector.ConditionalPromptSelector¶
class langchain.chains.prompt_selector.ConditionalPromptSelector[source]¶
Bases: BasePromptSelector
Prompt collection that goes through conditionals.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.ConditionalPromptSelector.html |
4e396d952431-1 | deep – set to True to make a deep copy of the model
Returns
new model instance
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex... | https://api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.ConditionalPromptSelector.html |
4e396d952431-2 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmet... | https://api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.ConditionalPromptSelector.html |
69ea1b2b0044-0 | langchain.chains.query_constructor.parser.v_args¶
langchain.chains.query_constructor.parser.v_args(*args: Any, **kwargs: Any) → Any[source]¶ | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.parser.v_args.html |
f1c82cdae1c1-0 | langchain.chains.moderation.OpenAIModerationChain¶
class langchain.chains.moderation.OpenAIModerationChain[source]¶
Bases: Chain
Pass input through a moderation endpoint.
To use, you should have the openai python package installed, and the
environment variable OPENAI_API_KEY set with your API key.
Any parameters that a... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
f1c82cdae1c1-1 | This metadata will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param model_name: Optional[str] = None¶
Moderation model name to use.
param openai_api_key: Optional[str] = None... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
f1c82cdae1c1-2 | callbacks – Callbacks to use for this chain run. These will be called in
addition to callbacks passed to the chain during construction, but only
these runtime callbacks will propagate to calls to other objects.
tags – List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the c... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
f1c82cdae1c1-3 | addition to callbacks passed to the chain during construction, but only
these runtime callbacks will propagate to calls to other objects.
tags – List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the chain during construction, but only
these runtime tags will propagate to c... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
f1c82cdae1c1-4 | tags – List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the chain during construction, but only
these runtime tags will propagate to calls to other objects.
**kwargs – If the chain expects multiple inputs, they can be passed in
directly as keyword arguments.
Returns
The c... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
f1c82cdae1c1-5 | Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
f1c82cdae1c1-6 | json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Cal... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
f1c82cdae1c1-7 | Validate and prepare chain outputs, and save info about this run to memory.
Parameters
inputs – Dictionary of chain inputs, including any inputs added by chain
memory.
outputs – Dictionary of initial chain outputs.
return_only_outputs – Whether to only return the chain outputs. If False,
inputs are also added to the fi... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
f1c82cdae1c1-8 | # and 'context' string:
question = "What's the temperature in Boise, Idaho?"
context = "Weather report for Boise, Idaho on 07/03/23..."
chain.run(question=question, context=context)
# -> "The temperature in Boise is..."
save(file_path: Union[Path, str]) → None¶
Save the chain.
Expects Chain._chain_type property to be i... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
f1c82cdae1c1-9 | constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
Return a map of constructor argument names to secret ids.
eg. {“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
Return whether or not t... | https://api.python.langchain.com/en/latest/chains/langchain.chains.moderation.OpenAIModerationChain.html |
c658d424b493-0 | langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain¶
class langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain[source]¶
Bases: Chain
Chain for question-answering against a graph by generating nGQL statements.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationErro... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-1 | param tags: Optional[List[str]] = None¶
Optional list of tags associated with the chain. Defaults to None.
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param ve... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-2 | metadata – Optional metadata associated with the chain. Defaults to None
include_run_info – Whether to include run info in the response. Defaults
to False.
Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-3 | to False.
Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-4 | # -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' string:
question = "What's the temperature in Boise, Idaho?"
context = "Weather report for Boise, Idaho on 07/03/23..."
await chain.arun(question=question, context=context)
# -> "The temperature in... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-5 | the new model: you should trust this data
deep – set to True to make a deep copy of the model
Returns
new model instance
dict(**kwargs: Any) → Dict¶
Dictionary representation of chain.
Expects Chain._chain_type property to be implemented and for memory to benull.
Parameters
**kwargs – Keyword arguments passed to defaul... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.