Rag.Ai.Gemini (rag v0.3.4)

View Source

Gemini provider implementation using gemini_ex.

This provider supports both text generation and embeddings, making it the primary provider for RAG systems. It also supports tool calling via Gemini's function calling API.

Examples

# Basic text generation
provider = Gemini.new(%{})
{:ok, response} = Gemini.generate_text(provider, "Hello!", [])

# Use a model alias from gemini_ex
provider = Gemini.new(%{model: :flash_lite_latest})

# Generate embeddings
{:ok, embeddings} = Gemini.generate_embeddings(provider, ["text1", "text2"], [])

Summary

Functions

Returns the cost per 1K tokens as {input_cost, output_cost} in USD.

Returns the maximum context window in tokens.

Returns whether this provider supports embeddings.

Returns whether this provider supports tool calling.

Types

model_ref()

@type model_ref() :: atom() | String.t()

t()

@type t() :: %Rag.Ai.Gemini{
  config: map(),
  embedding_dimensions: pos_integer() | nil,
  embedding_model: String.t(),
  model: String.t()
}

Functions

cost_per_1k_tokens()

@spec cost_per_1k_tokens() :: {float(), float()}

Returns the cost per 1K tokens as {input_cost, output_cost} in USD.

max_context_tokens()

@spec max_context_tokens() :: pos_integer()

Returns the maximum context window in tokens.

supports_embeddings?()

@spec supports_embeddings?() :: boolean()

Returns whether this provider supports embeddings.

supports_tools?()

@spec supports_tools?() :: boolean()

Returns whether this provider supports tool calling.