Zep.Client (Zep v1.0.0)

Copy Markdown View Source

A configured handle for talking to the Zep API.

Every Zep.* resource function takes a %Zep.Client{} (or plain opts, which are resolved into one implicitly) as its first argument, following the same explicit-client pattern used across Voidspace's other SDKs (no hidden global/process state, safe for concurrent use with multiple projects/API keys in the same VM).

Examples

client = Zep.Client.new(api_key: "z_...")
{:ok, %Zep.Schemas.Thread{}} = Zep.Thread.create(client, "thread-1", "user-1")

# Or let each call resolve config from Application env / ENV vars:
{:ok, threads} = Zep.Thread.list(api_key: "z_...")

Summary

Functions

Builds a new client, resolving configuration via Zep.Config.resolve/1.

Accepts either an already-built %Zep.Client{} (returned as-is) or a keyword list of options (built into one via new/1). This lets every resource function accept either form without callers needing to construct a client for one-off calls.

Types

t()

@type t() :: %Zep.Client{config: Zep.Config.t(), req: Req.Request.t()}

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Builds a new client, resolving configuration via Zep.Config.resolve/1.

Options

  • :api_key - Zep project API key. Falls back to ZEP_API_KEY env var.
  • :base_url - defaults to "https://api.getzep.com".
  • :receive_timeout - request timeout in ms (default 30_000).
  • :max_retries - retry attempts for retriable errors (default 2).
  • :req_options - additional keyword list merged into the underlying Req.Request (escape hatch for e.g. :plug in tests).

resolve(client)

@spec resolve(t() | keyword()) :: t()

Accepts either an already-built %Zep.Client{} (returned as-is) or a keyword list of options (built into one via new/1). This lets every resource function accept either form without callers needing to construct a client for one-off calls.