id stringlengths 14 15 | text stringlengths 44 2.47k | source stringlengths 61 181 |
|---|---|---|
72f9d2848d57-2 | classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatParams.html |
5ec3149e3d6c-0 | langchain.chat_models.anthropic.convert_messages_to_prompt_anthropic¶
langchain.chat_models.anthropic.convert_messages_to_prompt_anthropic(messages: List[BaseMessage], *, human_prompt: str = '\n\nHuman:', ai_prompt: str = '\n\nAssistant:') → str[source]¶
Format a list of messages into a full prompt for the Anthropic mo... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.anthropic.convert_messages_to_prompt_anthropic.html |
db2495b5c576-0 | langchain.chat_models.bedrock.BedrockChat¶
class langchain.chat_models.bedrock.BedrockChat[source]¶
Bases: BaseChatModel, BedrockBase
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[boo... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-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.
... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-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 ... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-3 | 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], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
A... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-4 | This includes all inner runs of LLMs, Retrievers, Tools, etc.
Output is streamed as Log objects, which include a list of
jsonpatch ops that describe how the state of the run has changed in each
step, and the final state of the run.
The jsonpatch ops can be applied in order to construct state.
async atransform(input: As... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-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/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-7 | 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.
Returns
A list of ids corresponding to the tokens in the text, in order they occurin the text.
invoke(input: Union[PromptValu... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-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/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-9 | to the model provider API call.
Returns
Top model prediction as a message.
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(in... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
db2495b5c576-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/chat_models/langchain.chat_models.bedrock.BedrockChat.html |
753da5d658b1-0 | langchain.chat_models.jinachat.acompletion_with_retry¶
async langchain.chat_models.jinachat.acompletion_with_retry(llm: JinaChat, **kwargs: Any) → Any[source]¶
Use tenacity to retry the async completion call. | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.jinachat.acompletion_with_retry.html |
ae5d97389c53-0 | langchain.chat_models.base.BaseChatModel¶
class langchain.chat_models.base.BaseChatModel[source]¶
Bases: BaseLanguageModel[BaseMessageChunk], ABC
Base class for Chat 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 ... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-1 | Subclasses should override this method if they can batch more efficiently.
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]] = Non... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-2 | async ainvoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → BaseMessageChunk[source]¶
Default implementation of ainvoke, which calls invoke in a thread pool.
Subclasses should override this method if they can run asynchr... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-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][source]¶
Default implementation of astream, which cal... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-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 of batch, which calls invoke N times.
Subclasses should override this method if they can ba... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-5 | Return a dictionary of the LLM.
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_nam... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-6 | classmethod get_lc_namespace() → List[str]¶
Get the namespace of the langchain object.
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 ... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-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/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-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/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-9 | 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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.BaseChatModel.html |
ae5d97389c53-10 | List of attribute names that should be included in the serialized kwargs.
These attributes must be accepted by the constructor.
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]¶ | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.BaseChatModel.html |
7999e3f533ce-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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.LlamaContentFormatter.html |
96a1308a9c16-0 | langchain.chat_models.google_palm.chat_with_retry¶
langchain.chat_models.google_palm.chat_with_retry(llm: ChatGooglePalm, **kwargs: Any) → Any[source]¶
Use tenacity to retry the completion call. | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.google_palm.chat_with_retry.html |
cb7be2a1738e-0 | langchain.chat_models.base.SimpleChatModel¶
class langchain.chat_models.base.SimpleChatModel[source]¶
Bases: BaseChatModel
Simple Chat Model.
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: Opti... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.SimpleChatModel.html |
cb7be2a1738e-1 | Subclasses should override this method if they can batch more efficiently.
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]] = Non... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.SimpleChatModel.html |
cb7be2a1738e-2 | async ainvoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → BaseMessageChunk¶
Default implementation of ainvoke, which calls invoke in a thread pool.
Subclasses should override this method if they can run asynchronously.... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.SimpleChatModel.html |
cb7be2a1738e-3 | Default implementation of astream, which calls ainvoke.
Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.SimpleChatModel.html |
cb7be2a1738e-4 | Bind arguments to a Runnable, returning a new Runnable.
call_as_llm(message: str, stop: Optional[List[str]] = None, **kwargs: Any) → str¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Defaul... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.SimpleChatModel.html |
cb7be2a1738e-5 | Top Level call
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → LLMResult¶
Pass a sequence of prompts to the model and return model generations.
This method should make use of batched calls f... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.SimpleChatModel.html |
cb7be2a1738e-6 | 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 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 t... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.SimpleChatModel.html |
cb7be2a1738e-7 | The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with each input.
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encod... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.SimpleChatModel.html |
cb7be2a1738e-8 | stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a message.
classmethod schema(by_alias: bool = True, ref_templ... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.base.SimpleChatModel.html |
cb7be2a1738e-9 | 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/chat_models/langchain.chat_models.base.SimpleChatModel.html |
2bc0f490dae5-0 | langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway¶
class langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway[source]¶
Bases: BaseChatModel
Javelin AI Gateway chat models API.
To use, you should have the javelin_sdk python package installed.
For more information, see https://docs.getjavelin.io
Exam... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-1 | param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
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) → BaseMessag... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-2 | 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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-3 | Asynchronously pass messages to the model and return a message prediction.
Use this method when calling chat models and only the topcandidate generation is needed.
Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off a... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-4 | The jsonpatch ops can be applied in order to construct state.
async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶
Default implementation of atransform, which buffers input and calls astream.
Subclasses should override this method if th... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-5 | 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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-6 | first occurrence of any of these substrings.
callbacks – Callbacks to pass through. Used for executing additional
functionality, such as logging or streaming, throughout generation.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
An LLMResult, which co... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-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/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-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/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-9 | 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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
2bc0f490dae5-10 | List of attribute names that should be included in the serialized kwargs.
These attributes must be accepted by the constructor.
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]¶ | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.javelin_ai_gateway.ChatJavelinAIGateway.html |
5b316afa11ad-0 | langchain.chat_models.fake.FakeMessagesListChatModel¶
class langchain.chat_models.fake.FakeMessagesListChatModel[source]¶
Bases: BaseChatModel
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: Opt... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
5b316afa11ad-1 | Subclasses should override this method if they can batch more efficiently.
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]] = Non... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
5b316afa11ad-2 | async ainvoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → BaseMessageChunk¶
Default implementation of ainvoke, which calls invoke in a thread pool.
Subclasses should override this method if they can run asynchronously.... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
5b316afa11ad-3 | Default implementation of astream, which calls ainvoke.
Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
5b316afa11ad-4 | Bind arguments to a Runnable, returning a new Runnable.
call_as_llm(message: str, stop: Optional[List[str]] = None, **kwargs: Any) → str¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Defaul... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
5b316afa11ad-5 | Top Level call
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → LLMResult¶
Pass a sequence of prompts to the model and return model generations.
This method should make use of batched calls f... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
5b316afa11ad-6 | 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 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 t... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
5b316afa11ad-7 | The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with each input.
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encod... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
5b316afa11ad-8 | stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a message.
classmethod schema(by_alias: bool = True, ref_templ... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
5b316afa11ad-9 | 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/chat_models/langchain.chat_models.fake.FakeMessagesListChatModel.html |
9d92538bf5c3-0 | langchain.chat_models.ollama.ChatOllama¶
class langchain.chat_models.ollama.ChatOllama[source]¶
Bases: BaseChatModel, _OllamaCommon
Ollama locally runs large language models.
To use, follow the instructions at https://ollama.ai/.
Example
from langchain.chat_models import ChatOllama
ollama = ChatOllama(model="llama2")
C... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-1 | coherent text. (Default: 5.0)
param model: str = 'llama2'¶
Model name to use.
param num_ctx: Optional[int] = None¶
Sets the size of the context window used to generate the
next token. (Default: 2048)
param num_gpu: Optional[int] = None¶
The number of GPUs to use. On macOS it defaults to 1 to
enable metal support, 0 to ... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-2 | Tail free sampling is used to reduce the impact of less probable
tokens from the output. A higher value (e.g., 2.0) will reduce the
impact more, while a value of 1.0 disables this setting. (default: 1)
param top_k: Optional[int] = None¶
Reduces the probability of generating nonsense. A higher value (e.g. 100)
will give... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-3 | Subclasses should override this method if they can batch more efficiently.
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]] = Non... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-4 | async ainvoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → BaseMessageChunk¶
Default implementation of ainvoke, which calls invoke in a thread pool.
Subclasses should override this method if they can run asynchronously.... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-5 | Default implementation of astream, which calls ainvoke.
Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-6 | Bind arguments to a Runnable, returning a new Runnable.
call_as_llm(message: str, stop: Optional[List[str]] = None, **kwargs: Any) → str¶
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Defaul... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-7 | Top Level call
generate_prompt(prompts: List[PromptValue], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) → LLMResult¶
Pass a sequence of prompts to the model and return model generations.
This method should make use of batched calls f... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-8 | 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 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 t... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-9 | 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 each input.
classmethod parse_file... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.ollama.ChatOllama.html |
9d92538bf5c3-11 | 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/chat_models/langchain.chat_models.ollama.ChatOllama.html |
d685128062aa-0 | langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint¶
class langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint[source]¶
Bases: SimpleChatModel
AzureML Chat models API.
Example
azure_chat = AzureMLChatOnlineEndpoint(
endpoint_url="https://<your-endpoint>.<your_region>.inference.ml.azure.com... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-1 | 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¶
Call self as a function.
async abatch(inputs: List[Input], config: ... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-2 | 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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-3 | Asynchronously pass messages to the model and return a message prediction.
Use this method when calling chat models and only the topcandidate generation is needed.
Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off a... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-4 | The jsonpatch ops can be applied in order to construct state.
async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶
Default implementation of atransform, which buffers input and calls astream.
Subclasses should override this method if th... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-5 | 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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-6 | first occurrence of any of these substrings.
callbacks – Callbacks to pass through. Used for executing additional
functionality, such as logging or streaming, throughout generation.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
An LLMResult, which co... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-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/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-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/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-9 | 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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
d685128062aa-10 | List of attribute names that should be included in the serialized kwargs.
These attributes must be accepted by the constructor.
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]¶
... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.azureml_endpoint.AzureMLChatOnlineEndpoint.html |
9de4872a65e5-0 | langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI¶
class langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI[source]¶
Bases: ChatOpenAI
PromptLayer and OpenAI Chat large language models API.
To use, you should have the openai and promptlayer python
package installed, and the environment variable... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-1 | Holds any model parameters valid for create call not explicitly specified.
param model_name: str = 'gpt-3.5-turbo' (alias 'model')¶
Model name to use.
param n: int = 1¶
Number of chat completions to generate for each prompt.
param openai_api_base: Optional[str] = None¶
param openai_api_key: Optional[str] = None¶
Base U... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-2 | API but with different models. In those cases, in order to avoid erroring
when tiktoken is called, you can specify a model name to use here.
param verbose: bool [Optional]¶
Whether to print out response text.
__call__(messages: List[BaseMessage], stop: Optional[List[str]] = None, callbacks: Optional[Union[List[BaseCall... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-3 | need more output from the model than just the top generated value,
are building chains that are agnostic to the underlying language modeltype (e.g., pure text completion models vs chat models).
Parameters
prompts – List of PromptValues. A PromptValue is an object that can be
converted to match the format of any languag... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-4 | to the model provider API call.
Returns
Top model prediction as a string.
async apredict_messages(messages: List[BaseMessage], *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → BaseMessage¶
Asynchronously pass messages to the model and return a message prediction.
Use this method when calling chat models and on... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-5 | jsonpatch ops that describe how the state of the run has changed in each
step, and the final state of the run.
The jsonpatch ops can be applied in order to construct state.
async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶
Default im... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-8 | main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb
get_token_ids(text: str) → List[int]¶
Get the tokens present in the text with tiktoken package.
invoke(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → BaseMessageC... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-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() → ... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
9de4872a65e5-11 | property InputType: TypeAlias¶
Get the input type for this runnable.
property OutputType: Any¶
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 be acce... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.promptlayer_openai.PromptLayerChatOpenAI.html |
3936c2867e88-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]¶
Examples using convert_message_to_dict¶
Twitter (via Apify) | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.baidu_qianfan_endpoint.convert_message_to_dict.html |
3df5d2f520db-0 | langchain.chat_models.fireworks.acompletion_with_retry_streaming¶
async langchain.chat_models.fireworks.acompletion_with_retry_streaming(llm: ChatFireworks, *, run_manager: Optional[AsyncCallbackManagerForLLMRun] = None, **kwargs: Any) → Any[source]¶
Use tenacity to retry the completion call for streaming. | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.fireworks.acompletion_with_retry_streaming.html |
9b6f65715ed0-0 | langchain.chat_models.minimax.MiniMaxChat¶
class langchain.chat_models.minimax.MiniMaxChat[source]¶
Bases: MinimaxCommon, BaseChatModel
Wrapper around Minimax large language models.
To use, you should have the environment variable MINIMAX_GROUP_ID and
MINIMAX_API_KEY set with your API token, or pass it as a named param... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.minimax.MiniMaxChat.html |
9b6f65715ed0-1 | param top_p: float = 0.95¶
Total probability mass of tokens to consider at each step.
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: A... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.minimax.MiniMaxChat.html |
9b6f65715ed0-2 | 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... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.minimax.MiniMaxChat.html |
9b6f65715ed0-3 | Asynchronously pass messages to the model and return a message prediction.
Use this method when calling chat models and only the topcandidate generation is needed.
Parameters
messages – A sequence of chat messages corresponding to a single model input.
stop – Stop words to use when generating. Model output is cut off a... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.minimax.MiniMaxChat.html |
9b6f65715ed0-4 | The jsonpatch ops can be applied in order to construct state.
async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶
Default implementation of atransform, which buffers input and calls astream.
Subclasses should override this method if th... | https://api.python.langchain.com/en/latest/chat_models/langchain.chat_models.minimax.MiniMaxChat.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.