id stringlengths 14 16 | text stringlengths 31 2.41k | source stringlengths 53 121 |
|---|---|---|
81099a94f427-227 | for the full catalog.
attribute tags: Optional[List[str]] = Noneο
Optional list of tags associated with the chain. Defaults to None
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain wi... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-228 | kwargs (Any) β
Return type
Tuple[str, dict]
apply(input_list, callbacks=None)ο
Call the chain on all inputs in the list.
Parameters
input_list (List[Dict[str, Any]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
Return type
List[Dict... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-229 | return_only_outputs (bool) β
Return type
Dict[str, str]
prompt_length(docs, **kwargs)[source]ο
Get the prompt length by formatting the prompt.
Parameters
docs (List[langchain.schema.Document]) β
kwargs (Any) β
Return type
Optional[int]
run(*args, callbacks=None, tags=None, **kwargs)ο
Run the chain as text in, text o... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-230 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.chains.MapRerankDocumentsChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, input_key='input_documents', output_key='output_text', llm_chain, document_variable_name, rank_key, answer_key, ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-231 | Each custom chain can optionally call additional callback methods, see Callback docs
for full details.
attribute document_variable_name: str [Required]ο
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.
attribute llm_chain: LLMChain [Required]ο... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-232 | only one param.
return_only_outputs (bool) β 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 (Optional[Union[List[langchain.callbacks... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-233 | tags (Optional[List[str]]) β
kwargs (Any) β
Return type
str
combine_docs(docs, callbacks=None, **kwargs)[source]ο
Combine documents in a map rerank manner.
Combine by mapping first chain over all documents, then reranking the results.
Parameters
docs (List[langchain.schema.Document]) β
callbacks (Optional[Union[List... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-234 | kwargs (Any) β
Return type
str
save(file_path)ο
Save the chain.
Parameters
file_path (Union[pathlib.Path, str]) β Path to file to save the chain to.
Return type
None
Example:
.. code-block:: python
chain.save(file_path=βpath/chain.yamlβ)
to_json()ο
Return type
Union[langchain.load.serializable.SerializedConstructor, l... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-235 | callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
verbose (bool) β
tags (Optional[List[str]]) β
input_key (str) β
output_key (str) β
llm_chain (langchain.chains.llm.LLMChain) β
combine_document_chain (langchain.chains.combine_documents.base.BaseCombineDocumentsChain) β
collapse_document... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-236 | 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/modules/chains.html |
81099a94f427-237 | include_run_info (bool) β Whether to include run info in the response. Defaults
to False.
tags (Optional[List[str]]) β
Return type
Dict[str, Any]
async acombine_docs(docs, callbacks=None, **kwargs)[source]ο
Combine documents in a map reduce manner.
Combine by mapping first chain over all documents, then reducing the r... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-238 | docs (List[langchain.schema.Document]) β
token_max (int) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
kwargs (Any) β
Return type
Tuple[str, dict]
dict(**kwargs)ο
Return dictionary representation of chain.
Parameters
kwargs (Any) β ... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-239 | Example:
.. code-block:: python
chain.save(file_path=βpath/chain.yamlβ)
to_json()ο
Return type
Union[langchain.load.serializable.SerializedConstructor, langchain.load.serializable.SerializedNotImplemented]
to_json_not_implemented()ο
Return type
langchain.load.serializable.SerializedNotImplemented
property lc_attributes... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-240 | input_key (str) β
output_key (str) β
initial_llm_chain (langchain.chains.llm.LLMChain) β
refine_llm_chain (langchain.chains.llm.LLMChain) β
document_variable_name (str) β
initial_response_name (str) β
document_prompt (langchain.prompts.base.BasePromptTemplate) β
return_intermediate_steps (bool) β
Return type
No... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-241 | There are many different types of memory - please see memory docs
for the full catalog.
attribute refine_llm_chain: LLMChain [Required]ο
LLM chain to use when refining.
attribute return_intermediate_steps: bool = Falseο
Return the results of the refine steps in the output.
attribute tags: Optional[List[str]] = Noneο
Op... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-242 | tags (Optional[List[str]]) β
Return type
Dict[str, Any]
async acombine_docs(docs, callbacks=None, **kwargs)[source]ο
Combine by mapping first chain over all, then stuffing into final chain.
Parameters
docs (List[langchain.schema.Document]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler]... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-243 | Return type
Dict
prep_inputs(inputs)ο
Validate and prep inputs.
Parameters
inputs (Union[Dict[str, Any], Any]) β
Return type
Dict[str, str]
prep_outputs(inputs, outputs, return_only_outputs=False)ο
Validate and prep outputs.
Parameters
inputs (Dict[str, str]) β
outputs (Dict[str, str]) β
return_only_outputs (bool) β... | https://api.python.langchain.com/en/latest/modules/chains.html |
81099a94f427-244 | 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/modules/chains.html |
2dbde574187e-0 | Base classesο
Common schema objects.
langchain.schema.get_buffer_string(messages, human_prefix='Human', ai_prefix='AI')[source]ο
Get buffer string of messages.
Parameters
messages (List[langchain.schema.BaseMessage]) β
human_prefix (str) β
ai_prefix (str) β
Return type
str
class langchain.schema.AgentAction(tool, to... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-1 | Default values are respected, but no other validation is performed.
Behaves as if Config.extra = βallowβ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) β
values (Any) β
Return type
Model
copy(*, include=None, exclude=None, update=None, deep=False)ο
Duplicate a model, optionally choo... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-2 | exclude_none (bool) β
Return type
DictStrAny
json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs)ο
Generate a JSON representation of the model, include and exclude arguments as per dic... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-3 | property lc_serializable: boolο
This class is LangChain serializable.
class langchain.schema.BaseMessage(*, content, additional_kwargs=None)[source]ο
Bases: langchain.load.serializable.Serializable
Message object.
Parameters
content (str) β
additional_kwargs (dict) β
Return type
None
classmethod construct(_fields_set... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-4 | Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-5 | 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ο
This class is LangChain... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-6 | update (Optional[DictStrAny]) β 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 (bool) β set to True to make a deep copy of the model
self (Model) β
Returns
new model instance
Return type
Model
dict(*, include=None, exclude=None, by_... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-7 | models_as_dict (bool) β
dumps_kwargs (Any) β
Return type
unicode
classmethod update_forward_refs(**localns)ο
Try to update ForwardRefs on fields based on this Model, globalns and localns.
Parameters
localns (Any) β
Return type
None
property lc_attributes: Dictο
Return a list of attribute names that should be include... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-8 | Model
copy(*, include=None, exclude=None, update=None, deep=False)ο
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) ... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-9 | Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (bool) β
exclude_defaults (bool) β
exclude_none (bool) β
encoder (Optional[Callable[[Any], Any]]) β
models... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-10 | Return type
None
classmethod construct(_fields_set=None, **values)ο
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
Parameters
_fie... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-11 | exclude_defaults (bool) β
exclude_none (bool) β
Return type
DictStrAny
json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs)ο
Generate a JSON representation of the model, include and e... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-12 | property lc_serializable: boolο
This class is LangChain serializable.
property type: strο
Type of the message, used for serialization.
class langchain.schema.FunctionMessage(*, content, additional_kwargs=None, name)[source]ο
Bases: langchain.schema.BaseMessage
Parameters
content (str) β
additional_kwargs (dict) β
nam... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-13 | Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-14 | 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ο
This class is LangChain... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-15 | the new model: you should trust this data
deep (bool) β set to True to make a deep copy of the model
self (Model) β
Returns
new model instance
Return type
Model
dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False)ο
Generate a dictionar... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-16 | Return type
unicode
classmethod update_forward_refs(**localns)ο
Try to update ForwardRefs on fields based on this Model, globalns and localns.
Parameters
localns (Any) β
Return type
None
property lc_attributes: Dictο
Return a list of attribute names that should be included in the
serialized kwargs. These attributes mu... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-17 | message (langchain.schema.BaseMessage) β
Return type
None
attribute generation_info: Optional[Dict[str, Any]] = Noneο
Raw generation info response from the provider
attribute text: str = ''ο
Generated text output.
classmethod construct(_fields_set=None, **values)ο
Creates a new model setting __dict__ and __fields_set_... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-18 | include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (bool) β
exclude_defaults (bool) β
exclude_none (bool) β
Return type
DictStrAny
json(*, include=None, exclude=None, by... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-19 | 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ο
This class is LangChain serializable... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-20 | self (Model) β
Returns
new model instance
Return type
Model
dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False)ο
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Parameters
i... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-21 | Parameters
localns (Any) β
Return type
None
class langchain.schema.ChatResult(*, generations, llm_output=None)[source]ο
Bases: pydantic.main.BaseModel
Class that contains all relevant information for a Chat Result.
Parameters
generations (List[langchain.schema.ChatGeneration]) β
llm_output (Optional[dict]) β
Return ... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-22 | self (Model) β
Returns
new model instance
Return type
Model
dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False)ο
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Parameters
i... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-23 | Parameters
localns (Any) β
Return type
None
class langchain.schema.LLMResult(*, generations, llm_output=None, run=None)[source]ο
Bases: pydantic.main.BaseModel
Class that contains all relevant information for an LLM Result.
Parameters
generations (List[List[langchain.schema.Generation]]) β
llm_output (Optional[dict])... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-24 | update (Optional[DictStrAny]) β 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 (bool) β set to True to make a deep copy of the model
self (Model) β
Returns
new model instance
Return type
Model
dict(*, include=None, exclude=None, by_... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-25 | exclude_unset (bool) β
exclude_defaults (bool) β
exclude_none (bool) β
encoder (Optional[Callable[[Any], Any]]) β
models_as_dict (bool) β
dumps_kwargs (Any) β
Return type
unicode
classmethod update_forward_refs(**localns)ο
Try to update ForwardRefs on fields based on this Model, globalns and localns.
Parameters
l... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-26 | self (Model) β
Returns
new model instance
Return type
Model
dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False)ο
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Parameters
i... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-27 | abstract to_string()[source]ο
Return prompt as string.
Return type
str
classmethod update_forward_refs(**localns)ο
Try to update ForwardRefs on fields based on this Model, globalns and localns.
Parameters
localns (Any) β
Return type
None
property lc_attributes: Dictο
Return a list of attribute names that should be inc... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-28 | Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β fields to exclude from new model, as with values this takes preced... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-29 | include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (bool) β
exclude_defaults (bool) β
exclude_none (bool) β
encoder (Optional[Callable[[Any], Any]]) β
models_as_dict (b... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-30 | property lc_serializable: boolο
Return whether or not the class is serializable.
abstract property memory_variables: List[str]ο
Input keys this memory class will load dynamically.
class langchain.schema.BaseChatMessageHistory[source]ο
Bases: abc.ABC
Base interface for chat message history
See ChatMessageHistory for def... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-31 | Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β fields to exclude from new model, as with values this takes preced... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-32 | include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (bool) β
exclude_defaults (bool) β
exclude_none (bool) β
encoder (Optional[Callable[[Any], Any]]) β
models_as_dict (b... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-33 | Get documents relevant for a query.
Parameters
query (str) β string to find relevant documents for
Returns
List of relevant documents
Return type
List[langchain.schema.Document]
langchain.schema.Memoryο
alias of langchain.schema.BaseMemory
class langchain.schema.BaseLLMOutputParser[source]ο
Bases: langchain.load.serial... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-34 | Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-35 | Return type
None
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:... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-36 | update (Optional[DictStrAny]) β 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 (bool) β set to True to make a deep copy of the model
self (Model) β
Returns
new model instance
Return type
Model
dict(**kwargs)[source]ο
Return dictiona... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-37 | Returns
structured output
Return type
langchain.schema.T
parse_result(result)[source]ο
Parse LLM Result.
Parameters
result (List[langchain.schema.Generation]) β
Return type
langchain.schema.T
parse_with_prompt(completion, prompt)[source]ο
Optional method to parse the output of an LLM call with a prompt.
The prompt is ... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-38 | Return type
None
classmethod construct(_fields_set=None, **values)ο
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
Parameters
_fie... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-39 | Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (bool) β
exclude_defaults (bool) β
exclude_none (bool) β
encoder (Optional[Callable[[Any], Any]]) β
models... | https://api.python.langchain.com/en/latest/modules/base_classes.html |
2dbde574187e-40 | 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/modules/base_classes.html |
2dbde574187e-41 | Asynchronously transform a list of documents.
Parameters
documents (Sequence[langchain.schema.Document]) β
kwargs (Any) β
Return type
Sequence[langchain.schema.Document] | https://api.python.langchain.com/en/latest/modules/base_classes.html |
f09a5cce5e87-0 | Chat Modelsο
class langchain.chat_models.ChatOpenAI(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model='gpt-3.5-turbo', temperature=0.7, model_kwargs=None, openai_api_key=None, openai_api_base=None, openai_organization=None, openai_proxy=None, request_timeout=None, max_ret... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-1 | max_retries (int) β
streaming (bool) β
n (int) β
max_tokens (Optional[int]) β
tiktoken_model_name (Optional[str]) β
Return type
None
attribute max_retries: int = 6ο
Maximum number of retries to make when generating.
attribute max_tokens: Optional[int] = Noneο
Maximum number of tokens to generate.
attribute model_k... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-2 | be the same as the embedding model name. However, there are some cases
where you may want to use this Embedding class with a model name not
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... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-3 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.chat_models.AzureChatOpenAI(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model='gpt-3.5-turbo', temperature=0.7, model_kwargs=None, openai_api_key='', openai_api_base='', opena... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-4 | Parameters
cache (Optional[bool]) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
tags (Optional[List[str]]) β
client (Any) β
model (str) β... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-5 | Fake ChatModel for testing purposes.
Parameters
cache (Optional[bool]) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
tags (Optional[List[st... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-6 | Generation object.
cache (Optional[bool]) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
tags (Optional[List[str]]) β
client (Any) β
model... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-7 | Wrapper around Anthropicβs large language model.
To use, you should have the anthropic python package installed, and the
environment variable ANTHROPIC_API_KEY set with your API key, or pass
it as a named parameter to the constructor.
Example
import anthropic
from langchain.llms import Anthropic
model = ChatAnthropic(m... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-8 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.chat_models.ChatGooglePalm(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model_name='models/chat-bison-001', google_api_key=None, temperature=None, top_p=None, top_k=None, n=1)[... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-9 | not return the full n completions if duplicates are generated.
attribute temperature: Optional[float] = Noneο
Run inference with this temperature. Must by in the closed
interval [0.0, 1.0].
attribute top_k: Optional[int] = Noneο
Decode using top-k sampling: consider the set of top_k most probable tokens.
Must be positi... | https://api.python.langchain.com/en/latest/modules/chat_models.html |
f09a5cce5e87-10 | location (str) β
credentials (Any) β
request_parallelism (int) β
Return type
None
attribute model_name: str = 'chat-bison'ο
Model name to use. | https://api.python.langchain.com/en/latest/modules/chat_models.html |
45b46cec0462-0 | LLMsο
Wrappers on top of large language models APIs.
class langchain.llms.AI21(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, model='j2-jumbo-instruct', temperature=0.7, maxTokens=256, minTokens=0, topP=1.0, presencePenalty=AI21PenaltyData(scale=0, applyToWhitespaces=True, applyToPunctua... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-1 | maxTokens (int) β
minTokens (int) β
topP (float) β
presencePenalty (langchain.llms.ai21.AI21PenaltyData) β
countPenalty (langchain.llms.ai21.AI21PenaltyData) β
frequencyPenalty (langchain.llms.ai21.AI21PenaltyData) β
numResults (int) β
logitBias (Optional[Dict[str, float]]) β
ai21_api_key (Optional[str]) β
sto... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-2 | Model name to use.
attribute numResults: int = 1ο
How many completions to generate for each prompt.
attribute presencePenalty: langchain.llms.ai21.AI21PenaltyData = AI21PenaltyData(scale=0, applyToWhitespaces=True, applyToPunctuations=True, applyToNumbers=True, applyToStopwords=True, applyToEmojis=True)ο
Penalizes repe... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-3 | async agenerate_prompt(prompts, stop=None, callbacks=None, **kwargs)ο
Take in a list of prompt values and return an LLMResult.
Parameters
prompts (List[langchain.schema.PromptValue]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.B... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-4 | exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) β 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 (bool... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-5 | Get the number of tokens in the message.
Parameters
messages (List[langchain.schema.BaseMessage]) β
Return type
int
get_token_ids(text)ο
Get the token present in the text.
Parameters
text (str) β
Return type
List[int]
json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-6 | save(file_path)ο
Save the LLM.
Parameters
file_path (Union[pathlib.Path, str]) β Path to file to save the LLM to.
Return type
None
Example:
.. code-block:: python
llm.save(file_path=βpath/llm.yamlβ)
classmethod update_forward_refs(**localns)ο
Try to update ForwardRefs on fields based on this Model, globalns and localns... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-7 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.llms.AlephAlpha(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model='luminous-base', maximum_tokens=64, temperature=0.0, top_k=0, top_p=0.0, presence_penalty=0.0, frequency_pena... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-8 | Example
from langchain.llms import AlephAlpha
aleph_alpha = AlephAlpha(aleph_alpha_api_key="my-api-key")
Parameters
cache (Optional[bool]) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
callback_manager (Optional[lang... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-9 | completion_bias_exclusion_first_token_only (bool) β
contextual_control_threshold (Optional[float]) β
control_log_additive (Optional[bool]) β
repetition_penalties_include_completion (bool) β
raw_completion (bool) β
aleph_alpha_api_key (Optional[str]) β
stop_sequences (Optional[List[str]]) β
Return type
None
attri... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-10 | The maximum number of tokens to be generated.
attribute minimum_tokens: Optional[int] = 0ο
Generate at least this number of tokens.
attribute model: Optional[str] = 'luminous-base'ο
Model name to use.
attribute n: int = 1ο
How many completions to generate for each prompt.
attribute penalty_bias: Optional[str] = Noneο
P... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-11 | Total probability mass of tokens to consider at each step.
attribute use_multiplicative_presence_penalty: Optional[bool] = Falseο
Flag deciding whether presence penalty is applied
multiplicatively (True) or additively (False).
attribute verbose: bool [Optional]ο
Whether to print out response text.
__call__(prompt, stop... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-12 | Predict text from text.
Parameters
text (str) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
str
async apredict_messages(messages, *, stop=None, **kwargs)ο
Predict message from messages.
Parameters
messages (List[langchain.schema.BaseMessage]) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Retur... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-13 | Parameters
kwargs (Any) β
Return type
Dict
generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameters
prompts (List[str]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.b... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-14 | 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().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-15 | 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]ο
Return a map of constructor ar... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-16 | output transform functions to handle formats between LLM
and the endpoint.
attribute model_kwargs: Optional[Dict] = Noneο
Key word arguments to pass to the model.
attribute tags: Optional[List[str]] = Noneο
Tags to add to the run trace.
attribute verbose: bool [Optional]ο
Whether to print out response text.
__call__(pr... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-17 | Predict text from text.
Parameters
text (str) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
str
async apredict_messages(messages, *, stop=None, **kwargs)ο
Predict message from messages.
Parameters
messages (List[langchain.schema.BaseMessage]) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Retur... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-18 | Parameters
kwargs (Any) β
Return type
Dict
generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameters
prompts (List[str]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.b... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-19 | 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().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-20 | 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]ο
Return a map of constructor ar... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-21 | # Or if you want to use the chat mode, build a few-shot-prompt, or
# put words in the Assistant's mouth, use HUMAN_PROMPT and AI_PROMPT:
raw_prompt = "What are the biggest risks facing humanity?"
prompt = f"{anthropic.HUMAN_PROMPT} {prompt}{anthropic.AI_PROMPT}"
response = model(prompt)
Parameters
client (Any) β
model... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-22 | Whether to stream the results.
attribute tags: Optional[List[str]] = Noneο
Tags to add to the run trace.
attribute temperature: Optional[float] = Noneο
A non-negative float that tunes the degree of randomness in generation.
attribute top_k: Optional[int] = Noneο
Number of most likely tokens to consider at each step.
at... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-23 | kwargs (Any) β
Return type
langchain.schema.LLMResult
async apredict(text, *, stop=None, **kwargs)ο
Predict text from text.
Parameters
text (str) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
str
async apredict_messages(messages, *, stop=None, **kwargs)ο
Predict message from messages.
Parameters
mes... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-24 | Returns
new model instance
Return type
Model
dict(**kwargs)ο
Return a dictionary of the LLM.
Parameters
kwargs (Any) β
Return type
Dict
generate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameters
prompts (List[str]) β
stop (Optional[List[str]]) β
callba... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-25 | 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().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) β
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-26 | Parameters
prompt (str) β The prompt to pass into the model.
stop (Optional[List[str]]) β Optional list of stop words to use when generating.
Returns
A generator representing the stream of tokens from Anthropic.
Return type
Generator
Example
prompt = "Write a poem about a stream."
prompt = f"\n\nHuman: {prompt}\n\nAssi... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-27 | Service, or pass it as a named parameter to the constructor.
Example
from langchain.llms import Anyscale
anyscale = Anyscale(anyscale_service_url="SERVICE_URL",
anyscale_service_route="SERVICE_ROUTE",
anyscale_service_token="SERVICE_TOKEN")
# Use Ray for distributed processing
im... | https://api.python.langchain.com/en/latest/modules/llms.html |
45b46cec0462-28 | kwargs (Any) β
Return type
str
async agenerate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameters
prompts (List[str]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.B... | https://api.python.langchain.com/en/latest/modules/llms.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.