id stringlengths 14 16 | text stringlengths 4 1.28k | source stringlengths 54 121 |
|---|---|---|
0e0436a883fe-511 | 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-512 | 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-513 | 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-514 | 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-515 | 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-516 | 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-517 | class langchain.llms.RWKV(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, model, tokens_path, strategy='cpu fp32', rwkv_verbose=True, temperature=1.0, top_p=0.5, penalty_alpha_frequency=0.4, penalty_alpha_presence=0.4, CHUNK_LEN=256, max_tokens_per_generation=256, client=None, tokenizer=N... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-518 | # Simplest invocation
response = model("Once upon a time, ")
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]) β... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-519 | model_tokens (Any) β
model_state (Any) β
Return type
None
attribute CHUNK_LEN: int = 256ο
Batch size for prompt processing.
attribute max_tokens_per_generation: int = 256ο
Maximum number of tokens to generate.
attribute model: str [Required]ο
Path to the pre-trained RWKV model file.
attribute penalty_alpha_frequency:... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-520 | Print debug information.
attribute strategy: str = 'cpu fp32'ο
Token context window.
attribute tags: Optional[List[str]] = Noneο
Tags to add to the run trace.
attribute temperature: float = 1.0ο
The temperature to use for sampling.
attribute tokens_path: str [Required]ο
Path to the RWKV tokens file.
attribute top_p: fl... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-521 | 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-522 | 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-523 | 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-524 | 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-525 | 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-526 | 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-527 | 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-528 | 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-529 | class langchain.llms.Replicate(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, model, input=None, model_kwargs=None, replicate_api_token=None)[source]ο
Bases: langchain.llms.base.LLM
Wrapper around Replicate models.
To use, you should have the replicate python package installed,
and the e... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-530 | from langchain.llms import Replicate
replicate = Replicate(model="stability-ai/stable-diffusion: 27b93a2413e7f36cd83da926f365628 0b2931564ff050bf9575f1fdf9bcd7478",
input={"image_dimensions": "512x512"})
Parameters
ca... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-531 | Return type
None
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[L... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-532 | 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-533 | 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-534 | 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-535 | 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-536 | 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-537 | 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-538 | 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-539 | 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-540 | To use, you must supply the endpoint name from your deployed
Sagemaker model & the region where it is deployed.
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 sh... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-541 | tags (Optional[List[str]]) β
client (Any) β
endpoint_name (str) β
region_name (str) β
credentials_profile_name (Optional[str]) β
content_handler (langchain.llms.sagemaker_endpoint.LLMContentHandler) β
model_kwargs (Optional[Dict]) β
endpoint_kwargs (Optional[Dict]) β
Return type
None
attribute content_handler: ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-542 | credentials from IMDS will be used.
See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
attribute endpoint_kwargs: Optional[Dict] = Noneο
Optional attributes passed to the invoke_endpoint
function. See `boto3`_. docs for more info.
.. _boto3: <https://boto3.amazonaws.com/v1/documentation... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-543 | 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 |
0e0436a883fe-544 | 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-545 | 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 |
0e0436a883fe-546 | 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 |
0e0436a883fe-547 | 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, callbacks=None, **kwargs)ο
Take in a lis... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-548 | 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.
Parameters
text (str) β
Return type
List[int]
json(*, include=None, exclude=None, by_alias... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-549 | 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 (bool) β
dumps_kwargs (Any) β
Return type
unicode
predict(text, *,... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-550 | 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:
.. code-block:: python
llm.save(file_path=βpath/llm.yamlβ)
classmethod update_forward_refs(**localns)ο
Try to update Forwar... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-551 | 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.
class langchain.llms.SelfHostedHuggingFaceLLM(*, cache=None, verbose=None, callbacks=None, callback_man... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-552 | Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, as well as servers specified
by IP address and SSH credentials (such as on-prem, or another cloud
like Paperspace, Coreweave, etc.).
To use, you should have the runhouse python package installed.
Only supports text-generation, text2text... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-553 | from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import runhouse as rh
def get_pipeline():
model_id = "gpt2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
pipe = pipeline(
"text-generation", model=model, tokenizer... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-554 | pipeline_ref (Any) β
client (Any) β
inference_fn (Callable) β
hardware (Any) β
model_load_fn (Callable) β
load_fn_kwargs (Optional[dict]) β
model_reqs (List[str]) β
model_id (str) β
task (str) β
device (int) β
model_kwargs (Optional[dict]) β
Return type
None
attribute device: int = 0ο
Device to use for infer... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-555 | Key word arguments to pass to the model load function.
attribute model_id: str = 'gpt2'ο
Hugging Face model_id to load the model.
attribute model_kwargs: Optional[dict] = Noneο
Key word arguments to pass to the model.
attribute model_load_fn: Callable = <function _load_transformer>ο
Function to load the model remotely ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-556 | 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], langchain.callbacks.base.BaseCallba... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-557 | 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 |
0e0436a883fe-558 | 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 |
0e0436a883fe-559 | 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 |
0e0436a883fe-560 | device (int) β
kwargs (Any) β
Return type
langchain.llms.base.LLM
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... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-561 | 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-562 | 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-563 | 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-564 | 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-565 | class langchain.llms.SelfHostedPipeline(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, pipeline_ref=None, client=None, inference_fn=<function _generate_text>, hardware=None, model_load_fn, load_fn_kwargs=None, model_reqs=['./', 'torch'])[source]ο
Bases: langchain.llms.base.LLM
Run model ... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-566 | import runhouse as rh
def load_pipeline():
tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = AutoModelForCausalLM.from_pretrained("gpt2")
return pipeline(
"text-generation", model=model, tokenizer=tokenizer,
max_new_tokens=10
)
def inference_fn(pipeline, prompt, stop = None):
... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-567 | import runhouse as rh
gpu = rh.cluster(name="rh-a10x", instance_type="A100:1")
my_model = ...
llm = SelfHostedPipeline.from_pipeline(
pipeline=my_model,
hardware=gpu,
model_reqs=["./", "torch", "transformers"],
)
Example passing model path for larger models:from langchain.llms import SelfHostedPipeline
impo... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-568 | 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]]) β
pipeline_ref (Any) β
client (Any) β
in... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-569 | Key word arguments to pass to the model load function.
attribute model_load_fn: Callable [Required]ο
Function to load the model remotely on the server.
attribute model_reqs: List[str] = ['./', 'torch']ο
Requirements to install on hardware to inference the model.
attribute tags: Optional[List[str]] = Noneο
Tags to add t... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-570 | 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-571 | 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-572 | 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-573 | Model
dict(**kwargs)ο
Return a dictionary of the LLM.
Parameters
kwargs (Any) β
Return type
Dict
classmethod from_pipeline(pipeline, hardware, model_reqs=None, device=0, **kwargs)[source]ο
Init the SelfHostedPipeline from a pipeline object or string.
Parameters
pipeline (Any) β
hardware (Any) β
model_reqs (Optional[... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-574 | 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, callbacks=None, **kwargs)ο
Take in a lis... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-575 | 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.
Parameters
text (str) β
Return type
List[int]
json(*, include=None, exclude=None, by_alias... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-576 | 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 (bool) β
dumps_kwargs (Any) β
Return type
unicode
predict(text, *,... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-577 | 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:
.. code-block:: python
llm.save(file_path=βpath/llm.yamlβ)
classmethod update_forward_refs(**localns)ο
Try to update Forwar... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-578 | 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.
class langchain.llms.StochasticAI(*, cache=None, verbose=None, callbacks=None, callback_manager=None, t... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-579 | 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]]) β
api_url (str) β
model_kwargs (Dict[str, Any]) β
stochasticai_api... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-580 | 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], langchain.callbacks.base.BaseCallbackManager]]) β
kwargs (Any) β
Return type
str
async agenerate(prompts, stop=None, callbac... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-581 | 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-582 | 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 data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = βallowβ was set since it adds all passe... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-583 | 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 |
0e0436a883fe-584 | kwargs (Any) β
Return type
langchain.schema.LLMResult
generate_prompt(prompts, stop=None, callbacks=None, **kwargs)ο
Take in a list of prompt values and return an LLMResult.
Parameters
prompts (List[langchain.schema.PromptValue]) β
stop (Optional[List[str]]) β
callbacks (Optional[Union[List[langchain.callbacks.base.... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-585 | 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_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs)ο
Generate a JSON represen... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-586 | exclude_none (bool) β
encoder (Optional[Callable[[Any], Any]]) β
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, *, st... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-587 | 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 |
0e0436a883fe-588 | property lc_serializable: boolο
Return whether or not the class is serializable.
class langchain.llms.VertexAI(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=None, client=None, model_name='text-bison', temperature=0.0, max_output_tokens=128, top_p=0.95, top_k=40, stop=None, project=None, locat... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-589 | tags (Optional[List[str]]) β
client (_LanguageModel) β
model_name (str) β
temperature (float) β
max_output_tokens (int) β
top_p (float) β
top_k (int) β
stop (Optional[List[str]]) β
project (Optional[str]) β
location (str) β
credentials (Any) β
tuned_model_name (Optional[str]) β
Return type
None
attribute cr... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-590 | The name of the Vertex AI large language model.
attribute project: Optional[str] = Noneο
The default GCP project to use when making Vertex API calls.
attribute stop: Optional[List[str]] = Noneο
Optional list of stop words to use when generating.
attribute tags: Optional[List[str]] = Noneο
Tags to add to the run trace.
... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-591 | 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 |
0e0436a883fe-592 | 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-593 | 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 |
0e0436a883fe-594 | 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 |
0e0436a883fe-595 | 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, callbacks=None, **kwargs)ο
Take in a lis... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-596 | 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.
Parameters
text (str) β
Return type
List[int]
json(*, include=None, exclude=None, by_alias... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-597 | 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 (bool) β
dumps_kwargs (Any) β
Return type
unicode
predict(text, *,... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-598 | 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:
.. code-block:: python
llm.save(file_path=βpath/llm.yamlβ)
classmethod update_forward_refs(**localns)ο
Try to update Forwar... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-599 | 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.
class langchain.llms.Writer(*, cache=None, verbose=None, callbacks=None, callback_manager=None, tags=No... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-600 | WRITER_ORG_ID set with your API key and organization ID respectively.
Example
from langchain import Writer
writer = Writer(model_id="palmyra-base")
Parameters
cache (Optional[bool]) β
verbose (bool) β
callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackMa... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-601 | best_of (Optional[int]) β
logprobs (bool) β
n (Optional[int]) β
writer_api_key (Optional[str]) β
base_url (Optional[str]) β
Return type
None
attribute base_url: Optional[str] = Noneο
Base url to use, if None decides based on model name.
attribute best_of: Optional[int] = Noneο
Generates this many completions serve... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-602 | How many completions to generate.
attribute presence_penalty: Optional[float] = Noneο
Penalizes repeated tokens regardless of frequency.
attribute repetition_penalty: Optional[float] = Noneο
Penalizes repeated tokens according to frequency.
attribute stop: Optional[List[str]] = Noneο
Sequences when completion generatio... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-603 | Writer organization ID.
__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], langchain.callbacks.base.BaseCallbackManager]])... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-604 | 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.callbacks.base.BaseCallb... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-605 | 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 |
0e0436a883fe-606 | 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 |
0e0436a883fe-607 | 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, callbacks=None, **kwargs)ο
Take in a lis... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-608 | 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.
Parameters
text (str) β
Return type
List[int]
json(*, include=None, exclude=None, by_alias... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-609 | 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 (bool) β
dumps_kwargs (Any) β
Return type
unicode
predict(text, *,... | https://api.python.langchain.com/en/latest/modules/llms.html |
0e0436a883fe-610 | 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:
.. code-block:: python
llm.save(file_path=βpath/llm.yamlβ)
classmethod update_forward_refs(**localns)ο
Try to update Forwar... | 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.