Gemini.Types.Document (GeminiEx v0.8.4)
View SourceType definitions for RAG document management.
Documents are stored in RAG stores and used for semantic search and retrieval-augmented generation (RAG) workflows.
Document Lifecycle
- Upload a file to a RAG store
- Document is created with metadata
- Document is indexed for search
- Use in generation with grounding
Example
# List documents in a store
{:ok, response} = Gemini.APIs.Documents.list("ragStores/my-store")
# Get document metadata
{:ok, doc} = Gemini.APIs.Documents.get("ragStores/my-store/documents/doc123")
# Delete when no longer needed
:ok = Gemini.APIs.Documents.delete(doc.name)
Summary
Types
Document metadata for custom properties.
Document state enumeration.
Represents a document in a RAG store.
Functions
Checks if the document is ready for use.
Checks if the document processing failed.
Creates a Document from API response.
Extracts the document ID from the full resource name.
Extracts the store ID from the document's full resource name.
Parses document state from API string.
Checks if the document is still processing.
Converts state atom to API string.
Types
Document metadata for custom properties.
@type document_state() :: :state_unspecified | :processing | :active | :failed
Document state enumeration.
@type t() :: %Gemini.Types.Document{ chunk_count: integer() | nil, create_time: String.t() | nil, display_name: String.t() | nil, error: map() | nil, metadata: document_metadata() | nil, mime_type: String.t() | nil, name: String.t() | nil, size_bytes: integer() | nil, source_uri: String.t() | nil, state: document_state() | nil, update_time: String.t() | nil }
Represents a document in a RAG store.
Fields
name- Resource name (e.g., "ragStores/abc/documents/xyz")display_name- Human-readable namestate- Processing statecreate_time- When the document was createdupdate_time- Last update timestampsize_bytes- Document size in bytessource_uri- Original source URI (if applicable)mime_type- MIME type of the documentmetadata- Custom metadata key-value pairserror- Error details if processing failedchunk_count- Number of chunks the document was split into
Functions
Checks if the document is ready for use.
Checks if the document processing failed.
Creates a Document from API response.
Extracts the document ID from the full resource name.
Extracts the store ID from the document's full resource name.
@spec parse_state(String.t() | nil) :: document_state() | nil
Parses document state from API string.
Checks if the document is still processing.
@spec state_to_api(document_state()) :: String.t()
Converts state atom to API string.