id stringlengths 14 16 | text stringlengths 13 2.7k | source stringlengths 57 178 |
|---|---|---|
343962c61522-8 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.BaseOpenAI.html |
343962c61522-9 | This method allows to get an input schema for a specific configuration.
Parameters
config – A config to use when generating the schema.
Returns
A pydantic model that can be used to validate input.
classmethod get_lc_namespace() → List[str]¶
Get the namespace of the langchain object.
For example, if the class is langcha... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.BaseOpenAI.html |
343962c61522-10 | Get the sub prompts for llm call.
get_token_ids(text: str) → List[int][source]¶
Get the token IDs using the tiktoken package.
invoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → str¶
Transform a single input into an out... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.BaseOpenAI.html |
343962c61522-11 | 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.
max_tokens_for_prompt(prompt: str) → int[source]¶
Calculate the maximum number of tokens possible to generate for a prompt.
Parameters
prompt – The prom... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.BaseOpenAI.html |
343962c61522-12 | 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.
predict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Pass a m... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.BaseOpenAI.html |
343962c61522-13 | to_json_not_implemented() → SerializedNotImplemented¶
transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Default implementation of transform, which buffers input and then calls stream.
Subclasses should override this method if they can start producing... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.BaseOpenAI.html |
343962c61522-14 | The Run object contains information about the run, including its id,
type, input, output, error, start_time, end_time, and any tags or metadata
added to the run.
with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_af... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.BaseOpenAI.html |
343962c61522-15 | For example,{“openai_api_key”: “OPENAI_API_KEY”}
property max_context_size: int¶
Get max context size for this model.
property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model. | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.BaseOpenAI.html |
79933c6a99ac-0 | langchain.llms.vertexai.completion_with_retry¶
langchain.llms.vertexai.completion_with_retry(llm: VertexAI, *args: Any, run_manager: Optional[CallbackManagerForLLMRun] = None, **kwargs: Any) → Any[source]¶
Use tenacity to retry the completion call. | lang/api.python.langchain.com/en/latest/llms/langchain.llms.vertexai.completion_with_retry.html |
a8af0bb016aa-0 | langchain.llms.gooseai.GooseAI¶
class langchain.llms.gooseai.GooseAI[source]¶
Bases: LLM
GooseAI large language models.
To use, you should have the openai python package installed, and the
environment variable GOOSEAI_API_KEY set with your API key.
Any parameters that are valid to be passed to the openai.create call ca... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-1 | Holds any model parameters valid for create call not explicitly specified.
param model_name: str = 'gpt-neo-20b'¶
Model name to use
param n: int = 1¶
How many completions to generate for each prompt.
param presence_penalty: float = 0¶
Penalizes repeated tokens.
param tags: Optional[List[str]] = None¶
Tags to add to the... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-2 | e.g., if the underlying runnable uses an API which supports a batch mode.
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[Li... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-4 | 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.
async astream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-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 runs invoke in parallel using a thread pool executor.
The default i... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-7 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-8 | For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
get_num_tokens(text: str) → int¶
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
Th... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-9 | Transform a single input into an output. Override to implement.
Parameters
input – The input to the runnable.
config – A config to use when invoking the runnable.
The config supports standard keys like ‘tags’, ‘metadata’ for tracing
purposes, ‘max_concurrency’ for controlling how much work to do
in parallel, and other ... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-10 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Pass a single string input to t... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-11 | .. 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: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
stream(input: Union[Promp... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-12 | Add fallbacks to a runnable, returning a new Runnable.
Parameters
fallbacks – A sequence of runnables to try if the original runnable fails.
exceptions_to_handle – A tuple of exception types to handle.
Returns
A new Runnable that will try the original runnable, and then each
fallback in order, upon failures.
with_liste... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
a8af0bb016aa-13 | Bind input and output types to a Runnable, returning a new Runnable.
property InputType: TypeAlias¶
Get the input type for this runnable.
property OutputType: Type[str]¶
Get the input type for this runnable.
property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶
List configurable fields for... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.gooseai.GooseAI.html |
97cd3865470f-0 | langchain.llms.edenai.EdenAI¶
class langchain.llms.edenai.EdenAI[source]¶
Bases: LLM
Wrapper around edenai models.
To use, you should have
the environment variable EDENAI_API_KEY set with your API token.
You can find your token here: https://app.edenai.run/admin/account/settings
feature and subfeature are required, but... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-1 | DEPRECATED: use temperature, max_tokens, resolution directly
optional parameters to pass to api
param provider: str [Required]¶
Generative provider to use (eg: openai,stabilityai,cohere,google etc.)
param resolution: Optional[Literal['256x256', '512x512', '1024x1024']] = None¶
param stop_sequences: Optional[List[str]] ... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-2 | e.g., if the underlying runnable uses an API which supports a batch mode.
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[Li... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-4 | 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.
async astream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-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 runs invoke in parallel using a thread pool executor.
The default i... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-7 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-8 | For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
get_num_tokens(text: str) → int¶
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
Th... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-9 | Transform a single input into an output. Override to implement.
Parameters
input – The input to the runnable.
config – A config to use when invoking the runnable.
The config supports standard keys like ‘tags’, ‘metadata’ for tracing
purposes, ‘max_concurrency’ for controlling how much work to do
in parallel, and other ... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-10 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Pass a single string input to t... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-11 | .. 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: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
stream(input: Union[Promp... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-12 | Add fallbacks to a runnable, returning a new Runnable.
Parameters
fallbacks – A sequence of runnables to try if the original runnable fails.
exceptions_to_handle – A tuple of exception types to handle.
Returns
A new Runnable that will try the original runnable, and then each
fallback in order, upon failures.
with_liste... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
97cd3865470f-13 | Bind input and output types to a Runnable, returning a new Runnable.
property InputType: TypeAlias¶
Get the input type for this runnable.
property OutputType: Type[str]¶
Get the input type for this runnable.
property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶
List configurable fields for... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.edenai.EdenAI.html |
abc571a5ff66-0 | langchain_experimental.llms.jsonformer_decoder.import_jsonformer¶
langchain_experimental.llms.jsonformer_decoder.import_jsonformer() → jsonformer[source]¶
Lazily import jsonformer. | lang/api.python.langchain.com/en/latest/llms/langchain_experimental.llms.jsonformer_decoder.import_jsonformer.html |
c83584502c94-0 | langchain.llms.minimax.MinimaxCommon¶
class langchain.llms.minimax.MinimaxCommon[source]¶
Bases: BaseModel
Common parameters for Minimax large language 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.... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.minimax.MinimaxCommon.html |
c83584502c94-1 | 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 creating
the new model: you should trust this data
deep – set to True to make a deep co... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.minimax.MinimaxCommon.html |
c83584502c94-2 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmet... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.minimax.MinimaxCommon.html |
b2021a78bf52-0 | langchain.llms.openai.acompletion_with_retry¶
async langchain.llms.openai.acompletion_with_retry(llm: Union[BaseOpenAI, OpenAIChat], run_manager: Optional[AsyncCallbackManagerForLLMRun] = None, **kwargs: Any) → Any[source]¶
Use tenacity to retry the async completion call. | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.acompletion_with_retry.html |
e38848f1443f-0 | langchain.llms.vertexai.acompletion_with_retry¶
async langchain.llms.vertexai.acompletion_with_retry(llm: VertexAI, *args: Any, run_manager: Optional[AsyncCallbackManagerForLLMRun] = None, **kwargs: Any) → Any[source]¶
Use tenacity to retry the completion call. | lang/api.python.langchain.com/en/latest/llms/langchain.llms.vertexai.acompletion_with_retry.html |
c9896efd112e-0 | langchain.llms.anyscale.create_llm_result¶
langchain.llms.anyscale.create_llm_result(choices: Any, prompts: List[str], token_usage: Dict[str, int], model_name: str) → LLMResult[source]¶
Create the LLMResult from the choices and prompts. | lang/api.python.langchain.com/en/latest/llms/langchain.llms.anyscale.create_llm_result.html |
eed0054d9789-0 | langchain.llms.openai.update_token_usage¶
langchain.llms.openai.update_token_usage(keys: Set[str], response: Dict[str, Any], token_usage: Dict[str, Any]) → None[source]¶
Update token usage. | lang/api.python.langchain.com/en/latest/llms/langchain.llms.openai.update_token_usage.html |
06a231346fbf-0 | langchain.llms.aviary.get_completions¶
langchain.llms.aviary.get_completions(model: str, prompt: str, use_prompt_format: bool = True, version: str = '') → Dict[str, Union[str, float, int]][source]¶
Get completions from Aviary models. | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aviary.get_completions.html |
7e67ca242254-0 | langchain.llms.bittensor.NIBittensorLLM¶
class langchain.llms.bittensor.NIBittensorLLM[source]¶
Bases: LLM
NIBittensor LLMs
NIBittensorLLM is created by Neural Internet (https://neuralinternet.ai/),
powered by Bittensor, a decentralized network full of different AI models.
To analyze API_KEYS and logs of your usage vis... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-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 runs ainvoke in parallel using as... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-2 | need more output from the model than just the top generated value,
are building chains that are agnostic to the underlying language modeltype (e.g., pure text completion models vs chat models).
Parameters
prompts – List of PromptValues. A PromptValue is an object that can be
converted to match the format of any languag... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-3 | **kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a string.
async apredict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Asynchronously pass messages to the model and ... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-4 | 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 can be applied in order to construct state.
async atransform(input: As... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-5 | Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶
configurable_fields(**kwargs: Union[ConfigurableField, C... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-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.
get_inp... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-8 | Get a pydantic model that can be used to validate output to the runnable.
Runnables that leverage the configurable_fields and configurable_alternatives
methods will have a dynamic output schema that depends on which
configuration the runnable is invoked with.
This method allows to get an output schema for a specific co... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-9 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-10 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-11 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-12 | fallback in order, upon failures.
with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶
Bind lifecycle listeners to a Runnable, returning a new Runnable.
on_start: Called before the runnable starts running, with the Run ... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
7e67ca242254-13 | property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶
List configurable fields for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶
The type of input this runnable accepts specified as a pydantic model.
property lc_attributes: Dict¶
List of attribute names that should b... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.bittensor.NIBittensorLLM.html |
c1d6f9d875e0-0 | langchain.llms.vertexai.is_codey_model¶
langchain.llms.vertexai.is_codey_model(model_name: str) → bool[source]¶
Returns True if the model name is a Codey model.
Parameters
model_name – The model name to check.
Returns: True if the model name is a Codey model. | lang/api.python.langchain.com/en/latest/llms/langchain.llms.vertexai.is_codey_model.html |
53dcc2adc77b-0 | langchain.llms.aviary.get_models¶
langchain.llms.aviary.get_models() → List[str][source]¶
List available models | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aviary.get_models.html |
4cc413362a29-0 | langchain.llms.fireworks.completion_with_retry_batching¶
langchain.llms.fireworks.completion_with_retry_batching(llm: Fireworks, use_retry: bool, *, run_manager: Optional[CallbackManagerForLLMRun] = None, **kwargs: Any) → Any[source]¶
Use tenacity to retry the completion call. | lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.completion_with_retry_batching.html |
93542bfc799f-0 | langchain.llms.aviary.AviaryBackend¶
class langchain.llms.aviary.AviaryBackend(backend_url: str, bearer: str)[source]¶
Aviary backend.
backend_url¶
The URL for the Aviary backend.
Type
str
bearer¶
The bearer token for the Aviary backend.
Type
str
Attributes
backend_url
bearer
Methods
__init__(backend_url, bearer)
from_... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aviary.AviaryBackend.html |
4bee6d12759f-0 | langchain.llms.huggingface_pipeline.HuggingFacePipeline¶
class langchain.llms.huggingface_pipeline.HuggingFacePipeline[source]¶
Bases: BaseLLM
HuggingFace Pipeline API.
To use, you should have the transformers python package installed.
Only supports text-generation, text2text-generation and summarization for now.
Examp... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-1 | Keyword arguments passed to the model.
param pipeline_kwargs: Optional[dict] = None¶
Keyword arguments passed to the pipeline.
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
param verbose: bool [Optional]¶
Whether to print out response text.
__call__(prompt: str, stop: Optional[List[str]] = None,... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-3 | the runnable did not implement a native async version of invoke.
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 ... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-4 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-5 | e.g., if the underlying runnable uses an API which supports a batch mode.
bind(**kwargs: Any) → Runnable[Input, Output]¶
Bind arguments to a Runnable, returning a new Runnable.
config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶
The type of config this runnable accepts specified as a pydantic m... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-6 | 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 creating
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(**kw... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-7 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-8 | For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
get_num_tokens(text: str) → int¶
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
Th... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-9 | Transform a single input into an output. Override to implement.
Parameters
input – The input to the runnable.
config – A config to use when invoking the runnable.
The config supports standard keys like ‘tags’, ‘metadata’ for tracing
purposes, ‘max_concurrency’ for controlling how much work to do
in parallel, and other ... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-10 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Pass a single string input to t... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-11 | .. 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: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
stream(input: Union[Promp... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-12 | Add fallbacks to a runnable, returning a new Runnable.
Parameters
fallbacks – A sequence of runnables to try if the original runnable fails.
exceptions_to_handle – A tuple of exception types to handle.
Returns
A new Runnable that will try the original runnable, and then each
fallback in order, upon failures.
with_liste... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
4bee6d12759f-13 | Bind input and output types to a Runnable, returning a new Runnable.
property InputType: TypeAlias¶
Get the input type for this runnable.
property OutputType: Type[str]¶
Get the input type for this runnable.
property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶
List configurable fields for... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_pipeline.HuggingFacePipeline.html |
3308dda14ad3-0 | langchain.llms.javelin_ai_gateway.Params¶
class langchain.llms.javelin_ai_gateway.Params[source]¶
Bases: BaseModel
Parameters for the Javelin AI Gateway LLM.
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.
p... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.javelin_ai_gateway.Params.html |
3308dda14ad3-1 | deep – set to True to make a deep copy of the model
Returns
new model instance
dict(*, 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, ex... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.javelin_ai_gateway.Params.html |
3308dda14ad3-2 | classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.javelin_ai_gateway.Params.html |
cb6b2e428eb2-0 | langchain.llms.aleph_alpha.AlephAlpha¶
class langchain.llms.aleph_alpha.AlephAlpha[source]¶
Bases: LLM
Aleph Alpha large language models.
To use, you should have the aleph_alpha_client python package installed, and the
environment variable ALEPH_ALPHA_API_KEY set with your API key, or pass
it as a named parameter to th... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-1 | If set to None, attention control parameters only apply to those tokens that have
explicitly been set in the request.
If set to a non-None value, control parameters are also applied to similar tokens.
param control_log_additive: Optional[bool] = True¶
True: apply control by adding the log(control_factor) to attention s... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-2 | param metadata: Optional[Dict[str, Any]] = None¶
Metadata to add to the run trace.
param minimum_tokens: Optional[int] = 0¶
Generate at least this number of tokens.
param model: Optional[str] = 'luminous-base'¶
Model name to use.
param n: int = 1¶
How many completions to generate for each prompt.
param nice: bool = Fal... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-3 | Stop sequences to use.
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
param temperature: float = 0.0¶
A non-negative float that tunes the degree of randomness in generation.
param tokens: Optional[bool] = False¶
return tokens of completion.
param top_k: int = 0¶
Number of most likely tokens to co... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-4 | 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 runs ainvoke in parallel using as... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-5 | need more output from the model than just the top generated value,
are building chains that are agnostic to the underlying language modeltype (e.g., pure text completion models vs chat models).
Parameters
prompts – List of PromptValues. A PromptValue is an object that can be
converted to match the format of any languag... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-6 | **kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a string.
async apredict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Asynchronously pass messages to the model and ... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-7 | 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 can be applied in order to construct state.
async atransform(input: As... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-8 | Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶
configurable_fields(**kwargs: Union[ConfigurableField, C... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-9 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-10 | 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.
get_inp... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-11 | Get a pydantic model that can be used to validate output to the runnable.
Runnables that leverage the configurable_fields and configurable_alternatives
methods will have a dynamic output schema that depends on which
configuration the runnable is invoked with.
This method allows to get an output schema for a specific co... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-12 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-13 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-14 | 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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-15 | fallback in order, upon failures.
with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶
Bind lifecycle listeners to a Runnable, returning a new Runnable.
on_start: Called before the runnable starts running, with the Run ... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
cb6b2e428eb2-16 | property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶
List configurable fields for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶
The type of input this runnable accepts specified as a pydantic model.
property lc_attributes: Dict¶
List of attribute names that should b... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.aleph_alpha.AlephAlpha.html |
417552ad3e52-0 | langchain.llms.azureml_endpoint.AzureMLOnlineEndpoint¶
class langchain.llms.azureml_endpoint.AzureMLOnlineEndpoint[source]¶
Bases: LLM, BaseModel
Azure ML Online Endpoint models.
Example
azure_llm = AzureMLOnlineEndpoint(
endpoint_url="https://<your-endpoint>.<your_region>.inference.ml.azure.com/score",
endpoin... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.azureml_endpoint.AzureMLOnlineEndpoint.html |
417552ad3e52-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... | lang/api.python.langchain.com/en/latest/llms/langchain.llms.azureml_endpoint.AzureMLOnlineEndpoint.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.