openai 0.65.0 → 0.66.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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/openai/models/chat/chat_completion.rb +341 -3
  5. data/lib/openai/models/chat/chat_completion_chunk.rb +341 -1
  6. data/lib/openai/models/chat/completion_create_params.rb +26 -1
  7. data/lib/openai/models/responses/response.rb +275 -1
  8. data/lib/openai/models/responses/response_create_params.rb +26 -1
  9. data/lib/openai/models/responses/responses_client_event.rb +27 -1
  10. data/lib/openai/resources/chat/completions.rb +6 -2
  11. data/lib/openai/resources/responses.rb +6 -2
  12. data/lib/openai/version.rb +1 -1
  13. data/rbi/openai/models/chat/chat_completion.rbi +620 -3
  14. data/rbi/openai/models/chat/chat_completion_chunk.rbi +621 -0
  15. data/rbi/openai/models/chat/completion_create_params.rbi +52 -0
  16. data/rbi/openai/models/responses/response.rbi +485 -0
  17. data/rbi/openai/models/responses/response_create_params.rbi +54 -0
  18. data/rbi/openai/models/responses/responses_client_event.rbi +54 -0
  19. data/rbi/openai/resources/chat/completions.rbi +12 -0
  20. data/rbi/openai/resources/responses.rbi +12 -0
  21. data/sig/openai/models/chat/chat_completion.rbs +243 -0
  22. data/sig/openai/models/chat/chat_completion_chunk.rbs +243 -0
  23. data/sig/openai/models/chat/completion_create_params.rbs +15 -0
  24. data/sig/openai/models/responses/response.rbs +189 -0
  25. data/sig/openai/models/responses/response_create_params.rbs +15 -0
  26. data/sig/openai/models/responses/responses_client_event.rbs +15 -0
  27. data/sig/openai/resources/chat/completions.rbs +2 -0
  28. data/sig/openai/resources/responses.rbs +2 -0
  29. metadata +2 -2
@@ -175,6 +175,13 @@ module OpenAI
175
175
  # @return [Integer, nil]
176
176
  optional :max_tool_calls, Integer, nil?: true
177
177
 
178
+ # @!attribute moderation
179
+ # Moderation results for the response input and output, if moderated completions
180
+ # were requested.
181
+ #
182
+ # @return [OpenAI::Models::Responses::Response::Moderation, nil]
183
+ optional :moderation, -> { OpenAI::Responses::Response::Moderation }, nil?: true
184
+
178
185
  # @!attribute previous_response_id
179
186
  # The unique ID of the previous response to the model. Use this to create
180
187
  # multi-turn conversations. Learn more about
@@ -335,7 +342,7 @@ module OpenAI
335
342
  texts.join
336
343
  end
337
344
 
338
- # @!method initialize(id:, created_at:, error:, incomplete_details:, instructions:, metadata:, model:, output:, parallel_tool_calls:, temperature:, tool_choice:, tools:, top_p:, background: nil, completed_at: nil, conversation: nil, max_output_tokens: nil, max_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, status: nil, text: nil, top_logprobs: nil, truncation: nil, usage: nil, user: nil, object: :response)
345
+ # @!method initialize(id:, created_at:, error:, incomplete_details:, instructions:, metadata:, model:, output:, parallel_tool_calls:, temperature:, tool_choice:, tools:, top_p:, background: nil, completed_at: nil, conversation: nil, max_output_tokens: nil, max_tool_calls: nil, moderation: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, status: nil, text: nil, top_logprobs: nil, truncation: nil, usage: nil, user: nil, object: :response)
339
346
  # Some parameter documentations has been truncated, see
340
347
  # {OpenAI::Models::Responses::Response} for more details.
341
348
  #
@@ -375,6 +382,8 @@ module OpenAI
375
382
  #
376
383
  # @param max_tool_calls [Integer, nil] The maximum number of total calls to built-in tools that can be processed in a r
377
384
  #
385
+ # @param moderation [OpenAI::Models::Responses::Response::Moderation, nil] Moderation results for the response input and output, if moderated completions w
386
+ #
378
387
  # @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to
379
388
  #
380
389
  # @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables.
@@ -515,6 +524,271 @@ module OpenAI
515
524
  # @param id [String] The unique ID of the conversation that this response was associated with.
516
525
  end
517
526
 
527
+ # @see OpenAI::Models::Responses::Response#moderation
528
+ class Moderation < OpenAI::Internal::Type::BaseModel
529
+ # @!attribute input
530
+ # Moderation for the response input.
531
+ #
532
+ # @return [OpenAI::Models::Responses::Response::Moderation::Input::ModerationResult, OpenAI::Models::Responses::Response::Moderation::Input::Error]
533
+ required :input, union: -> { OpenAI::Responses::Response::Moderation::Input }
534
+
535
+ # @!attribute output
536
+ # Moderation for the response output.
537
+ #
538
+ # @return [OpenAI::Models::Responses::Response::Moderation::Output::ModerationResult, OpenAI::Models::Responses::Response::Moderation::Output::Error]
539
+ required :output, union: -> { OpenAI::Responses::Response::Moderation::Output }
540
+
541
+ # @!method initialize(input:, output:)
542
+ # Moderation results for the response input and output, if moderated completions
543
+ # were requested.
544
+ #
545
+ # @param input [OpenAI::Models::Responses::Response::Moderation::Input::ModerationResult, OpenAI::Models::Responses::Response::Moderation::Input::Error] Moderation for the response input.
546
+ #
547
+ # @param output [OpenAI::Models::Responses::Response::Moderation::Output::ModerationResult, OpenAI::Models::Responses::Response::Moderation::Output::Error] Moderation for the response output.
548
+
549
+ # Moderation for the response input.
550
+ #
551
+ # @see OpenAI::Models::Responses::Response::Moderation#input
552
+ module Input
553
+ extend OpenAI::Internal::Type::Union
554
+
555
+ discriminator :type
556
+
557
+ # A moderation result produced for the response input or output.
558
+ variant :moderation_result, -> { OpenAI::Responses::Response::Moderation::Input::ModerationResult }
559
+
560
+ # An error produced while attempting moderation for the response input or output.
561
+ variant :error, -> { OpenAI::Responses::Response::Moderation::Input::Error }
562
+
563
+ class ModerationResult < OpenAI::Internal::Type::BaseModel
564
+ # @!attribute categories
565
+ # A dictionary of moderation categories to booleans, True if the input is flagged
566
+ # under this category.
567
+ #
568
+ # @return [Hash{Symbol=>Boolean}]
569
+ required :categories, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Boolean]
570
+
571
+ # @!attribute category_applied_input_types
572
+ # Which modalities of input are reflected by the score for each category.
573
+ #
574
+ # @return [Hash{Symbol=>Array<Symbol, OpenAI::Models::Responses::Response::Moderation::Input::ModerationResult::CategoryAppliedInputType>}]
575
+ required :category_applied_input_types,
576
+ -> do
577
+ OpenAI::Internal::Type::HashOf[
578
+ OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Responses::Response::Moderation::Input::ModerationResult::CategoryAppliedInputType]
579
+ ]
580
+ end
581
+
582
+ # @!attribute category_scores
583
+ # A dictionary of moderation categories to scores.
584
+ #
585
+ # @return [Hash{Symbol=>Float}]
586
+ required :category_scores, OpenAI::Internal::Type::HashOf[Float]
587
+
588
+ # @!attribute flagged
589
+ # A boolean indicating whether the content was flagged by any category.
590
+ #
591
+ # @return [Boolean]
592
+ required :flagged, OpenAI::Internal::Type::Boolean
593
+
594
+ # @!attribute model
595
+ # The moderation model that produced this result.
596
+ #
597
+ # @return [String]
598
+ required :model, String
599
+
600
+ # @!attribute type
601
+ # The object type, which was always `moderation_result` for successful moderation
602
+ # results.
603
+ #
604
+ # @return [Symbol, :moderation_result]
605
+ required :type, const: :moderation_result
606
+
607
+ # @!method initialize(categories:, category_applied_input_types:, category_scores:, flagged:, model:, type: :moderation_result)
608
+ # Some parameter documentations has been truncated, see
609
+ # {OpenAI::Models::Responses::Response::Moderation::Input::ModerationResult} for
610
+ # more details.
611
+ #
612
+ # A moderation result produced for the response input or output.
613
+ #
614
+ # @param categories [Hash{Symbol=>Boolean}] A dictionary of moderation categories to booleans, True if the input is flagged
615
+ #
616
+ # @param category_applied_input_types [Hash{Symbol=>Array<Symbol, OpenAI::Models::Responses::Response::Moderation::Input::ModerationResult::CategoryAppliedInputType>}] Which modalities of input are reflected by the score for each category.
617
+ #
618
+ # @param category_scores [Hash{Symbol=>Float}] A dictionary of moderation categories to scores.
619
+ #
620
+ # @param flagged [Boolean] A boolean indicating whether the content was flagged by any category.
621
+ #
622
+ # @param model [String] The moderation model that produced this result.
623
+ #
624
+ # @param type [Symbol, :moderation_result] The object type, which was always `moderation_result` for successful moderation
625
+
626
+ module CategoryAppliedInputType
627
+ extend OpenAI::Internal::Type::Enum
628
+
629
+ TEXT = :text
630
+ IMAGE = :image
631
+
632
+ # @!method self.values
633
+ # @return [Array<Symbol>]
634
+ end
635
+ end
636
+
637
+ class Error < OpenAI::Internal::Type::BaseModel
638
+ # @!attribute code
639
+ # The error code.
640
+ #
641
+ # @return [String]
642
+ required :code, String
643
+
644
+ # @!attribute message
645
+ # The error message.
646
+ #
647
+ # @return [String]
648
+ required :message, String
649
+
650
+ # @!attribute type
651
+ # The object type, which was always `error` for moderation failures.
652
+ #
653
+ # @return [Symbol, :error]
654
+ required :type, const: :error
655
+
656
+ # @!method initialize(code:, message:, type: :error)
657
+ # An error produced while attempting moderation for the response input or output.
658
+ #
659
+ # @param code [String] The error code.
660
+ #
661
+ # @param message [String] The error message.
662
+ #
663
+ # @param type [Symbol, :error] The object type, which was always `error` for moderation failures.
664
+ end
665
+
666
+ # @!method self.variants
667
+ # @return [Array(OpenAI::Models::Responses::Response::Moderation::Input::ModerationResult, OpenAI::Models::Responses::Response::Moderation::Input::Error)]
668
+ end
669
+
670
+ # Moderation for the response output.
671
+ #
672
+ # @see OpenAI::Models::Responses::Response::Moderation#output
673
+ module Output
674
+ extend OpenAI::Internal::Type::Union
675
+
676
+ discriminator :type
677
+
678
+ # A moderation result produced for the response input or output.
679
+ variant :moderation_result, -> { OpenAI::Responses::Response::Moderation::Output::ModerationResult }
680
+
681
+ # An error produced while attempting moderation for the response input or output.
682
+ variant :error, -> { OpenAI::Responses::Response::Moderation::Output::Error }
683
+
684
+ class ModerationResult < OpenAI::Internal::Type::BaseModel
685
+ # @!attribute categories
686
+ # A dictionary of moderation categories to booleans, True if the input is flagged
687
+ # under this category.
688
+ #
689
+ # @return [Hash{Symbol=>Boolean}]
690
+ required :categories, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Boolean]
691
+
692
+ # @!attribute category_applied_input_types
693
+ # Which modalities of input are reflected by the score for each category.
694
+ #
695
+ # @return [Hash{Symbol=>Array<Symbol, OpenAI::Models::Responses::Response::Moderation::Output::ModerationResult::CategoryAppliedInputType>}]
696
+ required :category_applied_input_types,
697
+ -> do
698
+ OpenAI::Internal::Type::HashOf[
699
+ OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Responses::Response::Moderation::Output::ModerationResult::CategoryAppliedInputType]
700
+ ]
701
+ end
702
+
703
+ # @!attribute category_scores
704
+ # A dictionary of moderation categories to scores.
705
+ #
706
+ # @return [Hash{Symbol=>Float}]
707
+ required :category_scores, OpenAI::Internal::Type::HashOf[Float]
708
+
709
+ # @!attribute flagged
710
+ # A boolean indicating whether the content was flagged by any category.
711
+ #
712
+ # @return [Boolean]
713
+ required :flagged, OpenAI::Internal::Type::Boolean
714
+
715
+ # @!attribute model
716
+ # The moderation model that produced this result.
717
+ #
718
+ # @return [String]
719
+ required :model, String
720
+
721
+ # @!attribute type
722
+ # The object type, which was always `moderation_result` for successful moderation
723
+ # results.
724
+ #
725
+ # @return [Symbol, :moderation_result]
726
+ required :type, const: :moderation_result
727
+
728
+ # @!method initialize(categories:, category_applied_input_types:, category_scores:, flagged:, model:, type: :moderation_result)
729
+ # Some parameter documentations has been truncated, see
730
+ # {OpenAI::Models::Responses::Response::Moderation::Output::ModerationResult} for
731
+ # more details.
732
+ #
733
+ # A moderation result produced for the response input or output.
734
+ #
735
+ # @param categories [Hash{Symbol=>Boolean}] A dictionary of moderation categories to booleans, True if the input is flagged
736
+ #
737
+ # @param category_applied_input_types [Hash{Symbol=>Array<Symbol, OpenAI::Models::Responses::Response::Moderation::Output::ModerationResult::CategoryAppliedInputType>}] Which modalities of input are reflected by the score for each category.
738
+ #
739
+ # @param category_scores [Hash{Symbol=>Float}] A dictionary of moderation categories to scores.
740
+ #
741
+ # @param flagged [Boolean] A boolean indicating whether the content was flagged by any category.
742
+ #
743
+ # @param model [String] The moderation model that produced this result.
744
+ #
745
+ # @param type [Symbol, :moderation_result] The object type, which was always `moderation_result` for successful moderation
746
+
747
+ module CategoryAppliedInputType
748
+ extend OpenAI::Internal::Type::Enum
749
+
750
+ TEXT = :text
751
+ IMAGE = :image
752
+
753
+ # @!method self.values
754
+ # @return [Array<Symbol>]
755
+ end
756
+ end
757
+
758
+ class Error < OpenAI::Internal::Type::BaseModel
759
+ # @!attribute code
760
+ # The error code.
761
+ #
762
+ # @return [String]
763
+ required :code, String
764
+
765
+ # @!attribute message
766
+ # The error message.
767
+ #
768
+ # @return [String]
769
+ required :message, String
770
+
771
+ # @!attribute type
772
+ # The object type, which was always `error` for moderation failures.
773
+ #
774
+ # @return [Symbol, :error]
775
+ required :type, const: :error
776
+
777
+ # @!method initialize(code:, message:, type: :error)
778
+ # An error produced while attempting moderation for the response input or output.
779
+ #
780
+ # @param code [String] The error code.
781
+ #
782
+ # @param message [String] The error message.
783
+ #
784
+ # @param type [Symbol, :error] The object type, which was always `error` for moderation failures.
785
+ end
786
+
787
+ # @!method self.variants
788
+ # @return [Array(OpenAI::Models::Responses::Response::Moderation::Output::ModerationResult, OpenAI::Models::Responses::Response::Moderation::Output::Error)]
789
+ end
790
+ end
791
+
518
792
  # The retention policy for the prompt cache. Set to `24h` to enable extended
519
793
  # prompt caching, which keeps cached prefixes active for longer, up to a maximum
520
794
  # of 24 hours.
@@ -127,6 +127,12 @@ module OpenAI
127
127
  # @return [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel, nil]
128
128
  optional :model, union: -> { OpenAI::ResponsesModel }
129
129
 
130
+ # @!attribute moderation
131
+ # Configuration for running moderation on the input and output of this response.
132
+ #
133
+ # @return [OpenAI::Models::Responses::ResponseCreateParams::Moderation, nil]
134
+ optional :moderation, -> { OpenAI::Responses::ResponseCreateParams::Moderation }, nil?: true
135
+
130
136
  # @!attribute parallel_tool_calls
131
137
  # Whether to allow the model to run tool calls in parallel.
132
138
  #
@@ -328,7 +334,7 @@ module OpenAI
328
334
  # @return [String, nil]
329
335
  optional :user, String
330
336
 
331
- # @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
337
+ # @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
332
338
  # Some parameter documentations has been truncated, see
333
339
  # {OpenAI::Models::Responses::ResponseCreateParams} for more details.
334
340
  #
@@ -352,6 +358,8 @@ module OpenAI
352
358
  #
353
359
  # @param model [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel] Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI
354
360
  #
361
+ # @param moderation [OpenAI::Models::Responses::ResponseCreateParams::Moderation, nil] Configuration for running moderation on the input and output of this response.
362
+ #
355
363
  # @param parallel_tool_calls [Boolean, nil] Whether to allow the model to run tool calls in parallel.
356
364
  #
357
365
  # @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to
@@ -450,6 +458,23 @@ module OpenAI
450
458
  # @return [Array(String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference>)]
451
459
  end
452
460
 
461
+ class Moderation < OpenAI::Internal::Type::BaseModel
462
+ # @!attribute model
463
+ # The moderation model to use for moderated completions, e.g.
464
+ # 'omni-moderation-latest'.
465
+ #
466
+ # @return [String]
467
+ required :model, String
468
+
469
+ # @!method initialize(model:)
470
+ # Some parameter documentations has been truncated, see
471
+ # {OpenAI::Models::Responses::ResponseCreateParams::Moderation} for more details.
472
+ #
473
+ # Configuration for running moderation on the input and output of this response.
474
+ #
475
+ # @param model [String] The moderation model to use for moderated completions, e.g. 'omni-moderation-lat
476
+ end
477
+
453
478
  # The retention policy for the prompt cache. Set to `24h` to enable extended
454
479
  # prompt caching, which keeps cached prefixes active for longer, up to a maximum
455
480
  # of 24 hours.
@@ -127,6 +127,12 @@ module OpenAI
127
127
  # @return [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel, nil]
128
128
  optional :model, union: -> { OpenAI::ResponsesModel }
129
129
 
130
+ # @!attribute moderation
131
+ # Configuration for running moderation on the input and output of this response.
132
+ #
133
+ # @return [OpenAI::Models::Responses::ResponsesClientEvent::Moderation, nil]
134
+ optional :moderation, -> { OpenAI::Responses::ResponsesClientEvent::Moderation }, nil?: true
135
+
130
136
  # @!attribute parallel_tool_calls
131
137
  # Whether to allow the model to run tool calls in parallel.
132
138
  #
@@ -333,7 +339,7 @@ module OpenAI
333
339
  # @return [String, nil]
334
340
  optional :user, String
335
341
 
336
- # @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, type: :"response.create")
342
+ # @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, type: :"response.create")
337
343
  # Some parameter documentations has been truncated, see
338
344
  # {OpenAI::Models::Responses::ResponsesClientEvent} for more details.
339
345
  #
@@ -357,6 +363,8 @@ module OpenAI
357
363
  #
358
364
  # @param model [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel] Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI
359
365
  #
366
+ # @param moderation [OpenAI::Models::Responses::ResponsesClientEvent::Moderation, nil] Configuration for running moderation on the input and output of this response.
367
+ #
360
368
  # @param parallel_tool_calls [Boolean, nil] Whether to allow the model to run tool calls in parallel.
361
369
  #
362
370
  # @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to
@@ -461,6 +469,24 @@ module OpenAI
461
469
  # @return [Array(String, Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseInputItem::ToolSearchCall, OpenAI::Models::Responses::ResponseToolSearchOutputItemParam, OpenAI::Models::Responses::ResponseInputItem::AdditionalTools, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCompactionItemParam, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ShellCall, OpenAI::Models::Responses::ResponseInputItem::ShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCall, OpenAI::Models::Responses::ResponseInputItem::ApplyPatchCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::CompactionTrigger, OpenAI::Models::Responses::ResponseInputItem::ItemReference>)]
462
470
  end
463
471
 
472
+ # @see OpenAI::Models::Responses::ResponsesClientEvent#moderation
473
+ class Moderation < OpenAI::Internal::Type::BaseModel
474
+ # @!attribute model
475
+ # The moderation model to use for moderated completions, e.g.
476
+ # 'omni-moderation-latest'.
477
+ #
478
+ # @return [String]
479
+ required :model, String
480
+
481
+ # @!method initialize(model:)
482
+ # Some parameter documentations has been truncated, see
483
+ # {OpenAI::Models::Responses::ResponsesClientEvent::Moderation} for more details.
484
+ #
485
+ # Configuration for running moderation on the input and output of this response.
486
+ #
487
+ # @param model [String] The moderation model to use for moderated completions, e.g. 'omni-moderation-lat
488
+ end
489
+
464
490
  # The retention policy for the prompt cache. Set to `24h` to enable extended
465
491
  # prompt caching, which keeps cached prefixes active for longer, up to a maximum
466
492
  # of 24 hours.
@@ -37,7 +37,7 @@ module OpenAI
37
37
  # Returns a chat completion object, or a streamed sequence of chat completion
38
38
  # chunk objects if the request is streamed.
39
39
  #
40
- # @overload create(messages:, model:, audio: nil, frequency_penalty: nil, function_call: nil, functions: nil, logit_bias: nil, logprobs: nil, max_completion_tokens: nil, max_tokens: nil, metadata: nil, modalities: nil, n: nil, parallel_tool_calls: nil, prediction: nil, presence_penalty: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning_effort: nil, response_format: nil, safety_identifier: nil, seed: nil, service_tier: nil, stop: nil, store: nil, stream_options: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, user: nil, verbosity: nil, web_search_options: nil, request_options: {})
40
+ # @overload create(messages:, model:, audio: nil, frequency_penalty: nil, function_call: nil, functions: nil, logit_bias: nil, logprobs: nil, max_completion_tokens: nil, max_tokens: nil, metadata: nil, modalities: nil, moderation: nil, n: nil, parallel_tool_calls: nil, prediction: nil, presence_penalty: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning_effort: nil, response_format: nil, safety_identifier: nil, seed: nil, service_tier: nil, stop: nil, store: nil, stream_options: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, user: nil, verbosity: nil, web_search_options: nil, request_options: {})
41
41
  #
42
42
  # @param messages [Array<OpenAI::Models::Chat::ChatCompletionDeveloperMessageParam, OpenAI::Models::Chat::ChatCompletionSystemMessageParam, OpenAI::Models::Chat::ChatCompletionUserMessageParam, OpenAI::Models::Chat::ChatCompletionAssistantMessageParam, OpenAI::Models::Chat::ChatCompletionToolMessageParam, OpenAI::Models::Chat::ChatCompletionFunctionMessageParam>] A list of messages comprising the conversation so far. Depending on the
43
43
  #
@@ -63,6 +63,8 @@ module OpenAI
63
63
  #
64
64
  # @param modalities [Array<Symbol, OpenAI::Models::Chat::CompletionCreateParams::Modality>, nil] Output types that you would like the model to generate.
65
65
  #
66
+ # @param moderation [OpenAI::Models::Chat::CompletionCreateParams::Moderation, nil] Configuration for running moderation on the request input and generated output.
67
+ #
66
68
  # @param n [Integer, nil] How many chat completion choices to generate for each input message. Note that y
67
69
  #
68
70
  # @param parallel_tool_calls [Boolean] Whether to enable [parallel function calling](https://platform.openai.com/docs/g
@@ -289,7 +291,7 @@ module OpenAI
289
291
  # Returns a chat completion object, or a streamed sequence of chat completion
290
292
  # chunk objects if the request is streamed.
291
293
  #
292
- # @overload stream_raw(messages:, model:, audio: nil, frequency_penalty: nil, function_call: nil, functions: nil, logit_bias: nil, logprobs: nil, max_completion_tokens: nil, max_tokens: nil, metadata: nil, modalities: nil, n: nil, parallel_tool_calls: nil, prediction: nil, presence_penalty: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning_effort: nil, response_format: nil, safety_identifier: nil, seed: nil, service_tier: nil, stop: nil, store: nil, stream_options: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, user: nil, verbosity: nil, web_search_options: nil, request_options: {})
294
+ # @overload stream_raw(messages:, model:, audio: nil, frequency_penalty: nil, function_call: nil, functions: nil, logit_bias: nil, logprobs: nil, max_completion_tokens: nil, max_tokens: nil, metadata: nil, modalities: nil, moderation: nil, n: nil, parallel_tool_calls: nil, prediction: nil, presence_penalty: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning_effort: nil, response_format: nil, safety_identifier: nil, seed: nil, service_tier: nil, stop: nil, store: nil, stream_options: nil, temperature: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, user: nil, verbosity: nil, web_search_options: nil, request_options: {})
293
295
  #
294
296
  # @param messages [Array<OpenAI::Models::Chat::ChatCompletionDeveloperMessageParam, OpenAI::Models::Chat::ChatCompletionSystemMessageParam, OpenAI::Models::Chat::ChatCompletionUserMessageParam, OpenAI::Models::Chat::ChatCompletionAssistantMessageParam, OpenAI::Models::Chat::ChatCompletionToolMessageParam, OpenAI::Models::Chat::ChatCompletionFunctionMessageParam>] A list of messages comprising the conversation so far. Depending on the
295
297
  #
@@ -315,6 +317,8 @@ module OpenAI
315
317
  #
316
318
  # @param modalities [Array<Symbol, OpenAI::Models::Chat::CompletionCreateParams::Modality>, nil] Output types that you would like the model to generate.
317
319
  #
320
+ # @param moderation [OpenAI::Models::Chat::CompletionCreateParams::Moderation, nil] Configuration for running moderation on the request input and generated output.
321
+ #
318
322
  # @param n [Integer, nil] How many chat completion choices to generate for each input message. Note that y
319
323
  #
320
324
  # @param parallel_tool_calls [Boolean] Whether to enable [parallel function calling](https://platform.openai.com/docs/g
@@ -26,7 +26,7 @@ module OpenAI
26
26
  # [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
27
27
  # your own data as input for the model's response.
28
28
  #
29
- # @overload create(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
29
+ # @overload create(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
30
30
  #
31
31
  # @param background [Boolean, nil] Whether to run the model response in the background.
32
32
  #
@@ -48,6 +48,8 @@ module OpenAI
48
48
  #
49
49
  # @param model [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel] Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI
50
50
  #
51
+ # @param moderation [OpenAI::Models::Responses::ResponseCreateParams::Moderation, nil] Configuration for running moderation on the input and output of this response.
52
+ #
51
53
  # @param parallel_tool_calls [Boolean, nil] Whether to allow the model to run tool calls in parallel.
52
54
  #
53
55
  # @param previous_response_id [String, nil] The unique ID of the previous response to the model. Use this to
@@ -130,7 +132,7 @@ module OpenAI
130
132
  # [file search](https://platform.openai.com/docs/guides/tools-file-search) to use
131
133
  # your own data as input for the model's response.
132
134
  #
133
- # @overload stream(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
135
+ # @overload stream(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
134
136
  #
135
137
  # @param background [Boolean, nil] Whether to run the model response in the background.
136
138
  #
@@ -152,6 +154,8 @@ module OpenAI
152
154
  #
153
155
  # @param model [String, Symbol, OpenAI::Models::ChatModel, OpenAI::Models::ResponsesModel::ResponsesOnlyModel] Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI
154
156
  #
157
+ # @param moderation [OpenAI::Models::Responses::ResponseCreateParams::Moderation, nil] Configuration for running moderation on the input and output of this response.
158
+ #
155
159
  # @param parallel_tool_calls [Boolean, nil] Whether to allow the model to run tool calls in parallel.
156
160
  #
157
161
  # @param previous_response_id [String, nil] The unique ID of the previous response to the response to the model. Use this to resume streams from a given response.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.65.0"
4
+ VERSION = "0.66.0"
5
5
  end