View Source LangChain.ChatModels.ChatModel behaviour (LangChain v0.3.0-rc.0)

Summary

Functions

Add a LangChain.ChatModels.LLMCallbacks callback map to the ChatModel if it includes the :callback key.

Restore a ChatModel from a serialized config map.

Create a serializable map from a ChatModel's current configuration that can later be restored.

Types

Callbacks

@callback call(
  t(),
  String.t() | [LangChain.Message.t()],
  [LangChain.Function.t()]
) :: call_response()
@callback restore_from_map(%{required(String.t()) => any()}) ::
  {:ok, struct()} | {:error, String.t()}
@callback serialize_config(t()) :: %{required(String.t()) => any()}

Functions

Link to this function

add_callback(model, callback_map)

View Source
@spec add_callback(%{optional(:callbacks) => nil | map()}, map()) :: map() | struct()

Add a LangChain.ChatModels.LLMCallbacks callback map to the ChatModel if it includes the :callback key.

@spec restore_from_map(nil | %{required(String.t()) => any()}) ::
  {:ok, struct()} | {:error, String.t()}

Restore a ChatModel from a serialized config map.

Create a serializable map from a ChatModel's current configuration that can later be restored.