id
stringlengths
14
15
text
stringlengths
44
2.47k
source
stringlengths
61
181
43fcb9cc9f9c-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.vertexai.VertexAIModelGarden.html
43fcb9cc9f9c-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.vertexai.VertexAIModelGarden.html
43fcb9cc9f9c-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.vertexai.VertexAIModelGarden.html
43fcb9cc9f9c-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.vertexai.VertexAIModelGarden.html
43fcb9cc9f9c-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.vertexai.VertexAIModelGarden.html
43fcb9cc9f9c-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.vertexai.VertexAIModelGarden.html
43fcb9cc9f9c-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.vertexai.VertexAIModelGarden.html
43fcb9cc9f9c-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.vertexai.VertexAIModelGarden.html
43fcb9cc9f9c-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.vertexai.VertexAIModelGarden.html
198c27400757-0
langchain.llms.huggingface_endpoint.HuggingFaceEndpoint¶ class langchain.llms.huggingface_endpoint.HuggingFaceEndpoint[source]¶ Bases: LLM HuggingFace Endpoint models. To use, you should have the huggingface_hub python package installed, and the environment variable HUGGINGFACEHUB_API_TOKEN set with your API token, or ...
https://api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
198c27400757-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.huggingface_endpoint.HuggingFaceEndpoint.html
e4373e6e017b-0
langchain.llms.openai.completion_with_retry¶ langchain.llms.openai.completion_with_retry(llm: Union[BaseOpenAI, OpenAIChat], run_manager: Optional[CallbackManagerForLLMRun] = None, **kwargs: Any) → Any[source]¶ Use tenacity to retry the completion call.
https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.completion_with_retry.html
935d4be8ad4b-0
langchain.llms.tongyi.generate_with_retry¶ langchain.llms.tongyi.generate_with_retry(llm: Tongyi, **kwargs: Any) → Any[source]¶ Use tenacity to retry the completion call.
https://api.python.langchain.com/en/latest/llms/langchain.llms.tongyi.generate_with_retry.html
e201d2bcfc2f-0
langchain.llms.bedrock.Bedrock¶ class langchain.llms.bedrock.Bedrock[source]¶ Bases: LLM, BedrockBase Bedrock models. To authenticate, the AWS client uses the following methods to automatically load credentials: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html If a specific credential prof...
https://api.python.langchain.com/en/latest/llms/langchain.llms.bedrock.Bedrock.html
e201d2bcfc2f-1
Key word arguments to pass to the model. param provider_stop_sequence_key_name_map: Mapping[str, str] = {'ai21': 'stop_sequences', 'amazon': 'stopSequences', 'anthropic': 'stop_sequences'}¶ param region_name: Optional[str] = None¶ The aws region e.g., us-west-2. Fallsback to AWS_DEFAULT_REGION env variable or region sp...
https://api.python.langchain.com/en/latest/llms/langchain.llms.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
e201d2bcfc2f-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.bedrock.Bedrock.html
80ab2c305674-0
langchain.llms.fireworks.Fireworks¶ class langchain.llms.fireworks.Fireworks[source]¶ Bases: LLM 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 cache: Optional[bool] = None¶ param ca...
https://api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
80ab2c305674-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.fireworks.Fireworks.html
80ab2c305674-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.fireworks.Fireworks.html
80ab2c305674-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][source]¶ Default implementation of astream, which calls ainvoke. S...
https://api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
80ab2c305674-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.fireworks.Fireworks.html
80ab2c305674-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.fireworks.Fireworks.html
80ab2c305674-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.fireworks.Fireworks.html
80ab2c305674-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.fireworks.Fireworks.html
80ab2c305674-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.fireworks.Fireworks.html
80ab2c305674-9
stream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → Iterator[str][source]¶ Default implementation of stream, which calls invoke. Subclasses should override this method if they support streaming output. to_json() → Union...
https://api.python.langchain.com/en/latest/llms/langchain.llms.fireworks.Fireworks.html
80ab2c305674-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.fireworks.Fireworks.html
1b54b0ee7449-0
langchain.llms.deepsparse.DeepSparse¶ class langchain.llms.deepsparse.DeepSparse[source]¶ Bases: LLM Neural Magic DeepSparse LLM interface. To use, you should have the deepsparse or deepsparse-nightly python package installed. See https://github.com/neuralmagic/deepsparse This interface let’s you deploy optimized LLMs ...
https://api.python.langchain.com/en/latest/llms/langchain.llms.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
1b54b0ee7449-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.deepsparse.DeepSparse.html
9aeb3cf42b42-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...
https://api.python.langchain.com/en/latest/llms/langchain.llms.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
9aeb3cf42b42-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.azureml_endpoint.AzureMLOnlineEndpoint.html
66a93dbda112-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...
https://api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
66a93dbda112-1
Default implementation of abatch, which calls ainvoke N times. 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[BaseCallbackHand...
https://api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
66a93dbda112-2
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 contains a list of candidate Generations for ea...
https://api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
66a93dbda112-3
**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[List[str]] = None, **kwargs: Any) → AsyncIter...
https://api.python.langchain.com/en/latest/llms/langchain.llms.modal.Modal.html
66a93dbda112-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.modal.Modal.html
66a93dbda112-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.modal.Modal.html
66a93dbda112-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.modal.Modal.html
66a93dbda112-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.modal.Modal.html
66a93dbda112-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.modal.Modal.html
66a93dbda112-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.modal.Modal.html
66a93dbda112-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.modal.Modal.html
776ae6301f87-0
langchain_experimental.llms.anthropic_functions.TagParser¶ class langchain_experimental.llms.anthropic_functions.TagParser[source]¶ A heavy-handed solution, but it’s fast for prototyping. Might be re-implemented later to restrict scope to the limited grammar, and more efficiency. Uses an HTML parser to parse a limited ...
https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.TagParser.html
776ae6301f87-1
parse_declaration(i) parse_endtag(i) parse_html_declaration(i) parse_marked_section(i[, report]) parse_pi(i) parse_starttag(i) reset() Reset this instance. set_cdata_mode(elem) unknown_decl(data) updatepos(i, j) __init__() → None[source]¶ A heavy-handed solution, but it’s fast for prototyping. Might be re-implemented l...
https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.TagParser.html
776ae6301f87-2
Hook when a tag is closed. handle_entityref(name)¶ handle_pi(data)¶ handle_startendtag(tag, attrs)¶ handle_starttag(tag: str, attrs: Any) → None[source]¶ Hook when a new tag is encountered. parse_bogus_comment(i, report=1)¶ parse_comment(i, report=1)¶ parse_declaration(i)¶ parse_endtag(i)¶ parse_html_declaration(i)¶ pa...
https://api.python.langchain.com/en/latest/llms/langchain_experimental.llms.anthropic_functions.TagParser.html
baef2ee3d166-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_...
https://api.python.langchain.com/en/latest/llms/langchain.llms.aviary.AviaryBackend.html
cd5c2c04e80d-0
langchain.llms.huggingface_text_gen_inference.HuggingFaceTextGenInference¶ class langchain.llms.huggingface_text_gen_inference.HuggingFaceTextGenInference[source]¶ Bases: LLM HuggingFace text generation API. To use, you should have the text-generation python package installed and a text-generation server running. Examp...
https://api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-1
param do_sample: bool = False¶ Activate logits sampling param inference_server_url: str = ''¶ text-generation-inference instance base url param max_new_tokens: int = 512¶ Maximum number of generated tokens param metadata: Optional[Dict[str, Any]] = None¶ Metadata to add to the run trace. param model_kwargs: Dict[str, A...
https://api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-2
param truncate: Optional[int] = None¶ Truncate inputs tokens to the given size param typical_p: Optional[float] = 0.95¶ Typical Decoding mass. See [Typical Decoding for Natural Language Generation](https://arxiv.org/abs/2202.00666) for more information. param verbose: bool [Optional]¶ Whether to print out response text...
https://api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-3
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.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-4
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.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-5
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.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-6
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.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-7
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.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-8
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.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-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...
https://api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-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...
https://api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-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...
https://api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
cd5c2c04e80d-12
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.huggingface_text_gen_inference.HuggingFaceTextGenInference.html
9a8d0892b65a-0
langchain.llms.openai.BaseOpenAI¶ class langchain.llms.openai.BaseOpenAI[source]¶ Bases: BaseLLM Base OpenAI large language model class. 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:...
https://api.python.langchain.com/en/latest/llms/langchain.llms.openai.BaseOpenAI.html
9a8d0892b65a-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.openai.BaseOpenAI.html
9a8d0892b65a-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.openai.BaseOpenAI.html
9a8d0892b65a-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.openai.BaseOpenAI.html
9a8d0892b65a-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.openai.BaseOpenAI.html