openai 0.16.0 → 0.17.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/CHANGELOG.md +24 -0
- data/README.md +14 -20
- data/lib/openai/internal/transport/base_client.rb +1 -1
- data/lib/openai/internal/type/enum.rb +6 -6
- data/lib/openai/internal/type/union.rb +13 -17
- data/lib/openai/models/beta/assistant_create_params.rb +4 -5
- data/lib/openai/models/beta/assistant_update_params.rb +22 -5
- data/lib/openai/models/beta/threads/run_create_params.rb +4 -5
- data/lib/openai/models/chat/chat_completion_allowed_tool_choice.rb +33 -0
- data/lib/openai/models/chat/chat_completion_allowed_tools.rb +64 -0
- data/lib/openai/models/chat/chat_completion_assistant_message_param.rb +3 -5
- data/lib/openai/models/chat/chat_completion_custom_tool.rb +163 -0
- data/lib/openai/models/chat/chat_completion_function_tool.rb +29 -0
- data/lib/openai/models/chat/chat_completion_message.rb +3 -5
- data/lib/openai/models/chat/chat_completion_message_custom_tool_call.rb +60 -0
- data/lib/openai/models/chat/chat_completion_message_function_tool_call.rb +73 -0
- data/lib/openai/models/chat/chat_completion_message_tool_call.rb +10 -56
- data/lib/openai/models/chat/chat_completion_named_tool_choice.rb +2 -2
- data/lib/openai/models/chat/chat_completion_named_tool_choice_custom.rb +42 -0
- data/lib/openai/models/chat/chat_completion_stream_options.rb +14 -1
- data/lib/openai/models/chat/chat_completion_tool.rb +12 -14
- data/lib/openai/models/chat/chat_completion_tool_choice_option.rb +7 -1
- data/lib/openai/models/chat/completion_create_params.rb +35 -12
- data/lib/openai/models/chat_model.rb +7 -0
- data/lib/openai/models/custom_tool_input_format.rb +76 -0
- data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +3 -3
- data/lib/openai/models/evals/run_cancel_response.rb +2 -2
- data/lib/openai/models/evals/run_create_params.rb +2 -2
- data/lib/openai/models/evals/run_create_response.rb +2 -2
- data/lib/openai/models/evals/run_list_response.rb +2 -2
- data/lib/openai/models/evals/run_retrieve_response.rb +2 -2
- data/lib/openai/models/reasoning.rb +4 -5
- data/lib/openai/models/reasoning_effort.rb +4 -4
- data/lib/openai/models/response_format_text_grammar.rb +27 -0
- data/lib/openai/models/response_format_text_python.rb +20 -0
- data/lib/openai/models/responses/custom_tool.rb +48 -0
- data/lib/openai/models/responses/response.rb +20 -12
- data/lib/openai/models/responses/response_create_params.rb +48 -10
- data/lib/openai/models/responses/response_custom_tool_call.rb +55 -0
- data/lib/openai/models/responses/response_custom_tool_call_input_delta_event.rb +52 -0
- data/lib/openai/models/responses/response_custom_tool_call_input_done_event.rb +52 -0
- data/lib/openai/models/responses/response_custom_tool_call_output.rb +47 -0
- data/lib/openai/models/responses/response_input_item.rb +7 -1
- data/lib/openai/models/responses/response_output_item.rb +4 -1
- data/lib/openai/models/responses/response_output_item_added_event.rb +2 -2
- data/lib/openai/models/responses/response_output_item_done_event.rb +2 -2
- data/lib/openai/models/responses/response_reasoning_item.rb +36 -5
- data/lib/openai/models/responses/response_reasoning_text_delta_event.rb +63 -0
- data/lib/openai/models/responses/response_reasoning_text_done_event.rb +63 -0
- data/lib/openai/models/responses/response_retrieve_params.rb +14 -1
- data/lib/openai/models/responses/response_stream_event.rb +13 -11
- data/lib/openai/models/responses/response_text_config.rb +27 -1
- data/lib/openai/models/responses/tool.rb +5 -1
- data/lib/openai/models/responses/tool_choice_allowed.rb +73 -0
- data/lib/openai/models/responses/tool_choice_custom.rb +28 -0
- data/lib/openai/models/vector_store_search_params.rb +6 -1
- data/lib/openai/models.rb +6 -0
- data/lib/openai/resources/beta/assistants.rb +2 -2
- data/lib/openai/resources/beta/threads/runs.rb +2 -2
- data/lib/openai/resources/chat/completions.rb +16 -10
- data/lib/openai/resources/responses.rb +38 -22
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +19 -2
- data/rbi/openai/internal/transport/base_client.rbi +1 -1
- data/rbi/openai/models/beta/assistant_create_params.rbi +6 -8
- data/rbi/openai/models/beta/assistant_update_params.rbi +36 -8
- data/rbi/openai/models/beta/threads/run_create_params.rbi +6 -8
- data/rbi/openai/models/chat/chat_completion_allowed_tool_choice.rbi +60 -0
- data/rbi/openai/models/chat/chat_completion_allowed_tools.rbi +118 -0
- data/rbi/openai/models/chat/chat_completion_assistant_message_param.rbi +27 -4
- data/rbi/openai/models/chat/chat_completion_custom_tool.rbi +335 -0
- data/rbi/openai/models/chat/chat_completion_function_tool.rbi +51 -0
- data/rbi/openai/models/chat/chat_completion_message.rbi +17 -4
- data/rbi/openai/models/chat/chat_completion_message_custom_tool_call.rbi +105 -0
- data/rbi/openai/models/chat/chat_completion_message_function_tool_call.rbi +118 -0
- data/rbi/openai/models/chat/chat_completion_message_tool_call.rbi +9 -92
- data/rbi/openai/models/chat/chat_completion_named_tool_choice.rbi +2 -2
- data/rbi/openai/models/chat/chat_completion_named_tool_choice_custom.rbi +89 -0
- data/rbi/openai/models/chat/chat_completion_stream_options.rbi +30 -2
- data/rbi/openai/models/chat/chat_completion_tool.rbi +11 -30
- data/rbi/openai/models/chat/chat_completion_tool_choice_option.rbi +3 -1
- data/rbi/openai/models/chat/completion_create_params.rbi +106 -25
- data/rbi/openai/models/chat_model.rbi +11 -0
- data/rbi/openai/models/custom_tool_input_format.rbi +136 -0
- data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +8 -4
- data/rbi/openai/models/evals/run_cancel_response.rbi +2 -0
- data/rbi/openai/models/evals/run_create_params.rbi +4 -0
- data/rbi/openai/models/evals/run_create_response.rbi +2 -0
- data/rbi/openai/models/evals/run_list_response.rbi +2 -0
- data/rbi/openai/models/evals/run_retrieve_response.rbi +2 -0
- data/rbi/openai/models/reasoning.rbi +6 -8
- data/rbi/openai/models/reasoning_effort.rbi +4 -4
- data/rbi/openai/models/response_format_text_grammar.rbi +35 -0
- data/rbi/openai/models/response_format_text_python.rbi +30 -0
- data/rbi/openai/models/responses/custom_tool.rbi +96 -0
- data/rbi/openai/models/responses/response.rbi +15 -5
- data/rbi/openai/models/responses/response_create_params.rbi +94 -7
- data/rbi/openai/models/responses/response_custom_tool_call.rbi +78 -0
- data/rbi/openai/models/responses/response_custom_tool_call_input_delta_event.rbi +75 -0
- data/rbi/openai/models/responses/response_custom_tool_call_input_done_event.rbi +75 -0
- data/rbi/openai/models/responses/response_custom_tool_call_output.rbi +65 -0
- data/rbi/openai/models/responses/response_input_item.rbi +2 -0
- data/rbi/openai/models/responses/response_output_item.rbi +2 -1
- data/rbi/openai/models/responses/response_output_item_added_event.rbi +2 -1
- data/rbi/openai/models/responses/response_output_item_done_event.rbi +2 -1
- data/rbi/openai/models/responses/response_reasoning_item.rbi +63 -4
- data/rbi/openai/models/responses/response_reasoning_text_delta_event.rbi +83 -0
- data/rbi/openai/models/responses/{response_reasoning_summary_done_event.rbi → response_reasoning_text_done_event.rbi} +20 -20
- data/rbi/openai/models/responses/response_retrieve_params.rbi +21 -0
- data/rbi/openai/models/responses/response_stream_event.rbi +4 -2
- data/rbi/openai/models/responses/response_text_config.rbi +64 -1
- data/rbi/openai/models/responses/tool.rbi +1 -0
- data/rbi/openai/models/responses/tool_choice_allowed.rbi +124 -0
- data/rbi/openai/models/responses/tool_choice_custom.rbi +39 -0
- data/rbi/openai/models/vector_store_search_params.rbi +12 -1
- data/rbi/openai/models.rbi +6 -0
- data/rbi/openai/resources/beta/assistants.rbi +6 -8
- data/rbi/openai/resources/beta/threads/runs.rbi +8 -10
- data/rbi/openai/resources/chat/completions.rbi +44 -19
- data/rbi/openai/resources/responses.rbi +215 -41
- data/sig/openai/internal/transport/base_client.rbs +1 -1
- data/sig/openai/models/beta/assistant_update_params.rbs +12 -0
- data/sig/openai/models/chat/chat_completion_allowed_tool_choice.rbs +29 -0
- data/sig/openai/models/chat/chat_completion_allowed_tools.rbs +38 -0
- data/sig/openai/models/chat/chat_completion_assistant_message_param.rbs +6 -6
- data/sig/openai/models/chat/chat_completion_custom_tool.rbs +137 -0
- data/sig/openai/models/chat/chat_completion_function_tool.rbs +26 -0
- data/sig/openai/models/chat/chat_completion_message.rbs +6 -6
- data/sig/openai/models/chat/chat_completion_message_custom_tool_call.rbs +46 -0
- data/sig/openai/models/chat/chat_completion_message_function_tool_call.rbs +46 -0
- data/sig/openai/models/chat/chat_completion_message_tool_call.rbs +6 -35
- data/sig/openai/models/chat/chat_completion_named_tool_choice_custom.rbs +39 -0
- data/sig/openai/models/chat/chat_completion_stream_options.rbs +11 -3
- data/sig/openai/models/chat/chat_completion_tool.rbs +6 -15
- data/sig/openai/models/chat/chat_completion_tool_choice_option.rbs +2 -0
- data/sig/openai/models/chat/completion_create_params.rbs +23 -6
- data/sig/openai/models/chat_model.rbs +15 -1
- data/sig/openai/models/custom_tool_input_format.rbs +61 -0
- data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +6 -6
- data/sig/openai/models/reasoning_effort.rbs +2 -1
- data/sig/openai/models/response_format_text_grammar.rbs +15 -0
- data/sig/openai/models/response_format_text_python.rbs +13 -0
- data/sig/openai/models/responses/custom_tool.rbs +43 -0
- data/sig/openai/models/responses/response.rbs +2 -0
- data/sig/openai/models/responses/response_create_params.rbs +19 -0
- data/sig/openai/models/responses/response_custom_tool_call.rbs +44 -0
- data/sig/openai/models/responses/response_custom_tool_call_input_delta_event.rbs +42 -0
- data/sig/openai/models/responses/response_custom_tool_call_input_done_event.rbs +42 -0
- data/sig/openai/models/responses/response_custom_tool_call_output.rbs +39 -0
- data/sig/openai/models/responses/response_input_item.rbs +2 -0
- data/sig/openai/models/responses/response_output_item.rbs +1 -0
- data/sig/openai/models/responses/response_reasoning_item.rbs +21 -0
- data/sig/openai/models/responses/{response_reasoning_summary_delta_event.rbs → response_reasoning_text_delta_event.rbs} +15 -15
- data/sig/openai/models/responses/{response_reasoning_summary_done_event.rbs → response_reasoning_text_done_event.rbs} +11 -11
- data/sig/openai/models/responses/response_retrieve_params.rbs +7 -0
- data/sig/openai/models/responses/response_stream_event.rbs +4 -2
- data/sig/openai/models/responses/response_text_config.rbs +22 -3
- data/sig/openai/models/responses/tool.rbs +1 -0
- data/sig/openai/models/responses/tool_choice_allowed.rbs +43 -0
- data/sig/openai/models/responses/tool_choice_custom.rbs +17 -0
- data/sig/openai/models/vector_store_search_params.rbs +2 -1
- data/sig/openai/models.rbs +6 -0
- data/sig/openai/resources/chat/completions.rbs +4 -2
- data/sig/openai/resources/responses.rbs +32 -0
- metadata +59 -8
- data/lib/openai/models/responses/response_reasoning_summary_delta_event.rb +0 -65
- data/lib/openai/models/responses/response_reasoning_summary_done_event.rb +0 -60
- data/rbi/openai/models/responses/response_reasoning_summary_delta_event.rbi +0 -85
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6413e169f6a035774a4322aa42bbce1b9374344c1f68c5d452be6b0dffcd9756
|
4
|
+
data.tar.gz: 1ef928f4030023fd8a2076b08c3077f8ee7b9d95eef046eebbfc72004d46d327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf5a3da338b678f1680b605d0cd5a383ca95d601706422e5bedd5131e7ee7d91f01941b7f913368cec2e007fc684309e64e449e52e724a3c7a764c993c3d9e53
|
7
|
+
data.tar.gz: ebb89edd3814ee447bcfababcb05662d26e7380fb024c943cb5fa30196fcc6c49aea64c820de4fe8256f2acdf20562544e41a410084d1e34c774cf179329dc47
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.17.0 (2025-08-08)
|
4
|
+
|
5
|
+
Full Changelog: [v0.16.0...v0.17.0](https://github.com/openai/openai-ruby/compare/v0.16.0...v0.17.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** adds GPT-5 and new API features: platform.openai.com/docs/guides/gpt-5 ([068a381](https://github.com/openai/openai-ruby/commit/068a381a17dd2d60865e67fcd17fa84d919f3f5c))
|
10
|
+
* **api:** manual updates ([1d79621](https://github.com/openai/openai-ruby/commit/1d79621120fbccc8dd41f5af6df5a9b1a9018e73))
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* **client:** dont try to parse if content is missing ([#770](https://github.com/openai/openai-ruby/issues/770)) ([7f8f2d3](https://github.com/openai/openai-ruby/commit/7f8f2d32863fafc39ee4a884937673a2ad9be358))
|
16
|
+
* **client:** fix verbosity parameter location in Responses ([a6b7ae8](https://github.com/openai/openai-ruby/commit/a6b7ae8b568c2214d4883fad44c9cf2e8a7d53e2))
|
17
|
+
* **internal:** fix rbi error ([803f20b](https://github.com/openai/openai-ruby/commit/803f20ba0c3751d28175dca99853783f0d851645))
|
18
|
+
* **respones:** undo accidently deleted fields ([#177](https://github.com/openai/openai-ruby/issues/177)) ([90a7c3a](https://github.com/openai/openai-ruby/commit/90a7c3ac8d22cc90b8ecaa3b091598ea3bc73029))
|
19
|
+
* **responses:** remove incorrect verbosity param ([127e2d1](https://github.com/openai/openai-ruby/commit/127e2d1b96b72307178446f0aa8acc1d3ad31367))
|
20
|
+
|
21
|
+
|
22
|
+
### Chores
|
23
|
+
|
24
|
+
* **internal:** increase visibility of internal helper method ([eddbcda](https://github.com/openai/openai-ruby/commit/eddbcda189ac0a864fc3dadc5dd3578d730c491f))
|
25
|
+
* update @stainless-api/prism-cli to v5.15.0 ([aaa7d89](https://github.com/openai/openai-ruby/commit/aaa7d895a3dba31f32cf5f4373a49d1571667fc6))
|
26
|
+
|
3
27
|
## 0.16.0 (2025-07-30)
|
4
28
|
|
5
29
|
Full Changelog: [v0.15.0...v0.16.0](https://github.com/openai/openai-ruby/compare/v0.15.0...v0.16.0)
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
15
15
|
<!-- x-release-please-start-version -->
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
gem "openai", "~> 0.
|
18
|
+
gem "openai", "~> 0.17.0"
|
19
19
|
```
|
20
20
|
|
21
21
|
<!-- x-release-please-end -->
|
@@ -30,10 +30,7 @@ openai = OpenAI::Client.new(
|
|
30
30
|
api_key: ENV["OPENAI_API_KEY"] # This is the default and can be omitted
|
31
31
|
)
|
32
32
|
|
33
|
-
chat_completion = openai.chat.completions.create(
|
34
|
-
messages: [{role: "user", content: "Say this is a test"}],
|
35
|
-
model: :"gpt-4.1"
|
36
|
-
)
|
33
|
+
chat_completion = openai.chat.completions.create(messages: [{role: "user", content: "Say this is a test"}], model: :"gpt-5")
|
37
34
|
|
38
35
|
puts(chat_completion)
|
39
36
|
```
|
@@ -45,7 +42,7 @@ We provide support for streaming responses using Server-Sent Events (SSE).
|
|
45
42
|
```ruby
|
46
43
|
stream = openai.responses.stream(
|
47
44
|
input: "Write a haiku about OpenAI.",
|
48
|
-
model: :"gpt-
|
45
|
+
model: :"gpt-5"
|
49
46
|
)
|
50
47
|
|
51
48
|
stream.each do |event|
|
@@ -343,7 +340,7 @@ openai = OpenAI::Client.new(
|
|
343
340
|
# Or, configure per-request:
|
344
341
|
openai.chat.completions.create(
|
345
342
|
messages: [{role: "user", content: "How can I get the name of the current day in JavaScript?"}],
|
346
|
-
model: :"gpt-
|
343
|
+
model: :"gpt-5",
|
347
344
|
request_options: {max_retries: 5}
|
348
345
|
)
|
349
346
|
```
|
@@ -361,7 +358,7 @@ openai = OpenAI::Client.new(
|
|
361
358
|
# Or, configure per-request:
|
362
359
|
openai.chat.completions.create(
|
363
360
|
messages: [{role: "user", content: "How can I list all files in a directory using Python?"}],
|
364
|
-
model: :"gpt-
|
361
|
+
model: :"gpt-5",
|
365
362
|
request_options: {timeout: 5}
|
366
363
|
)
|
367
364
|
```
|
@@ -396,7 +393,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
|
|
396
393
|
chat_completion =
|
397
394
|
openai.chat.completions.create(
|
398
395
|
messages: [{role: "user", content: "How can I get the name of the current day in JavaScript?"}],
|
399
|
-
model: :"gpt-
|
396
|
+
model: :"gpt-5",
|
400
397
|
request_options: {
|
401
398
|
extra_query: {my_query_parameter: value},
|
402
399
|
extra_body: {my_body_parameter: value},
|
@@ -444,7 +441,7 @@ You can provide typesafe request parameters like so:
|
|
444
441
|
```ruby
|
445
442
|
openai.chat.completions.create(
|
446
443
|
messages: [OpenAI::Chat::ChatCompletionUserMessageParam.new(content: "Say this is a test")],
|
447
|
-
model: :"gpt-
|
444
|
+
model: :"gpt-5"
|
448
445
|
)
|
449
446
|
```
|
450
447
|
|
@@ -452,15 +449,12 @@ Or, equivalently:
|
|
452
449
|
|
453
450
|
```ruby
|
454
451
|
# Hashes work, but are not typesafe:
|
455
|
-
openai.chat.completions.create(
|
456
|
-
messages: [{role: "user", content: "Say this is a test"}],
|
457
|
-
model: :"gpt-4.1"
|
458
|
-
)
|
452
|
+
openai.chat.completions.create(messages: [{role: "user", content: "Say this is a test"}], model: :"gpt-5")
|
459
453
|
|
460
454
|
# You can also splat a full Params class:
|
461
455
|
params = OpenAI::Chat::CompletionCreateParams.new(
|
462
456
|
messages: [OpenAI::Chat::ChatCompletionUserMessageParam.new(content: "Say this is a test")],
|
463
|
-
model: :"gpt-
|
457
|
+
model: :"gpt-5"
|
464
458
|
)
|
465
459
|
openai.chat.completions.create(**params)
|
466
460
|
```
|
@@ -470,11 +464,11 @@ openai.chat.completions.create(**params)
|
|
470
464
|
Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
|
471
465
|
|
472
466
|
```ruby
|
473
|
-
# :
|
474
|
-
puts(OpenAI::ReasoningEffort::
|
467
|
+
# :minimal
|
468
|
+
puts(OpenAI::ReasoningEffort::MINIMAL)
|
475
469
|
|
476
470
|
# Revealed type: `T.all(OpenAI::ReasoningEffort, Symbol)`
|
477
|
-
T.reveal_type(OpenAI::ReasoningEffort::
|
471
|
+
T.reveal_type(OpenAI::ReasoningEffort::MINIMAL)
|
478
472
|
```
|
479
473
|
|
480
474
|
Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
|
@@ -482,13 +476,13 @@ Enum parameters have a "relaxed" type, so you can either pass in enum constants
|
|
482
476
|
```ruby
|
483
477
|
# Using the enum constants preserves the tagged type information:
|
484
478
|
openai.chat.completions.create(
|
485
|
-
reasoning_effort: OpenAI::ReasoningEffort::
|
479
|
+
reasoning_effort: OpenAI::ReasoningEffort::MINIMAL,
|
486
480
|
# …
|
487
481
|
)
|
488
482
|
|
489
483
|
# Literal values are also permissible:
|
490
484
|
openai.chat.completions.create(
|
491
|
-
reasoning_effort: :
|
485
|
+
reasoning_effort: :minimal,
|
492
486
|
# …
|
493
487
|
)
|
494
488
|
```
|
@@ -365,7 +365,7 @@ module OpenAI
|
|
365
365
|
#
|
366
366
|
# @raise [OpenAI::Errors::APIError]
|
367
367
|
# @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
|
368
|
-
|
368
|
+
def send_request(request, redirect_count:, retry_count:, send_retry_header:)
|
369
369
|
url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
|
370
370
|
input = {**request.except(:timeout), deadline: OpenAI::Internal::Util.monotonic_secs + timeout}
|
371
371
|
|
@@ -19,11 +19,11 @@ module OpenAI
|
|
19
19
|
# @example
|
20
20
|
# # `chat_model` is a `OpenAI::ChatModel`
|
21
21
|
# case chat_model
|
22
|
-
# when OpenAI::ChatModel::
|
22
|
+
# when OpenAI::ChatModel::GPT_5
|
23
23
|
# # ...
|
24
|
-
# when OpenAI::ChatModel::
|
24
|
+
# when OpenAI::ChatModel::GPT_5_MINI
|
25
25
|
# # ...
|
26
|
-
# when OpenAI::ChatModel::
|
26
|
+
# when OpenAI::ChatModel::GPT_5_NANO
|
27
27
|
# # ...
|
28
28
|
# else
|
29
29
|
# puts(chat_model)
|
@@ -31,11 +31,11 @@ module OpenAI
|
|
31
31
|
#
|
32
32
|
# @example
|
33
33
|
# case chat_model
|
34
|
-
# in :"gpt-
|
34
|
+
# in :"gpt-5"
|
35
35
|
# # ...
|
36
|
-
# in :"gpt-
|
36
|
+
# in :"gpt-5-mini"
|
37
37
|
# # ...
|
38
|
-
# in :"gpt-
|
38
|
+
# in :"gpt-5-nano"
|
39
39
|
# # ...
|
40
40
|
# else
|
41
41
|
# puts(chat_model)
|
@@ -6,28 +6,24 @@ module OpenAI
|
|
6
6
|
# @api private
|
7
7
|
#
|
8
8
|
# @example
|
9
|
-
# # `
|
10
|
-
# case
|
11
|
-
# when OpenAI::
|
12
|
-
# puts(
|
13
|
-
# when OpenAI::
|
14
|
-
# puts(
|
15
|
-
# when OpenAI::Chat::ChatCompletionContentPartInputAudio
|
16
|
-
# puts(chat_completion_content_part.input_audio)
|
9
|
+
# # `custom_tool_input_format` is a `OpenAI::CustomToolInputFormat`
|
10
|
+
# case custom_tool_input_format
|
11
|
+
# when OpenAI::CustomToolInputFormat::Text
|
12
|
+
# puts(custom_tool_input_format.type)
|
13
|
+
# when OpenAI::CustomToolInputFormat::Grammar
|
14
|
+
# puts(custom_tool_input_format.definition)
|
17
15
|
# else
|
18
|
-
# puts(
|
16
|
+
# puts(custom_tool_input_format)
|
19
17
|
# end
|
20
18
|
#
|
21
19
|
# @example
|
22
|
-
# case
|
23
|
-
# in {type: :text
|
24
|
-
#
|
25
|
-
# in {type: :
|
26
|
-
# puts(
|
27
|
-
# in {type: :input_audio, input_audio: input_audio}
|
28
|
-
# puts(input_audio)
|
20
|
+
# case custom_tool_input_format
|
21
|
+
# in {type: :text}
|
22
|
+
# # ...
|
23
|
+
# in {type: :grammar, definition: definition, syntax: syntax}
|
24
|
+
# puts(definition)
|
29
25
|
# else
|
30
|
-
# puts(
|
26
|
+
# puts(custom_tool_input_format)
|
31
27
|
# end
|
32
28
|
module Union
|
33
29
|
include OpenAI::Internal::Type::Converter
|
@@ -49,12 +49,11 @@ module OpenAI
|
|
49
49
|
optional :name, String, nil?: true
|
50
50
|
|
51
51
|
# @!attribute reasoning_effort
|
52
|
-
# **o-series models only**
|
53
|
-
#
|
54
52
|
# Constrains effort on reasoning for
|
55
53
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
56
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
57
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
54
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
55
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
56
|
+
# response.
|
58
57
|
#
|
59
58
|
# @return [Symbol, OpenAI::Models::ReasoningEffort, nil]
|
60
59
|
optional :reasoning_effort, enum: -> { OpenAI::ReasoningEffort }, nil?: true
|
@@ -133,7 +132,7 @@ module OpenAI
|
|
133
132
|
#
|
134
133
|
# @param name [String, nil] The name of the assistant. The maximum length is 256 characters.
|
135
134
|
#
|
136
|
-
# @param reasoning_effort [Symbol, OpenAI::Models::ReasoningEffort, nil]
|
135
|
+
# @param reasoning_effort [Symbol, OpenAI::Models::ReasoningEffort, nil] Constrains effort on reasoning for
|
137
136
|
#
|
138
137
|
# @param response_format [Symbol, :auto, OpenAI::Models::ResponseFormatText, OpenAI::Models::ResponseFormatJSONObject, OpenAI::Models::ResponseFormatJSONSchema, nil] Specifies the format that the model must output. Compatible with [GPT-4o](https:
|
139
138
|
#
|
@@ -49,12 +49,11 @@ module OpenAI
|
|
49
49
|
optional :name, String, nil?: true
|
50
50
|
|
51
51
|
# @!attribute reasoning_effort
|
52
|
-
# **o-series models only**
|
53
|
-
#
|
54
52
|
# Constrains effort on reasoning for
|
55
53
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
56
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
57
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
54
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
55
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
56
|
+
# response.
|
58
57
|
#
|
59
58
|
# @return [Symbol, OpenAI::Models::ReasoningEffort, nil]
|
60
59
|
optional :reasoning_effort, enum: -> { OpenAI::ReasoningEffort }, nil?: true
|
@@ -133,7 +132,7 @@ module OpenAI
|
|
133
132
|
#
|
134
133
|
# @param name [String, nil] The name of the assistant. The maximum length is 256 characters.
|
135
134
|
#
|
136
|
-
# @param reasoning_effort [Symbol, OpenAI::Models::ReasoningEffort, nil]
|
135
|
+
# @param reasoning_effort [Symbol, OpenAI::Models::ReasoningEffort, nil] Constrains effort on reasoning for
|
137
136
|
#
|
138
137
|
# @param response_format [Symbol, :auto, OpenAI::Models::ResponseFormatText, OpenAI::Models::ResponseFormatJSONObject, OpenAI::Models::ResponseFormatJSONSchema, nil] Specifies the format that the model must output. Compatible with [GPT-4o](https:
|
139
138
|
#
|
@@ -157,6 +156,18 @@ module OpenAI
|
|
157
156
|
|
158
157
|
variant String
|
159
158
|
|
159
|
+
variant const: -> { OpenAI::Models::Beta::AssistantUpdateParams::Model::GPT_5 }
|
160
|
+
|
161
|
+
variant const: -> { OpenAI::Models::Beta::AssistantUpdateParams::Model::GPT_5_MINI }
|
162
|
+
|
163
|
+
variant const: -> { OpenAI::Models::Beta::AssistantUpdateParams::Model::GPT_5_NANO }
|
164
|
+
|
165
|
+
variant const: -> { OpenAI::Models::Beta::AssistantUpdateParams::Model::GPT_5_2025_08_07 }
|
166
|
+
|
167
|
+
variant const: -> { OpenAI::Models::Beta::AssistantUpdateParams::Model::GPT_5_MINI_2025_08_07 }
|
168
|
+
|
169
|
+
variant const: -> { OpenAI::Models::Beta::AssistantUpdateParams::Model::GPT_5_NANO_2025_08_07 }
|
170
|
+
|
160
171
|
variant const: -> { OpenAI::Models::Beta::AssistantUpdateParams::Model::GPT_4_1 }
|
161
172
|
|
162
173
|
variant const: -> { OpenAI::Models::Beta::AssistantUpdateParams::Model::GPT_4_1_MINI }
|
@@ -238,6 +249,12 @@ module OpenAI
|
|
238
249
|
|
239
250
|
# @!group
|
240
251
|
|
252
|
+
GPT_5 = :"gpt-5"
|
253
|
+
GPT_5_MINI = :"gpt-5-mini"
|
254
|
+
GPT_5_NANO = :"gpt-5-nano"
|
255
|
+
GPT_5_2025_08_07 = :"gpt-5-2025-08-07"
|
256
|
+
GPT_5_MINI_2025_08_07 = :"gpt-5-mini-2025-08-07"
|
257
|
+
GPT_5_NANO_2025_08_07 = :"gpt-5-nano-2025-08-07"
|
241
258
|
GPT_4_1 = :"gpt-4.1"
|
242
259
|
GPT_4_1_MINI = :"gpt-4.1-mini"
|
243
260
|
GPT_4_1_NANO = :"gpt-4.1-nano"
|
@@ -107,12 +107,11 @@ module OpenAI
|
|
107
107
|
optional :parallel_tool_calls, OpenAI::Internal::Type::Boolean
|
108
108
|
|
109
109
|
# @!attribute reasoning_effort
|
110
|
-
# **o-series models only**
|
111
|
-
#
|
112
110
|
# Constrains effort on reasoning for
|
113
111
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
114
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
115
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
112
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
113
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
114
|
+
# response.
|
116
115
|
#
|
117
116
|
# @return [Symbol, OpenAI::Models::ReasoningEffort, nil]
|
118
117
|
optional :reasoning_effort, enum: -> { OpenAI::ReasoningEffort }, nil?: true
|
@@ -216,7 +215,7 @@ module OpenAI
|
|
216
215
|
#
|
217
216
|
# @param parallel_tool_calls [Boolean] Whether to enable [parallel function calling](https://platform.openai.com/docs/g
|
218
217
|
#
|
219
|
-
# @param reasoning_effort [Symbol, OpenAI::Models::ReasoningEffort, nil]
|
218
|
+
# @param reasoning_effort [Symbol, OpenAI::Models::ReasoningEffort, nil] Constrains effort on reasoning for
|
220
219
|
#
|
221
220
|
# @param response_format [Symbol, :auto, OpenAI::Models::ResponseFormatText, OpenAI::Models::ResponseFormatJSONObject, OpenAI::Models::ResponseFormatJSONSchema, nil] Specifies the format that the model must output. Compatible with [GPT-4o](https:
|
222
221
|
#
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Chat
|
6
|
+
class ChatCompletionAllowedToolChoice < OpenAI::Internal::Type::BaseModel
|
7
|
+
# @!attribute allowed_tools
|
8
|
+
# Constrains the tools available to the model to a pre-defined set.
|
9
|
+
#
|
10
|
+
# @return [OpenAI::Models::Chat::ChatCompletionAllowedTools]
|
11
|
+
required :allowed_tools, -> { OpenAI::Chat::ChatCompletionAllowedTools }
|
12
|
+
|
13
|
+
# @!attribute type
|
14
|
+
# Allowed tool configuration type. Always `allowed_tools`.
|
15
|
+
#
|
16
|
+
# @return [Symbol, :allowed_tools]
|
17
|
+
required :type, const: :allowed_tools
|
18
|
+
|
19
|
+
# @!method initialize(allowed_tools:, type: :allowed_tools)
|
20
|
+
# Some parameter documentations has been truncated, see
|
21
|
+
# {OpenAI::Models::Chat::ChatCompletionAllowedToolChoice} for more details.
|
22
|
+
#
|
23
|
+
# Constrains the tools available to the model to a pre-defined set.
|
24
|
+
#
|
25
|
+
# @param allowed_tools [OpenAI::Models::Chat::ChatCompletionAllowedTools] Constrains the tools available to the model to a pre-defined set.
|
26
|
+
#
|
27
|
+
# @param type [Symbol, :allowed_tools] Allowed tool configuration type. Always `allowed_tools`.
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
ChatCompletionAllowedToolChoice = Chat::ChatCompletionAllowedToolChoice
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Chat
|
6
|
+
class ChatCompletionAllowedTools < OpenAI::Internal::Type::BaseModel
|
7
|
+
# @!attribute mode
|
8
|
+
# Constrains the tools available to the model to a pre-defined set.
|
9
|
+
#
|
10
|
+
# `auto` allows the model to pick from among the allowed tools and generate a
|
11
|
+
# message.
|
12
|
+
#
|
13
|
+
# `required` requires the model to call one or more of the allowed tools.
|
14
|
+
#
|
15
|
+
# @return [Symbol, OpenAI::Models::Chat::ChatCompletionAllowedTools::Mode]
|
16
|
+
required :mode, enum: -> { OpenAI::Chat::ChatCompletionAllowedTools::Mode }
|
17
|
+
|
18
|
+
# @!attribute tools
|
19
|
+
# A list of tool definitions that the model should be allowed to call.
|
20
|
+
#
|
21
|
+
# For the Chat Completions API, the list of tool definitions might look like:
|
22
|
+
#
|
23
|
+
# ```json
|
24
|
+
# [
|
25
|
+
# { "type": "function", "function": { "name": "get_weather" } },
|
26
|
+
# { "type": "function", "function": { "name": "get_time" } }
|
27
|
+
# ]
|
28
|
+
# ```
|
29
|
+
#
|
30
|
+
# @return [Array<Hash{Symbol=>Object}>]
|
31
|
+
required :tools,
|
32
|
+
OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown]]
|
33
|
+
|
34
|
+
# @!method initialize(mode:, tools:)
|
35
|
+
# Some parameter documentations has been truncated, see
|
36
|
+
# {OpenAI::Models::Chat::ChatCompletionAllowedTools} for more details.
|
37
|
+
#
|
38
|
+
# Constrains the tools available to the model to a pre-defined set.
|
39
|
+
#
|
40
|
+
# @param mode [Symbol, OpenAI::Models::Chat::ChatCompletionAllowedTools::Mode] Constrains the tools available to the model to a pre-defined set.
|
41
|
+
#
|
42
|
+
# @param tools [Array<Hash{Symbol=>Object}>] A list of tool definitions that the model should be allowed to call.
|
43
|
+
|
44
|
+
# Constrains the tools available to the model to a pre-defined set.
|
45
|
+
#
|
46
|
+
# `auto` allows the model to pick from among the allowed tools and generate a
|
47
|
+
# message.
|
48
|
+
#
|
49
|
+
# `required` requires the model to call one or more of the allowed tools.
|
50
|
+
#
|
51
|
+
# @see OpenAI::Models::Chat::ChatCompletionAllowedTools#mode
|
52
|
+
module Mode
|
53
|
+
extend OpenAI::Internal::Type::Enum
|
54
|
+
|
55
|
+
AUTO = :auto
|
56
|
+
REQUIRED = :required
|
57
|
+
|
58
|
+
# @!method self.values
|
59
|
+
# @return [Array<Symbol>]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -55,11 +55,9 @@ module OpenAI
|
|
55
55
|
# @!attribute tool_calls
|
56
56
|
# The tool calls generated by the model, such as function calls.
|
57
57
|
#
|
58
|
-
# @return [Array<OpenAI::Models::Chat::
|
58
|
+
# @return [Array<OpenAI::Models::Chat::ChatCompletionMessageFunctionToolCall, OpenAI::Models::Chat::ChatCompletionMessageCustomToolCall>, nil]
|
59
59
|
optional :tool_calls,
|
60
|
-
-> {
|
61
|
-
OpenAI::Internal::Type::ArrayOf[OpenAI::Chat::ChatCompletionMessageToolCall]
|
62
|
-
}
|
60
|
+
-> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Chat::ChatCompletionMessageToolCall] }
|
63
61
|
|
64
62
|
# @!method initialize(audio: nil, content: nil, function_call: nil, name: nil, refusal: nil, tool_calls: nil, role: :assistant)
|
65
63
|
# Some parameter documentations has been truncated, see
|
@@ -77,7 +75,7 @@ module OpenAI
|
|
77
75
|
#
|
78
76
|
# @param refusal [String, nil] The refusal message by the assistant.
|
79
77
|
#
|
80
|
-
# @param tool_calls [Array<OpenAI::Models::Chat::
|
78
|
+
# @param tool_calls [Array<OpenAI::Models::Chat::ChatCompletionMessageFunctionToolCall, OpenAI::Models::Chat::ChatCompletionMessageCustomToolCall>] The tool calls generated by the model, such as function calls.
|
81
79
|
#
|
82
80
|
# @param role [Symbol, :assistant] The role of the messages author, in this case `assistant`.
|
83
81
|
|
@@ -0,0 +1,163 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Chat
|
6
|
+
class ChatCompletionCustomTool < OpenAI::Internal::Type::BaseModel
|
7
|
+
# @!attribute custom
|
8
|
+
# Properties of the custom tool.
|
9
|
+
#
|
10
|
+
# @return [OpenAI::Models::Chat::ChatCompletionCustomTool::Custom]
|
11
|
+
required :custom, -> { OpenAI::Chat::ChatCompletionCustomTool::Custom }
|
12
|
+
|
13
|
+
# @!attribute type
|
14
|
+
# The type of the custom tool. Always `custom`.
|
15
|
+
#
|
16
|
+
# @return [Symbol, :custom]
|
17
|
+
required :type, const: :custom
|
18
|
+
|
19
|
+
# @!method initialize(custom:, type: :custom)
|
20
|
+
# Some parameter documentations has been truncated, see
|
21
|
+
# {OpenAI::Models::Chat::ChatCompletionCustomTool} for more details.
|
22
|
+
#
|
23
|
+
# A custom tool that processes input using a specified format.
|
24
|
+
#
|
25
|
+
# @param custom [OpenAI::Models::Chat::ChatCompletionCustomTool::Custom] Properties of the custom tool.
|
26
|
+
#
|
27
|
+
# @param type [Symbol, :custom] The type of the custom tool. Always `custom`.
|
28
|
+
|
29
|
+
# @see OpenAI::Models::Chat::ChatCompletionCustomTool#custom
|
30
|
+
class Custom < OpenAI::Internal::Type::BaseModel
|
31
|
+
# @!attribute name
|
32
|
+
# The name of the custom tool, used to identify it in tool calls.
|
33
|
+
#
|
34
|
+
# @return [String]
|
35
|
+
required :name, String
|
36
|
+
|
37
|
+
# @!attribute description
|
38
|
+
# Optional description of the custom tool, used to provide more context.
|
39
|
+
#
|
40
|
+
# @return [String, nil]
|
41
|
+
optional :description, String
|
42
|
+
|
43
|
+
# @!attribute format_
|
44
|
+
# The input format for the custom tool. Default is unconstrained text.
|
45
|
+
#
|
46
|
+
# @return [OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Text, OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Grammar, nil]
|
47
|
+
optional :format_,
|
48
|
+
union: -> {
|
49
|
+
OpenAI::Chat::ChatCompletionCustomTool::Custom::Format
|
50
|
+
},
|
51
|
+
api_name: :format
|
52
|
+
|
53
|
+
# @!method initialize(name:, description: nil, format_: nil)
|
54
|
+
# Some parameter documentations has been truncated, see
|
55
|
+
# {OpenAI::Models::Chat::ChatCompletionCustomTool::Custom} for more details.
|
56
|
+
#
|
57
|
+
# Properties of the custom tool.
|
58
|
+
#
|
59
|
+
# @param name [String] The name of the custom tool, used to identify it in tool calls.
|
60
|
+
#
|
61
|
+
# @param description [String] Optional description of the custom tool, used to provide more context.
|
62
|
+
#
|
63
|
+
# @param format_ [OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Text, OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Grammar] The input format for the custom tool. Default is unconstrained text.
|
64
|
+
|
65
|
+
# The input format for the custom tool. Default is unconstrained text.
|
66
|
+
#
|
67
|
+
# @see OpenAI::Models::Chat::ChatCompletionCustomTool::Custom#format_
|
68
|
+
module Format
|
69
|
+
extend OpenAI::Internal::Type::Union
|
70
|
+
|
71
|
+
discriminator :type
|
72
|
+
|
73
|
+
# Unconstrained free-form text.
|
74
|
+
variant :text, -> { OpenAI::Chat::ChatCompletionCustomTool::Custom::Format::Text }
|
75
|
+
|
76
|
+
# A grammar defined by the user.
|
77
|
+
variant :grammar, -> { OpenAI::Chat::ChatCompletionCustomTool::Custom::Format::Grammar }
|
78
|
+
|
79
|
+
class Text < OpenAI::Internal::Type::BaseModel
|
80
|
+
# @!attribute type
|
81
|
+
# Unconstrained text format. Always `text`.
|
82
|
+
#
|
83
|
+
# @return [Symbol, :text]
|
84
|
+
required :type, const: :text
|
85
|
+
|
86
|
+
# @!method initialize(type: :text)
|
87
|
+
# Unconstrained free-form text.
|
88
|
+
#
|
89
|
+
# @param type [Symbol, :text] Unconstrained text format. Always `text`.
|
90
|
+
end
|
91
|
+
|
92
|
+
class Grammar < OpenAI::Internal::Type::BaseModel
|
93
|
+
# @!attribute grammar
|
94
|
+
# Your chosen grammar.
|
95
|
+
#
|
96
|
+
# @return [OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Grammar::Grammar]
|
97
|
+
required :grammar,
|
98
|
+
-> {
|
99
|
+
OpenAI::Chat::ChatCompletionCustomTool::Custom::Format::Grammar::Grammar
|
100
|
+
}
|
101
|
+
|
102
|
+
# @!attribute type
|
103
|
+
# Grammar format. Always `grammar`.
|
104
|
+
#
|
105
|
+
# @return [Symbol, :grammar]
|
106
|
+
required :type, const: :grammar
|
107
|
+
|
108
|
+
# @!method initialize(grammar:, type: :grammar)
|
109
|
+
# A grammar defined by the user.
|
110
|
+
#
|
111
|
+
# @param grammar [OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Grammar::Grammar] Your chosen grammar.
|
112
|
+
#
|
113
|
+
# @param type [Symbol, :grammar] Grammar format. Always `grammar`.
|
114
|
+
|
115
|
+
# @see OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Grammar#grammar
|
116
|
+
class Grammar < OpenAI::Internal::Type::BaseModel
|
117
|
+
# @!attribute definition
|
118
|
+
# The grammar definition.
|
119
|
+
#
|
120
|
+
# @return [String]
|
121
|
+
required :definition, String
|
122
|
+
|
123
|
+
# @!attribute syntax
|
124
|
+
# The syntax of the grammar definition. One of `lark` or `regex`.
|
125
|
+
#
|
126
|
+
# @return [Symbol, OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Grammar::Grammar::Syntax]
|
127
|
+
required :syntax,
|
128
|
+
enum: -> {
|
129
|
+
OpenAI::Chat::ChatCompletionCustomTool::Custom::Format::Grammar::Grammar::Syntax
|
130
|
+
}
|
131
|
+
|
132
|
+
# @!method initialize(definition:, syntax:)
|
133
|
+
# Your chosen grammar.
|
134
|
+
#
|
135
|
+
# @param definition [String] The grammar definition.
|
136
|
+
#
|
137
|
+
# @param syntax [Symbol, OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Grammar::Grammar::Syntax] The syntax of the grammar definition. One of `lark` or `regex`.
|
138
|
+
|
139
|
+
# The syntax of the grammar definition. One of `lark` or `regex`.
|
140
|
+
#
|
141
|
+
# @see OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Grammar::Grammar#syntax
|
142
|
+
module Syntax
|
143
|
+
extend OpenAI::Internal::Type::Enum
|
144
|
+
|
145
|
+
LARK = :lark
|
146
|
+
REGEX = :regex
|
147
|
+
|
148
|
+
# @!method self.values
|
149
|
+
# @return [Array<Symbol>]
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# @!method self.variants
|
155
|
+
# @return [Array(OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Text, OpenAI::Models::Chat::ChatCompletionCustomTool::Custom::Format::Grammar)]
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
ChatCompletionCustomTool = Chat::ChatCompletionCustomTool
|
162
|
+
end
|
163
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Chat
|
6
|
+
class ChatCompletionFunctionTool < OpenAI::Internal::Type::BaseModel
|
7
|
+
# @!attribute function
|
8
|
+
#
|
9
|
+
# @return [OpenAI::Models::FunctionDefinition]
|
10
|
+
required :function, -> { OpenAI::FunctionDefinition }
|
11
|
+
|
12
|
+
# @!attribute type
|
13
|
+
# The type of the tool. Currently, only `function` is supported.
|
14
|
+
#
|
15
|
+
# @return [Symbol, :function]
|
16
|
+
required :type, const: :function
|
17
|
+
|
18
|
+
# @!method initialize(function:, type: :function)
|
19
|
+
# A function tool that can be used to generate a response.
|
20
|
+
#
|
21
|
+
# @param function [OpenAI::Models::FunctionDefinition]
|
22
|
+
#
|
23
|
+
# @param type [Symbol, :function] The type of the tool. Currently, only `function` is supported.
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
ChatCompletionFunctionTool = Chat::ChatCompletionFunctionTool
|
28
|
+
end
|
29
|
+
end
|