id
stringlengths
14
16
text
stringlengths
31
2.41k
source
stringlengths
53
121
45b46cec0462-29
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/llms.html
45b46cec0462-30
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.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema....
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-31
dumps_kwargs (Any) – Return type unicode predict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messages (List[langchain.schem...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-32
property lc_serializable: bool Return whether or not the class is serializable. class langchain.llms.Aviary(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, model='amazon/LightGPT', aviary_url=None, aviary_token=None, use_prompt_format=True, version=None)[source] Bases: langchain.llms.ba...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-33
Tags to add to the run trace. attribute verbose: bool [Optional] Whether to print out response text. __call__(prompt, stop=None, callbacks=None, **kwargs) Check Cache and run the LLM on the given prompt and input. Parameters prompt (str) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callba...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-34
Predict message from messages. Parameters messages (List[langchain.schema.BaseMessage]) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type langchain.schema.BaseMessage classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated d...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-35
Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[str]]) – kwargs (Any) – Return type langchain.schema.LLMResult generate_prompt(prompts, stop=None, callba...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-36
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/llms.html
45b46cec0462-37
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/modules/llms.html
45b46cec0462-38
attribute content_formatter: Any = None The content formatter that provides an input and output transform function to handle formats between the LLM and the endpoint attribute deployment_name: str = '' Deployment Name for Endpoint. Should be passed to constructor or specified as env var AZUREML_DEPLOYMENT_NAME. attri...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-39
kwargs (Any) – Return type langchain.schema.LLMResult 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.callback...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-40
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-41
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-42
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-43
property lc_serializable: bool Return whether or not the class is serializable. class langchain.llms.AzureOpenAI(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model='text-davinci-003', temperature=0.7, max_tokens=256, top_p=1, frequency_penalty=0, presence_penalty=0, n=1, ...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-44
max_tokens (int) – top_p (float) – frequency_penalty (float) – presence_penalty (float) – n (int) – best_of (int) – model_kwargs (Dict[str, Any]) – openai_api_key (Optional[str]) – openai_api_base (Optional[str]) – openai_organization (Optional[str]) – openai_proxy (Optional[str]) – batch_size (int) – reque...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-45
attribute logit_bias: Optional[Dict[str, float]] [Optional] Adjust the probability of specific tokens being generated. attribute max_retries: int = 6 Maximum number of retries to make when generating. attribute max_tokens: int = 256 The maximum number of tokens to generate in the completion. -1 returns as many token...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-46
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. attribute top_p: float = 1 Total prob...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-47
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-48
self (Model) – Returns new model instance Return type Model create_llm_result(choices, prompts, token_usage) Create the LLMResult from the choices and prompts. Parameters choices (Any) – prompts (List[str]) – token_usage (Dict[str, int]) – Return type langchain.schema.LLMResult dict(**kwargs) Return a dictionary ...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-49
Parameters messages (List[langchain.schema.BaseMessage]) – Return type int get_sub_prompts(params, prompts, stop=None) Get the sub prompts for llm call. Parameters params (Dict[str, Any]) – prompts (List[str]) – stop (Optional[List[str]]) – Return type List[List[str]] get_token_ids(text) Get the token IDs using t...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-50
int Example max_tokens = openai.max_token_for_prompt("Tell me a joke.") static modelname_to_contextsize(modelname) Calculate the maximum number of tokens possible to generate for a model. Parameters modelname (str) – The modelname we want to know the context size for. Returns The maximum context size Return type int E...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-51
stop (Optional[List[str]]) – Optional list of stop words to use when generating. Returns A generator representing the stream of tokens from OpenAI. Return type Generator Example generator = openai.stream("Tell me a joke.") for token in generator: yield token classmethod update_forward_refs(**localns) Try to update...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-52
Example from langchain.llms import Banana banana = Banana(model_key="") Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain.callbacks.base.BaseCallback...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-53
kwargs (Any) – Return type langchain.schema.LLMResult 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.callback...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-54
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-55
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-56
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-57
be passed in with the format input={model_param: value, …} The Baseten model must accept a dictionary of input with the key β€œprompt” and return a dictionary with a key β€œdata” which maps to a list of response strings. Example Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[List[langchain...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-58
kwargs (Any) – Return type langchain.schema.LLMResult 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.callback...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-59
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-60
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-61
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-62
to get these is available here: https://docs.beam.cloud/account/api-keys. The wrapper can then be called as follows, where the name, cpu, memory, gpu, python version, and python packages can be updated accordingly. Once deployed, the instance can be called. Example llm = Beam(model_name="gpt2", name="langchain-gpt2...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-63
Holds any model parameters valid for create call not explicitly specified. attribute tags: Optional[List[str]] = None Tags to add to the run trace. attribute url: str = '' model endpoint to use attribute verbose: bool [Optional] Whether to print out response text. __call__(prompt, stop=None, callbacks=None, **kwargs...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-64
Creates a Python file which will contain your Beam app definition. Return type None 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 ...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-65
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-66
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-67
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 must be accepted by the constructor. property lc_namespace: List[str] Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œo...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-68
client (Any) – region_name (Optional[str]) – credentials_profile_name (Optional[str]) – model_id (str) – model_kwargs (Optional[Dict]) – Return type None attribute credentials_profile_name: Optional[str] = None The name of the profile in the ~/.aws/credentials or ~/.aws/config files, which has either access keys ...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-69
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
45b46cec0462-70
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/llms.html
45b46cec0462-71
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.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema....
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-72
dumps_kwargs (Any) – Return type unicode predict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messages (List[langchain.schem...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-73
property lc_serializable: bool Return whether or not the class is serializable. class langchain.llms.CTransformers(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model, model_type=None, model_file=None, config=None, lib=None)[source] Bases: langchain.llms.base.LLM Wrapper ...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-74
model repo. attribute model_file: Optional[str] = None The name of the model file in repo or directory. attribute model_type: Optional[str] = None The model type. attribute tags: Optional[List[str]] = None Tags to add to the run trace. attribute verbose: bool [Optional] Whether to print out response text. __call__(...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-75
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 messages (List[langchain.schema.BaseMessage]) – stop (Opt...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-76
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]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbac...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-77
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-78
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-79
cerebriumai_api_key (Optional[str]) – Return type None attribute endpoint_url: str = '' model endpoint to use attribute model_kwargs: Dict[str, Any] [Optional] Holds any model parameters valid for create call not explicitly specified. attribute tags: Optional[List[str]] = None Tags to add to the run trace. attribut...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-80
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-81
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-82
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-83
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-84
callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) – tags (Optional[List[str]]) – stub (Any) – metadata (Any) – userDataObject (Any) – model_id (Optional[str]) – model_version_id (Optional[str]) – app_id (Optional[str]) – user_id (Optional[str]) – clarifai_pat_key (Optional[str]) – api_...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-85
Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[str]]) – kwargs (Any) – Return type langchain.schema.LLMResult async agenerate_prompt(prompts, stop=None,...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-86
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/llms.html
45b46cec0462-87
kwargs (Any) – Return type langchain.schema.LLMResult get_num_tokens(text) Get the number of tokens present in the text. Parameters text (str) – Return type int get_num_tokens_from_messages(messages) Get the number of tokens in the message. Parameters messages (List[langchain.schema.BaseMessage]) – Return type int...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-88
Predict message from messages. Parameters messages (List[langchain.schema.BaseMessage]) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type langchain.schema.BaseMessage 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...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-89
Bases: langchain.llms.base.LLM Wrapper around Cohere large language models. To use, you should have the cohere python package installed, and the environment variable COHERE_API_KEY set with your API key, or pass it as a named parameter to the constructor. Example from langchain.llms import Cohere cohere = Cohere(model=...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-90
Model name to use. attribute p: int = 1 Total probability mass of tokens to consider at each step. attribute presence_penalty: float = 0.0 Penalizes repeated tokens. Between 0 and 1. attribute tags: Optional[List[str]] = None Tags to add to the run trace. attribute temperature: float = 0.75 A non-negative float tha...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-91
Parameters prompts (List[langchain.schema.PromptValue]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema.LLMResult async apredict(text, *, stop=None, **kwargs) P...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-92
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) Return a dictionary of the LLM. Parameters kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwarg...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-93
Parameters text (str) – Return type List[int] 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 di...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-94
.. 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. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-95
inputs: [{"name": "prompt", "type": "string"}, {"name": "stop", "type": "list[string]"}] outputs: [{"type": "string"}] Cluster driver proxy app (recommended for interactive development). One can load an LLM on a Databricks interactive cluster and start a local HTTP server on the driver node to serve the model at / usi...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-96
cluster_id (Optional[str]) – cluster_driver_port (Optional[str]) – model_kwargs (Optional[Dict[str, Any]]) – transform_input_fn (Optional[Callable]) – transform_output_fn (Optional[Callable[[...], str]]) – Return type None attribute api_token: str [Optional] Databricks personal access token. If not provided, the ...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-97
the DATABRICKS_HOST environment variable if present, or the hostname of the current Databricks workspace if running inside a Databricks notebook attached to an interactive cluster in β€œsingle user” or β€œno isolation shared” mode. attribute model_kwargs: Optional[Dict[str, Any]] = None Extra parameters to pass to the end...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-98
kwargs (Any) – Return type langchain.schema.LLMResult 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.callback...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-99
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-100
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-101
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-102
di = DeepInfra(model_id="google/flan-t5-xl", deepinfra_api_token="my-api-key") Parameters cache (Optional[bool]) – verbose (bool) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – callback_manager (Optional[langchain....
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-103
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.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema....
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-104
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) Return a dictionary of ...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-105
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_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representati...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-106
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. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-107
attribute verbose: bool [Optional] Whether to print out response text. __call__(prompt, stop=None, callbacks=None, **kwargs) Check Cache and run the LLM on the given prompt and input. Parameters prompt (str) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler],...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-108
Predict message from messages. Parameters messages (List[langchain.schema.BaseMessage]) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type langchain.schema.BaseMessage classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated d...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-109
Parameters prompts (List[str]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[str]]) – kwargs (Any) – Return type langchain.schema.LLMResult generate_prompt(prompts, stop=None, callba...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-110
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/llms.html
45b46cec0462-111
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/modules/llms.html
45b46cec0462-112
Return type None attribute base_url: Optional[str] = None Base url to use, if None decides based on model name. attribute endpoint_url: str = '' Model name to use. attribute length: int = 256 The maximum number of tokens to generate in the completion. attribute repetition_penalty: int = 1 Penalizes repeated tokens ...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-113
kwargs (Any) – Return type langchain.schema.LLMResult 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.callback...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-114
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-115
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-116
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-117
Bases: langchain.llms.base.LLM Wrapper around GPT4All language models. To use, you should have the gpt4all python package installed, the pre-trained model file, and the model’s config information. Example from langchain.llms import GPT4All model = GPT4All(model="./models/gpt4all-model.bin", n_ctx=512, n_threads=8) # Si...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-118
Return type None attribute allow_download: bool = False If model does not exist in ~/.cache/gpt4all/, download it. attribute context_erase: float = 0.5 Leave (n_ctx * context_erase) tokens starting from beginning if the context has run out. attribute echo: Optional[bool] = False Whether to echo the prompt. attribute...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-119
attribute tags: Optional[List[str]] = None Tags to add to the run trace. attribute temp: Optional[float] = 0.8 The temperature to use for sampling. attribute top_k: Optional[int] = 40 The top-k value to use for sampling. attribute top_p: Optional[float] = 0.95 The top-p value to use for sampling. attribute use_mloc...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-120
Parameters prompts (List[langchain.schema.PromptValue]) – stop (Optional[List[str]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema.LLMResult async apredict(text, *, stop=None, **kwargs) P...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-121
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) Return a dictionary of the LLM. Parameters kwargs (Any) – Return type Dict generate(prompts, stop=None, callbacks=None, *, tags=None, **kwarg...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-122
Parameters text (str) – Return type List[int] 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 di...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-123
.. 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. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-124
temperature (float) – top_p (Optional[float]) – top_k (Optional[int]) – max_output_tokens (Optional[int]) – n (int) – Return type None attribute max_output_tokens: Optional[int] = None Maximum number of tokens to include in a candidate. Must be greater than zero. If unset, will default to 64. attribute model_name...
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-125
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
45b46cec0462-126
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/llms.html
45b46cec0462-127
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.BaseCallbackManager]]) – kwargs (Any) – Return type langchain.schema....
https://api.python.langchain.com/en/latest/modules/llms.html
45b46cec0462-128
dumps_kwargs (Any) – Return type unicode predict(text, *, stop=None, **kwargs) Predict text from text. Parameters text (str) – stop (Optional[Sequence[str]]) – kwargs (Any) – Return type str predict_messages(messages, *, stop=None, **kwargs) Predict message from messages. Parameters messages (List[langchain.schem...
https://api.python.langchain.com/en/latest/modules/llms.html