Gemini.Types.FileSearchStore (GeminiEx v0.8.4)

View Source

Type definitions for File Search Stores (semantic search stores).

File Search Stores enable semantic search over uploaded documents using vector embeddings. They are part of the RAG (Retrieval-Augmented Generation) system and are only available through Vertex AI.

Store States

Stores go through several states during their lifecycle:

  • :state_unspecified - Initial/unknown state
  • :creating - Store is being created
  • :active - Store is ready to use
  • :deleting - Store is being deleted
  • :failed - Store creation/operation failed

Example

# Create a file search store
config = %CreateFileSearchStoreConfig{
  display_name: "Product Documentation",
  description: "Technical documentation for our products"
}
{:ok, store} = Gemini.APIs.FileSearchStores.create(config)

# Check store state
case store.state do
  :active -> IO.puts("Store ready: #{store.name}")
  :creating -> IO.puts("Still creating...")
  :failed -> IO.puts("Failed to create store")
end

# Import files
{:ok, _doc} = Gemini.APIs.FileSearchStores.import_file(
  store.name,
  "files/uploaded-doc-id"
)

Summary

Types

File search store state enumeration.

t()

Represents a File Search Store for semantic search.

Vector embedding configuration for the store.

Functions

Checks if the store is active and ready to use.

Checks if the store is still being created.

Checks if the store operation failed.

Creates a FileSearchStore from API response.

Extracts the store ID from the full resource name.

Parses store state from API string.

Converts state atom to API string format.

Types

file_search_store_state()

@type file_search_store_state() ::
  :state_unspecified | :creating | :active | :deleting | :failed

File search store state enumeration.

  • :state_unspecified - Initial/unknown state
  • :creating - Store is being created
  • :active - Store is ready for operations
  • :deleting - Store is being deleted
  • :failed - Operation failed

t()

@type t() :: %Gemini.Types.FileSearchStore{
  create_time: String.t() | nil,
  description: String.t() | nil,
  display_name: String.t() | nil,
  document_count: integer() | nil,
  name: String.t() | nil,
  state: file_search_store_state() | nil,
  total_size_bytes: integer() | nil,
  update_time: String.t() | nil,
  vector_config: vector_config() | nil
}

Represents a File Search Store for semantic search.

Fields

  • name - Resource name (format: "fileSearchStores/{store_id}")
  • display_name - Human-readable name
  • description - Store description
  • state - Current state
  • create_time - Creation timestamp (ISO 8601)
  • update_time - Last update timestamp (ISO 8601)
  • document_count - Number of documents in the store
  • total_size_bytes - Total size of all documents
  • vector_config - Vector embedding configuration

vector_config()

@type vector_config() :: %{
  optional(:embedding_model) => String.t(),
  optional(:dimensions) => pos_integer()
}

Vector embedding configuration for the store.

Functions

active?(arg1)

@spec active?(t()) :: boolean()

Checks if the store is active and ready to use.

creating?(arg1)

@spec creating?(t()) :: boolean()

Checks if the store is still being created.

failed?(arg1)

@spec failed?(t()) :: boolean()

Checks if the store operation failed.

from_api_response(response)

@spec from_api_response(map()) :: t()

Creates a FileSearchStore from API response.

Parameters

  • response - Map from API response with string keys

Examples

response = %{
  "name" => "fileSearchStores/abc123",
  "displayName" => "My Store",
  "state" => "ACTIVE",
  "documentCount" => 42
}
store = FileSearchStore.from_api_response(response)

get_id(file_search_store)

@spec get_id(t()) :: String.t() | nil

Extracts the store ID from the full resource name.

Examples

store = %FileSearchStore{name: "fileSearchStores/abc123"}
FileSearchStore.get_id(store)
# => "abc123"

parse_state(arg1)

@spec parse_state(String.t() | nil) :: file_search_store_state() | nil

Parses store state from API string.

state_to_api(atom)

@spec state_to_api(file_search_store_state()) :: String.t()

Converts state atom to API string format.