id stringlengths 14 15 | text stringlengths 49 2.47k | source stringlengths 61 166 |
|---|---|---|
20fe4c734ec8-3 | batch(inputs: List[Union[PromptValue, str, List[BaseMessage]]], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, max_concurrency: Optional[int] = None, **kwargs: Any) → List[str]¶
bind(**kwargs: Any) → Runnable[Input, Output]¶
Bind arguments to a Runnable, returning a new Runnable.
classmethod cons... | https://api.python.langchain.com/en/latest/llms/langchain.llms.predibase.Predibase.html |
20fe4c734ec8-4 | classmethod from_orm(obj: Any) → Model¶
generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, *, tags: Optional[Union[List[str], List[List[str]]]] = None, metada... | https://api.python.langchain.com/en/latest/llms/langchain.llms.predibase.Predibase.html |
20fe4c734ec8-5 | to the model provider API call.
Returns
An LLMResult, which contains a list of candidate Generations for each inputprompt and additional model provider-specific output.
get_num_tokens(text: str) → int¶
Get the number of tokens present in the text.
Useful for checking if an input will fit in a model’s context window.
Pa... | https://api.python.langchain.com/en/latest/llms/langchain.llms.predibase.Predibase.html |
20fe4c734ec8-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/llms/langchain.llms.predibase.Predibase.html |
20fe4c734ec8-7 | **kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a message.
save(file_path: Union[Path, str]) → None¶
Save the LLM.
Parameters
file_path – Path to file to save the LLM to.
Example:
.. code-block:: python
llm.save(file_path=”path/... | https://api.python.langchain.com/en/latest/llms/langchain.llms.predibase.Predibase.html |
20fe4c734ec8-8 | 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 the class is s... | https://api.python.langchain.com/en/latest/llms/langchain.llms.predibase.Predibase.html |
bbd8dd29d91f-0 | langchain.llms.openai.OpenAI¶
class langchain.llms.openai.OpenAI[source]¶
Bases: BaseOpenAI
OpenAI large language models.
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 are valid to be passed to the openai.create call c... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-1 | The maximum number of tokens to generate in the completion.
-1 returns as many tokens as possible given the prompt and
the models maximal context size.
param metadata: Optional[Dict[str, Any]] = None¶
Metadata to add to the run trace.
param model_kwargs: Dict[str, Any] [Optional]¶
Holds any model parameters valid for c... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-2 | supported by tiktoken. This can include when using Azure embeddings or
when using one of the many model providers that expose an OpenAI-like
API but with different models. In those cases, in order to avoid erroring
when tiktoken is called, you can specify a model name to use here.
param top_p: float = 1¶
Total probabil... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-3 | Run the LLM on the given prompt and input.
async agenerate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, **kwargs: Any) → LLMResult¶
Asynchronously... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-4 | Asynchronously pass a string to the model and return a string prediction.
Use this method when calling pure text generation models and only the topcandidate generation is needed.
Parameters
text – String input to pass to the model.
stop – Stop words to use when generating. Model output is cut off at the
first occurrenc... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-5 | 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.extra = ‘allow’ was set since it adds all passed values
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-6 | Run the LLM on the given prompt and input.
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, **kwargs: Any) → LLMResult¶
Pass a sequence of pr... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-7 | get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶
Get the number of tokens in the messages.
Useful for checking if an input will fit in a model’s context window.
Parameters
messages – The message inputs to tokenize.
Returns
The sum of the number of tokens across the messages.
get_sub_prompts(params: Dict... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-8 | Example
max_tokens = openai.max_token_for_prompt("Tell me a joke.")
static modelname_to_contextsize(modelname: str) → int¶
Calculate the maximum number of tokens possible to generate for a model.
Parameters
modelname – The modelname we want to know the context size for.
Returns
The maximum context size
Example
max_toke... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-9 | Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Retur... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-10 | 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/llms/langchain.llms.openai.OpenAI.html |
bbd8dd29d91f-11 | Agent VectorDB Question Answering Benchmarking
HTTP request chain
OpenAPI chain
HuggingGPT
Context aware text splitting and QA / Chat
Question answering over a group chat messages using Activeloop’s DeepLake
Perform context-aware text splitting
Retrieve from vector stores directly
Retrieve as you generate with FLARE
Im... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.OpenAI.html |
2f9839c442d9-0 | langchain.llms.tongyi.Tongyi¶
class langchain.llms.tongyi.Tongyi[source]¶
Bases: LLM
Tongyi Qwen large language models.
To use, you should have the dashscope python package installed, and the
environment variable DASHSCOPE_API_KEY set with your API key, or pass
it as a named parameter to the constructor.
Example
from l... | https://api.python.langchain.com/en/latest/llms/langchain.llms.tongyi.Tongyi.html |
2f9839c442d9-1 | param verbose: bool [Optional]¶
Whether to print out response text.
__call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → str¶
Check Cache... | https://api.python.langchain.com/en/latest/llms/langchain.llms.tongyi.Tongyi.html |
2f9839c442d9-2 | need more output from the model than just the top generated value,
are building chains that are agnostic to the underlying language modeltype (e.g., pure text completion models vs chat models).
Parameters
prompts – List of PromptValues. A PromptValue is an object that can be
converted to match the format of any languag... | https://api.python.langchain.com/en/latest/llms/langchain.llms.tongyi.Tongyi.html |
2f9839c442d9-3 | Asynchronously pass messages to the model and return a message prediction.
Use this method when calling chat models and only the topcandidate generation is needed.
Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off a... | https://api.python.langchain.com/en/latest/llms/langchain.llms.tongyi.Tongyi.html |
2f9839c442d9-4 | Duplicate a model, optionally choose which fields to include, exclude and change.
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 creat... | https://api.python.langchain.com/en/latest/llms/langchain.llms.tongyi.Tongyi.html |
2f9839c442d9-5 | Parameters
prompts – List of PromptValues. A PromptValue is an object that can be
converted to match the format of any language model (string for pure
text generation models and BaseMessages for chat models).
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these subst... | https://api.python.langchain.com/en/latest/llms/langchain.llms.tongyi.Tongyi.html |
2f9839c442d9-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/llms/langchain.llms.tongyi.Tongyi.html |
2f9839c442d9-7 | to the model provider API call.
Returns
Top model prediction as a string.
predict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Pass a message sequence to the model and return a message prediction.
Use this method when passing in chat messages. If you want ... | https://api.python.langchain.com/en/latest/llms/langchain.llms.tongyi.Tongyi.html |
2f9839c442d9-8 | 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/llms/langchain.llms.tongyi.Tongyi.html |
316771404839-0 | langchain.llms.chatglm.ChatGLM¶
class langchain.llms.chatglm.ChatGLM[source]¶
Bases: LLM
ChatGLM LLM service.
Example
from langchain.llms import ChatGLM
endpoint_url = (
"http://127.0.0.1:8000"
)
ChatGLM_llm = ChatGLM(
endpoint_url=endpoint_url
)
Create a new model by parsing and validating input data from keyw... | https://api.python.langchain.com/en/latest/llms/langchain.llms.chatglm.ChatGLM.html |
316771404839-1 | param with_history: bool = False¶
Whether to use history or not
__call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → str¶
Check Cache and... | https://api.python.langchain.com/en/latest/llms/langchain.llms.chatglm.ChatGLM.html |
316771404839-2 | need more output from the model than just the top generated value,
are building chains that are agnostic to the underlying language modeltype (e.g., pure text completion models vs chat models).
Parameters
prompts – List of PromptValues. A PromptValue is an object that can be
converted to match the format of any languag... | https://api.python.langchain.com/en/latest/llms/langchain.llms.chatglm.ChatGLM.html |
316771404839-3 | Asynchronously pass messages to the model and return a message prediction.
Use this method when calling chat models and only the topcandidate generation is needed.
Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off a... | https://api.python.langchain.com/en/latest/llms/langchain.llms.chatglm.ChatGLM.html |
316771404839-4 | Duplicate a model, optionally choose which fields to include, exclude and change.
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 creat... | https://api.python.langchain.com/en/latest/llms/langchain.llms.chatglm.ChatGLM.html |
316771404839-5 | Parameters
prompts – List of PromptValues. A PromptValue is an object that can be
converted to match the format of any language model (string for pure
text generation models and BaseMessages for chat models).
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these subst... | https://api.python.langchain.com/en/latest/llms/langchain.llms.chatglm.ChatGLM.html |
316771404839-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/llms/langchain.llms.chatglm.ChatGLM.html |
316771404839-7 | to the model provider API call.
Returns
Top model prediction as a string.
predict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Pass a message sequence to the model and return a message prediction.
Use this method when passing in chat messages. If you want ... | https://api.python.langchain.com/en/latest/llms/langchain.llms.chatglm.ChatGLM.html |
316771404839-8 | 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/llms/langchain.llms.chatglm.ChatGLM.html |
2443993f9d77-0 | langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain¶
class langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain[source]¶
Bases: BaseQAWithSourcesChain
Question-answering with sources over a vector database.
Create a new model by parsing and validating input data from keyword arguments... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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 reduce_k_below_max_tokens: bool = False¶
Reduce the number of results to return from store based on tokens... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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. 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.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-3 | 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
these runtime callbacks will propagate to calls to other objects.... | https://api.python.langchain.com/en/latest/chains/langchain.chains.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-4 | 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.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.qa_with_sources.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.vector_db.VectorDBQAWithSourcesChain.html |
2443993f9d77-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.vector_db.VectorDBQAWithSourcesChain.html |
7d5f30131ae5-0 | langchain.chains.combine_documents.base.BaseCombineDocumentsChain¶
class langchain.chains.combine_documents.base.BaseCombineDocumentsChain[source]¶
Bases: Chain, ABC
Base interface for chains combining documents.
Subclasses of this chain deal with combining documents in a variety of
ways. This base class exists to add ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.BaseCombineDocumentsChain.html |
7d5f30131ae5-1 | Optional metadata associated with the chain. Defaults to None.
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 tags: Optional[List[str]] = None¶
Optional ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.BaseCombineDocumentsChain.html |
7d5f30131ae5-2 | 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.combine_documents.base.BaseCombineDocumentsChain.html |
7d5f30131ae5-3 | 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 chain. Defaults to None
include_run_info – Whether to include run ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.BaseCombineDocumentsChain.html |
7d5f30131ae5-4 | *args – If the chain expects a single input, it can be passed in as the
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... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.BaseCombineDocumentsChain.html |
7d5f30131ae5-5 | Combine documents into a single string.
Parameters
docs – List[Document], the documents to combine
**kwargs – Other parameters to use in combining documents, often
other inputs to the prompt.
Returns
The first element returned is the single string output. The second
element returned is a dictionary of other keys to ret... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.BaseCombineDocumentsChain.html |
7d5f30131ae5-6 | 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[RunnableConfig] = None) → Dict[str, Any]¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: ... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.BaseCombineDocumentsChain.html |
7d5f30131ae5-7 | 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.combine_documents.base.BaseCombineDocumentsChain.html |
7d5f30131ae5-8 | 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 chain run. These will be called in
addition to callbacks passed to the chain during construction, but only
these runtime callbacks will propagate to call... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.BaseCombineDocumentsChain.html |
7d5f30131ae5-9 | stream(input: Input, config: Optional[RunnableConfig] = None) → Iterator[Output]¶
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, glo... | https://api.python.langchain.com/en/latest/chains/langchain.chains.combine_documents.base.BaseCombineDocumentsChain.html |
98fbe3959428-0 | langchain.chains.api.openapi.response_chain.APIResponderChain¶
class langchain.chains.api.openapi.response_chain.APIResponderChain[source]¶
Bases: LLMChain
Get the response parser.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed t... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-1 | Defaults to one that takes the most likely string but does not change it
otherwise.
param prompt: BasePromptTemplate [Required]¶
Prompt object to use.
param return_final_only: bool = True¶
Whether to return only the final parsed result. Defaults to True.
If false, will return a bunch of extra information about the gene... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-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.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-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.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-4 | Call apply and then parse the results.
async apredict(callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → str¶
Format prompt with kwargs and pass to LLM.
Parameters
callbacks – Callbacks to pass to LLMChain
**kwargs – Keys to pass to prompt template.
Returns
Completion fr... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-5 | 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.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-6 | 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.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-7 | 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[str, Any], config: Optional[RunnableConfig] = None) → Dict[str, Any]¶
json(*, include: Optional[Union[AbstractSetIn... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-8 | 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 results.
prep_inputs(inputs: Union[Dict[str, Any],... | https://api.python.langchain.com/en/latest/chains/langchain.chains.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-9 | 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.api.openapi.response_chain.APIResponderChain.html |
98fbe3959428-10 | 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.api.openapi.response_chain.APIResponderChain.html |
99943ef614b7-0 | langchain.chains.sql_database.query.SQLInputWithTables¶
class langchain.chains.sql_database.query.SQLInputWithTables[source]¶
Input for a SQL Chain.
question: str¶
table_names_to_use: List[str]¶ | https://api.python.langchain.com/en/latest/chains/langchain.chains.sql_database.query.SQLInputWithTables.html |
a25bf71d4a19-0 | langchain.chains.conversational_retrieval.base.ChatVectorDBChain¶
class langchain.chains.conversational_retrieval.base.ChatVectorDBChain[source]¶
Bases: BaseConversationalRetrievalChain
Chain for chatting with a vector database.
Create a new model by parsing and validating input data from keyword arguments.
Raises Vali... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.ChatVectorDBChain.html |
a25bf71d4a19-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.ChatVectorDBChain.html |
a25bf71d4a19-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.ChatVectorDBChain.html |
a25bf71d4a19-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.ChatVectorDBChain.html |
a25bf71d4a19-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.ChatVectorDBChain.html |
a25bf71d4a19-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.ChatVectorDBChain.html |
a25bf71d4a19-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_llm(llm: BaseLanguageModel, vectorstore: VectorStore, condense_questio... | https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.ChatVectorDBChain.html |
a25bf71d4a19-7 | 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.conversational_retrieval.base.ChatVectorDBChain.html |
a25bf71d4a19-8 | 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.conversational_retrieval.base.ChatVectorDBChain.html |
a25bf71d4a19-9 | 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.conversational_retrieval.base.ChatVectorDBChain.html |
c3b11c537059-0 | langchain.chains.sequential.SimpleSequentialChain¶
class langchain.chains.sequential.SimpleSequentialChain[source]¶
Bases: Chain
Simple chain where the outputs of one step feed directly into next.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data ca... | https://api.python.langchain.com/en/latest/chains/langchain.chains.sequential.SimpleSequentialChain.html |
c3b11c537059-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.SimpleSequentialChain.html |
c3b11c537059-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.SimpleSequentialChain.html |
c3b11c537059-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.SimpleSequentialChain.html |
c3b11c537059-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.SimpleSequentialChain.html |
c3b11c537059-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.SimpleSequentialChain.html |
c3b11c537059-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.SimpleSequentialChain.html |
c3b11c537059-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.SimpleSequentialChain.html |
c3b11c537059-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.SimpleSequentialChain.html |
06d798a04242-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 |
06d798a04242-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.requests_chain.APIRequesterOutputParser.html |
06d798a04242-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.requests_chain.APIRequesterOutputParser.html |
06d798a04242-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.requests_chain.APIRequesterOutputParser.html |
06d798a04242-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.requests_chain.APIRequesterOutputParser.html |
9dca8d140b7b-0 | langchain.chains.query_constructor.base.load_query_constructor_chain¶
langchain.chains.query_constructor.base.load_query_constructor_chain(llm: BaseLanguageModel, document_contents: str, attribute_info: List[AttributeInfo], examples: Optional[List] = None, allowed_comparators: Optional[Sequence[Comparator]] = None, all... | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.base.load_query_constructor_chain.html |
04ccc9151608-0 | langchain.chains.graph_qa.cypher.extract_cypher¶
langchain.chains.graph_qa.cypher.extract_cypher(text: str) → str[source]¶
Extract Cypher code from a text.
Parameters
text – Text to extract Cypher code from.
Returns
Cypher code extracted from the text. | https://api.python.langchain.com/en/latest/chains/langchain.chains.graph_qa.cypher.extract_cypher.html |
8cfdea9f2ddc-0 | langchain.chains.query_constructor.ir.Operator¶
class langchain.chains.query_constructor.ir.Operator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Enumerator of the operations.
AND = 'and'¶
OR = 'or'¶
NOT = 'not'¶ | https://api.python.langchain.com/en/latest/chains/langchain.chains.query_constructor.ir.Operator.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.