id stringlengths 14 15 | text stringlengths 35 2.51k | source stringlengths 61 154 |
|---|---|---|
99d24018ea96-0 | langchain.prompts.base.BasePromptTemplate¶
class langchain.prompts.base.BasePromptTemplate(*, input_variables: List[str], output_parser: Optional[BaseOutputParser] = None, partial_variables: Mapping[str, Union[str, Callable[[], str]]] = None)[source]¶
Bases: Serializable, ABC
Base class for all prompt templates, return... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.base.BasePromptTemplate.html |
99d24018ea96-1 | to_json_not_implemented() → SerializedNotImplemented¶
validator validate_variable_names » all fields[source]¶
Validate variable names do not include restricted names.
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by t... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.base.BasePromptTemplate.html |
b7d10878eeef-0 | langchain.prompts.chat.BaseChatPromptTemplate¶
class langchain.prompts.chat.BaseChatPromptTemplate(*, input_variables: List[str], output_parser: Optional[BaseOutputParser] = None, partial_variables: Mapping[str, Union[str, Callable[[], str]]] = None)[source]¶
Bases: BasePromptTemplate, ABC
Create a new model by parsing... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseChatPromptTemplate.html |
b7d10878eeef-1 | to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
validator validate_variable_names » all fields¶
Validate variable names do not include restricted names.
property lc_attributes: Dict¶
Return a list of attribute names that should be included in t... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseChatPromptTemplate.html |
acf875f94ac8-0 | langchain.prompts.example_selector.length_based.LengthBasedExampleSelector¶
class langchain.prompts.example_selector.length_based.LengthBasedExampleSelector(*, examples: ~typing.List[dict], example_prompt: ~langchain.prompts.prompt.PromptTemplate, get_text_length: ~typing.Callable[[str], int] = <function _get_length_ba... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.example_selector.length_based.LengthBasedExampleSelector.html |
f38cf617b0bb-0 | langchain.prompts.chat.BaseMessagePromptTemplate¶
class langchain.prompts.chat.BaseMessagePromptTemplate[source]¶
Bases: Serializable, ABC
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.
abstract format_mess... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.BaseMessagePromptTemplate.html |
792b9cec63a5-0 | langchain.prompts.chat.HumanMessagePromptTemplate¶
class langchain.prompts.chat.HumanMessagePromptTemplate(*, prompt: StringPromptTemplate, additional_kwargs: dict = None)[source]¶
Bases: BaseStringMessagePromptTemplate
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationErr... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.HumanMessagePromptTemplate.html |
87704d65282d-0 | langchain.prompts.base.jinja2_formatter¶
langchain.prompts.base.jinja2_formatter(template: str, **kwargs: Any) → str[source]¶
Format a template using jinja2. | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.base.jinja2_formatter.html |
4cccdf3644f8-0 | langchain.prompts.base.validate_jinja2¶
langchain.prompts.base.validate_jinja2(template: str, input_variables: List[str]) → None[source]¶
Validate that the input variables are valid for the template.
Raise an exception if missing or extra variables are found.
Parameters
template – The template string.
input_variables –... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.base.validate_jinja2.html |
48a043638ec6-0 | langchain.prompts.example_selector.ngram_overlap.NGramOverlapExampleSelector¶
class langchain.prompts.example_selector.ngram_overlap.NGramOverlapExampleSelector(*, examples: List[dict], example_prompt: PromptTemplate, threshold: float = - 1.0)[source]¶
Bases: BaseExampleSelector, BaseModel
Select and order examples bas... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.example_selector.ngram_overlap.NGramOverlapExampleSelector.html |
27c3cff43628-0 | langchain.prompts.chat.ChatPromptValue¶
class langchain.prompts.chat.ChatPromptValue(*, messages: List[BaseMessage])[source]¶
Bases: PromptValue
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 messages... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatPromptValue.html |
36de74b7aba6-0 | langchain.prompts.base.StringPromptValue¶
class langchain.prompts.base.StringPromptValue(*, text: str)[source]¶
Bases: PromptValue
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 text: str [Required]¶
... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.base.StringPromptValue.html |
70b5b2f0d9d2-0 | langchain.prompts.loading.load_prompt¶
langchain.prompts.loading.load_prompt(path: Union[str, Path]) → BasePromptTemplate[source]¶
Unified method for loading a prompt from LangChainHub or local fs. | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.loading.load_prompt.html |
028a8c4740aa-0 | langchain.prompts.example_selector.semantic_similarity.MaxMarginalRelevanceExampleSelector¶
class langchain.prompts.example_selector.semantic_similarity.MaxMarginalRelevanceExampleSelector(*, vectorstore: VectorStore, k: int = 4, example_keys: Optional[List[str]] = None, input_keys: Optional[List[str]] = None, fetch_k:... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.example_selector.semantic_similarity.MaxMarginalRelevanceExampleSelector.html |
028a8c4740aa-1 | Reshuffles examples dynamically based on query similarity.
Parameters
examples – List of examples to use in the prompt.
embeddings – An iniialized embedding API interface, e.g. OpenAIEmbeddings().
vectorstore_cls – A vector store DB interface class, e.g. FAISS.
k – Number of examples to select
input_keys – If provided,... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.example_selector.semantic_similarity.MaxMarginalRelevanceExampleSelector.html |
0a4ca013fee9-0 | langchain.prompts.example_selector.semantic_similarity.SemanticSimilarityExampleSelector¶
class langchain.prompts.example_selector.semantic_similarity.SemanticSimilarityExampleSelector(*, vectorstore: VectorStore, k: int = 4, example_keys: Optional[List[str]] = None, input_keys: Optional[List[str]] = None)[source]¶
Bas... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.example_selector.semantic_similarity.SemanticSimilarityExampleSelector.html |
0a4ca013fee9-1 | input_keys – If provided, the search is based on the input variables
instead of all variables.
vectorstore_cls_kwargs – optional kwargs containing url for vector store
Returns
The ExampleSelector instantiated, backed by a vector store.
select_examples(input_variables: Dict[str, str]) → List[dict][source]¶
Select which ... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.example_selector.semantic_similarity.SemanticSimilarityExampleSelector.html |
3a6872cc031f-0 | langchain.prompts.chat.MessagesPlaceholder¶
class langchain.prompts.chat.MessagesPlaceholder(*, variable_name: str)[source]¶
Bases: BaseMessagePromptTemplate
Prompt template that assumes variable is already list of messages.
Create a new model by parsing and validating input data from keyword arguments.
Raises Validati... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.MessagesPlaceholder.html |
4b89af81f706-0 | langchain.prompts.few_shot.FewShotPromptTemplate¶
class langchain.prompts.few_shot.FewShotPromptTemplate(*, input_variables: List[str], output_parser: Optional[BaseOutputParser] = None, partial_variables: Mapping[str, Union[str, Callable[[], str]]] = None, examples: Optional[List[dict]] = None, example_selector: Option... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.few_shot.FewShotPromptTemplate.html |
4b89af81f706-1 | param prefix: str = ''¶
A prompt template string to put before the examples.
param suffix: str [Required]¶
A prompt template string to put after the examples.
param template_format: str = 'f-string'¶
The format of the prompt template. Options are: ‘f-string’, ‘jinja2’.
param validate_template: bool = True¶
Whether or n... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.few_shot.FewShotPromptTemplate.html |
4b89af81f706-2 | serialized kwargs. These attributes must be accepted by the
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_K... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.few_shot.FewShotPromptTemplate.html |
c47d09918869-0 | langchain.prompts.chat.SystemMessagePromptTemplate¶
class langchain.prompts.chat.SystemMessagePromptTemplate(*, prompt: StringPromptTemplate, additional_kwargs: dict = None)[source]¶
Bases: BaseStringMessagePromptTemplate
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationE... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.SystemMessagePromptTemplate.html |
331bb0096b3e-0 | langchain.prompts.example_selector.ngram_overlap.ngram_overlap_score¶
langchain.prompts.example_selector.ngram_overlap.ngram_overlap_score(source: List[str], example: List[str]) → float[source]¶
Compute ngram overlap score of source and example as sentence_bleu score.
Use sentence_bleu with method1 smoothing function a... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.example_selector.ngram_overlap.ngram_overlap_score.html |
e65a77a1b4ed-0 | langchain.prompts.pipeline.PipelinePromptTemplate¶
class langchain.prompts.pipeline.PipelinePromptTemplate(*, input_variables: List[str], output_parser: Optional[BaseOutputParser] = None, partial_variables: Mapping[str, Union[str, Callable[[], str]]] = None, final_prompt: BasePromptTemplate, pipeline_prompts: List[Tupl... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.pipeline.PipelinePromptTemplate.html |
e65a77a1b4ed-1 | Returns
A formatted string.
Example:
prompt.format(variable1="foo")
format_prompt(**kwargs: Any) → PromptValue[source]¶
Create Chat Messages.
validator get_input_variables » all fields[source]¶
Get input variables.
partial(**kwargs: Union[str, Callable[[], str]]) → BasePromptTemplate¶
Return a partial of the prompt t... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.pipeline.PipelinePromptTemplate.html |
8de18a3e5cb3-0 | langchain.prompts.chat.ChatMessagePromptTemplate¶
class langchain.prompts.chat.ChatMessagePromptTemplate(*, prompt: StringPromptTemplate, additional_kwargs: dict = None, role: str)[source]¶
Bases: BaseStringMessagePromptTemplate
Create a new model by parsing and validating input data from keyword arguments.
Raises Vali... | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatMessagePromptTemplate.html |
8de18a3e5cb3-1 | Return whether or not the class is serializable.
model Config¶
Bases: object
extra = 'ignore'¶ | https://api.python.langchain.com/en/latest/prompts/langchain.prompts.chat.ChatMessagePromptTemplate.html |
ec0b621e0cdb-0 | langchain.chains.router.embedding_router.EmbeddingRouterChain¶
class langchain.chains.router.embedding_router.EmbeddingRouterChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: b... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.embedding_router.EmbeddingRouterChain.html |
ec0b621e0cdb-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 vectorstore: VectorStore [Required]¶
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the c... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.embedding_router.EmbeddingRouterChain.html |
ec0b621e0cdb-2 | only one param.
return_only_outputs – boolean for 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. If not p... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.embedding_router.EmbeddingRouterChain.html |
ec0b621e0cdb-3 | Validate and prep outputs.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used.
route(inputs: Dict[str, Any], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → Route¶
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], Bas... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.embedding_router.EmbeddingRouterChain.html |
ec0b621e0cdb-4 | model Config[source]¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶ | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.embedding_router.EmbeddingRouterChain.html |
0a394591c485-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 |
0a394591c485-1 | Return whether or not the class is serializable.
model Config¶
Bases: object
extra = 'ignore'¶ | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderOutputParser.html |
fd715ca2b3aa-0 | langchain.chains.combine_documents.refine.RefineDocumentsChain¶
class langchain.chains.combine_documents.refine.RefineDocumentsChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose:... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.refine.RefineDocumentsChain.html |
fd715ca2b3aa-1 | LLM chain to use on initial document.
param initial_response_name: str [Required]¶
The variable name to format the initial response in when refining.
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... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.refine.RefineDocumentsChain.html |
fd715ca2b3aa-2 | only one param.
return_only_outputs – boolean for 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. If not p... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.refine.RefineDocumentsChain.html |
fd715ca2b3aa-3 | 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, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
combine_docs(docs: List[Document], callbacks: Op... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.refine.RefineDocumentsChain.html |
fd715ca2b3aa-4 | save(file_path: Union[Path, str]) → None¶
Save the chain.
Parameters
file_path – Path to file to save the chain to.
Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
validator set_verbose » verbose¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global set... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.refine.RefineDocumentsChain.html |
73ff7cc977f9-0 | langchain.chains.question_answering.__init__.load_qa_chain¶
langchain.chains.question_answering.__init__.load_qa_chain(llm: BaseLanguageModel, chain_type: str = 'stuff', verbose: Optional[bool] = None, callback_manager: Optional[BaseCallbackManager] = None, **kwargs: Any) → BaseCombineDocumentsChain[source]¶
Load quest... | https://api.python.langchain.com/en/latest/chains/langchain.chains.question_answering.__init__.load_qa_chain.html |
fd872902d24c-0 | langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain¶
class langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
fd872902d24c-1 | for the full catalog.
param ngql_generation_chain: LLMChain [Required]¶
param qa_chain: LLMChain [Required]¶
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 defin... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
fd872902d24c-2 | include_run_info – Whether to include run info in the response. Defaults
to False.
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, include_run_info: bool = False) → ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
fd872902d24c-3 | 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 |
fd872902d24c-4 | == '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 |
fd872902d24c-5 | Initialize from LLM.
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields¶
Raise deprecation war... | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
fd872902d24c-6 | property lc_serializable: bool¶
Return whether or not the class is serializable.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶ | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.nebulagraph.NebulaGraphQAChain.html |
a01b6b2d1b68-0 | langchain.chains.combine_documents.map_reduce.MapReduceDocumentsChain¶
class langchain.chains.combine_documents.map_reduce.MapReduceDocumentsChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_reduce.MapReduceDocumentsChain.html |
a01b6b2d1b68-1 | The variable name in the llm_chain to put the documents in.
If only one variable in the llm_chain, this need not be provided.
param llm_chain: LLMChain [Required]¶
Chain to apply to each document individually.
param memory: Optional[BaseMemory] = None¶
Optional memory object. Defaults to None.
Memory is a class that ge... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_reduce.MapReduceDocumentsChain.html |
a01b6b2d1b68-2 | 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. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to inc... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_reduce.MapReduceDocumentsChain.html |
a01b6b2d1b68-3 | This reducing can be done recursively if needed (if there are many documents).
apply(input_list: List[Dict[str, Any]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None) → List[Dict[str, str]]¶
Call the chain on all inputs in the list.
async arun(*args: Any, callbacks: Optional[Union[Lis... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_reduce.MapReduceDocumentsChain.html |
a01b6b2d1b68-4 | validator raise_deprecation » all fields¶
Raise deprecation warning if callback_manager is used.
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_reduce.MapReduceDocumentsChain.html |
fe0e677f7e37-0 | langchain.chains.api.openapi.requests_chain.APIRequesterOutputParser¶
class langchain.chains.api.openapi.requests_chain.APIRequesterOutputParser[source]¶
Bases: BaseOutputParser
Parse the request and error tags.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if th... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.requests_chain.APIRequesterOutputParser.html |
fe0e677f7e37-1 | property lc_serializable: bool¶
Return whether or not the class is serializable.
model Config¶
Bases: object
extra = 'ignore'¶ | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.requests_chain.APIRequesterOutputParser.html |
f43fb2365539-0 | langchain.chains.base.Chain¶
class langchain.chains.base.Chain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None)[source]¶
Bases: Serial... | https://api.python.langchain.com/en/latest/chains/langchain.chains.base.Chain.html |
f43fb2365539-1 | 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 printed to the console. Defaults to langchain.verbose value.
__call__(inputs: Union[Dict[str, Any], Any], return_only_out... | https://api.python.langchain.com/en/latest/chains/langchain.chains.base.Chain.html |
f43fb2365539-2 | 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. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to inc... | https://api.python.langchain.com/en/latest/chains/langchain.chains.base.Chain.html |
f43fb2365539-3 | Save the chain.
Parameters
file_path – Path to file to save the chain to.
Example:
.. code-block:: python
chain.save(file_path=”path/chain.yaml”)
validator set_verbose » verbose[source]¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global setting.
to_json() → Union[Serialized... | https://api.python.langchain.com/en/latest/chains/langchain.chains.base.Chain.html |
032a7baa5c89-0 | langchain.chains.api.openapi.chain.OpenAPIEndpointChain¶
class langchain.chains.api.openapi.chain.OpenAPIEndpointChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.chain.OpenAPIEndpointChain.html |
032a7baa5c89-1 | and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog.
param param_mapping: _ParamMapping [Required]¶
param requests: Requests [Optional]¶... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.chain.OpenAPIEndpointChain.html |
032a7baa5c89-2 | include_run_info – Whether to include run info in the response. Defaults
to False.
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, include_run_info: bool = False) → ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.chain.OpenAPIEndpointChain.html |
032a7baa5c89-3 | dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
classmethod from_api_operation(operation: APIOperation, llm: BaseLanguageModel, requests: Optional[Requests] = None, verbose: bool = False, return_intermediate_steps: bool = False, raw_response: bool = False, callbacks: Optional[Union[List[BaseCallb... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.chain.OpenAPIEndpointChain.html |
032a7baa5c89-4 | validator set_verbose » verbose¶
If verbose is None, set it.
This allows users to pass in None as verbose to access the global setting.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
property lc_attributes: Dict¶
Return a list of attribute nam... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.chain.OpenAPIEndpointChain.html |
2196de214610-0 | langchain.chains.query_constructor.base.StructuredQueryOutputParser¶
class langchain.chains.query_constructor.base.StructuredQueryOutputParser(*, ast_parse: Callable)[source]¶
Bases: BaseOutputParser[StructuredQuery]
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.base.StructuredQueryOutputParser.html |
2196de214610-1 | property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “llms”, “openai”]
property lc_secrets: Dict[str, str]¶
... | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.base.StructuredQueryOutputParser.html |
e2dab6a7e757-0 | langchain.chains.retrieval_qa.base.RetrievalQA¶
class langchain.chains.retrieval_qa.base.RetrievalQA(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[Lis... | https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html |
e2dab6a7e757-1 | 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 saves any returned variables.
There are many different types of memo... | https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html |
e2dab6a7e757-2 | callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbac... | https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html |
e2dab6a7e757-3 | dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
classmethod from_chain_type(llm: BaseLanguageModel, chain_type: str = 'stuff', chain_type_kwargs: Optional[dict] = None, **kwargs: Any) → BaseRetrievalQA¶
Load chain from chain type.
classmethod from_llm(llm: BaseLanguageModel, prompt: Optional[Prom... | https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html |
e2dab6a7e757-4 | serialized kwargs. These attributes must be accepted by the
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_K... | https://api.python.langchain.com/en/latest/chains/langchain.chains.retrieval_qa.base.RetrievalQA.html |
344d3d675e5b-0 | langchain.chains.llm_checker.base.LLMCheckerChain¶
class langchain.chains.llm_checker.base.LLMCheckerChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Option... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_checker.base.LLMCheckerChain.html |
344d3d675e5b-1 | Bases: Chain
Chain for question-answering with self-verification.
Example
from langchain import OpenAI, LLMCheckerChain
llm = OpenAI(temperature=0.7)
checker_chain = LLMCheckerChain.from_llm(llm)
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data can... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_checker.base.LLMCheckerChain.html |
344d3d675e5b-2 | [Deprecated]
param llm: Optional[BaseLanguageModel] = None¶
[Deprecated] LLM wrapper to use.
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 t... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_checker.base.LLMCheckerChain.html |
344d3d675e5b-3 | Run the logic of this chain and add to output if desired.
Parameters
inputs – Dictionary of inputs, or single input if chain expects
only one param.
return_only_outputs – boolean for whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input key... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_checker.base.LLMCheckerChain.html |
344d3d675e5b-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, **kwargs: Any) → str¶
Run the chain as text in, text out or multiple variables, text out.
dict(**kwargs: Any) → Dict¶
Return dictionary re... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_checker.base.LLMCheckerChain.html |
344d3d675e5b-5 | Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields, all fields[source]¶
Raise deprecation warning if callback_manager is used.
run(*args: Any, callbacks: Option... | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_checker.base.LLMCheckerChain.html |
344d3d675e5b-6 | model Config[source]¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶
extra = 'forbid'¶ | https://api.python.langchain.com/en/latest/chains/langchain.chains.llm_checker.base.LLMCheckerChain.html |
13ba9c6ef32e-0 | langchain.chains.query_constructor.schema.AttributeInfo¶
class langchain.chains.query_constructor.schema.AttributeInfo(*, name: str, description: str, type: str)[source]¶
Bases: BaseModel
Information about a data source attribute.
Create a new model by parsing and validating input data from keyword arguments.
Raises Va... | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.schema.AttributeInfo.html |
944c3f0a442e-0 | langchain.chains.qa_generation.base.QAGenerationChain¶
class langchain.chains.qa_generation.base.QAGenerationChain(*, memory: ~typing.Optional[~langchain.schema.BaseMemory] = None, callbacks: ~typing.Optional[~typing.Union[~typing.List[~langchain.callbacks.base.BaseCallbackHandler], ~langchain.callbacks.base.BaseCallba... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
944c3f0a442e-1 | 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 saves any returned variables.
There are many different types of memory - please see memory docs
for the full ca... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
944c3f0a442e-2 | use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] =... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
944c3f0a442e-3 | prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs: Dict[str, str], return_only_outputs: bool = False) → Dict[str, str]¶
Validate and prep outputs.
validator raise_deprecation » all fields¶
Raise deprecation warning if callback_mana... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
944c3f0a442e-4 | property lc_serializable: bool¶
Return whether or not the class is serializable.
property output_keys: List[str]¶
Output keys this chain expects.
model Config¶
Bases: object
Configuration for this pydantic object.
arbitrary_types_allowed = True¶ | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_generation.base.QAGenerationChain.html |
b69bd9f483ba-0 | langchain.chains.router.base.Route¶
class langchain.chains.router.base.Route(destination, next_inputs)[source]¶
Bases: NamedTuple
Create new instance of Route(destination, next_inputs)
Methods
__init__()
count(value, /)
Return number of occurrences of value.
index(value[, start, stop])
Return first index of value.
Attr... | https://api.python.langchain.com/en/latest/chains/langchain.chains.router.base.Route.html |
b80ffafa9391-0 | langchain.chains.flare.base.FlareChain¶
class langchain.chains.flare.base.FlareChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Optional[List[str]] = None, ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
b80ffafa9391-1 | There are many different types of memory - please see memory docs
for the full catalog.
param min_prob: float = 0.2¶
param min_token_gap: int = 5¶
param num_pad_tokens: int = 2¶
param output_parser: FinishedOutputParser [Optional]¶
param question_generator_chain: QuestionGeneratorChain [Required]¶
param response_chain:... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
b80ffafa9391-2 | callbacks – Callbacks to use for this chain run. If not provided, will
use the callbacks provided to the chain.
include_run_info – Whether to include run info in the response. Defaults
to False.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbac... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
b80ffafa9391-3 | dict(**kwargs: Any) → Dict¶
Return dictionary representation of chain.
classmethod from_llm(llm: BaseLanguageModel, max_generation_len: int = 32, **kwargs: Any) → FlareChain[source]¶
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Validate and prep inputs.
prep_outputs(inputs: Dict[str, str], outputs:... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
b80ffafa9391-4 | 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 the class is serializable.
property output_keys: List[str]¶
Output keys this chain expects.
mo... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.FlareChain.html |
549851b404a9-0 | langchain.chains.flare.base.QuestionGeneratorChain¶
class langchain.chains.flare.base.QuestionGeneratorChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = None, verbose: bool = None, tags: Opti... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
549851b404a9-1 | param llm: BaseLanguageModel [Required]¶
Language model to call.
param llm_kwargs: dict [Optional]¶
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 alo... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
549851b404a9-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.flare.base.QuestionGeneratorChain.html |
549851b404a9-3 | Call apply and then parse the results.
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, include_run_info: bool = False) → Dict[str, Any]¶
Run the logic of this chain ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
549851b404a9-4 | 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")
async apredict_and_parse(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
549851b404a9-5 | **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, **kwargs: Any) → Union[str, List[str], Dict[str, Any]]¶
Call predict and then parse the result... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
549851b404a9-6 | to_json_not_implemented() → SerializedNotImplemented¶
property lc_attributes: Dict¶
Return a list of attribute names that should be included in the
serialized kwargs. These attributes must be accepted by the
constructor.
property lc_namespace: List[str]¶
Return the namespace of the langchain object.
eg. [“langchain”, “... | https://api.python.langchain.com/en/latest/chains/langchain.chains.flare.base.QuestionGeneratorChain.html |
7004e92c1bfb-0 | langchain.chains.question_answering.__init__.LoadingCallable¶
class langchain.chains.question_answering.__init__.LoadingCallable(*args, **kwargs)[source]¶
Bases: Protocol
Interface for loading the combine documents chain.
Methods
__init__(*args, **kwargs)
__call__(llm: BaseLanguageModel, **kwargs: Any) → BaseCombineDoc... | https://api.python.langchain.com/en/latest/chains/langchain.chains.question_answering.__init__.LoadingCallable.html |
d7385da06783-0 | langchain.chains.openai_functions.citation_fuzzy_match.FactWithEvidence¶
class langchain.chains.openai_functions.citation_fuzzy_match.FactWithEvidence(*, fact: str, substring_quote: List[str])[source]¶
Bases: BaseModel
Class representing single statement.
Each fact has a body and a list of sources.
If there are multipl... | https://api.python.langchain.com/en/latest/chains/langchain.chains.openai_functions.citation_fuzzy_match.FactWithEvidence.html |
9f155aed0348-0 | langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain¶
class langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain(*, memory: Optional[BaseMemory] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, callback_manager: Optional[BaseCallbackManager] = ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html |
9f155aed0348-1 | Chain to apply to each document individually.
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 saves any returned var... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.map_rerank.MapRerankDocumentsChain.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.