id stringlengths 14 16 | text stringlengths 36 2.73k | source stringlengths 59 127 |
|---|---|---|
14c2a1c4ad3b-121 | 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-122 | environment variable NLPCLOUD_API_KEY set with your API key.
Example
from langchain.llms import NLPCloud
nlpcloud = NLPCloud(model="gpt-neox-20b")
Validators
raise_deprecation » all fields
set_verbose » verbose
validate_environment » all fields
field bad_words: List[str] = []#
List of tokens not allowed to be generated... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-123 | What sampling temperature to use.
field top_k: int = 50#
The number of highest probability tokens to keep for top-k filtering.
field top_p: int = 1#
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[st... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-124 | 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-125 | 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-126 | 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-127 | field frequency_penalty: float = 0#
Penalizes repeated tokens according to frequency.
field logit_bias: Optional[Dict[str, float]] [Optional]#
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 maximu... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-128 | 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-129 | 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-130 | 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-131 | 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-132 | pydantic model langchain.llms.OpenAIChat[source]#
Wrapper around OpenAI Chat large language models.
To use, you should have the openai python package installed, and the
environment variable OPENAI_API_KEY set with your API key.
Any parameters that are valid to be passed to the openai.create call can be passed
in, even ... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-133 | 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-134 | 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-135 | 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] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exc... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-136 | 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.OpenLM[source]#
Validators
build_extr... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-137 | 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 request_timeout: Optional[Union[float, Tuple[float, float]]] = None#
Timeout for requests to OpenAI completion API. Default is 600 seconds.
field streaming: bool = F... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-138 | 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-139 | 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-140 | 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] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exc... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-141 | 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.yaml”)
stream(prompt: str, stop: Optional[List[str]] = None) → Generator#
Call OpenAI with streaming flag... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-142 | To use, you should have the petals python package installed, and the
environment variable HUGGINGFACE_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 petals
petals = Petals()
Validators... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-143 | 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-144 | 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-145 | 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-146 | 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-147 | 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-148 | 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-149 | 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-150 | 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.PredictionGuard[source]#
Wrapper arou... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-151 | 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-152 | 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-153 | 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-154 | 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-155 | 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-156 | 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-157 | 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-158 | 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-159 | pydantic model langchain.llms.PromptLayerOpenAIChat[source]#
Wrapper around OpenAI large language models.
To use, you should have the openai and promptlayer python
package installed, and the environment variable OPENAI_API_KEY
and PROMPTLAYER_API_KEY set with your openAI API key and
promptlayer key respectively.
All pa... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-160 | field streaming: bool = False#
Whether to stream the results or not.
__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-161 | 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-162 | 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 IDs using the tiktoken package.
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSet... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-163 | 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-164 | new topics..
field rwkv_verbose: bool = True#
Print debug information.
field strategy: str = 'cpu fp32'#
Token context window.
field tags: Optional[List[str]] = None#
Tags to add to the run trace.
field temperature: float = 1.0#
The temperature to use for sampling.
field tokens_path: str [Required]#
Path to the RWKV to... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-165 | 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-166 | 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-167 | 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-168 | input={"image_dimensions": "512x512"})
Validators
build_extra » all fields
raise_deprecation » all fields
set_verbose » verbose
validate_environment » all fields
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... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-169 | Predict message from messages.
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model#
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 ... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-170 | 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-171 | 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-172 | Validators
raise_deprecation » all fields
set_verbose » verbose
validate_environment » all fields
field content_handler: langchain.llms.sagemaker_endpoint.LLMContentHandler [Required]#
The content handler class that provides an input and
output transform functions to handle formats between LLM
and the endpoint.
field c... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-173 | 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-174 | 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-175 | 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-176 | 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.SelfHostedHuggingFaceLLM[source]#
Wra... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-177 | "text-generation", model=model, tokenizer=tokenizer
)
return pipe
hf = SelfHostedHuggingFaceLLM(
model_load_fn=get_pipeline, model_id="gpt2", hardware=gpu)
Validators
raise_deprecation » all fields
set_verbose » verbose
field device: int = 0#
Device to use for inference. -1 for CPU, 0 for GPU, 1 for second ... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-178 | 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-179 | 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-180 | 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] = None, exclude_unset: bool = False, exclude_... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-181 | 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-182 | model_reqs=model_reqs, inference_fn=inference_fn
)
Example for <2GB model (can be serialized and sent directly to the server):from langchain.llms import SelfHostedPipeline
import runhouse as rh
gpu = rh.cluster(name="rh-a10x", instance_type="A100:1")
my_model = ...
llm = SelfHostedPipeline.from_pipeline(
pipeline=m... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-183 | 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-184 | 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-185 | Take in a list of prompt values and return an LLMResult.
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 i... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-186 | classmethod update_forward_refs(**localns: Any) → None#
Try to update ForwardRefs on fields based on this Model, globalns and localns.
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_namesp... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-187 | 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-188 | 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-189 | 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-190 | 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.VertexAI[source]#
Wrapper around Goog... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-191 | 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-192 | 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-193 | 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-194 | 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-195 | field stop: Optional[List[str]] = None#
Sequences when completion generation will stop.
field tags: Optional[List[str]] = None#
Tags to add to the run trace.
field temperature: Optional[float] = None#
What sampling temperature to use.
field top_p: Optional[float] = None#
Total probability mass of tokens to consider at ... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/llms.html |
14c2a1c4ad3b-196 | 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-197 | 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-198 | 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 |
fe18070e4f36-0 | .rst
.pdf
Document Loaders
Document Loaders#
All different types of document loaders.
class langchain.document_loaders.AZLyricsLoader(web_path: Union[str, List[str]], header_template: Optional[dict] = None)[source]#
Loader that loads AZLyrics webpages.
load() → List[langchain.schema.Document][source]#
Load webpage.
cla... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-1 | field dataset_mapping_function: Callable[[Dict], langchain.schema.Document] [Required]#
A custom function that takes a single dictionary (an Apify dataset item)
and converts it to an instance of the Document class.
load() → List[langchain.schema.Document][source]#
Load documents.
class langchain.document_loaders.ArxivL... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-2 | Load data into document objects.
class langchain.document_loaders.BibtexLoader(file_path: str, *, parser: Optional[langchain.utilities.bibtex.BibtexparserWrapper] = None, max_docs: Optional[int] = None, max_content_chars: Optional[int] = 4000, load_extra_metadata: bool = False, file_pattern: str = '[^:]+\\.pdf')[source... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-3 | are written into the page_content of the document. The metadata_columns
are written into the metadata of the document. By default, all columns
are written into the page_content and none into the metadata.
load() → List[langchain.schema.Document][source]#
Load data into document objects.
class langchain.document_loaders... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-4 | Download a file from a url.
Parameters
path – Path to the file.
folder_path: str#
load() → List[langchain.schema.Document][source]#
Load data into document objects.
Returns
List of documents.
load_all_recursively: bool#
parse_filename(url: str) → str[source]#
Parse the filename from a url.
Parameters
url – Url to parse... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-5 | Support additional Alchemy APIs (e.g. getTransactions, etc.)
Support additional blockain APIs (e.g. Infura, Opensea, etc.)
load() → List[langchain.schema.Document][source]#
Load data into document objects.
class langchain.document_loaders.CSVLoader(file_path: str, source_column: Optional[str] = None, csv_args: Optional... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-6 | load() → List[langchain.schema.Document][source]#
Load from file path.
class langchain.document_loaders.CollegeConfidentialLoader(web_path: Union[str, List[str]], header_template: Optional[dict] = None)[source]#
Loader that loads College Confidential webpages.
load() → List[langchain.schema.Document][source]#
Load webp... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-7 | a enum content_format argument to load() to specify the content format, this is
set to ContentFormat.STORAGE by default.
Hint: space_key and page_id can both be found in the URL of a page in Confluence
- https://yoursite.atlassian.com/wiki/spaces/<space_key>/pages/<page_id>
Example
from langchain.document_loaders impor... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-8 | Check if a page is publicly accessible.
load(space_key: Optional[str] = None, page_ids: Optional[List[str]] = None, label: Optional[str] = None, cql: Optional[str] = None, include_restricted_content: bool = False, include_archived_content: bool = False, include_attachments: bool = False, include_comments: bool = False,... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-9 | ValueError – _description_
ImportError – _description_
Returns
_description_
Return type
List[Document]
paginate_request(retrieval_method: Callable, **kwargs: Any) → List[source]#
Paginate the various methods to retrieve groups of pages.
Unfortunately, due to page size, sometimes the Confluence API
doesn’t match the li... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-10 | process_pages(pages: List[dict], include_restricted_content: bool, include_attachments: bool, include_comments: bool, content_format: langchain.document_loaders.confluence.ContentFormat, ocr_languages: Optional[str] = None) → List[langchain.schema.Document][source]#
Process a list of pages into a list of documents.
pro... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-11 | Extract text from Diffbot on all the URLs and return Document instances
class langchain.document_loaders.DirectoryLoader(path: str, glob: str = '**/[!.]*', silent_errors: bool = False, load_hidden: bool = False, loader_cls: typing.Union[typing.Type[langchain.document_loaders.unstructured.UnstructuredFileLoader], typing... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-12 | field file_paths: Optional[Sequence[Union[pathlib.Path, str]]] = None#
field min_chunk_size: int = 32#
load() → List[langchain.schema.Document][source]#
Load documents.
class langchain.document_loaders.Docx2txtLoader(file_path: str)[source]#
Loads a DOCX with docx2txt and chunks at character level.
Defaults to check fo... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-13 | loader = EmbaasBlobLoader()
blob = Blob.from_path(path="example.mp3")
documents = loader.parse(blob=blob)
# Custom api parameters (create embeddings automatically)
from langchain.document_loaders.embaas import EmbaasBlobLoader
loader = EmbaasBlobLoader(
params={
"should_embed": True,
"model": "e5-la... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-14 | }
)
documents = loader.load()
Validators
validate_blob_loader » blob_loader
validate_environment » all fields
field blob_loader: Optional[langchain.document_loaders.embaas.EmbaasBlobLoader] = None#
The blob loader to use. If not provided, a default one will be created.
field file_path: str [Required]#
The path to the f... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-15 | notes into a single long Document.
True (If this is set to) – the ‘source’ which contains the file name of the export.
load() → List[langchain.schema.Document][source]#
Load documents from EverNote export file.
class langchain.document_loaders.FacebookChatLoader(path: str)[source]#
Loader that loads Facebook messages j... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-16 | Loading logic for loading documents from GCS.
load() → List[langchain.schema.Document][source]#
Load documents.
pydantic model langchain.document_loaders.GitHubIssuesLoader[source]#
Validators
validate_environment » all fields
validate_since » since
field assignee: Optional[str] = None#
Filter on assigned user. Pass ‘n... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-17 | field state: Optional[Literal['open', 'closed', 'all']] = None#
Filter on issue state. Can be one of: ‘open’, ‘closed’, ‘all’.
lazy_load() → Iterator[langchain.schema.Document][source]#
Get issues of a GitHub repository.
Returns
page_content
metadata
url
title
creator
created_at
last_update_time
closed_time
number of c... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-18 | Load data into document objects.
class langchain.document_loaders.GitbookLoader(web_page: str, load_all_paths: bool = False, base_url: Optional[str] = None, content_selector: str = 'main')[source]#
Load GitBook data.
load from either a single page, or
load all (relative) paths in the navbar.
load() → List[langchain.sch... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-19 | Validate that either folder_id or document_ids is set, but not both.
class langchain.document_loaders.GoogleApiYoutubeLoader(google_api_client: langchain.document_loaders.youtube.GoogleApiClient, channel_name: Optional[str] = None, video_ids: Optional[List[str]] = None, add_video_info: bool = True, captions_language: s... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-20 | Loader that loads Google Docs from Google Drive.
Validators
validate_credentials_path » credentials_path
validate_inputs » all fields
field credentials_path: pathlib.Path = PosixPath('/home/docs/.credentials/credentials.json')#
field document_ids: Optional[List[str]] = None#
field file_ids: Optional[List[str]] = None#
... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
fe18070e4f36-21 | Load items from an HN page.
class langchain.document_loaders.HuggingFaceDatasetLoader(path: str, page_content_column: str = 'text', name: Optional[str] = None, data_dir: Optional[str] = None, data_files: Optional[Union[str, Sequence[str], Mapping[str, Union[str, Sequence[str]]]]] = None, cache_dir: Optional[str] = None... | rtdocs_stable/api.python.langchain.com/en/stable/reference/modules/document_loaders.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.