id
stringlengths
14
16
text
stringlengths
36
2.73k
source
stringlengths
59
127
14c2a1c4ad3b-21
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-22
Get the token present in the text. 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: ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-23
eg. [“langchain”, “llms”, “openai”] property lc_secrets: Dict[str, str]# Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”} property lc_serializable: bool# Return whether or not the class is serializable. pydantic model langchain.llms.AzureOpenAI[source]# Wrapper around A...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-24
Adjust the probability of specific tokens being generated. field max_retries: int = 6# Maximum number of retries to make when generating. field max_tokens: int = 256# 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. f...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-25
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → lang...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-26
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-27
Get the sub prompts for llm call. get_token_ids(text: str) → List[int]# Get the token IDs using the tiktoken package. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-28
Predict message from messages. prep_streaming_params(stop: Optional[List[str]] = None) → Dict[str, Any]# Prepare the params for streaming. save(file_path: Union[pathlib.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/llm....
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-29
pydantic model langchain.llms.Banana[source]# Wrapper around Banana large language models. To use, you should have the banana-dev python package installed, and the environment variable BANANA_API_KEY set with your API key. Any parameters that are valid to be passed to the call can be passed in, even if not explicitly s...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-30
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → langchain.schema.LLMResul...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-31
deep – set to True to make a deep copy of the model Returns new model instance dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackMan...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-32
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(). predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. predict_messages(...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-33
The required model param can be either a model id or model version id. Using a model version ID will result in slightly faster invocation. Any other model parameters can also 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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-34
Predict text from text. async apredict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → langchain.schema.BaseMessage# Predict message from messages. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model# Creates a new model set...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-35
Run the LLM on the given prompt and input. generate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → langchain.schema.LLMResult# Take...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-36
save(file_path: Union[pathlib.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/llm.yaml”) classmethod update_forward_refs(**localns: Any) → None# Try to update ForwardRefs on fields based on this Model, globalns and localn...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-37
memory="32Gi", gpu="A10G", python_version="python3.8", python_packages=[ "diffusers[torch]>=0.10", "transformers", "torch", "pillow", "accelerate", "safetensors", "xformers",], max_length=50) llm._deploy() call_result = llm._call(input) Validators ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-38
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → langchain.schema.LLMResul...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-39
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# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler]...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-40
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(). predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. predict_messages(...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-41
To authenticate, the AWS client uses the following methods to automatically load credentials: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html If a specific credential profile should be used, you must pass the name of the profile from the ~/.aws/credentials file that is to be used. Make su...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-42
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → lang...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-43
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-44
Get the token present in the text. 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: ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-45
eg. [“langchain”, “llms”, “openai”] property lc_secrets: Dict[str, str]# Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”} property lc_serializable: bool# Return whether or not the class is serializable. pydantic model langchain.llms.CTransformers[source]# Wrapper around...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-46
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → lang...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-47
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-48
Get the token present in the text. 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: ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-49
eg. [“langchain”, “llms”, “openai”] property lc_secrets: Dict[str, str]# Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”} property lc_serializable: bool# Return whether or not the class is serializable. pydantic model langchain.llms.CerebriumAI[source]# Wrapper around C...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-50
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → lang...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-51
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-52
Get the token present in the text. 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: ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-53
eg. [“langchain”, “llms”, “openai”] property lc_secrets: Dict[str, str]# Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”} property lc_serializable: bool# Return whether or not the class is serializable. pydantic model langchain.llms.Cohere[source]# Wrapper around Cohere...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-54
A non-negative float that tunes the degree of randomness in generation. field truncate: Optional[str] = None# Specify how the client handles inputs longer than the maximum token length: Truncate from START, END or NONE field verbose: bool [Optional]# Whether to print out response text. __call__(prompt: str, stop: Optio...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-55
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-56
get_num_tokens(text: str) → int# Get the number of tokens present in the text. get_num_tokens_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present in the text. json(*, include: Optional[Union[AbstractSetIn...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-57
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]# ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-58
Set cluster_id and cluster_driver_port and do not set endpoint_name. The expected server schema (using JSON schema) is: inputs: {"type": "object", "properties": { "prompt": {"type": "string"}, "stop": {"type": "array", "items": {"type": "string"}}}, "required": ["prompt"]}` outputs: {"type": "string"} If the ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-59
or “no isolation shared” mode, the current cluster ID is used as default. You must not set both endpoint_name and cluster_id. field endpoint_name: Optional[str] = None# Name of the model serving endpont. You must specify the endpoint name to connect to a model serving endpoint. You must not set both endpoint_name and c...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-60
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → lang...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-61
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-62
Get the token present in the text. 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: ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-63
eg. [“langchain”, “llms”, “openai”] property lc_secrets: Dict[str, str]# Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”} property lc_serializable: bool# Return whether or not the class is serializable. pydantic model langchain.llms.DeepInfra[source]# Wrapper around Dee...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-64
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → langchain.schema.LLMResul...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-65
deep – set to True to make a deep copy of the model Returns new model instance dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackMan...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-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(). predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. predict_messages(...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-67
field tags: Optional[List[str]] = None# Tags to add to the run trace. field verbose: bool [Optional]# Whether to print out response text. __call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] =...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-68
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-69
Get the number of tokens present in the text. get_num_tokens_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present in the text. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-70
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]# ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-71
Total probability mass of tokens to consider at each step. field verbose: bool [Optional]# Whether to print out response text. __call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kw...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-72
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-73
Get the number of tokens present in the text. get_num_tokens_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present in the text. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-74
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]# ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-75
Return logits for all tokens, not just the last token. field model: str [Required]# Path to the pre-trained GPT4All model file. field n_batch: int = 1# Batch size for prompt processing. field n_ctx: int = 512# Token context window. field n_parts: int = -1# Number of parts to split the model into. If -1, the number of p...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-76
field vocab_only: bool = False# Only load the vocabulary, no weights. __call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → str# Check Cache and run the LLM on the give...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-77
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-78
get_num_tokens_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present in the text. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, Map...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-79
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-80
field verbose: bool [Optional]# Whether to print out response text. __call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → str# Check Cache and run the LLM on the given ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-81
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-82
get_num_tokens_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present in the text. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, Map...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-83
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-84
Holds any model parameters valid for create call not explicitly specified. field model_name: str = 'gpt-neo-20b'# Model name to use field n: int = 1# How many completions to generate for each prompt. field presence_penalty: float = 0# Penalizes repeated tokens. field tags: Optional[List[str]] = None# Tags to add to the...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-85
Take in a list of prompt values and return an LLMResult. async apredict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. async apredict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → langchain.schema.BaseM...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-86
dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → langchain....
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-87
predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. predict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → langchain.schema.BaseMessage# Predict message from messages. save(file_path: Union[pathlib.Pa...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-88
Example from langchain.llms import HuggingFaceEndpoint endpoint_url = ( "https://abcdefghijklmnop.us-east-1.aws.endpoints.huggingface.cloud" ) hf = HuggingFaceEndpoint( endpoint_url=endpoint_url, huggingfacehub_api_token="my-api-key" ) Validators raise_deprecation » all fields set_verbose » verbose validate...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-89
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → langchain.schema.LLMResul...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-90
deep – set to True to make a deep copy of the model Returns new model instance dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackMan...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-91
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(). predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. predict_messages(...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-92
environment variable HUGGINGFACEHUB_API_TOKEN set with your API token, or pass it as a named parameter to the constructor. Only supports text-generation, text2text-generation and summarization for now. Example from langchain.llms import HuggingFaceHub hf = HuggingFaceHub(repo_id="gpt2", huggingfacehub_api_token="my-api...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-93
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → langchain.schema.LLMResul...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-94
deep – set to True to make a deep copy of the model Returns new model instance dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackMan...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-95
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(). predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. predict_messages(...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-96
Only supports text-generation, text2text-generation and summarization for now. Example using from_model_id:from langchain.llms import HuggingFacePipeline hf = HuggingFacePipeline.from_model_id( model_id="gpt2", task="text-generation", pipeline_kwargs={"max_new_tokens": 10}, ) Example passing pipeline in dir...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-97
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → lang...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-98
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-99
Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present in the text. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = No...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-100
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-101
Tags to add to the run trace. field verbose: bool [Optional]# Whether to print out response text. __call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → str# Check Cache...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-102
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-103
Get the number of tokens present in the text. get_num_tokens_from_messages(messages: List[langchain.schema.BaseMessage]) → int# Get the number of tokens in the message. get_token_ids(text: str) → List[int]# Get the token present in the text. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-104
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]# ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-105
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → langchain.schema.LLMResul...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-106
deep – set to True to make a deep copy of the model Returns new model instance dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackMan...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-107
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(). predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. predict_messages(...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-108
path to the Llama model as a named parameter to the constructor. Check out: abetlen/llama-cpp-python Example from langchain.llms import LlamaCppEmbeddings llm = LlamaCppEmbeddings(model_path="/path/to/llama/model") Validators raise_deprecation » all fields set_verbose » verbose validate_environment » all fields field e...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-109
field n_parts: int = -1# Number of parts to split the model into. If -1, the number of parts is automatically determined. field n_threads: Optional[int] = None# Number of threads to use. If None, the number of threads is automatically determined. field repeat_penalty: Optional[float] = 1.1# The penalty to apply to repe...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-110
Check Cache and run the LLM on the given prompt and input. async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → lang...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-111
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...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-112
Get the token present in the text. 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: ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-113
It also calls the callback manager’s on_llm_new_token event with similar parameters to the OpenAI LLM class method of the same name. Args:prompt: The prompts to pass into the model. stop: Optional list of stop words to use when generating. Returns:A generator representing the stream of tokens being generated. Yields:A ...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-114
To use, you should have the modal-client python package installed. Any parameters that are valid to be passed to the call can be passed in, even if not explicitly saved on this class. Example from langchain.llms import Modal modal = Modal(endpoint_url="") Validators build_extra » all fields raise_deprecation » all fiel...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-115
Take in a list of prompt values and return an LLMResult. async apredict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. async apredict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → langchain.schema.BaseM...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-116
dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, **kwargs: Any) → langchain....
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-117
predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str# Predict text from text. predict_messages(messages: List[langchain.schema.BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → langchain.schema.BaseMessage# Predict message from messages. save(file_path: Union[pathlib.Pa...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-118
) mosaic_llm = MosaicML( endpoint_url=endpoint_url, mosaicml_api_token="my-api-key" ) Validators raise_deprecation » all fields set_verbose » verbose validate_environment » all fields field endpoint_url: str = 'https://models.hosted-on.mosaicml.hosting/mpt-7b-instruct/v1/predict'# Endpoint URL to use. field inj...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-119
Run the LLM on the given prompt and input. async agenerate_prompt(prompts: List[langchain.schema.PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]] = None, **kwargs: Any) → langchain.schema.LLMResul...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html
14c2a1c4ad3b-120
deep – set to True to make a deep copy of the model Returns new model instance dict(**kwargs: Any) → Dict# Return a dictionary of the LLM. generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackMan...
rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html