id stringlengths 14 15 | text stringlengths 49 2.47k | source stringlengths 61 166 |
|---|---|---|
c658d424b493-6 | classmethod from_llm(llm: BaseLanguageModel, *, qa_prompt: BasePromptTemplate = PromptTemplate(input_variables=['context', 'question'], output_parser=None, partial_variables={}, template="You are an assistant that helps to form nice and human understandable answers.\nThe information part contains the provided informati... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-7 | == 'The Godfather II'\n> RETURN p.`person`.`name`, e.year, m.`movie`.`name`;\n```\n\nUse only the provided relationship types and properties in the schema.\nDo not use any other relationship types or properties that are not provided.\nSchema:\n{schema}\nNote: Do not include any explanations or apologies in your respons... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-8 | Initialize from LLM.
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... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-9 | 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.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-10 | 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.graph_qa.nebulagraph.NebulaGraphQAChain.html |
c658d424b493-11 | 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.graph_qa.nebulagraph.NebulaGraphQAChain.html |
953a8351d8bf-0 | langchain.chains.openai_functions.citation_fuzzy_match.QuestionAnswer¶
class langchain.chains.openai_functions.citation_fuzzy_match.QuestionAnswer[source]¶
Bases: BaseModel
A question and its answer as a list of facts each one should have a source.
each sentence contains a body and a list of sources.
Create a new model... | https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.citation_fuzzy_match.QuestionAnswer.html |
953a8351d8bf-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.openai_functions.citation_fuzzy_match.QuestionAnswer.html |
953a8351d8bf-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.openai_functions.citation_fuzzy_match.QuestionAnswer.html |
bc1484268ee5-0 | langchain.chains.llm_math.base.LLMMathChain¶
class langchain.chains.llm_math.base.LLMMathChain[source]¶
Bases: Chain
Chain that interprets a prompt and executes python code to do math.
Example
from langchain import LLMMathChain, OpenAI
llm_math = LLMMathChain.from_llm(OpenAI())
Create a new model by parsing and validat... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
bc1484268ee5-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 prompt: BasePromptTemplate = PromptTemplate(input_variables=['question'], output_parser=None, partial_variables={}, template='Translate a math problem into a expression ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
bc1484268ee5-2 | param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs
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], BaseCallba... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
bc1484268ee5-3 | 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_only_outputs... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
bc1484268ee5-4 | 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.llm_math.base.LLMMathChain.html |
bc1484268ee5-5 | # -> "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.llm_math.base.LLMMathChain.html |
bc1484268ee5-6 | 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.llm_math.base.LLMMathChain.html |
bc1484268ee5-7 | # -> {“_type”: “foo”, “verbose”: False, …}
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 numexpr library. Use the o... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_math.base.LLMMathChain.html |
bc1484268ee5-8 | 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.llm_math.base.LLMMathChain.html |
bc1484268ee5-9 | 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.llm_math.base.LLMMathChain.html |
bc1484268ee5-10 | # 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.llm_math.base.LLMMathChain.html |
bc1484268ee5-11 | 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.llm_math.base.LLMMathChain.html |
8a20db5bc979-0 | langchain.chains.openai_functions.openapi.get_openapi_chain¶
langchain.chains.openai_functions.openapi.get_openapi_chain(spec: Union[OpenAPISpec, str], llm: Optional[BaseLanguageModel] = None, prompt: Optional[BasePromptTemplate] = None, request_chain: Optional[Chain] = None, llm_chain_kwargs: Optional[Dict] = None, ve... | https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.openapi.get_openapi_chain.html |
c75964cb0481-0 | langchain.chains.query_constructor.ir.Visitor¶
class langchain.chains.query_constructor.ir.Visitor[source]¶
Defines interface for IR translation using visitor pattern.
Attributes
allowed_comparators
allowed_operators
Methods
__init__()
visit_comparison(comparison)
Translate a Comparison.
visit_operation(operation)
Tran... | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.Visitor.html |
73968f331d8b-0 | langchain.chains.mapreduce.MapReduceChain¶
class langchain.chains.mapreduce.MapReduceChain[source]¶
Bases: Chain
Map-reduce chain.
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.
param callback_manager: Opti... | https://api.python.langchain.com/en/latest/chains/langchain.chains.mapreduce.MapReduceChain.html |
73968f331d8b-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 text_splitter: TextSplitter [Required]¶
Text splitter to use.
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs... | https://api.python.langchain.com/en/latest/chains/langchain.chains.mapreduce.MapReduceChain.html |
73968f331d8b-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.mapreduce.MapReduceChain.html |
73968f331d8b-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.mapreduce.MapReduceChain.html |
73968f331d8b-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.mapreduce.MapReduceChain.html |
73968f331d8b-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.mapreduce.MapReduceChain.html |
73968f331d8b-6 | Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol... | https://api.python.langchain.com/en/latest/chains/langchain.chains.mapreduce.MapReduceChain.html |
73968f331d8b-7 | Convenience method for executing chain.
The main difference between this method and Chain.__call__ is that this
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 expect... | https://api.python.langchain.com/en/latest/chains/langchain.chains.mapreduce.MapReduceChain.html |
73968f331d8b-8 | Example
chain.save(file_path="path/chain.yaml")
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¶
stream(input: Input, config: Optiona... | https://api.python.langchain.com/en/latest/chains/langchain.chains.mapreduce.MapReduceChain.html |
1b17f242d847-0 | langchain.chains.openai_functions.tagging.create_tagging_chain¶
langchain.chains.openai_functions.tagging.create_tagging_chain(schema: dict, llm: BaseLanguageModel, prompt: Optional[ChatPromptTemplate] = None, **kwargs: Any) → Chain[source]¶
Creates a chain that extracts information from a passagebased on a schema.
Par... | https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.tagging.create_tagging_chain.html |
fb86e9be6ef4-0 | langchain.chains.query_constructor.schema.AttributeInfo¶
class langchain.chains.query_constructor.schema.AttributeInfo[source]¶
Bases: BaseModel
Information about a data source attribute.
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.query_constructor.schema.AttributeInfo.html |
fb86e9be6ef4-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.schema.AttributeInfo.html |
fb86e9be6ef4-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.schema.AttributeInfo.html |
b7e9af332f13-0 | langchain.chains.api.openapi.response_chain.APIResponderOutputParser¶
class langchain.chains.api.openapi.response_chain.APIResponderOutputParser[source]¶
Bases: BaseOutputParser
Parse the response and error tags.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if t... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderOutputParser.html |
b7e9af332f13-1 | 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.api.openapi.response_chain.APIResponderOutputParser.html |
b7e9af332f13-2 | 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.api.openapi.response_chain.APIResponderOutputParser.html |
b7e9af332f13-3 | Parse the output of an LLM call with the input prompt for context.
The prompt is largely provided in the event the OutputParser wants
to retry or fix the output in some way, and needs information from
the prompt to do so.
Parameters
completion – String output of a language model.
prompt – Input PromptValue.
Returns
Str... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderOutputParser.html |
b7e9af332f13-4 | 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 the class is serializable. | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderOutputParser.html |
907abf5a30e5-0 | langchain.chains.router.base.RouterChain¶
class langchain.chains.router.base.RouterChain[source]¶
Bases: Chain, ABC
Chain that outputs the name of a destination chain and the inputs to it.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html |
907abf5a30e5-1 | 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 run in verbose mode. In verbose mode, some intermediate logs
will be... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html |
907abf5a30e5-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.router.base.RouterChain.html |
907abf5a30e5-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.router.base.RouterChain.html |
907abf5a30e5-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.router.base.RouterChain.html |
907abf5a30e5-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.router.base.RouterChain.html |
907abf5a30e5-6 | classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html |
907abf5a30e5-7 | callbacks – callbacks to use for the chain
Returns
a Route object
run(*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 differe... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html |
907abf5a30e5-8 | save(file_path: Union[Path, str]) → None¶
Save the chain.
Expects Chain._chain_type property to be implemented and for memory to benull.
Parameters
file_path – Path to file to save the chain to.
Example
chain.save(file_path="path/chain.yaml")
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definiti... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html |
907abf5a30e5-9 | 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 the class is serializable.
property output_keys: List[str]¶
Keys expected to be in the chain output. | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.RouterChain.html |
f5a66af11c99-0 | langchain.chains.router.multi_prompt.MultiPromptChain¶
class langchain.chains.router.multi_prompt.MultiPromptChain[source]¶
Bases: MultiRouteChain
A multi-route chain that uses an LLM router chain to choose amongst prompts.
Create a new model by parsing and validating input data from keyword arguments.
Raises Validatio... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_prompt.MultiPromptChain.html |
f5a66af11c99-1 | You can use these to eg identify a specific instance of a chain with its use case.
param router_chain: RouterChain [Required]¶
Chain for deciding a destination chain and the input to it.
param silent_errors: bool = False¶
If True, use default_chain when an invalid destination name is provided.
Defaults to False.
param ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_prompt.MultiPromptChain.html |
f5a66af11c99-2 | 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.router.multi_prompt.MultiPromptChain.html |
f5a66af11c99-3 | 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 calls to other objects.
metadata – Optional metadata associated with the ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_prompt.MultiPromptChain.html |
f5a66af11c99-4 | 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 chain output.
Example
# Suppose we have a single-input chain that takes a 'que... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.multi_prompt.MultiPromptChain.html |
f5a66af11c99-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.router.multi_prompt.MultiPromptChain.html |
f5a66af11c99-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.router.multi_prompt.MultiPromptChain.html |
f5a66af11c99-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.router.multi_prompt.MultiPromptChain.html |
f5a66af11c99-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.router.multi_prompt.MultiPromptChain.html |
f5a66af11c99-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.router.multi_prompt.MultiPromptChain.html |
491cf204d130-0 | langchain.chains.prompt_selector.is_llm¶
langchain.chains.prompt_selector.is_llm(llm: BaseLanguageModel) → bool[source]¶
Check if the language model is a LLM.
Parameters
llm – Language model to check.
Returns
True if the language model is a BaseLLM model, False otherwise. | https://api.python.langchain.com/en/latest/chains/langchain.chains.prompt_selector.is_llm.html |
f2000ebdd282-0 | langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain¶
class langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain[source]¶
Bases: Chain, ABC
Question answering chain with sources over documents.
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.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-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.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-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.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-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.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-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.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-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.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-6 | classmethod from_llm(llm: BaseLanguageModel, document_prompt: BasePromptTemplate = PromptTemplate(input_variables=['page_content', 'source'], output_parser=None, partial_variables={}, template='Content: {page_content}\nSource: {source}', template_format='f-string', validate_template=True), question_prompt: BasePromptTe... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-7 | or unenforceability of any term (or part of a term) of this Agreement shall not affect the continuation in force of the remainder of the term (if any) and this Agreement.\n\n11.8 No Agency. Except as expressly stated otherwise, nothing in this Agreement shall create an agency, partnership or joint venture of any kind... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-8 | \n\nFrom President Zelenskyy to every Ukrainian, their fearlessness, their courage, their determination, inspires the world. \n\nGroups of citizens blocking tanks with their bodies. Everyone from students to retirees teachers turned soldiers defending their homeland.\nSource: 0-pl\nContent: And we won’t stop. \n\nWe ha... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-9 | \n\nTo all Americans, I will be honest with you, as I’ve always promised. A Russian dictator, invading a foreign country, has costs around the world. \n\nAnd I’m taking robust action to make sure the pain of our sanctions is targeted at Russia’s economy. And I will use every tool at our disposal to protect American bu... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-10 | and most prosperous nation the world has ever known. \n\nNow is the hour. \n\nOur moment of responsibility. \n\nOur test of resolve and conscience, of history itself. \n\nIt is in this moment that our character is formed. Our purpose is found. Our future is forged. \n\nWell I know this nation.\nSource: 34-pl\n=========... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-11 | Construct the chain from an LLM.
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: ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.base.BaseQAWithSourcesChain.html |
f2000ebdd282-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.BaseQAWithSourcesChain.html |
f2000ebdd282-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.BaseQAWithSourcesChain.html |
f2000ebdd282-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.BaseQAWithSourcesChain.html |
7c5ea5d9bd7c-0 | langchain.chains.sequential.SequentialChain¶
class langchain.chains.sequential.SequentialChain[source]¶
Bases: Chain
Chain where the outputs of one chain feed directly into next.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.sequential.SequentialChain.html |
7c5ea5d9bd7c-1 | 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 run in verbose mode. In verbose mode, some intermediate logs
will be... | https://api.python.langchain.com/en/latest/chains/langchain.chains.sequential.SequentialChain.html |
7c5ea5d9bd7c-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.sequential.SequentialChain.html |
7c5ea5d9bd7c-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.sequential.SequentialChain.html |
7c5ea5d9bd7c-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.sequential.SequentialChain.html |
7c5ea5d9bd7c-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.sequential.SequentialChain.html |
7c5ea5d9bd7c-6 | 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¶
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prepare chain inputs, including ad... | https://api.python.langchain.com/en/latest/chains/langchain.chains.sequential.SequentialChain.html |
7c5ea5d9bd7c-7 | 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.sequential.SequentialChain.html |
7c5ea5d9bd7c-8 | to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on fields based on this Model, globalns and localns.
classmethod validate(value: Any) → Model¶
with_fallbacks(fallba... | https://api.python.langchain.com/en/latest/chains/langchain.chains.sequential.SequentialChain.html |
395f0d465697-0 | langchain.chains.graph_qa.neptune_cypher.extract_cypher¶
langchain.chains.graph_qa.neptune_cypher.extract_cypher(text: str) → str[source]¶
Extract Cypher code from text using Regex. | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.neptune_cypher.extract_cypher.html |
3d13d76a98e2-0 | langchain.chains.flare.base.QuestionGeneratorChain¶
class langchain.chains.flare.base.QuestionGeneratorChain[source]¶
Bases: LLMChain
Chain that generates questions from uncertain spans.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be pa... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-1 | Defaults to one that takes the most likely string but does not change it
otherwise.
param prompt: BasePromptTemplate = PromptTemplate(input_variables=['user_input', 'current_response', 'uncertain_span'], output_parser=None, partial_variables={}, template='Given a user input and an existing partial response as context, ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-2 | 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.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-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.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-4 | apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Utilize the LLM generate method for speed gains.
apply_and_parse(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-5 | 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.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-6 | 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.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-7 | classmethod from_orm(obj: Any) → Model¶
classmethod from_string(llm: BaseLanguageModel, template: str) → LLMChain¶
Create LLMChain from LLM and template.
generate(input_list: List[Dict[str, Any]], run_manager: Optional[CallbackManagerForChainRun] = None) → LLMResult¶
Generate LLM result from inputs.
invoke(input: Dict[... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-8 | Format prompt with kwargs and pass to LLM.
Parameters
callbacks – Callbacks to pass to LLMChain
**kwargs – Keys to pass to prompt template.
Returns
Completion from LLM.
Example
completion = llm.predict(adjective="funny")
predict_and_parse(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-9 | Prepare prompts from inputs.
run(*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 method and Chain.__c... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-10 | save(file_path: Union[Path, str]) → None¶
Save the chain.
Expects Chain._chain_type property to be implemented and for memory to benull.
Parameters
file_path – Path to file to save the chain to.
Example
chain.save(file_path="path/chain.yaml")
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definiti... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
3d13d76a98e2-11 | 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 the class is serializable. | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
e81b777a91d3-0 | langchain.chains.router.llm_router.RouterOutputParser¶
class langchain.chains.router.llm_router.RouterOutputParser[source]¶
Bases: BaseOutputParser[Dict[str, str]]
Parser for output of router chain int he multi-prompt chain.
Create a new model by parsing and validating input data from keyword arguments.
Raises Validati... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.llm_router.RouterOutputParser.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.