Normandy.Components.ContextProvider protocol (normandy v0.2.0)

View Source

Protocol for providing additional context information to agents.

Context providers supply extra information that can be included in system prompts, such as current date/time, user preferences, system state, etc.

Example

defmodule DateTimeProvider do
  defstruct []

  defimpl Normandy.Components.ContextProvider do
    def title(_), do: "Current Date and Time"

    def get_info(_) do
      DateTime.utc_now() |> DateTime.to_string()
    end
  end
end

Summary

Types

t()

All the types that implement this protocol.

Functions

Returns the context information as a string.

Returns the title for this context section in the prompt.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

get_info(context_config)

@spec get_info(struct()) :: String.t()

Returns the context information as a string.

title(context_config)

@spec title(struct()) :: String.t()

Returns the title for this context section in the prompt.