Gemini.APIs.RagStores (GeminiEx v0.8.4)

View Source

RAG Stores API for managing file search stores.

RAG (Retrieval-Augmented Generation) stores contain documents that can be searched semantically and used for context augmentation.

Overview

The RAG Stores API allows you to:

  • Create and manage RAG stores
  • List stores
  • Delete stores

Example Workflow

# List stores
{:ok, response} = Gemini.APIs.RagStores.list()

Enum.each(response.rag_stores, fn store ->
  IO.puts("#{store.display_name}: #{store.document_count} documents")
end)

# Get specific store
{:ok, store} = Gemini.APIs.RagStores.get("ragStores/my-store")

# Delete store
:ok = Gemini.APIs.RagStores.delete("ragStores/my-store")

Summary

Functions

Create a new RAG store.

Delete a RAG store.

Get a RAG store by name.

List all RAG stores.

List all RAG stores across all pages.

Types

create_opts()

@type create_opts() :: [
  display_name: String.t(),
  description: String.t(),
  vector_config: map(),
  auth: :gemini | :vertex_ai
]

list_opts()

@type list_opts() :: [
  page_size: pos_integer(),
  page_token: String.t(),
  auth: :gemini | :vertex_ai
]

store_opts()

@type store_opts() :: [{:auth, :gemini | :vertex_ai}]

Functions

create(opts)

@spec create(create_opts()) :: {:ok, Gemini.Types.RagStore.t()} | {:error, term()}

Create a new RAG store.

Parameters

  • opts - Creation options

Options

  • :display_name - Human-readable name (required)
  • :description - Store description
  • :vector_config - Vector embedding configuration
  • :auth - Authentication strategy

Examples

{:ok, store} = Gemini.APIs.RagStores.create(
  display_name: "My Knowledge Base",
  description: "Documents for customer support"
)

delete(name, opts \\ [])

@spec delete(String.t(), store_opts()) :: :ok | {:error, term()}

Delete a RAG store.

Parameters

  • name - Store resource name
  • opts - Options

Examples

:ok = Gemini.APIs.RagStores.delete("ragStores/my-store")

get(name, opts \\ [])

@spec get(String.t(), store_opts()) ::
  {:ok, Gemini.Types.RagStore.t()} | {:error, term()}

Get a RAG store by name.

Parameters

  • name - Store resource name (e.g., "ragStores/abc123")
  • opts - Options

Examples

{:ok, store} = Gemini.APIs.RagStores.get("ragStores/my-store")
IO.puts("Documents: #{store.document_count}")
IO.puts("Size: #{store.total_size_bytes} bytes")

list(opts \\ [])

@spec list(list_opts()) ::
  {:ok, Gemini.Types.ListRagStoresResponse.t()} | {:error, term()}

List all RAG stores.

Parameters

  • opts - List options

Options

  • :page_size - Number of stores per page (default: 100)
  • :page_token - Token from previous response for pagination
  • :auth - Authentication strategy

Examples

{:ok, response} = Gemini.APIs.RagStores.list()

Enum.each(response.rag_stores, fn store ->
  IO.puts("#{store.display_name}: #{store.state}")
end)

list_all(opts \\ [])

@spec list_all(list_opts()) :: {:ok, [Gemini.Types.RagStore.t()]} | {:error, term()}

List all RAG stores across all pages.

Examples

{:ok, all_stores} = Gemini.APIs.RagStores.list_all()
active = Enum.filter(all_stores, &RagStore.active?/1)