id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
d26a797910e6-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.ctranslate2.CTranslate2.html
d26a797910e6-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.ctranslate2.CTranslate2.html
d26a797910e6-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.ctranslate2.CTranslate2.html
d26a797910e6-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.ctranslate2.CTranslate2.html
d26a797910e6-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.ctranslate2.CTranslate2.html
67944cc350cc-0
langchain.llms.databricks.Databricks¶ class langchain.llms.databricks.Databricks[source]¶ Bases: LLM Databricks serving endpoint or a cluster driver proxy app for LLM. It supports two endpoint types: Serving endpoint (recommended for both production and development). We assume that an LLM was registered and deployed to...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-1
If the endpoint model signature is different or you want to set extra params, you can use transform_input_fn and transform_output_fn to apply necessary transformations before and after the query. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data can...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-2
param host: str [Optional]¶ Databricks workspace hostname. If not provided, the default value is determined by the DATABRICKS_HOST environment variable if present, or the hostname of the current Databricks workspace if running inside a Databricks notebook attached to an interactive cluster in “single user” or “no isola...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-3
Default implementation runs ainvoke in parallel using asyncio.gather. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. async agenerate(prompts: List[...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-4
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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-5
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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-6
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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-7
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 since it adds all passed values...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-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.databricks.Databricks.html
67944cc350cc-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.databricks.Databricks.html
67944cc350cc-10
Parameters text – The string input to tokenize. Returns A list of ids corresponding to the tokens in the text, in order they occurin the text. invoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → str¶ Transform a single ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-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. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool =...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-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 message. save(file_path: Union[Path, str]) → None¶ Save the LLM. Parameters file_path – Path to file to save the LLM to. Example: .. ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-13
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'Exception'>,)) → RunnableWithFallbacksT[Input, Output]¶ Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A se...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
67944cc350cc-14
between retries stop_after_attempt – The maximum number of attempts to make before giving up Returns A new Runnable that retries the original runnable on exceptions. with_types(*, input_type: Optional[Type[Input]] = None, output_type: Optional[Type[Output]] = None) → Runnable[Input, Output]¶ Bind input and output types...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.databricks.Databricks.html
8872550373c8-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, ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-3
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.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-4
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.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-5
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.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-6
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.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-7
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.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-8
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 agnostic to the underlying language modeltype (e.g., pure text completion models vs chat models). Parameters prompts – List of PromptValues. A PromptVal...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-9
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 The integer number of tokens in the text. get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶ Get the ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-10
The config supports standard keys like ‘tags’, ‘metadata’ for tracing purposes, ‘max_concurrency’ for controlling how much work to do in parallel, and other keys. Please refer to the RunnableConfig for more details. Returns The output of the runnable. classmethod is_lc_serializable() → bool¶ Is this class serializable?...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-11
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.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-12
.. 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.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-13
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.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
8872550373c8-14
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.self_hosted_hugging_face.SelfHostedHuggingFaceLLM.html
c9f36f9d3ae5-0
langchain.llms.azureml_endpoint.OSSContentFormatter¶ class langchain.llms.azureml_endpoint.OSSContentFormatter[source]¶ Deprecated: Kept for backwards compatibility Content handler for LLMs from the OSS catalog. Attributes accepts The MIME type of the response data returned from the endpoint content_formatter content_t...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.azureml_endpoint.OSSContentFormatter.html
ed75cca15371-0
langchain.llms.fireworks.completion_with_retry¶ langchain.llms.fireworks.completion_with_retry(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.html
85bda5713254-0
langchain.llms.base.BaseLLM¶ class langchain.llms.base.BaseLLM[source]¶ Bases: BaseLanguageModel[str], ABC Base LLM abstract interface. It should take in a prompt and return a string. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parse...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-1
Subclasses should override this method if they can batch more efficiently; 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[BaseC...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-2
first occurrence of any of these substrings. callbacks – Callbacks to pass through. Used for executing additional 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 co...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-3
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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-4
Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can start producing output while input is still being generated. batch(inputs: List[Union[PromptValue, str, List[BaseMessage]]], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = Non...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-5
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, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-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[source]¶ Pass a sequen...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-7
methods will have a dynamic input schema that depends on which configuration the runnable is invoked with. 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_...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-8
Return the ordered ids of the tokens in a text. Parameters text – The string input to tokenize. Returns A list of ids corresponding to the tokens in the text, in order they occurin the text. invoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] =...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-9
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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-10
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. save(file_path: Union[Path, str]) → None[source]¶ S...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-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: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'E...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
85bda5713254-12
Create a new Runnable that retries the original runnable on exceptions. Parameters retry_if_exception_type – A tuple of exception types to retry on wait_exponential_jitter – Whether to add jitter to the wait time between retries stop_after_attempt – The maximum number of attempts to make before giving up Returns A new ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.base.BaseLLM.html
1a3149bcf9a5-0
langchain.llms.vertexai.stream_completion_with_retry¶ langchain.llms.vertexai.stream_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.stream_completion_with_retry.html
4403e137fc63-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.azureml_endpoint.AzureMLEndpointClient.html
7b1676530787-0
langchain.llms.fireworks.Fireworks¶ class langchain.llms.fireworks.Fireworks[source]¶ Bases: BaseLLM Fireworks 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 batch_size: int = 20¶ param cache:...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
7b1676530787-1
Default implementation runs ainvoke in parallel using asyncio.gather. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. async agenerate(prompts: List[...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
7b1676530787-2
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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
7b1676530787-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
7b1676530787-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
7b1676530787-5
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 since it adds all passed values...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
7b1676530787-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.fireworks.Fireworks.html
7b1676530787-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_bat...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
7b1676530787-8
Returns The sum of the number of tokens across the messages. get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶ 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 o...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
7b1676530787-9
classmethod is_lc_serializable() → bool[source]¶ 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, excl...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
7b1676530787-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.fireworks.Fireworks.html
7b1676530787-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.fireworks.Fireworks.html
7b1676530787-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.fireworks.Fireworks.html
7b1676530787-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.fireworks.Fireworks.html
c93bbdcae8bb-0
langchain_experimental.llms.rellm_decoder.import_rellm¶ langchain_experimental.llms.rellm_decoder.import_rellm() → rellm[source]¶ Lazily import rellm.
lang/api.python.langchain.com/en/latest/llms/langchain_experimental.llms.rellm_decoder.import_rellm.html
a171589e8c8d-0
langchain.llms.modal.Modal¶ class langchain.llms.modal.Modal[source]¶ Bases: LLM Modal large language models. To use, you should have the modal-client python package installed. 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.llm...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-1
Default implementation runs ainvoke in parallel using asyncio.gather. The default implementation of batch works well for IO bound runnables. Subclasses should override this method if they can batch more efficiently; e.g., if the underlying runnable uses an API which supports a batch mode. async agenerate(prompts: List[...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-2
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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-5
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 since it adds all passed values...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-7
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.modal.Modal.html
a171589e8c8d-8
Parameters text – The string input to tokenize. Returns A list of ids corresponding to the tokens in the text, in order they occurin the text. invoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → str¶ Transform a single ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-9
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, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool =...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-10
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. save(file_path: Union[Path, str]) → None¶ Save the LLM. Parameters file_path – Path to file to save the LLM to. Example: .. ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-11
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'Exception'>,)) → RunnableWithFallbacksT[Input, Output]¶ Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A se...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
a171589e8c8d-12
between retries stop_after_attempt – The maximum number of attempts to make before giving up Returns A new Runnable that retries the original runnable on exceptions. with_types(*, input_type: Optional[Type[Input]] = None, output_type: Optional[Type[Output]] = None) → Runnable[Input, Output]¶ Bind input and output types...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
752871a00972-0
langchain.llms.arcee.Arcee¶ class langchain.llms.arcee.Arcee[source]¶ Bases: LLM Arcee’s Domain Adapted Language Models (DALMs). To use, set the ARCEE_API_KEY environment variable with your Arcee API key, or pass arcee_api_key as a named parameter. Example from langchain.llms import Arcee arcee = Arcee( model="DALM...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-7
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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.arcee.Arcee.html
752871a00972-8
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 tokenize. Returns The sum of the number of tokens across the messages. get_output_schema(config: Op...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
752871a00972-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.arcee.Arcee.html
80af13ff513b-0
langchain.llms.gpt4all.GPT4All¶ class langchain.llms.gpt4all.GPT4All[source]¶ Bases: LLM GPT4All language models. To use, you should have the gpt4all python package installed, the pre-trained model file, and the model’s config information. Example from langchain.llms import GPT4All model = GPT4All(model="./models/gpt4a...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.gpt4all.GPT4All.html
80af13ff513b-1
param n_batch: int = 8¶ Batch size for prompt processing. param n_parts: int = -1¶ Number of parts to split the model into. If -1, the number of parts is automatically determined. param n_predict: Optional[int] = 256¶ The maximum number of tokens to generate. param n_threads: Optional[int] = 4¶ Number of threads to use...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.gpt4all.GPT4All.html
80af13ff513b-2
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.gpt4all.GPT4All.html
80af13ff513b-3
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.gpt4all.GPT4All.html
80af13ff513b-4
**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.gpt4all.GPT4All.html
80af13ff513b-5
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.gpt4all.GPT4All.html