View Source LangChain.ChatModels.ChatMistralAI (LangChain v0.3.3)

Summary

Functions

Calls the Mistral API passing the ChatMistralAI struct plus either a simple string prompt or a list of messages as the prompt. Optionally pass in a list of tools.

Converts a LangChain Message-based structure into the expected map of data for Mistral. We also include any tool_calls stored on the message.

Formats this struct plus the given messages and tools as a request payload.

Restores the model from the config map.

Generate a config map that can later restore the model's configuration.

Types

@type t() :: %LangChain.ChatModels.ChatMistralAI{
  api_key: term(),
  callbacks: term(),
  endpoint: term(),
  max_tokens: term(),
  model: term(),
  random_seed: term(),
  receive_timeout: term(),
  safe_prompt: term(),
  stream: term(),
  temperature: term(),
  tool_choice: term(),
  top_p: term()
}

Functions

Link to this function

call(mistralai, prompt, tools)

View Source

Calls the Mistral API passing the ChatMistralAI struct plus either a simple string prompt or a list of messages as the prompt. Optionally pass in a list of tools.

Converts a LangChain Message-based structure into the expected map of data for Mistral. We also include any tool_calls stored on the message.

Link to this function

for_api(mistral, messages, tools)

View Source
@spec for_api(t(), [LangChain.Message.t()], LangChain.ChatModels.ChatModel.tools()) ::
  %{
    required(atom()) => any()
  }

Formats this struct plus the given messages and tools as a request payload.

@spec new(attrs :: map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
@spec new!(attrs :: map()) :: t() | no_return()

Restores the model from the config map.

@spec serialize_config(t()) :: %{required(String.t()) => any()}

Generate a config map that can later restore the model's configuration.