View Source Lightning.AiAssistant (Lightning v2.10.4)
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.
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()) :: [Lightning.AiAssistant.ChatSession.t(), ...] | []
@spec project_has_any_session?(Ecto.UUID.t()) :: boolean()
@spec query(Lightning.AiAssistant.ChatSession.t(), String.t()) :: {:ok, Lightning.AiAssistant.ChatSession.t()} | {:error, Ecto.Changeset.t() | :apollo_unavailable}
Queries the AI assistant with the given content.
Returns {:ok, session}
if the query was successful, otherwise :error
.
Example
iex> AiAssistant.query(session, "fn()")
{:ok, session}
@spec save_message(Lightning.AiAssistant.ChatSession.t(), %{required(any()) => any()}) :: {:ok, Lightning.AiAssistant.ChatSession.t()} | {:error, Ecto.Changeset.t()}