id stringlengths 14 16 | text stringlengths 13 2.7k | source stringlengths 57 178 |
|---|---|---|
0e8f429a1d47-15 | property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model.
Examples using ChatAnyscale¶
Anyscale | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.anyscale.ChatAnyscale.html |
5657b76cc42c-0 | langchain.chat_models.human.HumanInputChatModel¶
class langchain.chat_models.human.HumanInputChatModel[source]¶
Bases: BaseChatModel
ChatModel which returns user input as the response.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be pars... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-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(messages: List[List[BaseMessage]], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-2 | 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 ainvoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-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[BaseMessageChunk]¶
Default implementation of astream, which calls ainvo... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-4 | input is still being generated.
batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶
Default implementation runs invoke in parallel using a thread pool executor.
The default implementation of batch w... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-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/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-6 | 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/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-7 | 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/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-8 | 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 keys. Please refer to the RunnableConfig
for more details.
Returns
The output of the runnable.
classmethod is_... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-9 | 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/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-10 | stream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → Iterator[BaseMessageChunk]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-11 | 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/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5657b76cc42c-12 | 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 be included in the serialized kwargs.
These attributes must be accepted by the constr... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.human.HumanInputChatModel.html |
5fd2ca05c7f7-0 | langchain.chat_models.baidu_qianfan_endpoint.convert_message_to_dict¶
langchain.chat_models.baidu_qianfan_endpoint.convert_message_to_dict(message: BaseMessage) → dict[source]¶
Convert a message to a dictionary that can be passed to the API.
Examples using convert_message_to_dict¶
Twitter (via Apify) | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.baidu_qianfan_endpoint.convert_message_to_dict.html |
a4f73a187f15-0 | langchain.chat_models.ernie.ErnieBotChat¶
class langchain.chat_models.ernie.ErnieBotChat[source]¶
Bases: BaseChatModel
ERNIE-Bot large language model.
ERNIE-Bot is a large language model developed by Baidu,
covering a huge amount of Chinese data.
To use, you should have the ernie_client_id and ernie_client_secret set,
... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-1 | Metadata to add to the run trace.
param model_name: str = 'ERNIE-Bot-turbo'¶
model name of ernie, default is ERNIE-Bot-turbo.
Currently supported ERNIE-Bot-turbo, ERNIE-Bot
param penalty_score: Optional[float] = 1¶
param request_timeout: Optional[int] = 60¶
request timeout for chat http requests
param streaming: Option... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-2 | e.g., if the underlying runnable uses an API which supports a batch mode.
async agenerate(messages: List[List[BaseMessage]], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-3 | async ainvoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → BaseMessage¶
Default implementation of ainvoke, calls invoke from a thread.
The default implementation allows usage of async code even if
the runnable did not i... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-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[BaseMessageChunk]¶
Default implementation of astream, which calls ainvo... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-5 | input is still being generated.
batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶
Default implementation runs invoke in parallel using a thread pool executor.
The default implementation of batch w... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-6 | 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/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-7 | 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/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-8 | 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/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-9 | 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 keys. Please refer to the RunnableConfig
for more details.
Returns
The output of the runnable.
classmethod is_... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-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/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-11 | stream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → Iterator[BaseMessageChunk]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-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/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
a4f73a187f15-13 | 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 be included in the serialized kwargs.
These attributes must be accepted by the constr... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ernie.ErnieBotChat.html |
d84d8cd615a3-0 | langchain.chat_models.bedrock.BedrockChat¶
class langchain.chat_models.bedrock.BedrockChat[source]¶
Bases: BaseChatModel, BedrockBase
A chat model that uses the Bedrock API.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-1 | param region_name: Optional[str] = None¶
The aws region e.g., us-west-2. Fallsback to AWS_DEFAULT_REGION env variable
or region specified in ~/.aws/config in case it is not provided here.
param streaming: bool = False¶
Whether to stream the results.
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-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... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-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.... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-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/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-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.
call_as_llm(message: str, stop: Optional[List[str]] = None, **kwargs: Any) → str¶
config_schema(*, include: Optional[Sequence[str]] = None) → T... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-6 | Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include – fields to include in new model
exclude – fields to exclude from new model, as with values this takes precedence over include
update – values to change/add in the new model. Note: the data is not validated before creat... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-7 | 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/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-8 | 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: Optional[RunnableConfig] = None) → Type[BaseModel]¶
Get a pydantic model that can be used to validate output ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-9 | Return whether this model can be serialized by Langchain.
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_defaults: bool ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-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/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-11 | Subclasses should override this method if they support streaming output.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Defau... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-12 | on_end: Called after the runnable finishes running, with the Run object.
on_error: Called if the runnable throws an error, with the Run object.
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(*, ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
d84d8cd615a3-13 | property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model.
Examples using BedrockChat¶
Bedrock Chat | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
c5efb603dd11-0 | langchain.chat_models.litellm.acompletion_with_retry¶
async langchain.chat_models.litellm.acompletion_with_retry(llm: ChatLiteLLM, run_manager: Optional[AsyncCallbackManagerForLLMRun] = None, **kwargs: Any) → Any[source]¶
Use tenacity to retry the async completion call. | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.litellm.acompletion_with_retry.html |
0c7215a9c546-0 | langchain.chat_models.cohere.get_role¶
langchain.chat_models.cohere.get_role(message: BaseMessage) → str[source]¶
Get the role of the message.
Parameters
message – The message.
Returns
The role of the message.
Raises
ValueError – If the message is of an unknown type. | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.cohere.get_role.html |
627764212183-0 | langchain.chat_models.fake.FakeMessagesListChatModel¶
class langchain.chat_models.fake.FakeMessagesListChatModel[source]¶
Bases: BaseChatModel
Fake ChatModel for testing purposes.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-1 | e.g., if the underlying runnable uses an API which supports a batch mode.
async agenerate(messages: List[List[BaseMessage]], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-2 | async ainvoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → BaseMessage¶
Default implementation of ainvoke, calls invoke from a thread.
The default implementation allows usage of async code even if
the runnable did not i... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-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[BaseMessageChunk]¶
Default implementation of astream, which calls ainvo... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-4 | input is still being generated.
batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶
Default implementation runs invoke in parallel using a thread pool executor.
The default implementation of batch w... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-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/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-6 | 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/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-7 | 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/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-8 | 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 keys. Please refer to the RunnableConfig
for more details.
Returns
The output of the runnable.
classmethod is_... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-9 | 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/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-10 | stream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → Iterator[BaseMessageChunk]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-11 | 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/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
627764212183-12 | 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 be included in the serialized kwargs.
These attributes must be accepted by the constr... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
3924dc4b55fb-0 | langchain.chat_models.fireworks.acompletion_with_retry¶
async langchain.chat_models.fireworks.acompletion_with_retry(llm: ChatFireworks, use_retry: bool, *, run_manager: Optional[AsyncCallbackManagerForLLMRun] = None, **kwargs: Any) → Any[source]¶
Use tenacity to retry the async completion call. | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fireworks.acompletion_with_retry.html |
20c9c7ef591f-0 | langchain.chat_models.hunyuan.ChatHunyuan¶
class langchain.chat_models.hunyuan.ChatHunyuan[source]¶
Bases: BaseChatModel
Tencent Hunyuan chat models API by Tencent.
For more information, see https://cloud.tencent.com/document/product/1729
Create a new model by parsing and validating input data from keyword arguments.
R... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-1 | Whether to stream the results or not.
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
param temperature: float = 1.0¶
What sampling temperature to use.
param top_p: float = 1.0¶
What probability mass to use.
param verbose: bool [Optional]¶
Whether to print out response text.
__call__(messages: Lis... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-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... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-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.... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-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/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-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.
call_as_llm(message: str, stop: Optional[List[str]] = None, **kwargs: Any) → str¶
config_schema(*, include: Optional[Sequence[str]] = None) → T... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-6 | Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include – fields to include in new model
exclude – fields to exclude from new model, as with values this takes precedence over include
update – values to change/add in the new model. Note: the data is not validated before creat... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-7 | 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/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-8 | 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: Optional[RunnableConfig] = None) → Type[BaseModel]¶
Get a pydantic model that can be used to validate output ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-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/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-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/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-11 | Subclasses should override this method if they support streaming output.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Defau... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-12 | on_end: Called after the runnable finishes running, with the Run object.
on_error: Called if the runnable throws an error, with the Run object.
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(*, ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
20c9c7ef591f-13 | property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property lc_serializable: bool¶
property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model. | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.hunyuan.ChatHunyuan.html |
b9457ba01024-0 | langchain.chat_models.azureml_endpoint.LlamaContentFormatter¶
class langchain.chat_models.azureml_endpoint.LlamaContentFormatter[source]¶
Content formatter for LLaMA.
Attributes
SUPPORTED_ROLES
accepts
The MIME type of the response data returned from the endpoint
content_type
The MIME type of the input data passed to t... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.LlamaContentFormatter.html |
238d0c0e87b0-0 | langchain.chat_models.google_palm.ChatGooglePalm¶
class langchain.chat_models.google_palm.ChatGooglePalm[source]¶
Bases: BaseChatModel, BaseModel
Google PaLM Chat models API.
To use you must have the google.generativeai Python package installed and
either:
The GOOGLE_API_KEY` environment variable set with your API key,... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-1 | Must be positive.
param top_p: Optional[float] = None¶
Decode using nucleus sampling: consider the smallest set of tokens whose
probability sum is at least top_p. Must be in the closed interval [0.0, 1.0].
param verbose: bool [Optional]¶
Whether to print out response text.
__call__(messages: List[BaseMessage], stop: Op... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-2 | 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 agnostic to the underlying language modeltype (e.g., pure text completion ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-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.... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-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/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-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.
call_as_llm(message: str, stop: Optional[List[str]] = None, **kwargs: Any) → str¶
config_schema(*, include: Optional[Sequence[str]] = None) → T... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-6 | Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include – fields to include in new model
exclude – fields to exclude from new model, as with values this takes precedence over include
update – values to change/add in the new model. Note: the data is not validated before creat... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-7 | 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/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-8 | 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: Optional[RunnableConfig] = None) → Type[BaseModel]¶
Get a pydantic model that can be used to validate output ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-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/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-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/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-11 | Subclasses should override this method if they support streaming output.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() → SerializedNotImplemented¶
transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Defau... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-12 | on_end: Called after the runnable finishes running, with the Run object.
on_error: Called if the runnable throws an error, with the Run object.
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(*, ... | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
238d0c0e87b0-13 | property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model. | lang/api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.ChatGooglePalm.html |
b82fbb5085c8-0 | langchain_experimental.chat_models.llm_wrapper.Orca¶
class langchain_experimental.chat_models.llm_wrapper.Orca[source]¶
Bases: ChatWrapper
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 ai_n_beg: str ... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-1 | param usr_n_beg: str = '### User:\n'¶
param usr_n_end: str = '\n\n'¶
param verbose: bool [Optional]¶
Whether to print out response text.
__call__(messages: List[BaseMessage], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → BaseMessage... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-2 | 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/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-3 | 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.
async apredict_messages(messages: List[BaseMessage],... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-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... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-5 | Parameters
include – A list of fields to include in the config schema.
Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[I... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-6 | classmethod from_orm(obj: Any) → Model¶
generate(messages: List[List[BaseMessage]], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, **kwarg... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-7 | Get a pydantic model that can be used to validate input to the runnable.
Runnables that leverage the configurable_fields and configurable_alternatives
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 confi... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-8 | Returns
A pydantic model that can be used to validate output.
get_token_ids(text: str) → List[int]¶
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[PromptVal... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-9 | classmethod lc_id() → List[str]¶
A unique identifier for this class for serialization purposes.
The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with e... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-10 | Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Retur... | lang/api.python.langchain.com/en/latest/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
b82fbb5085c8-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/chat_models/langchain_experimental.chat_models.llm_wrapper.Orca.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.