id stringlengths 14 16 | text stringlengths 4 1.28k | source stringlengths 54 121 |
|---|---|---|
0e0436a883fe-111 | 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 dict().
encoder is an optio... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-112 | models_as_dict (bool) β
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
messa... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-113 | 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 must be accepted by th... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-114 | class langchain.llms.Baseten(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, model, input=None, model_kwargs=None)[source]ο
Bases: langchain.llms.base.LLM
Use your Baseten models in Langchain
To use, you should have the baseten python package installed,
and run baseten.login() with your B... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-115 | 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]]) β
model (str) β
input (Dict[str, Any]) β ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-116 | stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
kwargs (Any) β
Return type
str
async agenerate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameter... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-117 | 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 |
0e0436a883fe-118 | 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
_fields_set (Optional[SetStr]) β
values (Any) β
Return type
Model
copy... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-119 | 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 |
0e0436a883fe-120 | 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 |
0e0436a883fe-121 | 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 dict().
encoder is an optio... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-122 | models_as_dict (bool) β
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
messa... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-123 | 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 must be accepted by th... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-124 | class langchain.llms.Beam(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, model_name='', name='', cpu='', memory='', gpu='', python_version='', python_packages=[], max_length='', url='', model_kwargs=None, beam_client_id='', beam_client_secret='', app_id=None)[source]ο
Bases: langchain.ll... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-125 | the instance can be called.
Example
llm = Beam(model_name="gpt2",
name="langchain-gpt2",
cpu=8,
memory="32Gi",
gpu="A10G",
python_version="python3.8",
python_packages=[
"diffusers[torch]>=0.10",
"transformers",
"torch",
"pillow",
"accelerate",
"saf... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-126 | callback_manager (Optional[langchain.callbacks.base.BaseCallbackManager]) β
tags (Optional[List[str]]) β
model_name (str) β
name (str) β
cpu (str) β
memory (str) β
gpu (str) β
python_version (str) β
python_packages (List[str]) β
max_length (str) β
url (str) β
model_kwargs (Dict[str, Any]) β
beam_client_id (... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-127 | attribute url: str = ''ο
model endpoint to use
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... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-128 | tags (Optional[List[str]]) β
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... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-129 | 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) β
Return type
langchain.schema.BaseMessage
classmethod c... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-130 | 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/llms.html |
0e0436a883fe-131 | 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.BaseCallbackManager]]) β
tags (Optional[List[str]]) β
kwargs (Any) β
Return type
langchain.schema.LLMResult... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-132 | 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
get_token_ids(text)ο
Get the token present in the text... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-133 | 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/llms.html |
0e0436a883fe-134 | Predict message from messages.
Parameters
messages (List[langchain.schema.BaseMessage]) β
stop (Optional[Sequence[str]]) β
kwargs (Any) β
Return type
langchain.schema.BaseMessage
run_creation()[source]ο
Creates a Python file which will be deployed on beam.
Return type
None
save(file_path)ο
Save the LLM.
Parameters
f... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-135 | 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: Dict[str, s... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-136 | LLM provider to invoke Bedrock models.
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/crede... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-137 | 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 or role information specified.
If not specified... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-138 | Key word arguments to pass to the model.
attribute region_name: Optional[str] = Noneο
The aws region e.g., us-west-2. Fallsback to AWS_DEFAULT_REGION env variable
or region specified in ~/.aws/config in case it is not provided here.
attribute tags: Optional[List[str]] = Noneο
Tags to add to the run trace.
attribute ver... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-139 | 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.BaseCallbackManag... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-140 | 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 |
0e0436a883fe-141 | Parameters
_fields_set (Optional[SetStr]) β
values (Any) β
Return type
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 ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-142 | 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]]) β
callbacks (Optional[Union[List[langchain.call... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-143 | stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
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
i... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-144 | 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 dict().
encoder is an optio... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-145 | models_as_dict (bool) β
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
messa... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-146 | 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 must be accepted by th... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-147 | 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 around the C Transformers LLM interface.
To use, you should have the ctransformer... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-148 | tags (Optional[List[str]]) β
client (Any) β
model (str) β
model_type (Optional[str]) β
model_file (Optional[str]) β
config (Optional[Dict[str, Any]]) β
lib (Optional[str]) β
Return type
None
attribute config: Optional[Dict[str, Any]] = Noneο
The config parameters.
See https://github.com/marella/ctransformers#con... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-149 | 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__(prompt, stop=None, callbacks=None, **kwargs)ο
Check Cache and run the LLM on the given prompt and input.
Parameters
prompt (str) β
stop (Optional[Li... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-150 | 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, callbacks=None, **kwargs)ο
Take i... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-151 | 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) β
Return type
langchain.schema.... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-152 | Return type
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, MappingI... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-153 | 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.base.BaseCal... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-154 | 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 |
0e0436a883fe-155 | 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, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (bo... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-156 | Return type
str
predict_messages(messages, *, stop=None, **kwargs)ο
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.Pat... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-157 | 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/llms.html |
0e0436a883fe-158 | To use, you should have the cerebrium python package installed, and the
environment variable CEREBRIUMAI_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 saved on this class.
Example
from langchain.llms import CerebriumAI
cerebrium = Cerebriu... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-159 | 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.
attribute verbose: bool [Optional]ο
Whether to ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-160 | 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.BaseCallbackManager]]) β
tags (Optional[List[str]]) β
kwargs (Any) β
Return type
langchain.schema.LLMResult... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-161 | 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
messages (List[lang... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-162 | Parameters
_fields_set (Optional[SetStr]) β
values (Any) β
Return type
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 ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-163 | 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]]) β
callbacks (Optional[Union[List[langchain.call... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-164 | stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
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
i... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-165 | 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 dict().
encoder is an optio... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-166 | models_as_dict (bool) β
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
messa... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-167 | 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 must be accepted by th... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-168 | class langchain.llms.Clarifai(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, stub=None, metadata=None, userDataObject=None, model_id=None, model_version_id=None, app_id=None, user_id=None, clarifai_pat_key=None, api_base='https://api.clarifai.com', stop=None)[source]ο
Bases: langchain.ll... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-169 | from langchain.llms import Clarifai
clarifai_llm = Clarifai(clarifai_pat_key=CLARIFAI_PAT_KEY, user_id=USER_ID, app_id=APP_ID, model_id=MODEL_ID)
Parameters
cache (Optional[bool]) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-170 | api_base (str) β
stop (Optional[List[str]]) β
Return type
None
attribute app_id: Optional[str] = Noneο
Clarifai application id to use.
attribute model_id: Optional[str] = Noneο
Model id to use.
attribute model_version_id: Optional[str] = Noneο
Model version id to use.
attribute tags: Optional[List[str]] = Noneο
Tags ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-171 | stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
kwargs (Any) β
Return type
str
async agenerate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameter... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-172 | 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 |
0e0436a883fe-173 | 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
_fields_set (Optional[SetStr]) β
values (Any) β
Return type
Model
copy... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-174 | 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 |
0e0436a883fe-175 | 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 |
0e0436a883fe-176 | 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 dict().
encoder is an optio... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-177 | models_as_dict (bool) β
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
messa... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-178 | 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 must be accepted by th... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-179 | class langchain.llms.Cohere(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model=None, max_tokens=256, temperature=0.75, k=0, p=1, frequency_penalty=0.0, presence_penalty=0.0, truncate=None, max_retries=10, cohere_api_key=None, stop=None)[source]ο
Bases: langchain.llms.base.... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-180 | 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 (Optional[str]) β ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-181 | attribute k: int = 0ο
Number of most likely tokens to consider at each step.
attribute max_retries: int = 10ο
Maximum number of retries to make when generating.
attribute max_tokens: int = 256ο
Denotes the number of tokens to predict per generation.
attribute model: Optional[str] = Noneο
Model name to use.
attribute p:... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-182 | Specify how the client handles inputs longer than the maximum token
length: Truncate from START, END or NONE
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) β... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-183 | 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, callbacks=None, **kwargs)ο
Take i... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-184 | 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) β
Return type
langchain.schema.... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-185 | Return type
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, MappingI... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-186 | 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.base.BaseCal... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-187 | 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 |
0e0436a883fe-188 | 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, MappingIntStrAny]]) β
by_alias (bool) β
skip_defaults (Optional[bool]) β
exclude_unset (bo... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-189 | Return type
str
predict_messages(messages, *, stop=None, **kwargs)ο
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.Pat... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-190 | 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/llms.html |
0e0436a883fe-191 | LLM wrapper around a Databricks serving endpoint or a cluster driver proxy app.
It supports two endpoint types:
Serving endpoint (recommended for both production and development).
We assume that an LLM was registered and deployed to a serving endpoint.
To wrap it as an LLM you must have βCan Queryβ permission to the en... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-192 | with JSON input/output.
Please use a port number between [3000, 8000] and let the server listen to
the driver IP address or simply 0.0.0.0 instead of localhost only.
To wrap it as an LLM you must have βCan Attach Toβ permission to the cluster.
Set cluster_id and cluster_driver_port and do not set endpoint_name.
The exp... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-193 | 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]]) β
host (str) β
api_token (str)... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-194 | an automatically generated temporary token if running inside a Databricks
notebook attached to an interactive cluster in βsingle userβ or
βno isolation sharedβ mode.
attribute cluster_driver_port: Optional[str] = Noneο
The port number used by the HTTP server running on the cluster driver node.
The server should listen ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-195 | attribute 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 cluster_id.
attribute host: str [Optional]ο
Databricks workspace hostname.
If not provided, the default value is determined... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-196 | A function that transforms {prompt, stop, **kwargs} into a JSON-compatible
request object that the endpoint accepts.
For example, you can apply a prompt template to the input prompt.
attribute transform_output_fn: Optional[Callable[[...], str]] = Noneο
A function that transforms the output from the endpoint to the gene... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-197 | 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.BaseCallbackManag... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-198 | 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 |
0e0436a883fe-199 | Parameters
_fields_set (Optional[SetStr]) β
values (Any) β
Return type
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 ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-200 | 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]]) β
callbacks (Optional[Union[List[langchain.call... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-201 | stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
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
i... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-202 | 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 dict().
encoder is an optio... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-203 | models_as_dict (bool) β
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
messa... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-204 | 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 must be accepted by th... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-205 | class langchain.llms.DeepInfra(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, model_id='google/flan-t5-xl', model_kwargs=None, deepinfra_api_token=None)[source]ο
Bases: langchain.llms.base.LLM
Wrapper around DeepInfra deployed models.
To use, you should have the requests python package i... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-206 | 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]]) β
model_id (str) β
model_kwargs (Optional[dict]) β
deepinfra_api_t... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-207 | stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) β
kwargs (Any) β
Return type
str
async agenerate(prompts, stop=None, callbacks=None, *, tags=None, **kwargs)ο
Run the LLM on the given prompt and input.
Parameter... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-208 | 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 |
0e0436a883fe-209 | 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
_fields_set (Optional[SetStr]) β
values (Any) β
Return type
Model
copy... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-210 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.