View Source Lightning.AiAssistant (Lightning v2.10.15)
The AI assistant module.
Summary
Functions
Checks if the AI assistant is enabled.
Checks if the Apollo endpoint is available.
Queries the AI assistant with the given content.
Updates the status of a specific message within a chat session.
Functions
@spec create_session( Lightning.Workflows.Job.t(), Lightning.Accounts.User.t(), String.t() ) :: {:ok, Lightning.AiAssistant.ChatSession.t()} | {:error, Ecto.Changeset.t()}
@spec enabled?() :: boolean()
Checks if the AI assistant is enabled.
@spec endpoint_available?() :: boolean()
Checks if the Apollo endpoint is available.
@spec get_session!(Ecto.UUID.t()) :: Lightning.AiAssistant.ChatSession.t()
@spec list_sessions_for_job(Lightning.Workflows.Job.t(), :asc | :desc) :: [Lightning.AiAssistant.ChatSession.t(), ...] | []
@spec mark_disclaimer_read(Lightning.Accounts.User.t()) :: {:ok, Lightning.Accounts.User.t()}
@spec query(Lightning.AiAssistant.ChatSession.t(), String.t()) :: {:ok, Lightning.AiAssistant.ChatSession.t()} | {:error, String.t() | Ecto.Changeset.t()}
Queries the AI assistant with the given content.
Returns {:ok, session}
if the query was successful, otherwise {:error, reason}
.
Example
iex> AiAssistant.query(session, "fn()")
{:ok, session}
@spec update_message_status( Lightning.AiAssistant.ChatSession.t(), Lightning.AiAssistant.ChatMessage.t(), atom() ) :: {:ok, Lightning.AiAssistant.ChatSession.t()} | {:error, Ecto.Changeset.t()}
Updates the status of a specific message within a chat session.
Returns {:ok, session}
if the update is successful, otherwise {:error, changeset}
.
@spec user_has_read_disclaimer?(Lightning.Accounts.User.t()) :: boolean()