Module: GeminiCraft
- Defined in:
- lib/gemini_craft.rb,
lib/gemini_craft/cache.rb,
lib/gemini_craft/error.rb,
lib/gemini_craft/client.rb,
lib/gemini_craft/version.rb,
lib/gemini_craft/configuration.rb
Overview
GeminiCraft is a Ruby gem for generating content using Google’s Gemini AI
Defined Under Namespace
Classes: APIError, AuthenticationError, AuthorizationError, Cache, CacheKeyGenerator, Client, ClientError, Configuration, ConfigurationError, ConnectionBuilder, ConnectionError, ContentExtractor, Error, FunctionResponseProcessor, NotFoundError, PayloadBuilder, RateLimitError, ResponseError, ResponseHandler, ServerError, StreamingConnectionBuilder, StreamingError, StreamingProcessor, TimeoutError
Constant Summary collapse
- VERSION =
"0.2.0"
Class Attribute Summary collapse
-
.configuration ⇒ GeminiCraft::Configuration
Returns the current configuration.
Class Method Summary collapse
-
.cache_stats ⇒ Hash
Get cache statistics.
-
.clear_cache ⇒ Object
Clear the cache.
-
.client ⇒ GeminiCraft::Client
Create a new client instance.
-
.configure {|config| ... } ⇒ Object
Configure the gem by providing a block.
-
.generate_content(text, system_instruction = nil, options = {}, stream: false) ⇒ String, Enumerator
Generate content using Gemini.
-
.generate_with_functions(text, functions, system_instruction = nil, options = {}) ⇒ Hash
Generate content with function calling support.
-
.reset_configuration ⇒ Object
Reset the configuration to defaults.
-
.stream_content(text, system_instruction = nil, options = {}) ⇒ Enumerator
Generate streaming content.
Class Attribute Details
.configuration ⇒ GeminiCraft::Configuration
Returns the current configuration
16 17 18 |
# File 'lib/gemini_craft.rb', line 16 def configuration @configuration ||= Configuration.new end |
Class Method Details
.cache_stats ⇒ Hash
Get cache statistics
76 77 78 |
# File 'lib/gemini_craft.rb', line 76 def cache_stats client.cache.stats end |
.clear_cache ⇒ Object
Clear the cache
81 82 83 |
# File 'lib/gemini_craft.rb', line 81 def clear_cache client.cache.clear end |
.client ⇒ GeminiCraft::Client
Create a new client instance
36 37 38 |
# File 'lib/gemini_craft.rb', line 36 def client Client.new end |
.configure {|config| ... } ⇒ Object
Configure the gem by providing a block
30 31 32 |
# File 'lib/gemini_craft.rb', line 30 def configure yield(configuration) end |
.generate_content(text, system_instruction = nil, options = {}, stream: false) ⇒ String, Enumerator
Generate content using Gemini
46 47 48 |
# File 'lib/gemini_craft.rb', line 46 def generate_content(text, system_instruction = nil, = {}, stream: false) client.generate_content(text, system_instruction, , stream: stream) end |
.generate_with_functions(text, functions, system_instruction = nil, options = {}) ⇒ Hash
Generate content with function calling support
56 57 58 |
# File 'lib/gemini_craft.rb', line 56 def generate_with_functions(text, functions, system_instruction = nil, = {}) client.generate_with_functions(text, functions, system_instruction, ) end |
.reset_configuration ⇒ Object
Reset the configuration to defaults
70 71 72 |
# File 'lib/gemini_craft.rb', line 70 def reset_configuration @configuration = Configuration.new end |
.stream_content(text, system_instruction = nil, options = {}) ⇒ Enumerator
Generate streaming content
65 66 67 |
# File 'lib/gemini_craft.rb', line 65 def stream_content(text, system_instruction = nil, = {}) generate_content(text, system_instruction, , stream: true) end |