Jido.AI.Request.Handle (Jido AI v2.2.0)

Copy Markdown View Source

Represents a tracked request handle with correlation ID.

Similar to %Task{}, this struct holds the information needed to await a specific request's completion.

Summary

Functions

Marks request as completed with a result.

Marks request as failed with an error.

Creates a new Handle struct.

Types

server()

@type server() :: pid() | atom() | {:via, module(), term()}

status()

@type status() :: :pending | :completed | :failed | :timeout

t()

@type t() :: %Jido.AI.Request.Handle{
  completed_at: nil | nil | integer(),
  error: nil | nil | any(),
  id: binary(),
  inserted_at: nil | nil | integer(),
  query: binary() | [any()],
  result: nil | nil | any(),
  server: any(),
  status: :pending | :completed | :failed | :timeout
}

Functions

complete(request, result)

@spec complete(t(), any()) :: t()

Marks request as completed with a result.

fail(request, error)

@spec fail(t(), any()) :: t()

Marks request as failed with an error.

new(id, server, query)

@spec new(String.t(), server(), Jido.AI.Query.t()) :: t()

Creates a new Handle struct.