Tags: nshkrdotcom/gemini_ex
Tags
Release v0.13.0: Refactor Live API session management and metadata re… …solution - Added explicit metadata for Live session modalities and input transport to `ModelRegistry`, enabling robust selection and local validation. - Introduced `Gemini.Live.Session.send_text/3` to abstract transport layer logic (clientContent vs. realtimeInput) for different models. - Updated examples and guides to use audio-first sessions with output transcription for Gemini 3.1 Flash Live, maintaining text-chat UX. - Enhanced `Session` validation to reject unsupported `response_modalities` locally, preventing opaque WebSocket 1011 handshake errors. - Improved Live test suite: added regression coverage for metadata-driven model selection and introduced a failure threshold for repeated transient 1011 errors on identical configurations. - Fixed legacy tool calling to avoid process-local state dependencies.
Release v0.12.0: Gemini authentication precedence and Live session AP… …I key support - Update default Gemini auth resolution to prioritize application configuration (config :gemini_ex, api_key: ...) over the GEMINI_API_KEY environment variable. - Modify Gemini.Client.HTTP to implicitly select Gemini auth when an api_key is passed, even if the :auth option is omitted. - Enable Live session API key propagation by updating Gemini.Live.Session to pass per-session credentials through to WebSocket connections. - Ensure WebSocket auth resolution favors connection-scoped keys before falling back to global configuration. - Enhance documentation for the updated precedence order and session-scoped override paths. - Add regression tests for config precedence, implicit HTTP auth selection, and proper propagation of Live session API keys.
Release v0.11.1: Normalize Live API usage metadata and improve Vertex…
… AI compatibility
- Implement canonical `candidates_*` fields in `UsageMetadata` to unify
Gemini Live (`response_*`) and Vertex Live (`candidates_*`) schemas.
- Add `output_token_count/1` and `output_tokens_details/1` helpers for
backend-agnostic usage tracking.
- Capture and expose Vertex Live `turnCompleteReason` via `ServerContent`.
- Update `RateLimiter.Manager` to reconcile usage against canonical
fields, preferring `candidatesTokenCount` where available.
- Refine Vertex Live model resolution to exclude native-audio-only models
from text-only session candidates.
- Improve test stability:
- Add retry/skip logic for transient upstream 1011 errors.
- Dynamically skip Vertex text-only tests if no compatible model is
detected in the user's project.
- Document backend schema differences and provide updated testing
instructions in README and guides.
- Bump version to 0.11.1.
Releae v0.11.0: add Gemini 3.1 model support and comprehensive Files … …API features - Add `gemini-3.1-flash-lite-preview` and `gemini-3.1-flash-image-preview` entries to the model registry. - Implement generic `Gemini.predict/3` and `predict_long_running/3` endpoints for advanced model interactions (Imagen/Veo). - Add `thinking` boolean to `Gemini.Types.Response.Model` and `supports_thinking?/1` helper to identify reasoning capabilities. - Enhance `generateContent` response parsing with `candidates_tokens_details`, `grounding_metadata`, `logprobs_result`, and `url_context_metadata`. - Add structured parsing for `CitationMetadata` and `CitationSource`. - Implement `MultiSpeakerVoiceConfig` for advanced text-to-speech workflows. - Add `enable_enhanced_civic_answers` to `GenerationConfig`. - Enforce Gemini-only auth for Files API; add `api_key` override support. - Remove `mimeType` from file upload metadata (output-only field fix). - Deprecate `gemini-3-pro-preview` in favor of `gemini-3.1-pro-preview`.
Release v0.9.1: implement Files API content normalization and Python …
…SDK parity
Enhance the content normalization logic to support a wider variety of input
formats for the Files API, matching the developer experience found in the
official Python SDK.
Functionality updates:
- Support passing Gemini.Types.File structs directly as content items.
- Support flat map shorthand %{file_uri: uri, mime_type: mime} as top-level
items and within parts lists (resolves Issue 18).
- Support nested %{file_data: %{file_uri: uri}} map structures.
- Support bare %{text: text} maps as content items.
- Add Part.file_data/2 convenience constructor for referencing uploaded files.
Documentation and Fixes:
- Update README and module documentation examples to use the new shorthand.
- Corrected broken file reference examples in Files API and File moduledocs.
- Expand ArgumentError messages to provide hints for file-based content.
Testing:
A new test suite provides full coverage for the normalization matrix, ensuring
that various combinations of text, inline data, and file references are
correctly transformed into the API wire format.
Release v0.9.0: upgrade Live API to v1beta and enhance native audio f… …eatures This commit updates the Live API implementation to use v1beta as the default version while maintaining v1alpha support for advanced features. Key changes: - Introduced Gemini.Live.Models to resolve available models at runtime based on API key capabilities and regional rollout status. - Updated Gemini.Live.Session to support native audio features including affective dialog, proactivity configuration, and thinking budgets. - Refactored text extraction logic in Gemini and GenerateContentResponse to support decoding inline text blobs and application/json parts. - Implemented sensitive query parameter redaction for WebSocket connection logging, covering keys and access tokens. - Comprehensive update to Live API documentation and example files, adding support for real audio file streaming and session resumption patterns. - Enhanced type definitions for Setup to include media resolution and thinking configurations. - Reorganized and streamlined guides. - Updated test suites to reflect versioning changes and model resolution.
Release v0.8.8: Extract shared utilities and remove dead code
Consolidate duplicated helper functions into dedicated utility modules
and remove unused code paths discovered during codebase audit.
New utility modules:
lib/gemini/utils/map_helpers.ex
- maybe_put/3: conditionally add to map if value not nil
- maybe_put_non_empty/3: skip nil and empty strings
- maybe_put_non_zero/3: skip nil and zero values
- build_paginated_path/2: construct paths with pagination params
- add_query_param/3: conditionally add query parameters
lib/gemini/utils/polling_helpers.ex
- timed_out?/2: check if polling operation exceeded timeout
- maybe_add/3: conditionally add to keyword list
Modules updated to use shared utilities:
- Gemini.APIs.Batches
- Gemini.APIs.Documents
- Gemini.APIs.FileSearchStores
- Gemini.APIs.Files
- Gemini.APIs.Interactions
- Gemini.APIs.Operations
- Gemini.APIs.RagStores
- Gemini.APIs.Tunings
- Gemini.APIs.Videos
- Gemini.Auth.MultiAuthCoordinator
- Gemini.Config
- Gemini.RateLimiter.RetryManager
- Gemini.Types.Generation.Video
- Gemini.Types.Interactions.* (content, config, delta, events, etc.)
- Gemini.Types.Request.* (embed content types)
- Gemini.Types.Schema
- Gemini.Types.Tuning
Removed dead code:
Gemini.Auth
- authenticate/2 and base_url/2 delegators (unused)
Gemini.Auth.GeminiStrategy
- authenticate/1 (headers/1 is the actual interface)
Gemini.Auth.MultiAuthCoordinator
- Unused struct definition
Gemini.Client
- stream_post/2 and stream_post_with_auth/4
- Streaming moved to HTTPStreaming module
Gemini.Client.HTTP
- All SSE streaming functions (parse_sse_stream, handle_stream_*)
- Module now focused on regular HTTP requests only
Gemini.Config
- models/0, use_case_models/0, use_case_token_minima/0
- model_for_use_case/2, resolved_use_case_models/1
Gemini.RateLimiter.ConcurrencyGate
- reset/1 (reset_all/0 sufficient for testing)
Gemini.RateLimiter.Config
- adaptive_enabled?/1, profile_config/1
Gemini.RateLimiter.State
- would_exceed_budget?/3
Gemini.Streaming.ToolOrchestrator
- subscribe/2, stop/1, cleanup_streams/1
Deleted files:
- lib/gemini/types/interactions/params.ex (unused parameter structs)
- lib/gemini/types/live.ex (unused Live API types)
- test/gemini/auth/vertex_strategy_test_old.exs (stale test file)
Test updates:
- gemini_strategy_test.exs now tests headers/1 interface
- auth_test.exs uses build_headers/2 instead of authenticate/2
- Removed tests for deleted would_exceed_budget?/3 function
Release v0.8.7: Code quality improvements and dependency updates This release focuses on internal code quality enhancements and dependency updates to improve maintainability and developer experience. Code Quality Improvements: Simplified conditional logic throughout the codebase by replacing complex cond expressions with clearer if/else patterns. Extracted helper functions to reduce cyclomatic complexity and improve readability across all API modules. Enhanced pattern matching and function composition patterns. Replaced Enum.map followed by Enum.join with more efficient Enum.map_join calls. Improved error handling patterns by reducing nesting and making control flow more explicit. Better function organization and naming consistency across authentication, streaming, and coordinator layers. Enhanced separation of concerns in type serialization and parsing logic. Dependency Updates: Updated altar from 0.1.2 to 0.2.0 for latest ALTAR protocol improvements. Updated supertester from 0.3.1 to 0.4.0 for enhanced testing capabilities. Added stream_data 1.2.0 as explicit dependency for property-based testing. Technical Details: Function extraction and modularization throughout all API modules including Coordinator, Batches, Documents, Files, Images, Videos, Operations, and Tunings. Consistent error handling patterns across all coordinators. Improved telemetry callback handling with safer invocation patterns and better error recovery. Enhanced readability in ToolSerialization and type conversion logic. All changes are internal refactoring with no breaking changes to the public API. Zero compilation warnings maintained. Full test suite passing with 425+ tests.
PreviousNext