ai-chat 0.6.1 → 0.7.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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -7
  3. data/ai-chat.gemspec +3 -3
  4. data/lib/ai/chat.rb +11 -4
  5. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ff5e0be07d3ba9d6d0328cc296512bd93db861eb556cf5d8c6a2172772b4b14
4
- data.tar.gz: d86987bcb8ce4af8b5946a5b10316bc04739ef7d9b787cdb81ea9f7e8c4bbc7b
3
+ metadata.gz: dc2941185cac34d62d83233dd4e680fe84e5260cd4444ab168207c1b14064d9b
4
+ data.tar.gz: 7aa8e27049a66787cd49319d45421b8a82bb5a44fe622a1878c0e045ff341373
5
5
  SHA512:
6
- metadata.gz: cc0f8bfea811e0b3e2f695c307736c54cf2f2349e336f968b7f252572a450ca7f385e94e24ad4ad66cbf3c2952b9c8b86fac4202013a291c4e90a48d2fe1e196
7
- data.tar.gz: 1f7e08ca035f6f2af97d0fd43f184795f1dc1e631e3e683020890209d431274d3d2e150883ff1343993da35a0fcdc21792e50072b64e636d3cb3e3c1cd8630a1
6
+ metadata.gz: 5fa4dc0c4a18a484e676c7b14f1de69fd6d4c814f6bc4be5f1c91fcb56294b90f324a890e8c2f954bf2fe4528f75328c5a0c4b5e8dec8fb8ed94a5f20446a276
7
+ data.tar.gz: ade82f46956897d29530401ddc604977bab731e6c0714e4904d1cae4d7e853b6ad23a0a5eef4dbeca2b2ea4fd3e690aacb1bde0812e27a67cfb08504dc3f5000
data/README.md CHANGED
@@ -56,7 +56,7 @@ ap response
56
56
  # => {
57
57
  # :role => "assistant",
58
58
  # :content => "Matz is nice and so we are nice.",
59
- # :response => { id: "resp_abc...", model: "gpt-5.2", ... }
59
+ # :response => { id: "resp_abc...", model: "gpt-5.6-terra", ... }
60
60
  # }
61
61
 
62
62
  ap chat.messages
@@ -68,7 +68,7 @@ ap chat.messages
68
68
  # {
69
69
  # :role => "assistant",
70
70
  # :content => "Matz is nice and so we are nice.",
71
- # :response => { id: "resp_abc...", model: "gpt-5.2", ... }
71
+ # :response => { id: "resp_abc...", model: "gpt-5.6-terra", ... }
72
72
  # }
73
73
  # ]
74
74
  ```
@@ -131,11 +131,11 @@ chat.add("Here's what I think...", role: "assistant")
131
131
 
132
132
  ### Model
133
133
 
134
- The gem defaults to `gpt-5.2`. You can change it:
134
+ The gem defaults to `gpt-5.6-terra`. You can change it:
135
135
 
136
136
  ```ruby
137
137
  chat = AI::Chat.new
138
- chat.model = "gpt-4o"
138
+ chat.model = "gpt-5.6-luna"
139
139
  ```
140
140
 
141
141
  ### API Key
@@ -403,13 +403,15 @@ Control how much reasoning the model does before responding:
403
403
 
404
404
  ```ruby
405
405
  chat = AI::Chat.new
406
- chat.reasoning_effort = "high" # "low", "medium", or "high"
406
+ chat.reasoning_effort = "high" # "none", "low", "medium", "high", "xhigh", or "max"
407
407
 
408
408
  chat.user("Explain the tradeoffs between microservices and monoliths.")
409
409
  chat.generate!
410
410
  ```
411
411
 
412
- By default, `reasoning_effort` is `nil` (no reasoning parameter is sent). For `gpt-5.2`, this is equivalent to no reasoning.
412
+ By default, `reasoning_effort` is `"none"`, so the model answers directly without spending reasoning tokens. This matters because GPT-5.5 and newer models (including the default `gpt-5.6-terra`) fall back to `"medium"` reasoning when the parameter is omitted, which is slower and more expensive.
413
+
414
+ Set `reasoning_effort = nil` to omit the reasoning parameter entirely — you will need this if you switch to a model that does not support reasoning (e.g., `gpt-4o`) or one that predates the `"none"` option.
413
415
 
414
416
  ### Verbosity
415
417
 
@@ -474,7 +476,7 @@ chat.generate!
474
476
 
475
477
  response = chat.last[:response]
476
478
  response[:id] # => "resp_abc123..."
477
- response[:model] # => "gpt-5.2"
479
+ response[:model] # => "gpt-5.6-terra"
478
480
  response[:usage] # => { input_tokens: 5, output_tokens: 7, total_tokens: 12 }
479
481
  ```
480
482
 
data/ai-chat.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "ai-chat"
5
- spec.version = "0.6.1"
5
+ spec.version = "0.7.0"
6
6
  spec.authors = ["Raghu Betina", "Jelani Woods"]
7
7
  spec.email = ["raghu@firstdraft.com", "jelani@firstdraft.com"]
8
8
  spec.homepage = "https://github.com/firstdraft/ai-chat"
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  "source_code_uri" => "https://github.com/firstdraft/ai-chat"
19
19
  }
20
20
 
21
- spec.required_ruby_version = ">= 3.2"
22
- spec.add_runtime_dependency "openai", "~> 0.59"
21
+ spec.required_ruby_version = ">= 3.3"
22
+ spec.add_runtime_dependency "openai", "~> 0.80"
23
23
  spec.add_runtime_dependency "marcel", "~> 1.0"
24
24
  spec.add_runtime_dependency "base64", "~> 0.1", "> 0.1.1"
25
25
  spec.add_runtime_dependency "json", "~> 2.0"
data/lib/ai/chat.rb CHANGED
@@ -32,8 +32,8 @@ module AI
32
32
  @proxy = proxy.nil? ? ENV[PROXY_ENV]&.downcase == "true" : !!proxy
33
33
  @api_key = resolve_api_key
34
34
  @messages = []
35
- @reasoning_effort = nil
36
- @model = "gpt-5.2"
35
+ @reasoning_effort = "none"
36
+ @model = "gpt-5.6-terra"
37
37
  client_options = {api_key: @api_key}
38
38
  client_options[:base_url] = BASE_PROXY_URL if @proxy
39
39
  @client = OpenAI::Client.new(**client_options)
@@ -57,7 +57,7 @@ module AI
57
57
 
58
58
  client = OpenAI::Client.new(**options)
59
59
  response = client.responses.create(
60
- model: "gpt-5.2",
60
+ model: "gpt-5.6-terra",
61
61
  input: [
62
62
  {role: :system, content: system_prompt},
63
63
  {role: :user, content: description}
@@ -307,6 +307,13 @@ module AI
307
307
  end
308
308
  end
309
309
 
310
+ # Reasoning summaries are only meaningful when the model actually reasons.
311
+ def reasoning_parameters
312
+ params = {effort: reasoning_effort}
313
+ params[:summary] = "auto" unless reasoning_effort.to_s == "none"
314
+ params
315
+ end
316
+
310
317
  def create_conversation
311
318
  conversation = client.conversations.create
312
319
  self.conversation_id = conversation.id
@@ -321,7 +328,7 @@ module AI
321
328
  parameters[:background] = background if background
322
329
  parameters[:tools] = tools unless tools.empty?
323
330
  parameters[:text] = schema if schema
324
- parameters[:reasoning] = {effort: reasoning_effort, summary: "auto"} if reasoning_effort
331
+ parameters[:reasoning] = reasoning_parameters if reasoning_effort
325
332
 
326
333
  create_conversation unless conversation_id
327
334
  parameters[:conversation] = conversation_id
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ai-chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raghu Betina
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.59'
19
+ version: '0.80'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.59'
26
+ version: '0.80'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: marcel
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -149,14 +149,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: '3.2'
152
+ version: '3.3'
153
153
  required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  requirements:
155
155
  - - ">="
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 4.0.3
159
+ rubygems_version: 3.6.9
160
160
  specification_version: 4
161
161
  summary: A beginner-friendly Ruby interface for OpenAI's API
162
162
  test_files: []