id stringlengths 14 15 | text stringlengths 44 2.47k | source stringlengths 61 181 |
|---|---|---|
8212e6040127-0 | langchain.llms.databricks.get_repl_context¶
langchain.llms.databricks.get_repl_context() → Any[source]¶
Gets the notebook REPL context if running inside a Databricks notebook.
Returns None otherwise. | https://api.python.langchain.com/en/latest/llms/langchain.llms.databricks.get_repl_context.html |
9700abd2fab3-0 | langchain.llms.azureml_endpoint.AzureMLEndpointClient¶
class langchain.llms.azureml_endpoint.AzureMLEndpointClient(endpoint_url: str, endpoint_api_key: str, deployment_name: str = '')[source]¶
AzureML Managed Endpoint client.
Initialize the class.
Methods
__init__(endpoint_url, endpoint_api_key[, ...])
Initialize the c... | https://api.python.langchain.com/en/latest/llms/langchain.llms.azureml_endpoint.AzureMLEndpointClient.html |
9a2b6269bcfc-0 | langchain.llms.human.HumanInputLLM¶
class langchain.llms.human.HumanInputLLM[source]¶
Bases: LLM
It returns user input as the response.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param cache: Optional[b... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-1 | Subclasses should override this method if they can batch more efficiently.
async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, *, tags: Optional[Union[L... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-2 | functionality, such as logging or streaming, throughout generation.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
An LLMResult, which contains a list of candidate Generations for each inputprompt and additional model provider-specific output.
async a... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-3 | to the model provider API call.
Returns
Top model prediction as a message.
async astream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → AsyncIterator[str]¶
Default implementation of astream, which calls ainvoke.
Subclasse... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-4 | input is still being generated.
batch(inputs: List[Union[PromptValue, str, List[BaseMessage]]], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Any) → List[str]¶
Default implementation of batch, which calls invoke N times.
Subclasses should override th... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-5 | classmethod from_orm(obj: Any) → Model¶
generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, *, tags: Optional[Union[List[str], List[List[str]]]] = None, metada... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-6 | functionality, such as logging or streaming, throughout generation.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
An LLMResult, which contains a list of candidate Generations for each inputprompt and additional model provider-specific output.
classme... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-7 | classmethod is_lc_serializable() → bool¶
Is this class serializable?
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_defa... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-8 | Pass a single string input to the model and return a string prediction.
Use this method when passing in raw text. If you want to pass in specifictypes of chat messages, use predict_messages.
Parameters
text – String input to pass to the model.
stop – Stop words to use when generating. Model output is cut off at the
fir... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-9 | stream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → Iterator[str]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → Union[Seriali... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
9a2b6269bcfc-10 | property InputType: TypeAlias¶
Get the input type for this runnable.
property OutputType: Type[str]¶
Get the input type for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶
property lc_attributes: Dict¶
List of attribute names that should be included in the serialized kwargs.
These attributes must b... | https://api.python.langchain.com/en/latest/llms/langchain.llms.human.HumanInputLLM.html |
0df62259bf9d-0 | langchain_experimental.llms.anthropic_functions.AnthropicFunctions¶
class langchain_experimental.llms.anthropic_functions.AnthropicFunctions[source]¶
Bases: BaseChatModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a v... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0df62259bf9d-1 | Subclasses should override this method if they can batch more efficiently.
async agenerate(messages: List[List[BaseMessage]], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = Non... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0df62259bf9d-2 | async ainvoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → BaseMessageChunk¶
Default implementation of ainvoke, which calls invoke in a thread pool.
Subclasses should override this method if they can run asynchronously.... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0df62259bf9d-3 | Default implementation of astream, which calls ainvoke.
Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0df62259bf9d-4 | Bind arguments to a Runnable, returning a new Runnable.
call_as_llm(message: str, stop: Optional[List[str]] = None, **kwargs: Any) → str¶
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.
Defaul... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0df62259bf9d-5 | Top Level call
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → LLMResult¶
Pass a sequence of prompts to the model and return model generations.
This method should make use of batched calls f... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0df62259bf9d-6 | Parameters
text – The string input to tokenize.
Returns
The integer number of tokens in the text.
get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶
Get the number of tokens in the messages.
Useful for checking if an input will fit in a model’s context window.
Parameters
messages – The message inputs to t... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0df62259bf9d-7 | The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with each input.
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encod... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0df62259bf9d-8 | stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a message.
classmethod schema(by_alias: bool = True, ref_templ... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0df62259bf9d-9 | Bind config to a Runnable, returning a new Runnable.
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.base.Runnable[~langchain.schema.runnable.utils.Input, ~langchain.schema.runnable.utils.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,)) →... | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.AnthropicFunctions.html |
0cd5954f2755-0 | langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint¶
class langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint[source]¶
Bases: LLM
Baidu Qianfan hosted open source or customized models.
To use, you should have the qianfan python package installed, and
the environment variable qianfan_ak and qianfan_sk set wit... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-1 | param penalty_score: Optional[float] = 1¶
Model params, only supported in ERNIE-Bot and ERNIE-Bot-turbo.
In the case of other model, passing these params will not affect the result.
param qianfan_ak: Optional[str] = None¶
param qianfan_sk: Optional[str] = None¶
param request_timeout: Optional[int] = 60¶
request timeout... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-2 | Subclasses should override this method if they can batch more efficiently.
async agenerate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, *, tags: Optional[Union[L... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-3 | functionality, such as logging or streaming, throughout generation.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
An LLMResult, which contains a list of candidate Generations for each inputprompt and additional model provider-specific output.
async a... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-4 | to the model provider API call.
Returns
Top model prediction as a message.
async astream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → AsyncIterator[str]¶
Default implementation of astream, which calls ainvoke.
Subclasse... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-5 | input is still being generated.
batch(inputs: List[Union[PromptValue, str, List[BaseMessage]]], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Any) → List[str]¶
Default implementation of batch, which calls invoke N times.
Subclasses should override th... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-6 | classmethod from_orm(obj: Any) → Model¶
generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, *, tags: Optional[Union[List[str], List[List[str]]]] = None, metada... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-7 | functionality, such as logging or streaming, throughout generation.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
An LLMResult, which contains a list of candidate Generations for each inputprompt and additional model provider-specific output.
classme... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-8 | classmethod is_lc_serializable() → bool¶
Is this class serializable?
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_defa... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-9 | Pass a single string input to the model and return a string prediction.
Use this method when passing in raw text. If you want to pass in specifictypes of chat messages, use predict_messages.
Parameters
text – String input to pass to the model.
stop – Stop words to use when generating. Model output is cut off at the
fir... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-10 | stream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → Iterator[str]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → Union[Seriali... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
0cd5954f2755-11 | property InputType: TypeAlias¶
Get the input type for this runnable.
property OutputType: Type[str]¶
Get the input type for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶
property lc_attributes: Dict¶
List of attribute names that should be included in the serialized kwargs.
These attributes must b... | https://api.python.langchain.com/en/latest/llms/langchain.llms.baidu_qianfan_endpoint.QianfanLLMEndpoint.html |
ed9226c647f8-0 | langchain.llms.utils.enforce_stop_tokens¶
langchain.llms.utils.enforce_stop_tokens(text: str, stop: List[str]) → str[source]¶
Cut off the text as soon as any stop words occur. | https://api.python.langchain.com/en/latest/llms/langchain.llms.utils.enforce_stop_tokens.html |
5005bd650864-0 | langchain.llms.aviary.Aviary¶
class langchain.llms.aviary.Aviary[source]¶
Bases: LLM
Aviary hosted models.
Aviary is a backend for hosted models. You can
find out more about aviary at
http://github.com/ray-project/aviary
To get a list of the models supported on an
aviary, follow the instructions on the website to
insta... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-1 | Metadata to add to the run trace.
param model: str = 'amazon/LightGPT'¶
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
param use_prompt_format: bool = True¶
param verbose: bool [Optional]¶
Whether to print out response text.
param version: Optional[str] = None¶
__call__(prompt: str, stop: Optiona... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-2 | Run the LLM on the given prompt and input.
async agenerate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, **kwargs: Any) → LLMResult¶
Asynchronously... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-3 | Subclasses should override this method if they can run asynchronously.
async apredict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Asynchronously pass a string to the model and return a string prediction.
Use this method when calling pure text generation models and only the topcandidate gen... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-4 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names: Optional[Sequence[... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-5 | Bind arguments to a Runnable, returning a new Runnable.
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... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-6 | Run the LLM on the given prompt and input.
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, **kwargs: Any) → LLMResult¶
Pass a sequence of pr... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-7 | Get the number of tokens present in the text.
Useful for checking if an input will fit in a model’s context window.
Parameters
text – The string input to tokenize.
Returns
The integer number of tokens in the text.
get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶
Get the number of tokens in the messages.... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-8 | classmethod lc_id() → List[str]¶
A unique identifier for this class for serialization purposes.
The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with e... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-9 | Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Retur... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
5005bd650864-10 | classmethod validate(value: Any) → Model¶
with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶
Bind config to a Runnable, returning a new Runnable.
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.base.Runnable[~langchain.schema.runnable.utils.Input, ~langc... | https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.Aviary.html |
43f42178f54d-0 | langchain.llms.symblai_nebula.completion_with_retry¶
langchain.llms.symblai_nebula.completion_with_retry(llm: Nebula, **kwargs: Any) → Any[source]¶
Use tenacity to retry the completion call. | https://api.python.langchain.com/en/latest/llms/langchain.llms.symblai_nebula.completion_with_retry.html |
e334b9631e29-0 | langchain.llms.forefrontai.ForefrontAI¶
class langchain.llms.forefrontai.ForefrontAI[source]¶
Bases: LLM
ForefrontAI large language models.
To use, you should have the environment variable FOREFRONTAI_API_KEY
set with your API key.
Example
from langchain.llms import ForefrontAI
forefrontai = ForefrontAI(endpoint_url=""... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-1 | param verbose: bool [Optional]¶
Whether to print out response text.
__call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → str¶
Check Cache... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-2 | Asynchronously pass a sequence of prompts and return model generations.
This method should make use of batched calls for models that expose a batched
API.
Use this method when you want to:
take advantage of batched calls,
need more output from the model than just the top generated value,
are building chains that are ag... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-3 | Parameters
text – String input to pass to the model.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a string.... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-4 | Stream all output from a runnable, as reported to the callback system.
This includes all inner runs of LLMs, Retrievers, Tools, etc.
Output is streamed as Log objects, which include a list of
jsonpatch ops that describe how the state of the run has changed in each
step, and the final state of the run.
The jsonpatch ops... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-5 | 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... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-6 | Pass a sequence of prompts to the model and return model generations.
This method should make use of batched calls for models that expose a batched
API.
Use this method when you want to:
take advantage of batched calls,
need more output from the model than just the top generated value,
are building chains that are agno... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-7 | Useful for checking if an input will fit in a model’s context window.
Parameters
messages – The message inputs to tokenize.
Returns
The sum of the number of tokens across the messages.
get_token_ids(text: str) → List[int]¶
Return the ordered ids of the tokens in a text.
Parameters
text – The string input to tokenize.
R... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-8 | by calling invoke() with each input.
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = No... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-9 | save(file_path: Union[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 schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
e334b9631e29-10 | Bind config to a Runnable, returning a new Runnable.
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.base.Runnable[~langchain.schema.runnable.utils.Input, ~langchain.schema.runnable.utils.Output]], *, exceptions_to_handle: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,)) →... | https://api.python.langchain.com/en/latest/llms/langchain.llms.forefrontai.ForefrontAI.html |
2fc1d808319b-0 | langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM¶
class langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM[source]¶
Bases: SelfHostedPipeline
HuggingFace Pipeline API to run on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, ... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-1 | Construct the pipeline remotely using an auxiliary function.
The load function needs to be importable to be imported
and run on the server, i.e. in a module and not a REPL or closure.
Then, initialize the remote inference function.
param cache: Optional[bool] = None¶
param callback_manager: Optional[BaseCallbackManager... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-2 | param verbose: bool [Optional]¶
Whether to print out response text.
__call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → str¶
Check Cache... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-3 | Asynchronously pass a sequence of prompts and return model generations.
This method should make use of batched calls for models that expose a batched
API.
Use this method when you want to:
take advantage of batched calls,
need more output from the model than just the top generated value,
are building chains that are ag... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-4 | Parameters
text – String input to pass to the model.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a string.... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-5 | Stream all output from a runnable, as reported to the callback system.
This includes all inner runs of LLMs, Retrievers, Tools, etc.
Output is streamed as Log objects, which include a list of
jsonpatch ops that describe how the state of the run has changed in each
step, and the final state of the run.
The jsonpatch ops... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-6 | 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... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-7 | Run the LLM on the given prompt and input.
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, **kwargs: Any) → LLMResult¶
Pass a sequence of pr... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-8 | Get the number of tokens present in the text.
Useful for checking if an input will fit in a model’s context window.
Parameters
text – The string input to tokenize.
Returns
The integer number of tokens in the text.
get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶
Get the number of tokens in the messages.... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-9 | classmethod lc_id() → List[str]¶
A unique identifier for this class for serialization purposes.
The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with e... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-10 | Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Retur... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
2fc1d808319b-11 | classmethod validate(value: Any) → Model¶
with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶
Bind config to a Runnable, returning a new Runnable.
with_fallbacks(fallbacks: ~typing.Sequence[~langchain.schema.runnable.base.Runnable[~langchain.schema.runnable.utils.Input, ~langc... | https://api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html |
bf2cdd76d83c-0 | langchain.llms.pipelineai.PipelineAI¶
class langchain.llms.pipelineai.PipelineAI[source]¶
Bases: LLM, BaseModel
PipelineAI large language models.
To use, you should have the pipeline-ai python package installed,
and the environment variable PIPELINE_API_KEY set with your API key.
Any parameters that are valid to be pas... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-1 | Check Cache and run the LLM on the given prompt and input.
async abatch(inputs: List[Union[PromptValue, str, List[BaseMessage]]], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Any) → List[str]¶
Default implementation of abatch, which calls ainvoke N ... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-2 | Parameters
prompts – List of PromptValues. A PromptValue is an object that can be
converted to match the format of any language model (string for pure
text generation models and BaseMessages for chat models).
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these subst... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-3 | Asynchronously pass messages to the model and return a message prediction.
Use this method when calling chat models and only the topcandidate generation is needed.
Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off a... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-4 | The jsonpatch ops can be applied in order to construct state.
async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶
Default implementation of atransform, which buffers input and calls astream.
Subclasses should override this method if th... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-5 | the new model: you should trust this data
deep – set to True to make a deep copy of the model
Returns
new model instance
dict(**kwargs: Any) → Dict¶
Return a dictionary of the LLM.
classmethod from_orm(obj: Any) → Model¶
generate(prompts: List[str], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHa... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-6 | text generation models and BaseMessages for chat models).
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
callbacks – Callbacks to pass through. Used for executing additional
functionality, such as logging or streaming, throughout generation.
**kwarg... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-7 | invoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → str¶
classmethod is_lc_serializable() → bool¶
Is this class serializable?
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Option... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-8 | predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Pass a single string input to the model and return a string prediction.
Use this method when passing in raw text. If you want to pass in specifictypes of chat messages, use predict_messages.
Parameters
text – String input to pass to the m... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-9 | stream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → Iterator[str]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → Union[Seriali... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
bf2cdd76d83c-10 | property InputType: TypeAlias¶
Get the input type for this runnable.
property OutputType: Type[str]¶
Get the input type for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶
property lc_attributes: Dict¶
List of attribute names that should be included in the serialized kwargs.
These attributes must b... | https://api.python.langchain.com/en/latest/llms/langchain.llms.pipelineai.PipelineAI.html |
a917f7cbbbd4-0 | langchain.llms.openlm.OpenLM¶
class langchain.llms.openlm.OpenLM[source]¶
Bases: BaseOpenAI
OpenLM models.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param allowed_special: Union[Literal['all'], Abstrac... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-1 | Model name to use.
param n: int = 1¶
How many completions to generate for each prompt.
param openai_api_base: Optional[str] = None¶
param openai_api_key: Optional[str] = None¶
param openai_organization: Optional[str] = None¶
param openai_proxy: Optional[str] = None¶
param presence_penalty: float = 0¶
Penalizes repeated... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-2 | param verbose: bool [Optional]¶
Whether to print out response text.
__call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → str¶
Check Cache... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-3 | Asynchronously pass a sequence of prompts and return model generations.
This method should make use of batched calls for models that expose a batched
API.
Use this method when you want to:
take advantage of batched calls,
need more output from the model than just the top generated value,
are building chains that are ag... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-4 | Parameters
text – String input to pass to the model.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a string.... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-5 | Stream all output from a runnable, as reported to the callback system.
This includes all inner runs of LLMs, Retrievers, Tools, etc.
Output is streamed as Log objects, which include a list of
jsonpatch ops that describe how the state of the run has changed in each
step, and the final state of the run.
The jsonpatch ops... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-6 | 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... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-7 | Run the LLM on the given prompt and input.
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Union[List[BaseCallbackHandler], BaseCallbackManager, None, List[Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]]] = None, **kwargs: Any) → LLMResult¶
Pass a sequence of pr... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-8 | Get the number of tokens present in the text.
Useful for checking if an input will fit in a model’s context window.
Parameters
text – The string input to tokenize.
Returns
The integer number of tokens in the text.
get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶
Get the number of tokens in the messages.... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-9 | classmethod lc_id() → List[str]¶
A unique identifier for this class for serialization purposes.
The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with e... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-10 | Parameters
text – String input to pass to the model.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a string.... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-11 | Subclasses should override this method if they support streaming output.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Defau... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
a917f7cbbbd4-12 | List of attribute names that should be included in the serialized kwargs.
These attributes must be accepted by the constructor.
property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property max_context_size: int¶
Get max context size fo... | https://api.python.langchain.com/en/latest/llms/langchain.llms.openlm.OpenLM.html |
20a17ed0c688-0 | langchain_experimental.llms.jsonformer_decoder.import_jsonformer¶
langchain_experimental.llms.jsonformer_decoder.import_jsonformer() → jsonformer[source]¶
Lazily import jsonformer. | https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.jsonformer_decoder.import_jsonformer.html |
27ccb1b9e8fe-0 | langchain.llms.ctransformers.CTransformers¶
class langchain.llms.ctransformers.CTransformers[source]¶
Bases: LLM
C Transformers LLM models.
To use, you should have the ctransformers python package installed.
See https://github.com/marella/ctransformers
Example
from langchain.llms import CTransformers
llm = CTransformer... | https://api.python.langchain.com/en/latest/llms/langchain.llms.ctransformers.CTransformers.html |
27ccb1b9e8fe-1 | param verbose: bool [Optional]¶
Whether to print out response text.
__call__(prompt: str, stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → str¶
Check Cache... | https://api.python.langchain.com/en/latest/llms/langchain.llms.ctransformers.CTransformers.html |
27ccb1b9e8fe-2 | Asynchronously pass a sequence of prompts and return model generations.
This method should make use of batched calls for models that expose a batched
API.
Use this method when you want to:
take advantage of batched calls,
need more output from the model than just the top generated value,
are building chains that are ag... | https://api.python.langchain.com/en/latest/llms/langchain.llms.ctransformers.CTransformers.html |
27ccb1b9e8fe-3 | Parameters
text – String input to pass to the model.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a string.... | https://api.python.langchain.com/en/latest/llms/langchain.llms.ctransformers.CTransformers.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.