id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
417552ad3e52-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.azureml_endpoint.AzureMLOnlineEndpoint.html
a2dcf9b37a4b-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 ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.huggingface_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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.huggingface_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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.huggingface_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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.huggingface_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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.huggingface_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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.huggingface_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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.huggingface_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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.huggingface_endpoint.HuggingFaceEndpoint.html
a2dcf9b37a4b-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.huggingface_endpoint.HuggingFaceEndpoint.html
6dd1eb9a53c8-0
langchain.llms.cohere.Cohere¶ class langchain.llms.cohere.Cohere[source]¶ Bases: LLM, BaseCohere Cohere large language models. To use, you should have the cohere python package installed, and the environment variable COHERE_API_KEY set with your API key, or pass it as a named parameter to the constructor. Example from ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.cohere.Cohere.html
6dd1eb9a53c8-1
param stop: Optional[List[str]] = None¶ param streaming: bool = False¶ Whether to stream the results. param tags: Optional[List[str]] = None¶ Tags to add to the run trace. param temperature: float = 0.75¶ A non-negative float that tunes the degree of randomness in generation. param truncate: Optional[str] = None¶ Speci...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
6dd1eb9a53c8-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.cohere.Cohere.html
8ce84ada46b3-0
langchain.llms.vllm.VLLMOpenAI¶ class langchain.llms.vllm.VLLMOpenAI[source]¶ Bases: BaseOpenAI vLLM OpenAI-compatible API client Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a valid model. param allowed_special: Union[...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.vllm.VLLMOpenAI.html
8ce84ada46b3-1
param metadata: Optional[Dict[str, Any]] = None¶ Metadata to add to the run trace. param model_kwargs: Dict[str, Any] [Optional]¶ Holds any model parameters valid for create call not explicitly specified. param model_name: str = 'text-davinci-003' (alias 'model')¶ Model name to use. param n: int = 1¶ How many completio...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.vllm.VLLMOpenAI.html
8ce84ada46b3-2
them to be under a certain limit. By default, when set to None, this will be the same as the embedding model name. However, there are some cases where you may want to use this Embedding class with a model name not supported by tiktoken. This can include when using Azure embeddings or when using one of the many model pr...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.vllm.VLLMOpenAI.html
8ce84ada46b3-3
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.vllm.VLLMOpenAI.html
8ce84ada46b3-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.vllm.VLLMOpenAI.html
8ce84ada46b3-5
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.vllm.VLLMOpenAI.html
8ce84ada46b3-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 runs invoke in parallel using a thread pool executor. The default i...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.vllm.VLLMOpenAI.html
8ce84ada46b3-7
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.vllm.VLLMOpenAI.html
8ce84ada46b3-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.vllm.VLLMOpenAI.html
8ce84ada46b3-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.vllm.VLLMOpenAI.html
8ce84ada46b3-10
Get the sub prompts for llm call. get_token_ids(text: str) → List[int]¶ 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 output. Ove...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.vllm.VLLMOpenAI.html
8ce84ada46b3-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¶ Calculate the maximum number of tokens possible to generate for a prompt. Parameters prompt – The prompt to pa...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.vllm.VLLMOpenAI.html
8ce84ada46b3-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.vllm.VLLMOpenAI.html
8ce84ada46b3-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.vllm.VLLMOpenAI.html
8ce84ada46b3-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.vllm.VLLMOpenAI.html
8ce84ada46b3-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. Examples using VLLMOpenAI¶ vLLM
lang/api.python.langchain.com/en/latest/llms/langchain.llms.vllm.VLLMOpenAI.html
76fb1c9bc58f-0
langchain.llms.rwkv.RWKV¶ class langchain.llms.rwkv.RWKV[source]¶ Bases: LLM, BaseModel RWKV language models. To use, you should have the rwkv python package installed, the pre-trained model file, and the model’s config information. Example from langchain.llms import RWKV model = RWKV(model="./models/rwkv-3b-fp16.bin",...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.rwkv.RWKV.html
76fb1c9bc58f-1
Token context window. param tags: Optional[List[str]] = None¶ Tags to add to the run trace. param temperature: float = 1.0¶ The temperature to use for sampling. param tokens_path: str [Required]¶ Path to the RWKV tokens file. param top_p: float = 0.5¶ The top-p value to use for sampling. param verbose: bool [Optional]¶...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-11
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: bool = True, ref_template: unicode = '#/...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
76fb1c9bc58f-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.rwkv.RWKV.html
666273585653-0
langchain.llms.together.Together¶ class langchain.llms.together.Together[source]¶ Bases: LLM Wrapper around Together AI models. To use, you’ll need an API key which you can find here: https://api.together.xyz/settings/api-keys. This can be passed in as init param together_api_key or set as environment variable TOGETHER...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.together.Together.html
666273585653-1
Together AI API key. Get it here: https://api.together.xyz/settings/api-keys param top_k: Optional[int] = None¶ Used to limit the number of choices for the next predicted word or token. It specifies the maximum number of tokens to consider at each step, based on their probability of occurrence. This technique helps to ...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
666273585653-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.together.Together.html
bc8b12cf41eb-0
langchain.llms.textgen.TextGen¶ class langchain.llms.textgen.TextGen[source]¶ Bases: LLM text-generation-webui models. To use, you should have the text-generation-webui installed, a model loaded, and –api added as a command-line option. Suggested installation, use one-click installer for your OS: https://github.com/oob...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.textgen.TextGen.html
bc8b12cf41eb-1
Metadata to add to the run trace. param min_length: Optional[int] = 0¶ Minimum generation length in tokens. param model_url: str [Required]¶ The full URL to the textgen webui including http[s]://host:port param no_repeat_ngram_size: Optional[int] = 0¶ If not set to 0, specifies the length of token sets that are complet...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.textgen.TextGen.html
bc8b12cf41eb-2
Similar to top_p, but select instead only the top_k most likely tokens. Higher value = higher range of possible random results. param top_p: Optional[float] = 0.1¶ If not set to 1, select tokens with probabilities adding up to less than this number. Higher value = higher range of possible random results. param truncati...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.textgen.TextGen.html
bc8b12cf41eb-3
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.textgen.TextGen.html
bc8b12cf41eb-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...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.textgen.TextGen.html
bc8b12cf41eb-5
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.textgen.TextGen.html
bc8b12cf41eb-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 runs invoke in parallel using a thread pool executor. The default i...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.textgen.TextGen.html
bc8b12cf41eb-7
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.textgen.TextGen.html
bc8b12cf41eb-8
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.textgen.TextGen.html
bc8b12cf41eb-9
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.textgen.TextGen.html
bc8b12cf41eb-10
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.textgen.TextGen.html
bc8b12cf41eb-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.textgen.TextGen.html
bc8b12cf41eb-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.textgen.TextGen.html
bc8b12cf41eb-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.textgen.TextGen.html
bc8b12cf41eb-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.textgen.TextGen.html
d946a896f476-0
langchain.llms.octoai_endpoint.OctoAIEndpoint¶ class langchain.llms.octoai_endpoint.OctoAIEndpoint[source]¶ Bases: LLM OctoAI LLM Endpoints. OctoAIEndpoint is a class to interact with OctoAICompute Service large language model endpoints. To use, you should have the octoai python package installed, and the environment v...
lang/api.python.langchain.com/en/latest/llms/langchain.llms.octoai_endpoint.OctoAIEndpoint.html