RevelryAI.V2.Artifact (RevelryAI v0.3.0)

Copy Markdown View Source

Handles v2 artifact operations for the RevelryAI API.

V2 artifact creation is asynchronous-only: the endpoint returns immediately with an api_async_create_event_id, and the completed artifact is delivered via webhook carrying the artifact_id, chat_id, and the same api_async_create_event_id for correlation.

Artifacts are generated by running a skill, which may use tools such as document search and web search depending on the skill's configuration.

Summary

Functions

Creates an artifact asynchronously.

Functions

create(project_id, params, config \\ [])

@spec create(
  integer(),
  %{
    :skill_id => integer(),
    :inputs => [%{name: String.t(), value: String.t()}],
    optional(:name) => String.t(),
    optional(:model_configuration_id) => integer()
  },
  Keyword.t()
) :: {:ok, map()} | {:error, term()}

Creates an artifact asynchronously.

Parameters

  • project_id: the ID of the project the artifact belongs to
  • params: the request body:
    • skill_id (required): the ID of the skill to run
    • inputs (required): a list of %{name: name, value: value} maps matching the skill's custom variables
    • name (optional): a name for the artifact; auto-generated when absent
    • model_configuration_id (optional): overrides the organization's default model configuration
  • config (optional): a configuration keyword list used to override default config values

Example

iex> RevelryAI.V2.Artifact.create(1, %{
...>   skill_id: 10,
...>   inputs: [
...>     %{name: "Context", value: "this is a test"}
...>   ]
...> })
{:ok,
 %{
   status: "ok",
   response: %{
     "api_async_create_event_id" => "0b6f7c1e-5c3a-4d2b-9e8f-1a2b3c4d5e6f",
     "message" => "Artifact is being generated with tool support. You will receive a webhook when it is complete."
   }
 }}

Returns

Returns {:ok, response} as soon as generation is enqueued (HTTP 202). The completed artifact is delivered via webhook.