geminize 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cursor/mcp.json +3 -0
- data/.cursor/rules/isolation_rules/Core/command-execution.mdc +235 -0
- data/.cursor/rules/isolation_rules/Core/complexity-decision-tree.mdc +187 -0
- data/.cursor/rules/isolation_rules/Core/creative-phase-enforcement.mdc +145 -0
- data/.cursor/rules/isolation_rules/Core/creative-phase-metrics.mdc +195 -0
- data/.cursor/rules/isolation_rules/Core/file-verification.mdc +198 -0
- data/.cursor/rules/isolation_rules/Core/platform-awareness.mdc +71 -0
- data/.cursor/rules/isolation_rules/Level3/planning-comprehensive.mdc +159 -0
- data/.cursor/rules/isolation_rules/Level3/task-tracking-intermediate.mdc +135 -0
- data/.cursor/rules/isolation_rules/Phases/CreativePhase/creative-phase-architecture.mdc +187 -0
- data/.cursor/rules/isolation_rules/main.mdc +123 -0
- data/.cursor/rules/isolation_rules/visual-maps/archive-mode-map.mdc +277 -0
- data/.cursor/rules/isolation_rules/visual-maps/creative-mode-map.mdc +224 -0
- data/.cursor/rules/isolation_rules/visual-maps/implement-mode-map.mdc +321 -0
- data/.cursor/rules/isolation_rules/visual-maps/plan-mode-map.mdc +269 -0
- data/.cursor/rules/isolation_rules/visual-maps/qa-mode-map.mdc +495 -0
- data/.cursor/rules/isolation_rules/visual-maps/reflect-mode-map.mdc +234 -0
- data/.cursor/rules/isolation_rules/visual-maps/van-mode-map.mdc +902 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-complexity-determination.mdc +60 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-file-verification.mdc +49 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-mode-map.mdc +49 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-platform-detection.mdc +50 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/build-test.mdc +117 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/config-check.mdc +103 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/dependency-check.mdc +147 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/environment-check.mdc +104 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/file-verification.mdc +1 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-main.mdc +142 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/common-fixes.mdc +92 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/mode-transitions.mdc +101 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/reports.mdc +149 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/rule-calling-guide.mdc +66 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/rule-calling-help.mdc +19 -0
- data/.cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-validation.md.old +363 -0
- data/.env.example +7 -0
- data/.memory_bank/activeContext.md +78 -0
- data/.memory_bank/progress.md +80 -0
- data/.memory_bank/projectbrief.md +29 -0
- data/.memory_bank/systemPatterns.md +90 -0
- data/.memory_bank/tasks.md +98 -0
- data/.memory_bank/techContext.md +73 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +20 -0
- data/README.md +42 -5
- data/examples/models_api.rb +125 -0
- data/lib/geminize/configuration.rb +4 -4
- data/lib/geminize/model_info.rb +87 -8
- data/lib/geminize/models/model.rb +101 -109
- data/lib/geminize/models/model_list.rb +70 -28
- data/lib/geminize/request_builder.rb +29 -0
- data/lib/geminize/version.rb +1 -1
- data/lib/geminize.rb +71 -14
- metadata +45 -2
@@ -4,69 +4,131 @@ module Geminize
|
|
4
4
|
module Models
|
5
5
|
# Represents an AI model from the Gemini API.
|
6
6
|
class Model
|
7
|
-
# @return [String] The
|
8
|
-
attr_reader :id
|
9
|
-
|
10
|
-
# @return [String] The display name of the model
|
7
|
+
# @return [String] The resource name of the model
|
11
8
|
attr_reader :name
|
12
9
|
|
10
|
+
# @return [String] The base model ID
|
11
|
+
attr_reader :base_model_id
|
12
|
+
|
13
13
|
# @return [String] The model version
|
14
14
|
attr_reader :version
|
15
15
|
|
16
|
+
# @return [String] The display name of the model
|
17
|
+
attr_reader :display_name
|
18
|
+
|
16
19
|
# @return [String] The model description
|
17
20
|
attr_reader :description
|
18
21
|
|
19
|
-
# @return [
|
20
|
-
attr_reader :
|
22
|
+
# @return [Integer] Maximum number of input tokens allowed
|
23
|
+
attr_reader :input_token_limit
|
24
|
+
|
25
|
+
# @return [Integer] Maximum number of output tokens available
|
26
|
+
attr_reader :output_token_limit
|
21
27
|
|
22
|
-
# @return [
|
23
|
-
attr_reader :
|
28
|
+
# @return [Array<String>] Supported generation methods
|
29
|
+
attr_reader :supported_generation_methods
|
24
30
|
|
25
|
-
# @return [
|
26
|
-
attr_reader :
|
31
|
+
# @return [Float] Default temperature
|
32
|
+
attr_reader :temperature
|
33
|
+
|
34
|
+
# @return [Float] Maximum allowed temperature
|
35
|
+
attr_reader :max_temperature
|
36
|
+
|
37
|
+
# @return [Float] Default top_p value for nucleus sampling
|
38
|
+
attr_reader :top_p
|
39
|
+
|
40
|
+
# @return [Integer] Default top_k value for sampling
|
41
|
+
attr_reader :top_k
|
27
42
|
|
28
43
|
# @return [Hash] Raw model data from the API
|
29
44
|
attr_reader :raw_data
|
30
45
|
|
31
46
|
# Create a new Model instance
|
32
47
|
# @param attributes [Hash] Model attributes
|
33
|
-
# @option attributes [String] :
|
34
|
-
# @option attributes [String] :
|
48
|
+
# @option attributes [String] :name The resource name of the model
|
49
|
+
# @option attributes [String] :base_model_id The base model ID
|
35
50
|
# @option attributes [String] :version The model version
|
51
|
+
# @option attributes [String] :display_name The display name of the model
|
36
52
|
# @option attributes [String] :description The model description
|
37
|
-
# @option attributes [
|
38
|
-
# @option attributes [
|
39
|
-
# @option attributes [Array<String>] :
|
53
|
+
# @option attributes [Integer] :input_token_limit Maximum input tokens
|
54
|
+
# @option attributes [Integer] :output_token_limit Maximum output tokens
|
55
|
+
# @option attributes [Array<String>] :supported_generation_methods Supported methods
|
56
|
+
# @option attributes [Float] :temperature Default temperature
|
57
|
+
# @option attributes [Float] :max_temperature Maximum temperature
|
58
|
+
# @option attributes [Float] :top_p Default top_p value
|
59
|
+
# @option attributes [Integer] :top_k Default top_k value
|
40
60
|
# @option attributes [Hash] :raw_data Raw model data from API
|
41
61
|
def initialize(attributes = {})
|
42
|
-
@id = attributes[:id]
|
43
62
|
@name = attributes[:name]
|
63
|
+
@base_model_id = attributes[:base_model_id]
|
44
64
|
@version = attributes[:version]
|
65
|
+
@display_name = attributes[:display_name]
|
45
66
|
@description = attributes[:description]
|
46
|
-
@
|
47
|
-
@
|
48
|
-
@
|
67
|
+
@input_token_limit = attributes[:input_token_limit]
|
68
|
+
@output_token_limit = attributes[:output_token_limit]
|
69
|
+
@supported_generation_methods = attributes[:supported_generation_methods] || []
|
70
|
+
@temperature = attributes[:temperature]
|
71
|
+
@max_temperature = attributes[:max_temperature]
|
72
|
+
@top_p = attributes[:top_p]
|
73
|
+
@top_k = attributes[:top_k]
|
49
74
|
@raw_data = attributes[:raw_data] || {}
|
50
75
|
end
|
51
76
|
|
52
|
-
#
|
53
|
-
# @
|
54
|
-
|
55
|
-
|
56
|
-
|
77
|
+
# Shorthand accessor for the model ID (last part of the name path)
|
78
|
+
# @return [String] The model ID
|
79
|
+
def id
|
80
|
+
return nil unless @name
|
81
|
+
@name.split("/").last
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check if model supports a specific generation method
|
85
|
+
# @param method [String] Generation method to check for
|
86
|
+
# @return [Boolean] True if the model supports the method
|
87
|
+
def supports_method?(method)
|
88
|
+
supported_generation_methods.include?(method.to_s)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Check if model supports content generation
|
92
|
+
# @return [Boolean] True if the model supports content generation
|
93
|
+
def supports_content_generation?
|
94
|
+
supports_method?("generateContent")
|
95
|
+
end
|
96
|
+
|
97
|
+
# Check if model supports message generation (chat)
|
98
|
+
# @return [Boolean] True if the model supports message generation
|
99
|
+
def supports_message_generation?
|
100
|
+
supports_method?("generateMessage")
|
101
|
+
end
|
102
|
+
|
103
|
+
# Check if model supports embedding generation
|
104
|
+
# @return [Boolean] True if the model supports embedding generation
|
105
|
+
def supports_embedding?
|
106
|
+
supports_method?("embedContent")
|
107
|
+
end
|
108
|
+
|
109
|
+
# Check if model supports streaming content generation
|
110
|
+
# @return [Boolean] True if the model supports streaming content generation
|
111
|
+
def supports_streaming?
|
112
|
+
supports_method?("streamGenerateContent")
|
57
113
|
end
|
58
114
|
|
59
115
|
# Convert model to a hash representation
|
60
116
|
# @return [Hash] Hash representation of the model
|
61
117
|
def to_h
|
62
118
|
{
|
63
|
-
id: id,
|
64
119
|
name: name,
|
120
|
+
id: id,
|
121
|
+
base_model_id: base_model_id,
|
65
122
|
version: version,
|
123
|
+
display_name: display_name,
|
66
124
|
description: description,
|
67
|
-
|
68
|
-
|
69
|
-
|
125
|
+
input_token_limit: input_token_limit,
|
126
|
+
output_token_limit: output_token_limit,
|
127
|
+
supported_generation_methods: supported_generation_methods,
|
128
|
+
temperature: temperature,
|
129
|
+
max_temperature: max_temperature,
|
130
|
+
top_p: top_p,
|
131
|
+
top_k: top_k
|
70
132
|
}
|
71
133
|
end
|
72
134
|
|
@@ -80,92 +142,22 @@ module Geminize
|
|
80
142
|
# @param data [Hash] Raw API response data
|
81
143
|
# @return [Model] New Model instance
|
82
144
|
def self.from_api_data(data)
|
83
|
-
# Extract capabilities from model data
|
84
|
-
capabilities = extract_capabilities(data)
|
85
|
-
|
86
|
-
# Extract limitations from model data
|
87
|
-
limitations = extract_limitations(data)
|
88
|
-
|
89
|
-
# Extract use cases from model data
|
90
|
-
use_cases = extract_use_cases(data)
|
91
|
-
|
92
145
|
new(
|
93
|
-
|
94
|
-
|
95
|
-
version:
|
146
|
+
name: data["name"],
|
147
|
+
base_model_id: data["baseModelId"],
|
148
|
+
version: data["version"],
|
149
|
+
display_name: data["displayName"],
|
96
150
|
description: data["description"],
|
97
|
-
|
98
|
-
|
99
|
-
|
151
|
+
input_token_limit: data["inputTokenLimit"],
|
152
|
+
output_token_limit: data["outputTokenLimit"],
|
153
|
+
supported_generation_methods: data["supportedGenerationMethods"] || [],
|
154
|
+
temperature: data["temperature"],
|
155
|
+
max_temperature: data["maxTemperature"],
|
156
|
+
top_p: data["topP"],
|
157
|
+
top_k: data["topK"],
|
100
158
|
raw_data: data
|
101
159
|
)
|
102
160
|
end
|
103
|
-
|
104
|
-
private_class_method def self.extract_version(data)
|
105
|
-
# Extract version from model name or other fields
|
106
|
-
# Example: if name is "gemini-1.0-pro", extract "1.0"
|
107
|
-
if data["displayName"]
|
108
|
-
match = data["displayName"].match(/[-_](\d+\.\d+)[-_]/)
|
109
|
-
return match[1] if match
|
110
|
-
|
111
|
-
# Try another pattern (e.g., "Gemini 1.5 Pro")
|
112
|
-
match = data["displayName"].match(/\s(\d+\.\d+)\s/)
|
113
|
-
return match[1] if match
|
114
|
-
end
|
115
|
-
nil
|
116
|
-
end
|
117
|
-
|
118
|
-
private_class_method def self.extract_capabilities(data)
|
119
|
-
capabilities = []
|
120
|
-
|
121
|
-
# Example capability extraction, adjust based on actual API response format
|
122
|
-
capabilities << "text" if data.dig("supportedGenerationMethods")&.include?("generateText")
|
123
|
-
capabilities << "chat" if data.dig("supportedGenerationMethods")&.include?("generateMessage")
|
124
|
-
capabilities << "vision" if data.dig("supportedGenerationMethods")&.include?("generateContent") &&
|
125
|
-
data.dig("inputSetting", "supportMultiModal")
|
126
|
-
capabilities << "embedding" if data.dig("supportedGenerationMethods")&.include?("embedContent")
|
127
|
-
|
128
|
-
capabilities
|
129
|
-
end
|
130
|
-
|
131
|
-
private_class_method def self.extract_limitations(data)
|
132
|
-
limitations = {}
|
133
|
-
|
134
|
-
# Extract token limits
|
135
|
-
if data.dig("inputTokenLimit")
|
136
|
-
limitations[:input_token_limit] = data["inputTokenLimit"]
|
137
|
-
end
|
138
|
-
|
139
|
-
if data.dig("outputTokenLimit")
|
140
|
-
limitations[:output_token_limit] = data["outputTokenLimit"]
|
141
|
-
end
|
142
|
-
|
143
|
-
# Extract any other limitations from the API data
|
144
|
-
limitations
|
145
|
-
end
|
146
|
-
|
147
|
-
private_class_method def self.extract_use_cases(data)
|
148
|
-
# Extract use cases from the description or other fields
|
149
|
-
# This is a simple implementation - adjust based on actual API data
|
150
|
-
use_cases = []
|
151
|
-
|
152
|
-
if data["description"]
|
153
|
-
if data["description"].include?("chat")
|
154
|
-
use_cases << "conversational_ai"
|
155
|
-
end
|
156
|
-
|
157
|
-
if data["description"].include?("vision") || data["description"].include?("image")
|
158
|
-
use_cases << "image_understanding"
|
159
|
-
end
|
160
|
-
|
161
|
-
if data["description"].include?("embedding")
|
162
|
-
use_cases << "semantic_search"
|
163
|
-
use_cases << "clustering"
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
use_cases
|
168
|
-
end
|
169
161
|
end
|
170
162
|
end
|
171
163
|
end
|
@@ -12,13 +12,18 @@ module Geminize
|
|
12
12
|
# @return [Array<Model>] The list of models
|
13
13
|
attr_reader :models
|
14
14
|
|
15
|
+
# @return [String, nil] Token for fetching the next page of results
|
16
|
+
attr_reader :next_page_token
|
17
|
+
|
15
18
|
# Delegate array methods to the underlying models array
|
16
19
|
def_delegators :@models, :[], :size, :length, :empty?, :first, :last
|
17
20
|
|
18
21
|
# Create a new ModelList
|
19
22
|
# @param models [Array<Model>] Initial list of models
|
20
|
-
|
23
|
+
# @param next_page_token [String, nil] Token for fetching the next page
|
24
|
+
def initialize(models = [], next_page_token = nil)
|
21
25
|
@models = models
|
26
|
+
@next_page_token = next_page_token
|
22
27
|
end
|
23
28
|
|
24
29
|
# Implement Enumerable's required each method
|
@@ -35,43 +40,50 @@ module Geminize
|
|
35
40
|
self
|
36
41
|
end
|
37
42
|
|
38
|
-
# Find a model by its
|
43
|
+
# Find a model by its resource name
|
44
|
+
# @param name [String] The model name to search for
|
45
|
+
# @return [Model, nil] The found model or nil
|
46
|
+
def find_by_name(name)
|
47
|
+
@models.find { |model| model.name == name }
|
48
|
+
end
|
49
|
+
|
50
|
+
# Find a model by its ID (last part of the resource name)
|
39
51
|
# @param id [String] The model ID to search for
|
40
52
|
# @return [Model, nil] The found model or nil
|
41
53
|
def find_by_id(id)
|
42
54
|
@models.find { |model| model.id == id }
|
43
55
|
end
|
44
56
|
|
45
|
-
# Find all models that support a specific
|
46
|
-
# @param
|
57
|
+
# Find all models that support a specific generation method
|
58
|
+
# @param method [String] The generation method to filter by
|
47
59
|
# @return [ModelList] A new ModelList containing only matching models
|
48
|
-
def
|
49
|
-
filtered = @models.select { |model| model.
|
50
|
-
ModelList.new(filtered)
|
60
|
+
def filter_by_method(method)
|
61
|
+
filtered = @models.select { |model| model.supports_method?(method) }
|
62
|
+
ModelList.new(filtered, nil)
|
51
63
|
end
|
52
64
|
|
53
|
-
# Find all models that support
|
54
|
-
# @return [ModelList] A new ModelList containing only
|
55
|
-
def
|
56
|
-
|
65
|
+
# Find all models that support content generation
|
66
|
+
# @return [ModelList] A new ModelList containing only content generation capable models
|
67
|
+
def content_generation_models
|
68
|
+
filter_by_method("generateContent")
|
57
69
|
end
|
58
70
|
|
59
|
-
# Find all models that support
|
60
|
-
# @return [ModelList] A new ModelList containing only
|
61
|
-
def
|
62
|
-
|
71
|
+
# Find all models that support streaming content generation
|
72
|
+
# @return [ModelList] A new ModelList containing only streaming capable models
|
73
|
+
def streaming_models
|
74
|
+
filter_by_method("streamGenerateContent")
|
63
75
|
end
|
64
76
|
|
65
|
-
# Find all models that support
|
66
|
-
# @return [ModelList] A new ModelList containing only
|
67
|
-
def
|
68
|
-
|
77
|
+
# Find all models that support embeddings
|
78
|
+
# @return [ModelList] A new ModelList containing only embedding-capable models
|
79
|
+
def embedding_models
|
80
|
+
filter_by_method("embedContent")
|
69
81
|
end
|
70
82
|
|
71
83
|
# Find all models that support chat/conversation
|
72
84
|
# @return [ModelList] A new ModelList containing only chat-capable models
|
73
85
|
def chat_models
|
74
|
-
|
86
|
+
filter_by_method("generateMessage")
|
75
87
|
end
|
76
88
|
|
77
89
|
# Filter models by version
|
@@ -79,16 +91,40 @@ module Geminize
|
|
79
91
|
# @return [ModelList] A new ModelList containing only matching models
|
80
92
|
def filter_by_version(version)
|
81
93
|
filtered = @models.select { |model| model.version == version }
|
82
|
-
ModelList.new(filtered)
|
94
|
+
ModelList.new(filtered, nil)
|
83
95
|
end
|
84
96
|
|
85
|
-
# Filter models by name pattern
|
86
|
-
# @param pattern [String, Regexp] The pattern to match model names against
|
97
|
+
# Filter models by display name pattern
|
98
|
+
# @param pattern [String, Regexp] The pattern to match model display names against
|
87
99
|
# @return [ModelList] A new ModelList containing only matching models
|
88
|
-
def
|
100
|
+
def filter_by_display_name(pattern)
|
89
101
|
pattern = Regexp.new(pattern.to_s, Regexp::IGNORECASE) if pattern.is_a?(String)
|
90
|
-
filtered = @models.select { |model| model.
|
91
|
-
ModelList.new(filtered)
|
102
|
+
filtered = @models.select { |model| model.display_name&.match?(pattern) }
|
103
|
+
ModelList.new(filtered, nil)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Filter models by base model ID
|
107
|
+
# @param base_model_id [String] The base model ID to filter by
|
108
|
+
# @return [ModelList] A new ModelList containing only matching models
|
109
|
+
def filter_by_base_model_id(base_model_id)
|
110
|
+
filtered = @models.select { |model| model.base_model_id == base_model_id }
|
111
|
+
ModelList.new(filtered, nil)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Find models with a minimum input token limit
|
115
|
+
# @param min_limit [Integer] The minimum input token limit
|
116
|
+
# @return [ModelList] A new ModelList containing only matching models
|
117
|
+
def filter_by_min_input_tokens(min_limit)
|
118
|
+
filtered = @models.select { |model| model.input_token_limit && model.input_token_limit >= min_limit }
|
119
|
+
ModelList.new(filtered, nil)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Find models with a minimum output token limit
|
123
|
+
# @param min_limit [Integer] The minimum output token limit
|
124
|
+
# @return [ModelList] A new ModelList containing only matching models
|
125
|
+
def filter_by_min_output_tokens(min_limit)
|
126
|
+
filtered = @models.select { |model| model.output_token_limit && model.output_token_limit >= min_limit }
|
127
|
+
ModelList.new(filtered, nil)
|
92
128
|
end
|
93
129
|
|
94
130
|
# Create a ModelList from API response data
|
@@ -96,16 +132,22 @@ module Geminize
|
|
96
132
|
# @return [ModelList] New ModelList instance
|
97
133
|
def self.from_api_data(data)
|
98
134
|
models = []
|
135
|
+
next_page_token = data["nextPageToken"]
|
99
136
|
|
100
137
|
# Process model data from API response
|
101
|
-
# The exact structure will depend on the Gemini API response format
|
102
138
|
if data.key?("models")
|
103
139
|
models = data["models"].map do |model_data|
|
104
140
|
Model.from_api_data(model_data)
|
105
141
|
end
|
106
142
|
end
|
107
143
|
|
108
|
-
new(models)
|
144
|
+
new(models, next_page_token)
|
145
|
+
end
|
146
|
+
|
147
|
+
# Check if there are more pages of results available
|
148
|
+
# @return [Boolean] True if there are more pages
|
149
|
+
def has_more_pages?
|
150
|
+
!next_page_token.nil? && !next_page_token.empty?
|
109
151
|
end
|
110
152
|
|
111
153
|
# Convert to array of hashes representation
|
@@ -52,6 +52,35 @@ module Geminize
|
|
52
52
|
def build_streaming_endpoint(model_name)
|
53
53
|
build_model_endpoint(model_name, "streamGenerateContent")
|
54
54
|
end
|
55
|
+
|
56
|
+
# Build a models list request parameters
|
57
|
+
# @param page_size [Integer, nil] Number of models to return per page
|
58
|
+
# @param page_token [String, nil] Token for retrieving a specific page
|
59
|
+
# @return [Hash] The query parameters for models listing
|
60
|
+
def build_models_list_params(page_size = nil, page_token = nil)
|
61
|
+
params = {}
|
62
|
+
params[:pageSize] = page_size if page_size
|
63
|
+
params[:pageToken] = page_token if page_token
|
64
|
+
params
|
65
|
+
end
|
66
|
+
|
67
|
+
# Build a specific model endpoint for the get model info API
|
68
|
+
# @param model_name [String] The model name or ID to get info for
|
69
|
+
# @return [String] The complete API endpoint path for getting model info
|
70
|
+
def build_get_model_endpoint(model_name)
|
71
|
+
# Handle both formats: "models/gemini-1.5-pro" or just "gemini-1.5-pro"
|
72
|
+
unless model_name.start_with?("models/")
|
73
|
+
model_name = "models/#{model_name}"
|
74
|
+
end
|
75
|
+
model_name
|
76
|
+
end
|
77
|
+
|
78
|
+
# Build the endpoint for embedding generation
|
79
|
+
# @param model_name [String] The name of the model
|
80
|
+
# @return [String] The complete API endpoint path for embedding generation
|
81
|
+
def build_embedding_endpoint(model_name)
|
82
|
+
build_model_endpoint(model_name, "embedContent")
|
83
|
+
end
|
55
84
|
end
|
56
85
|
end
|
57
86
|
end
|
data/lib/geminize/version.rb
CHANGED
data/lib/geminize.rb
CHANGED
@@ -478,35 +478,92 @@ module Geminize
|
|
478
478
|
)
|
479
479
|
end
|
480
480
|
|
481
|
-
#
|
481
|
+
# List available models from the Gemini API
|
482
|
+
# @param page_size [Integer, nil] Number of models to return per page (max 1000)
|
483
|
+
# @param page_token [String, nil] Token for retrieving a specific page
|
482
484
|
# @param force_refresh [Boolean] Force a refresh from the API instead of using cache
|
483
485
|
# @param client_options [Hash] Options to pass to the client
|
484
486
|
# @return [Geminize::Models::ModelList] List of available models
|
485
487
|
# @raise [Geminize::GeminizeError] If the request fails
|
486
|
-
|
487
|
-
# models = Geminize.list_models
|
488
|
-
# @example Get a fresh list bypassing cache
|
489
|
-
# models = Geminize.list_models(force_refresh: true)
|
490
|
-
# @example Filter models by capability
|
491
|
-
# vision_models = Geminize.list_models.vision_models
|
492
|
-
def list_models(force_refresh: false, client_options: {})
|
488
|
+
def list_models(page_size: nil, page_token: nil, force_refresh: false, client_options: {})
|
493
489
|
validate_configuration!
|
494
490
|
model_info = ModelInfo.new(nil, client_options)
|
495
|
-
model_info.list_models(force_refresh: force_refresh)
|
491
|
+
model_info.list_models(page_size: page_size, page_token: page_token, force_refresh: force_refresh)
|
492
|
+
end
|
493
|
+
|
494
|
+
# Get all available models, handling pagination automatically
|
495
|
+
# @param force_refresh [Boolean] Force a refresh from the API instead of using cache
|
496
|
+
# @param client_options [Hash] Options to pass to the client
|
497
|
+
# @return [Geminize::Models::ModelList] Complete list of all available models
|
498
|
+
# @raise [Geminize::GeminizeError] If the request fails
|
499
|
+
def list_all_models(force_refresh: false, client_options: {})
|
500
|
+
validate_configuration!
|
501
|
+
model_info = ModelInfo.new(nil, client_options)
|
502
|
+
model_info.list_all_models(force_refresh: force_refresh)
|
496
503
|
end
|
497
504
|
|
498
505
|
# Get information about a specific model
|
499
|
-
# @param
|
506
|
+
# @param model_name [String] The model name to retrieve (can be "models/gemini-1.5-pro" or just "gemini-1.5-pro")
|
500
507
|
# @param force_refresh [Boolean] Force a refresh from the API instead of using cache
|
501
508
|
# @param client_options [Hash] Options to pass to the client
|
502
509
|
# @return [Geminize::Models::Model] The model information
|
503
510
|
# @raise [Geminize::GeminizeError] If the request fails or model is not found
|
504
|
-
|
505
|
-
# model = Geminize.get_model("gemini-1.5-pro")
|
506
|
-
def get_model(model_id, force_refresh: false, client_options: {})
|
511
|
+
def get_model(model_name, force_refresh: false, client_options: {})
|
507
512
|
validate_configuration!
|
508
513
|
model_info = ModelInfo.new(nil, client_options)
|
509
|
-
model_info.get_model(
|
514
|
+
model_info.get_model(model_name, force_refresh: force_refresh)
|
515
|
+
end
|
516
|
+
|
517
|
+
# Get models that support a specific generation method
|
518
|
+
# @param method [String] The generation method (e.g., "generateContent", "embedContent")
|
519
|
+
# @param force_refresh [Boolean] Force a refresh from the API instead of using cache
|
520
|
+
# @param client_options [Hash] Options to pass to the client
|
521
|
+
# @return [Geminize::Models::ModelList] List of models that support the method
|
522
|
+
# @raise [Geminize::GeminizeError] If the request fails
|
523
|
+
def get_models_by_method(method, force_refresh: false, client_options: {})
|
524
|
+
validate_configuration!
|
525
|
+
model_info = ModelInfo.new(nil, client_options)
|
526
|
+
model_info.get_models_by_method(method, force_refresh: force_refresh)
|
527
|
+
end
|
528
|
+
|
529
|
+
# Get models that support content generation
|
530
|
+
# @param force_refresh [Boolean] Force a refresh from the API instead of using cache
|
531
|
+
# @param client_options [Hash] Options to pass to the client
|
532
|
+
# @return [Geminize::Models::ModelList] List of models that support content generation
|
533
|
+
# @raise [Geminize::GeminizeError] If the request fails
|
534
|
+
def get_content_generation_models(force_refresh: false, client_options: {})
|
535
|
+
models = list_all_models(force_refresh: force_refresh, client_options: client_options)
|
536
|
+
models.content_generation_models
|
537
|
+
end
|
538
|
+
|
539
|
+
# Get models that support embedding generation
|
540
|
+
# @param force_refresh [Boolean] Force a refresh from the API instead of using cache
|
541
|
+
# @param client_options [Hash] Options to pass to the client
|
542
|
+
# @return [Geminize::Models::ModelList] List of models that support embedding generation
|
543
|
+
# @raise [Geminize::GeminizeError] If the request fails
|
544
|
+
def get_embedding_models(force_refresh: false, client_options: {})
|
545
|
+
models = list_all_models(force_refresh: force_refresh, client_options: client_options)
|
546
|
+
models.embedding_models
|
547
|
+
end
|
548
|
+
|
549
|
+
# Get models that support chat generation
|
550
|
+
# @param force_refresh [Boolean] Force a refresh from the API instead of using cache
|
551
|
+
# @param client_options [Hash] Options to pass to the client
|
552
|
+
# @return [Geminize::Models::ModelList] List of models that support chat generation
|
553
|
+
# @raise [Geminize::GeminizeError] If the request fails
|
554
|
+
def get_chat_models(force_refresh: false, client_options: {})
|
555
|
+
models = list_all_models(force_refresh: force_refresh, client_options: client_options)
|
556
|
+
models.chat_models
|
557
|
+
end
|
558
|
+
|
559
|
+
# Get models that support streaming generation
|
560
|
+
# @param force_refresh [Boolean] Force a refresh from the API instead of using cache
|
561
|
+
# @param client_options [Hash] Options to pass to the client
|
562
|
+
# @return [Geminize::Models::ModelList] List of models that support streaming generation
|
563
|
+
# @raise [Geminize::GeminizeError] If the request fails
|
564
|
+
def get_streaming_models(force_refresh: false, client_options: {})
|
565
|
+
models = list_all_models(force_refresh: force_refresh, client_options: client_options)
|
566
|
+
models.streaming_models
|
510
567
|
end
|
511
568
|
|
512
569
|
# Update a conversation's system instruction
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geminize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nhat Long Nguyen
|
@@ -130,8 +130,50 @@ executables: []
|
|
130
130
|
extensions: []
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
|
+
- ".cursor/mcp.json"
|
134
|
+
- ".cursor/rules/isolation_rules/Core/command-execution.mdc"
|
135
|
+
- ".cursor/rules/isolation_rules/Core/complexity-decision-tree.mdc"
|
136
|
+
- ".cursor/rules/isolation_rules/Core/creative-phase-enforcement.mdc"
|
137
|
+
- ".cursor/rules/isolation_rules/Core/creative-phase-metrics.mdc"
|
138
|
+
- ".cursor/rules/isolation_rules/Core/file-verification.mdc"
|
139
|
+
- ".cursor/rules/isolation_rules/Core/platform-awareness.mdc"
|
140
|
+
- ".cursor/rules/isolation_rules/Level3/planning-comprehensive.mdc"
|
141
|
+
- ".cursor/rules/isolation_rules/Level3/task-tracking-intermediate.mdc"
|
142
|
+
- ".cursor/rules/isolation_rules/Phases/CreativePhase/creative-phase-architecture.mdc"
|
143
|
+
- ".cursor/rules/isolation_rules/main.mdc"
|
144
|
+
- ".cursor/rules/isolation_rules/visual-maps/archive-mode-map.mdc"
|
145
|
+
- ".cursor/rules/isolation_rules/visual-maps/creative-mode-map.mdc"
|
146
|
+
- ".cursor/rules/isolation_rules/visual-maps/implement-mode-map.mdc"
|
147
|
+
- ".cursor/rules/isolation_rules/visual-maps/plan-mode-map.mdc"
|
148
|
+
- ".cursor/rules/isolation_rules/visual-maps/qa-mode-map.mdc"
|
149
|
+
- ".cursor/rules/isolation_rules/visual-maps/reflect-mode-map.mdc"
|
150
|
+
- ".cursor/rules/isolation_rules/visual-maps/van-mode-map.mdc"
|
151
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-complexity-determination.mdc"
|
152
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-file-verification.mdc"
|
153
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-mode-map.mdc"
|
154
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-platform-detection.mdc"
|
155
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/build-test.mdc"
|
156
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/config-check.mdc"
|
157
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/dependency-check.mdc"
|
158
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/environment-check.mdc"
|
159
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-checks/file-verification.mdc"
|
160
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-main.mdc"
|
161
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/common-fixes.mdc"
|
162
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/mode-transitions.mdc"
|
163
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/reports.mdc"
|
164
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/rule-calling-guide.mdc"
|
165
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-utils/rule-calling-help.mdc"
|
166
|
+
- ".cursor/rules/isolation_rules/visual-maps/van_mode_split/van-qa-validation.md.old"
|
167
|
+
- ".env.example"
|
168
|
+
- ".memory_bank/activeContext.md"
|
169
|
+
- ".memory_bank/progress.md"
|
170
|
+
- ".memory_bank/projectbrief.md"
|
171
|
+
- ".memory_bank/systemPatterns.md"
|
172
|
+
- ".memory_bank/tasks.md"
|
173
|
+
- ".memory_bank/techContext.md"
|
133
174
|
- ".rspec"
|
134
175
|
- ".standard.yml"
|
176
|
+
- ".tool-versions"
|
135
177
|
- ".yardopts"
|
136
178
|
- CHANGELOG.md
|
137
179
|
- CODE_OF_CONDUCT.md
|
@@ -142,6 +184,7 @@ files:
|
|
142
184
|
- examples/README.md
|
143
185
|
- examples/configuration.rb
|
144
186
|
- examples/embeddings.rb
|
187
|
+
- examples/models_api.rb
|
145
188
|
- examples/multimodal.rb
|
146
189
|
- examples/ruby.png
|
147
190
|
- examples/system_instructions.rb
|
@@ -197,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
240
|
- !ruby/object:Gem::Version
|
198
241
|
version: '0'
|
199
242
|
requirements: []
|
200
|
-
rubygems_version: 3.6.
|
243
|
+
rubygems_version: 3.6.7
|
201
244
|
specification_version: 4
|
202
245
|
summary: Ruby interface for Google's Gemini AI API
|
203
246
|
test_files: []
|