openai 0.130.0 → 1.0.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 +36 -0
- data/README.md +39 -3
- data/lib/openai/client.rb +0 -4
- data/lib/openai/internal/type/union.rb +5 -1
- data/lib/openai/models/batch_create_params.rb +6 -19
- data/lib/openai/models/beta/beta_compacted_response.rb +3 -3
- data/lib/openai/models/beta/beta_response.rb +0 -18
- data/lib/openai/models/beta/beta_responses_client_event.rb +0 -26
- data/lib/openai/models/beta/response_compact_params.rb +0 -18
- data/lib/openai/models/beta/response_create_params.rb +0 -18
- data/lib/openai/models/chat/completion_create_params.rb +8 -6
- data/lib/openai/models/chat_model.rb +0 -12
- data/lib/openai/models/completion_create_params.rb +4 -2
- data/lib/openai/models/graders/multi_grader.rb +11 -15
- data/lib/openai/models/image_edit_completed_event.rb +9 -17
- data/lib/openai/models/image_edit_partial_image_event.rb +9 -17
- data/lib/openai/models/image_gen_completed_event.rb +9 -17
- data/lib/openai/models/image_gen_partial_image_event.rb +9 -17
- data/lib/openai/models/images_response.rb +8 -14
- data/lib/openai/models/live/responses_delegation_config.rb +47 -21
- data/lib/openai/models/live/responses_delegation_update_config.rb +47 -21
- data/lib/openai/models/responses/compacted_response.rb +3 -3
- data/lib/openai/models/responses/response_compact_params.rb +0 -18
- data/lib/openai/models.rb +0 -32
- data/lib/openai/providers/vertex.rb +9 -6
- data/lib/openai/resources/batches.rb +2 -6
- data/lib/openai/resources/beta.rb +0 -10
- data/lib/openai/resources/chat/completions.rb +8 -6
- data/lib/openai/resources/completions.rb +4 -2
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +0 -114
- data/rbi/openai/client.rbi +0 -3
- data/rbi/openai/models/batch_create_params.rbi +6 -19
- data/rbi/openai/models/beta/beta_compacted_response.rbi +22 -20
- data/rbi/openai/models/beta/beta_response.rbi +0 -3
- data/rbi/openai/models/beta/beta_responses_client_event.rbi +0 -12
- data/rbi/openai/models/beta/response_compact_params.rbi +0 -9
- data/rbi/openai/models/beta/response_create_params.rbi +0 -6
- data/rbi/openai/models/chat/completion_create_params.rbi +8 -6
- data/rbi/openai/models/chat_model.rbi +0 -3
- data/rbi/openai/models/completion_create_params.rbi +4 -2
- data/rbi/openai/models/graders/multi_grader.rbi +32 -27
- data/rbi/openai/models/image_edit_completed_event.rbi +11 -8
- data/rbi/openai/models/image_edit_partial_image_event.rbi +11 -8
- data/rbi/openai/models/image_gen_completed_event.rbi +11 -8
- data/rbi/openai/models/image_gen_partial_image_event.rbi +11 -8
- data/rbi/openai/models/images_response.rbi +6 -6
- data/rbi/openai/models/live/responses_delegation_config.rbi +54 -30
- data/rbi/openai/models/live/responses_delegation_update_config.rbi +54 -30
- data/rbi/openai/models/responses/compacted_response.rbi +19 -17
- data/rbi/openai/models/responses/response_compact_params.rbi +0 -12
- data/rbi/openai/models.rbi +0 -32
- data/rbi/openai/resources/batches.rbi +2 -6
- data/rbi/openai/resources/beta.rbi +0 -8
- data/rbi/openai/resources/chat/completions.rbi +8 -6
- data/rbi/openai/resources/completions.rbi +4 -2
- data/sig/openai/client.rbs +0 -2
- data/sig/openai/models/batch_create_params.rbs +4 -14
- data/sig/openai/models/beta/beta_compacted_response.rbs +4 -4
- data/sig/openai/models/beta/beta_response.rbs +0 -6
- data/sig/openai/models/beta/beta_responses_client_event.rbs +0 -6
- data/sig/openai/models/beta/response_compact_params.rbs +0 -6
- data/sig/openai/models/beta/response_create_params.rbs +0 -6
- data/sig/openai/models/chat/completion_create_params.rbs +8 -6
- data/sig/openai/models/chat_model.rbs +0 -6
- data/sig/openai/models/completion_create_params.rbs +4 -2
- data/sig/openai/models/graders/multi_grader.rbs +7 -12
- data/sig/openai/models/image_edit_completed_event.rbs +11 -9
- data/sig/openai/models/image_edit_partial_image_event.rbs +11 -9
- data/sig/openai/models/image_gen_completed_event.rbs +11 -9
- data/sig/openai/models/image_gen_partial_image_event.rbs +11 -9
- data/sig/openai/models/images_response.rbs +5 -7
- data/sig/openai/models/live/responses_delegation_config.rbs +50 -18
- data/sig/openai/models/live/responses_delegation_update_config.rbs +50 -18
- data/sig/openai/models/responses/compacted_response.rbs +4 -4
- data/sig/openai/models/responses/response_compact_params.rbs +0 -6
- data/sig/openai/models.rbs +0 -32
- data/sig/openai/resources/beta.rbs +0 -4
- metadata +1 -343
- data/lib/openai/models/beta/assistant.rb +0 -270
- data/lib/openai/models/beta/assistant_create_params.rb +0 -448
- data/lib/openai/models/beta/assistant_delete_params.rb +0 -22
- data/lib/openai/models/beta/assistant_deleted.rb +0 -30
- data/lib/openai/models/beta/assistant_list_params.rb +0 -80
- data/lib/openai/models/beta/assistant_response_format_option.rb +0 -50
- data/lib/openai/models/beta/assistant_retrieve_params.rb +0 -22
- data/lib/openai/models/beta/assistant_stream_event.rb +0 -688
- data/lib/openai/models/beta/assistant_tool.rb +0 -22
- data/lib/openai/models/beta/assistant_tool_choice.rb +0 -43
- data/lib/openai/models/beta/assistant_tool_choice_function.rb +0 -19
- data/lib/openai/models/beta/assistant_tool_choice_option.rb +0 -42
- data/lib/openai/models/beta/assistant_update_params.rb +0 -450
- data/lib/openai/models/beta/code_interpreter_tool.rb +0 -19
- data/lib/openai/models/beta/file_search_tool.rb +0 -123
- data/lib/openai/models/beta/function_tool.rb +0 -26
- data/lib/openai/models/beta/message_stream_event.rb +0 -159
- data/lib/openai/models/beta/run_step_stream_event.rb +0 -201
- data/lib/openai/models/beta/run_stream_event.rb +0 -288
- data/lib/openai/models/beta/thread.rb +0 -133
- data/lib/openai/models/beta/thread_create_and_run_params.rb +0 -857
- data/lib/openai/models/beta/thread_create_params.rb +0 -443
- data/lib/openai/models/beta/thread_delete_params.rb +0 -22
- data/lib/openai/models/beta/thread_deleted.rb +0 -30
- data/lib/openai/models/beta/thread_retrieve_params.rb +0 -22
- data/lib/openai/models/beta/thread_stream_event.rb +0 -41
- data/lib/openai/models/beta/thread_update_params.rb +0 -114
- data/lib/openai/models/beta/threads/annotation.rb +0 -27
- data/lib/openai/models/beta/threads/annotation_delta.rb +0 -27
- data/lib/openai/models/beta/threads/file_citation_annotation.rb +0 -68
- data/lib/openai/models/beta/threads/file_citation_delta_annotation.rb +0 -86
- data/lib/openai/models/beta/threads/file_path_annotation.rb +0 -67
- data/lib/openai/models/beta/threads/file_path_delta_annotation.rb +0 -76
- data/lib/openai/models/beta/threads/image_file.rb +0 -51
- data/lib/openai/models/beta/threads/image_file_content_block.rb +0 -32
- data/lib/openai/models/beta/threads/image_file_delta.rb +0 -51
- data/lib/openai/models/beta/threads/image_file_delta_block.rb +0 -41
- data/lib/openai/models/beta/threads/image_url.rb +0 -49
- data/lib/openai/models/beta/threads/image_url_content_block.rb +0 -30
- data/lib/openai/models/beta/threads/image_url_delta.rb +0 -49
- data/lib/openai/models/beta/threads/image_url_delta_block.rb +0 -39
- data/lib/openai/models/beta/threads/message.rb +0 -272
- data/lib/openai/models/beta/threads/message_content.rb +0 -33
- data/lib/openai/models/beta/threads/message_content_delta.rb +0 -33
- data/lib/openai/models/beta/threads/message_content_part_param.rb +0 -30
- data/lib/openai/models/beta/threads/message_create_params.rb +0 -172
- data/lib/openai/models/beta/threads/message_delete_params.rb +0 -30
- data/lib/openai/models/beta/threads/message_deleted.rb +0 -32
- data/lib/openai/models/beta/threads/message_delta.rb +0 -48
- data/lib/openai/models/beta/threads/message_delta_event.rb +0 -42
- data/lib/openai/models/beta/threads/message_list_params.rb +0 -98
- data/lib/openai/models/beta/threads/message_retrieve_params.rb +0 -30
- data/lib/openai/models/beta/threads/message_update_params.rb +0 -51
- data/lib/openai/models/beta/threads/refusal_content_block.rb +0 -30
- data/lib/openai/models/beta/threads/refusal_delta_block.rb +0 -39
- data/lib/openai/models/beta/threads/required_action_function_tool_call.rb +0 -73
- data/lib/openai/models/beta/threads/run.rb +0 -557
- data/lib/openai/models/beta/threads/run_cancel_params.rb +0 -30
- data/lib/openai/models/beta/threads/run_create_params.rb +0 -565
- data/lib/openai/models/beta/threads/run_list_params.rb +0 -89
- data/lib/openai/models/beta/threads/run_retrieve_params.rb +0 -30
- data/lib/openai/models/beta/threads/run_status.rb +0 -29
- data/lib/openai/models/beta/threads/run_submit_tool_outputs_params.rb +0 -69
- data/lib/openai/models/beta/threads/run_update_params.rb +0 -51
- data/lib/openai/models/beta/threads/runs/code_interpreter_logs.rb +0 -43
- data/lib/openai/models/beta/threads/runs/code_interpreter_output_image.rb +0 -54
- data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call.rb +0 -161
- data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call_delta.rb +0 -107
- data/lib/openai/models/beta/threads/runs/file_search_tool_call.rb +0 -207
- data/lib/openai/models/beta/threads/runs/file_search_tool_call_delta.rb +0 -52
- data/lib/openai/models/beta/threads/runs/function_tool_call.rb +0 -78
- data/lib/openai/models/beta/threads/runs/function_tool_call_delta.rb +0 -87
- data/lib/openai/models/beta/threads/runs/message_creation_step_details.rb +0 -48
- data/lib/openai/models/beta/threads/runs/run_step.rb +0 -311
- data/lib/openai/models/beta/threads/runs/run_step_delta.rb +0 -45
- data/lib/openai/models/beta/threads/runs/run_step_delta_event.rb +0 -46
- data/lib/openai/models/beta/threads/runs/run_step_delta_message_delta.rb +0 -47
- data/lib/openai/models/beta/threads/runs/run_step_include.rb +0 -22
- data/lib/openai/models/beta/threads/runs/step_list_params.rb +0 -122
- data/lib/openai/models/beta/threads/runs/step_retrieve_params.rb +0 -65
- data/lib/openai/models/beta/threads/runs/tool_call.rb +0 -28
- data/lib/openai/models/beta/threads/runs/tool_call_delta.rb +0 -28
- data/lib/openai/models/beta/threads/runs/tool_call_delta_object.rb +0 -41
- data/lib/openai/models/beta/threads/runs/tool_calls_step_details.rb +0 -38
- data/lib/openai/models/beta/threads/text.rb +0 -28
- data/lib/openai/models/beta/threads/text_content_block.rb +0 -30
- data/lib/openai/models/beta/threads/text_content_block_param.rb +0 -32
- data/lib/openai/models/beta/threads/text_delta.rb +0 -31
- data/lib/openai/models/beta/threads/text_delta_block.rb +0 -39
- data/lib/openai/models/image_input_reference_param.rb +0 -24
- data/lib/openai/models/video.rb +0 -161
- data/lib/openai/models/video_create_character_params.rb +0 -40
- data/lib/openai/models/video_create_character_response.rb +0 -36
- data/lib/openai/models/video_create_error.rb +0 -166
- data/lib/openai/models/video_create_params.rb +0 -85
- data/lib/openai/models/video_delete_params.rb +0 -20
- data/lib/openai/models/video_delete_response.rb +0 -38
- data/lib/openai/models/video_download_content_params.rb +0 -42
- data/lib/openai/models/video_edit_params.rb +0 -68
- data/lib/openai/models/video_extend_params.rb +0 -79
- data/lib/openai/models/video_get_character_params.rb +0 -20
- data/lib/openai/models/video_get_character_response.rb +0 -36
- data/lib/openai/models/video_list_params.rb +0 -55
- data/lib/openai/models/video_model.rb +0 -38
- data/lib/openai/models/video_remix_params.rb +0 -30
- data/lib/openai/models/video_retrieve_params.rb +0 -20
- data/lib/openai/models/video_seconds.rb +0 -16
- data/lib/openai/models/video_size.rb +0 -17
- data/lib/openai/resources/beta/assistants.rb +0 -320
- data/lib/openai/resources/beta/threads/messages.rb +0 -236
- data/lib/openai/resources/beta/threads/runs/steps.rb +0 -141
- data/lib/openai/resources/beta/threads/runs.rb +0 -623
- data/lib/openai/resources/beta/threads.rb +0 -444
- data/lib/openai/resources/videos.rb +0 -354
- data/rbi/openai/models/beta/assistant.rbi +0 -411
- data/rbi/openai/models/beta/assistant_create_params.rbi +0 -776
- data/rbi/openai/models/beta/assistant_delete_params.rbi +0 -53
- data/rbi/openai/models/beta/assistant_deleted.rbi +0 -60
- data/rbi/openai/models/beta/assistant_list_params.rbi +0 -132
- data/rbi/openai/models/beta/assistant_response_format_option.rbi +0 -49
- data/rbi/openai/models/beta/assistant_retrieve_params.rbi +0 -53
- data/rbi/openai/models/beta/assistant_stream_event.rbi +0 -1277
- data/rbi/openai/models/beta/assistant_tool.rbi +0 -28
- data/rbi/openai/models/beta/assistant_tool_choice.rbi +0 -79
- data/rbi/openai/models/beta/assistant_tool_choice_function.rbi +0 -49
- data/rbi/openai/models/beta/assistant_tool_choice_option.rbi +0 -53
- data/rbi/openai/models/beta/assistant_update_params.rbi +0 -556
- data/rbi/openai/models/beta/code_interpreter_tool.rbi +0 -49
- data/rbi/openai/models/beta/file_search_tool.rbi +0 -223
- data/rbi/openai/models/beta/function_tool.rbi +0 -59
- data/rbi/openai/models/beta/message_stream_event.rbi +0 -288
- data/rbi/openai/models/beta/run_step_stream_event.rbi +0 -378
- data/rbi/openai/models/beta/run_stream_event.rbi +0 -537
- data/rbi/openai/models/beta/thread.rbi +0 -255
- data/rbi/openai/models/beta/thread_create_and_run_params.rbi +0 -1461
- data/rbi/openai/models/beta/thread_create_params.rbi +0 -823
- data/rbi/openai/models/beta/thread_delete_params.rbi +0 -53
- data/rbi/openai/models/beta/thread_deleted.rbi +0 -60
- data/rbi/openai/models/beta/thread_retrieve_params.rbi +0 -53
- data/rbi/openai/models/beta/thread_stream_event.rbi +0 -75
- data/rbi/openai/models/beta/thread_update_params.rbi +0 -240
- data/rbi/openai/models/beta/threads/annotation.rbi +0 -34
- data/rbi/openai/models/beta/threads/annotation_delta.rbi +0 -34
- data/rbi/openai/models/beta/threads/file_citation_annotation.rbi +0 -132
- data/rbi/openai/models/beta/threads/file_citation_delta_annotation.rbi +0 -166
- data/rbi/openai/models/beta/threads/file_path_annotation.rbi +0 -131
- data/rbi/openai/models/beta/threads/file_path_delta_annotation.rbi +0 -153
- data/rbi/openai/models/beta/threads/image_file.rbi +0 -88
- data/rbi/openai/models/beta/threads/image_file_content_block.rbi +0 -66
- data/rbi/openai/models/beta/threads/image_file_delta.rbi +0 -91
- data/rbi/openai/models/beta/threads/image_file_delta_block.rbi +0 -75
- data/rbi/openai/models/beta/threads/image_url.rbi +0 -86
- data/rbi/openai/models/beta/threads/image_url_content_block.rbi +0 -64
- data/rbi/openai/models/beta/threads/image_url_delta.rbi +0 -89
- data/rbi/openai/models/beta/threads/image_url_delta_block.rbi +0 -73
- data/rbi/openai/models/beta/threads/message.rbi +0 -433
- data/rbi/openai/models/beta/threads/message_content.rbi +0 -36
- data/rbi/openai/models/beta/threads/message_content_delta.rbi +0 -36
- data/rbi/openai/models/beta/threads/message_content_part_param.rbi +0 -35
- data/rbi/openai/models/beta/threads/message_create_params.rbi +0 -299
- data/rbi/openai/models/beta/threads/message_delete_params.rbi +0 -64
- data/rbi/openai/models/beta/threads/message_deleted.rbi +0 -64
- data/rbi/openai/models/beta/threads/message_delta.rbi +0 -106
- data/rbi/openai/models/beta/threads/message_delta_event.rbi +0 -76
- data/rbi/openai/models/beta/threads/message_list_params.rbi +0 -157
- data/rbi/openai/models/beta/threads/message_retrieve_params.rbi +0 -64
- data/rbi/openai/models/beta/threads/message_update_params.rbi +0 -88
- data/rbi/openai/models/beta/threads/refusal_content_block.rbi +0 -61
- data/rbi/openai/models/beta/threads/refusal_delta_block.rbi +0 -73
- data/rbi/openai/models/beta/threads/required_action_function_tool_call.rbi +0 -130
- data/rbi/openai/models/beta/threads/run.rbi +0 -803
- data/rbi/openai/models/beta/threads/run_cancel_params.rbi +0 -64
- data/rbi/openai/models/beta/threads/run_create_params.rbi +0 -825
- data/rbi/openai/models/beta/threads/run_list_params.rbi +0 -144
- data/rbi/openai/models/beta/threads/run_retrieve_params.rbi +0 -64
- data/rbi/openai/models/beta/threads/run_status.rbi +0 -39
- data/rbi/openai/models/beta/threads/run_submit_tool_outputs_params.rbi +0 -132
- data/rbi/openai/models/beta/threads/run_update_params.rbi +0 -88
- data/rbi/openai/models/beta/threads/runs/code_interpreter_logs.rbi +0 -79
- data/rbi/openai/models/beta/threads/runs/code_interpreter_output_image.rbi +0 -118
- data/rbi/openai/models/beta/threads/runs/code_interpreter_tool_call.rbi +0 -315
- data/rbi/openai/models/beta/threads/runs/code_interpreter_tool_call_delta.rbi +0 -210
- data/rbi/openai/models/beta/threads/runs/file_search_tool_call.rbi +0 -409
- data/rbi/openai/models/beta/threads/runs/file_search_tool_call_delta.rbi +0 -89
- data/rbi/openai/models/beta/threads/runs/function_tool_call.rbi +0 -138
- data/rbi/openai/models/beta/threads/runs/function_tool_call_delta.rbi +0 -161
- data/rbi/openai/models/beta/threads/runs/message_creation_step_details.rbi +0 -111
- data/rbi/openai/models/beta/threads/runs/run_step.rbi +0 -422
- data/rbi/openai/models/beta/threads/runs/run_step_delta.rbi +0 -91
- data/rbi/openai/models/beta/threads/runs/run_step_delta_event.rbi +0 -82
- data/rbi/openai/models/beta/threads/runs/run_step_delta_message_delta.rbi +0 -113
- data/rbi/openai/models/beta/threads/runs/run_step_include.rbi +0 -37
- data/rbi/openai/models/beta/threads/runs/step_list_params.rbi +0 -181
- data/rbi/openai/models/beta/threads/runs/step_retrieve_params.rbi +0 -105
- data/rbi/openai/models/beta/threads/runs/tool_call.rbi +0 -37
- data/rbi/openai/models/beta/threads/runs/tool_call_delta.rbi +0 -37
- data/rbi/openai/models/beta/threads/runs/tool_call_delta_object.rbi +0 -91
- data/rbi/openai/models/beta/threads/runs/tool_calls_step_details.rbi +0 -77
- data/rbi/openai/models/beta/threads/text.rbi +0 -65
- data/rbi/openai/models/beta/threads/text_content_block.rbi +0 -64
- data/rbi/openai/models/beta/threads/text_content_block_param.rbi +0 -63
- data/rbi/openai/models/beta/threads/text_delta.rbi +0 -81
- data/rbi/openai/models/beta/threads/text_delta_block.rbi +0 -73
- data/rbi/openai/models/image_input_reference_param.rbi +0 -58
- data/rbi/openai/models/video.rbi +0 -203
- data/rbi/openai/models/video_create_character_params.rbi +0 -68
- data/rbi/openai/models/video_create_character_response.rbi +0 -63
- data/rbi/openai/models/video_create_error.rbi +0 -255
- data/rbi/openai/models/video_create_params.rbi +0 -132
- data/rbi/openai/models/video_delete_params.rbi +0 -49
- data/rbi/openai/models/video_delete_response.rbi +0 -64
- data/rbi/openai/models/video_download_content_params.rbi +0 -81
- data/rbi/openai/models/video_edit_params.rbi +0 -122
- data/rbi/openai/models/video_extend_params.rbi +0 -134
- data/rbi/openai/models/video_get_character_params.rbi +0 -49
- data/rbi/openai/models/video_get_character_response.rbi +0 -63
- data/rbi/openai/models/video_list_params.rbi +0 -101
- data/rbi/openai/models/video_model.rbi +0 -35
- data/rbi/openai/models/video_remix_params.rbi +0 -58
- data/rbi/openai/models/video_retrieve_params.rbi +0 -49
- data/rbi/openai/models/video_seconds.rbi +0 -22
- data/rbi/openai/models/video_size.rbi +0 -23
- data/rbi/openai/resources/beta/assistants.rbi +0 -285
- data/rbi/openai/resources/beta/threads/messages.rbi +0 -161
- data/rbi/openai/resources/beta/threads/runs/steps.rbi +0 -107
- data/rbi/openai/resources/beta/threads/runs.rbi +0 -527
- data/rbi/openai/resources/beta/threads.rbi +0 -391
- data/rbi/openai/resources/videos.rbi +0 -205
- data/sig/openai/models/beta/assistant.rbs +0 -278
- data/sig/openai/models/beta/assistant_create_params.rbs +0 -485
- data/sig/openai/models/beta/assistant_delete_params.rbs +0 -25
- data/sig/openai/models/beta/assistant_deleted.rbs +0 -28
- data/sig/openai/models/beta/assistant_list_params.rbs +0 -104
- data/sig/openai/models/beta/assistant_response_format_option.rbs +0 -17
- data/sig/openai/models/beta/assistant_retrieve_params.rbs +0 -25
- data/sig/openai/models/beta/assistant_stream_event.rbs +0 -645
- data/sig/openai/models/beta/assistant_tool.rbs +0 -16
- data/sig/openai/models/beta/assistant_tool_choice.rbs +0 -46
- data/sig/openai/models/beta/assistant_tool_choice_function.rbs +0 -18
- data/sig/openai/models/beta/assistant_tool_choice_option.rbs +0 -27
- data/sig/openai/models/beta/assistant_update_params.rbs +0 -396
- data/sig/openai/models/beta/code_interpreter_tool.rbs +0 -18
- data/sig/openai/models/beta/file_search_tool.rbs +0 -159
- data/sig/openai/models/beta/function_tool.rbs +0 -27
- data/sig/openai/models/beta/message_stream_event.rbs +0 -153
- data/sig/openai/models/beta/run_step_stream_event.rbs +0 -197
- data/sig/openai/models/beta/run_stream_event.rbs +0 -269
- data/sig/openai/models/beta/thread.rbs +0 -150
- data/sig/openai/models/beta/thread_create_and_run_params.rbs +0 -885
- data/sig/openai/models/beta/thread_create_params.rbs +0 -492
- data/sig/openai/models/beta/thread_delete_params.rbs +0 -25
- data/sig/openai/models/beta/thread_deleted.rbs +0 -28
- data/sig/openai/models/beta/thread_retrieve_params.rbs +0 -25
- data/sig/openai/models/beta/thread_stream_event.rbs +0 -43
- data/sig/openai/models/beta/thread_update_params.rbs +0 -137
- data/sig/openai/models/beta/threads/annotation.rbs +0 -17
- data/sig/openai/models/beta/threads/annotation_delta.rbs +0 -17
- data/sig/openai/models/beta/threads/file_citation_annotation.rbs +0 -63
- data/sig/openai/models/beta/threads/file_citation_delta_annotation.rbs +0 -93
- data/sig/openai/models/beta/threads/file_path_annotation.rbs +0 -63
- data/sig/openai/models/beta/threads/file_path_delta_annotation.rbs +0 -85
- data/sig/openai/models/beta/threads/image_file.rbs +0 -59
- data/sig/openai/models/beta/threads/image_file_content_block.rbs +0 -29
- data/sig/openai/models/beta/threads/image_file_delta.rbs +0 -64
- data/sig/openai/models/beta/threads/image_file_delta_block.rbs +0 -44
- data/sig/openai/models/beta/threads/image_url.rbs +0 -57
- data/sig/openai/models/beta/threads/image_url_content_block.rbs +0 -29
- data/sig/openai/models/beta/threads/image_url_delta.rbs +0 -61
- data/sig/openai/models/beta/threads/image_url_delta_block.rbs +0 -44
- data/sig/openai/models/beta/threads/message.rbs +0 -275
- data/sig/openai/models/beta/threads/message_content.rbs +0 -19
- data/sig/openai/models/beta/threads/message_content_delta.rbs +0 -19
- data/sig/openai/models/beta/threads/message_content_part_param.rbs +0 -18
- data/sig/openai/models/beta/threads/message_create_params.rbs +0 -167
- data/sig/openai/models/beta/threads/message_delete_params.rbs +0 -35
- data/sig/openai/models/beta/threads/message_deleted.rbs +0 -30
- data/sig/openai/models/beta/threads/message_delta.rbs +0 -56
- data/sig/openai/models/beta/threads/message_delta_event.rbs +0 -43
- data/sig/openai/models/beta/threads/message_list_params.rbs +0 -122
- data/sig/openai/models/beta/threads/message_retrieve_params.rbs +0 -35
- data/sig/openai/models/beta/threads/message_update_params.rbs +0 -53
- data/sig/openai/models/beta/threads/refusal_content_block.rbs +0 -22
- data/sig/openai/models/beta/threads/refusal_delta_block.rbs +0 -34
- data/sig/openai/models/beta/threads/required_action_function_tool_call.rbs +0 -69
- data/sig/openai/models/beta/threads/run.rbs +0 -545
- data/sig/openai/models/beta/threads/run_cancel_params.rbs +0 -35
- data/sig/openai/models/beta/threads/run_create_params.rbs +0 -524
- data/sig/openai/models/beta/threads/run_list_params.rbs +0 -111
- data/sig/openai/models/beta/threads/run_retrieve_params.rbs +0 -35
- data/sig/openai/models/beta/threads/run_status.rbs +0 -34
- data/sig/openai/models/beta/threads/run_submit_tool_outputs_params.rbs +0 -70
- data/sig/openai/models/beta/threads/run_update_params.rbs +0 -53
- data/sig/openai/models/beta/threads/runs/code_interpreter_logs.rbs +0 -40
- data/sig/openai/models/beta/threads/runs/code_interpreter_output_image.rbs +0 -65
- data/sig/openai/models/beta/threads/runs/code_interpreter_tool_call.rbs +0 -147
- data/sig/openai/models/beta/threads/runs/code_interpreter_tool_call_delta.rbs +0 -115
- data/sig/openai/models/beta/threads/runs/file_search_tool_call.rbs +0 -228
- data/sig/openai/models/beta/threads/runs/file_search_tool_call_delta.rbs +0 -58
- data/sig/openai/models/beta/threads/runs/function_tool_call.rbs +0 -80
- data/sig/openai/models/beta/threads/runs/function_tool_call_delta.rbs +0 -103
- data/sig/openai/models/beta/threads/runs/message_creation_step_details.rbs +0 -47
- data/sig/openai/models/beta/threads/runs/run_step.rbs +0 -290
- data/sig/openai/models/beta/threads/runs/run_step_delta.rbs +0 -46
- data/sig/openai/models/beta/threads/runs/run_step_delta_event.rbs +0 -47
- data/sig/openai/models/beta/threads/runs/run_step_delta_message_delta.rbs +0 -56
- data/sig/openai/models/beta/threads/runs/run_step_include.rbs +0 -22
- data/sig/openai/models/beta/threads/runs/step_list_params.rbs +0 -149
- data/sig/openai/models/beta/threads/runs/step_retrieve_params.rbs +0 -73
- data/sig/openai/models/beta/threads/runs/tool_call.rbs +0 -20
- data/sig/openai/models/beta/threads/runs/tool_call_delta.rbs +0 -20
- data/sig/openai/models/beta/threads/runs/tool_call_delta_object.rbs +0 -48
- data/sig/openai/models/beta/threads/runs/tool_calls_step_details.rbs +0 -41
- data/sig/openai/models/beta/threads/text.rbs +0 -32
- data/sig/openai/models/beta/threads/text_content_block.rbs +0 -26
- data/sig/openai/models/beta/threads/text_content_block_param.rbs +0 -25
- data/sig/openai/models/beta/threads/text_delta.rbs +0 -39
- data/sig/openai/models/beta/threads/text_delta_block.rbs +0 -44
- data/sig/openai/models/image_input_reference_param.rbs +0 -23
- data/sig/openai/models/video.rbs +0 -142
- data/sig/openai/models/video_create_character_params.rbs +0 -45
- data/sig/openai/models/video_create_character_response.rbs +0 -27
- data/sig/openai/models/video_create_error.rbs +0 -163
- data/sig/openai/models/video_create_params.rbs +0 -104
- data/sig/openai/models/video_delete_params.rbs +0 -23
- data/sig/openai/models/video_delete_response.rbs +0 -31
- data/sig/openai/models/video_download_content_params.rbs +0 -51
- data/sig/openai/models/video_edit_params.rbs +0 -77
- data/sig/openai/models/video_extend_params.rbs +0 -87
- data/sig/openai/models/video_get_character_params.rbs +0 -23
- data/sig/openai/models/video_get_character_response.rbs +0 -27
- data/sig/openai/models/video_list_params.rbs +0 -70
- data/sig/openai/models/video_model.rbs +0 -23
- data/sig/openai/models/video_remix_params.rbs +0 -34
- data/sig/openai/models/video_retrieve_params.rbs +0 -23
- data/sig/openai/models/video_seconds.rbs +0 -15
- data/sig/openai/models/video_size.rbs +0 -16
- data/sig/openai/resources/beta/assistants.rbs +0 -58
- data/sig/openai/resources/beta/threads/messages.rbs +0 -49
- data/sig/openai/resources/beta/threads/runs/steps.rbs +0 -32
- data/sig/openai/resources/beta/threads/runs.rbs +0 -99
- data/sig/openai/resources/beta/threads.rbs +0 -75
- data/sig/openai/resources/videos.rbs +0 -69
|
@@ -1,444 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module OpenAI
|
|
4
|
-
module Resources
|
|
5
|
-
class Beta
|
|
6
|
-
# @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
7
|
-
#
|
|
8
|
-
# Build Assistants that can call models and use tools.
|
|
9
|
-
class Threads
|
|
10
|
-
# Build Assistants that can call models and use tools.
|
|
11
|
-
# @return [OpenAI::Resources::Beta::Threads::Runs]
|
|
12
|
-
attr_reader :runs
|
|
13
|
-
|
|
14
|
-
# Build Assistants that can call models and use tools.
|
|
15
|
-
# @return [OpenAI::Resources::Beta::Threads::Messages]
|
|
16
|
-
attr_reader :messages
|
|
17
|
-
|
|
18
|
-
# @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
19
|
-
#
|
|
20
|
-
# Create a thread.
|
|
21
|
-
#
|
|
22
|
-
# @overload create(messages: nil, metadata: nil, tool_resources: nil, request_options: {})
|
|
23
|
-
#
|
|
24
|
-
# @param messages [Array<OpenAI::Models::Beta::ThreadCreateParams::Message>]
|
|
25
|
-
# A list of
|
|
26
|
-
# [messages](https://developers.openai.com/api/docs/assistants/migration) to start
|
|
27
|
-
# the thread with.
|
|
28
|
-
#
|
|
29
|
-
# @param metadata [Hash{Symbol=>String}, nil]
|
|
30
|
-
# Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
31
|
-
# for storing additional information about the object in a structured format, and
|
|
32
|
-
# querying for objects via API or the dashboard.
|
|
33
|
-
#
|
|
34
|
-
# Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
35
|
-
# a maximum length of 512 characters.
|
|
36
|
-
#
|
|
37
|
-
# @param tool_resources [OpenAI::Models::Beta::ThreadCreateParams::ToolResources, nil]
|
|
38
|
-
# A set of resources that are made available to the assistant's tools in this
|
|
39
|
-
# thread. The resources are specific to the type of tool. For example, the
|
|
40
|
-
# `code_interpreter` tool requires a list of file IDs, while the `file_search`
|
|
41
|
-
# tool requires a list of vector store IDs.
|
|
42
|
-
#
|
|
43
|
-
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
44
|
-
#
|
|
45
|
-
# @return [OpenAI::Models::Beta::Thread]
|
|
46
|
-
#
|
|
47
|
-
# @see OpenAI::Models::Beta::ThreadCreateParams
|
|
48
|
-
def create(params = {})
|
|
49
|
-
parsed, options = OpenAI::Beta::ThreadCreateParams.dump_request(params)
|
|
50
|
-
@client.request(
|
|
51
|
-
method: :post,
|
|
52
|
-
path: "threads",
|
|
53
|
-
headers: {"openai-beta" => "assistants=v2"},
|
|
54
|
-
body: parsed,
|
|
55
|
-
model: OpenAI::Beta::Thread,
|
|
56
|
-
security: {bearer_auth: true},
|
|
57
|
-
options: options
|
|
58
|
-
)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
62
|
-
#
|
|
63
|
-
# Retrieves a thread.
|
|
64
|
-
#
|
|
65
|
-
# @overload retrieve(thread_id, request_options: {})
|
|
66
|
-
#
|
|
67
|
-
# @param thread_id [String]
|
|
68
|
-
# The ID of the thread to retrieve.
|
|
69
|
-
#
|
|
70
|
-
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
71
|
-
#
|
|
72
|
-
# @return [OpenAI::Models::Beta::Thread]
|
|
73
|
-
#
|
|
74
|
-
# @see OpenAI::Models::Beta::ThreadRetrieveParams
|
|
75
|
-
def retrieve(thread_id, params = {})
|
|
76
|
-
@client.request(
|
|
77
|
-
method: :get,
|
|
78
|
-
path: ["threads/%1$s", thread_id],
|
|
79
|
-
headers: {"openai-beta" => "assistants=v2"},
|
|
80
|
-
model: OpenAI::Beta::Thread,
|
|
81
|
-
security: {bearer_auth: true},
|
|
82
|
-
options: params[:request_options]
|
|
83
|
-
)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
87
|
-
#
|
|
88
|
-
# Modifies a thread.
|
|
89
|
-
#
|
|
90
|
-
# @overload update(thread_id, metadata: nil, tool_resources: nil, request_options: {})
|
|
91
|
-
#
|
|
92
|
-
# @param thread_id [String]
|
|
93
|
-
# The ID of the thread to modify. Only the `metadata` can be modified.
|
|
94
|
-
#
|
|
95
|
-
# @param metadata [Hash{Symbol=>String}, nil]
|
|
96
|
-
# Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
97
|
-
# for storing additional information about the object in a structured format, and
|
|
98
|
-
# querying for objects via API or the dashboard.
|
|
99
|
-
#
|
|
100
|
-
# Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
101
|
-
# a maximum length of 512 characters.
|
|
102
|
-
#
|
|
103
|
-
# @param tool_resources [OpenAI::Models::Beta::ThreadUpdateParams::ToolResources, nil]
|
|
104
|
-
# A set of resources that are made available to the assistant's tools in this
|
|
105
|
-
# thread. The resources are specific to the type of tool. For example, the
|
|
106
|
-
# `code_interpreter` tool requires a list of file IDs, while the `file_search`
|
|
107
|
-
# tool requires a list of vector store IDs.
|
|
108
|
-
#
|
|
109
|
-
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
110
|
-
#
|
|
111
|
-
# @return [OpenAI::Models::Beta::Thread]
|
|
112
|
-
#
|
|
113
|
-
# @see OpenAI::Models::Beta::ThreadUpdateParams
|
|
114
|
-
def update(thread_id, params = {})
|
|
115
|
-
parsed, options = OpenAI::Beta::ThreadUpdateParams.dump_request(params)
|
|
116
|
-
@client.request(
|
|
117
|
-
method: :post,
|
|
118
|
-
path: ["threads/%1$s", thread_id],
|
|
119
|
-
headers: {"openai-beta" => "assistants=v2"},
|
|
120
|
-
body: parsed,
|
|
121
|
-
model: OpenAI::Beta::Thread,
|
|
122
|
-
security: {bearer_auth: true},
|
|
123
|
-
options: options
|
|
124
|
-
)
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
# @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
128
|
-
#
|
|
129
|
-
# Delete a thread.
|
|
130
|
-
#
|
|
131
|
-
# @overload delete(thread_id, request_options: {})
|
|
132
|
-
#
|
|
133
|
-
# @param thread_id [String]
|
|
134
|
-
# The ID of the thread to delete.
|
|
135
|
-
#
|
|
136
|
-
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
137
|
-
#
|
|
138
|
-
# @return [OpenAI::Models::Beta::ThreadDeleted]
|
|
139
|
-
#
|
|
140
|
-
# @see OpenAI::Models::Beta::ThreadDeleteParams
|
|
141
|
-
def delete(thread_id, params = {})
|
|
142
|
-
@client.request(
|
|
143
|
-
method: :delete,
|
|
144
|
-
path: ["threads/%1$s", thread_id],
|
|
145
|
-
headers: {"openai-beta" => "assistants=v2"},
|
|
146
|
-
model: OpenAI::Beta::ThreadDeleted,
|
|
147
|
-
security: {bearer_auth: true},
|
|
148
|
-
options: params[:request_options]
|
|
149
|
-
)
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
# @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
153
|
-
#
|
|
154
|
-
# See {OpenAI::Resources::Beta::Threads#stream_raw} for streaming counterpart.
|
|
155
|
-
#
|
|
156
|
-
# Create a thread and run it in one request.
|
|
157
|
-
#
|
|
158
|
-
# @overload create_and_run(assistant_id:, instructions: nil, max_completion_tokens: nil, max_prompt_tokens: nil, metadata: nil, model: nil, parallel_tool_calls: nil, response_format: nil, temperature: nil, thread: nil, tool_choice: nil, tool_resources: nil, tools: nil, top_p: nil, truncation_strategy: nil, request_options: {})
|
|
159
|
-
#
|
|
160
|
-
# @param assistant_id [String]
|
|
161
|
-
# The ID of the
|
|
162
|
-
# [assistant](https://developers.openai.com/api/docs/assistants/migration) to use
|
|
163
|
-
# to execute this run.
|
|
164
|
-
#
|
|
165
|
-
# @param instructions [String, nil]
|
|
166
|
-
# Override the default system message of the assistant. This is useful for
|
|
167
|
-
# modifying the behavior on a per-run basis.
|
|
168
|
-
#
|
|
169
|
-
# @param max_completion_tokens [Integer, nil]
|
|
170
|
-
# The maximum number of completion tokens that may be used over the course of the
|
|
171
|
-
# run. The run will make a best effort to use only the number of completion tokens
|
|
172
|
-
# specified, across multiple turns of the run. If the run exceeds the number of
|
|
173
|
-
# completion tokens specified, the run will end with status `incomplete`. See
|
|
174
|
-
# `incomplete_details` for more info.
|
|
175
|
-
#
|
|
176
|
-
# @param max_prompt_tokens [Integer, nil]
|
|
177
|
-
# The maximum number of prompt tokens that may be used over the course of the run.
|
|
178
|
-
# The run will make a best effort to use only the number of prompt tokens
|
|
179
|
-
# specified, across multiple turns of the run. If the run exceeds the number of
|
|
180
|
-
# prompt tokens specified, the run will end with status `incomplete`. See
|
|
181
|
-
# `incomplete_details` for more info.
|
|
182
|
-
#
|
|
183
|
-
# @param metadata [Hash{Symbol=>String}, nil]
|
|
184
|
-
# Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
185
|
-
# for storing additional information about the object in a structured format, and
|
|
186
|
-
# querying for objects via API or the dashboard.
|
|
187
|
-
#
|
|
188
|
-
# Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
189
|
-
# a maximum length of 512 characters.
|
|
190
|
-
#
|
|
191
|
-
# @param model [String, Symbol, OpenAI::Models::ChatModel, nil]
|
|
192
|
-
# The ID of the
|
|
193
|
-
# [Model](https://developers.openai.com/api/reference/resources/models) to be used
|
|
194
|
-
# to execute this run. If a value is provided here, it will override the model
|
|
195
|
-
# associated with the assistant. If not, the model associated with the assistant
|
|
196
|
-
# will be used.
|
|
197
|
-
#
|
|
198
|
-
# @param parallel_tool_calls [Boolean]
|
|
199
|
-
# Whether to enable
|
|
200
|
-
# [parallel function calling](https://developers.openai.com/api/docs/guides/function-calling#parallel-function-calling)
|
|
201
|
-
# during tool use.
|
|
202
|
-
#
|
|
203
|
-
# @param response_format [Symbol, :auto, OpenAI::Models::ResponseFormatText, OpenAI::Models::ResponseFormatJSONObject, OpenAI::Models::ResponseFormatJSONSchema, nil]
|
|
204
|
-
# Specifies the format that the model must output. Compatible with
|
|
205
|
-
# [GPT-4o](https://developers.openai.com/api/docs/models/gpt-4o),
|
|
206
|
-
# [GPT-4 Turbo](https://developers.openai.com/api/docs/models/gpt-4-turbo), and
|
|
207
|
-
# all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
|
|
208
|
-
#
|
|
209
|
-
# Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
|
|
210
|
-
# Outputs which ensures the model will match your supplied JSON schema. Learn more
|
|
211
|
-
# in the
|
|
212
|
-
# [Structured Outputs guide](https://developers.openai.com/api/docs/guides/structured-outputs).
|
|
213
|
-
#
|
|
214
|
-
# Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
|
|
215
|
-
# message the model generates is valid JSON.
|
|
216
|
-
#
|
|
217
|
-
# **Important:** when using JSON mode, you **must** also instruct the model to
|
|
218
|
-
# produce JSON yourself via a system or user message. Without this, the model may
|
|
219
|
-
# generate an unending stream of whitespace until the generation reaches the token
|
|
220
|
-
# limit, resulting in a long-running and seemingly "stuck" request. Also note that
|
|
221
|
-
# the message content may be partially cut off if `finish_reason="length"`, which
|
|
222
|
-
# indicates the generation exceeded `max_tokens` or the conversation exceeded the
|
|
223
|
-
# max context length.
|
|
224
|
-
#
|
|
225
|
-
# @param temperature [Float, nil]
|
|
226
|
-
# What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
227
|
-
# make the output more random, while lower values like 0.2 will make it more
|
|
228
|
-
# focused and deterministic.
|
|
229
|
-
#
|
|
230
|
-
# @param thread [OpenAI::Models::Beta::ThreadCreateAndRunParams::Thread]
|
|
231
|
-
# Options to create a new thread. If no thread is provided when running a request,
|
|
232
|
-
# an empty thread will be created.
|
|
233
|
-
#
|
|
234
|
-
# @param tool_choice [Symbol, OpenAI::Models::Beta::AssistantToolChoiceOption::Auto, OpenAI::Models::Beta::AssistantToolChoice, nil]
|
|
235
|
-
# Controls which (if any) tool is called by the model. `none` means the model will
|
|
236
|
-
# not call any tools and instead generates a message. `auto` is the default value
|
|
237
|
-
# and means the model can pick between generating a message or calling one or more
|
|
238
|
-
# tools. `required` means the model must call one or more tools before responding
|
|
239
|
-
# to the user. Specifying a particular tool like `{"type": "file_search"}` or
|
|
240
|
-
# `{"type": "function", "function": {"name": "my_function"}}` forces the model to
|
|
241
|
-
# call that tool.
|
|
242
|
-
#
|
|
243
|
-
# @param tool_resources [OpenAI::Models::Beta::ThreadCreateAndRunParams::ToolResources, nil]
|
|
244
|
-
# A set of resources that are used by the assistant's tools. The resources are
|
|
245
|
-
# specific to the type of tool. For example, the `code_interpreter` tool requires
|
|
246
|
-
# a list of file IDs, while the `file_search` tool requires a list of vector store
|
|
247
|
-
# IDs.
|
|
248
|
-
#
|
|
249
|
-
# @param tools [Array<OpenAI::Models::Beta::CodeInterpreterTool, OpenAI::Models::Beta::FileSearchTool, OpenAI::Models::Beta::FunctionTool>, nil]
|
|
250
|
-
# Override the tools the assistant can use for this run. This is useful for
|
|
251
|
-
# modifying the behavior on a per-run basis.
|
|
252
|
-
#
|
|
253
|
-
# @param top_p [Float, nil]
|
|
254
|
-
# An alternative to sampling with temperature, called nucleus sampling, where the
|
|
255
|
-
# model considers the results of the tokens with top_p probability mass. So 0.1
|
|
256
|
-
# means only the tokens comprising the top 10% probability mass are considered.
|
|
257
|
-
#
|
|
258
|
-
# We generally recommend altering this or temperature but not both.
|
|
259
|
-
#
|
|
260
|
-
# @param truncation_strategy [OpenAI::Models::Beta::ThreadCreateAndRunParams::TruncationStrategy, nil]
|
|
261
|
-
# Controls for how a thread will be truncated prior to the run. Use this to
|
|
262
|
-
# control the initial context window of the run.
|
|
263
|
-
#
|
|
264
|
-
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
265
|
-
#
|
|
266
|
-
# @return [OpenAI::Models::Beta::Threads::Run]
|
|
267
|
-
#
|
|
268
|
-
# @see OpenAI::Models::Beta::ThreadCreateAndRunParams
|
|
269
|
-
def create_and_run(params)
|
|
270
|
-
parsed, options = OpenAI::Beta::ThreadCreateAndRunParams.dump_request(params)
|
|
271
|
-
if parsed[:stream]
|
|
272
|
-
message = "Please use `#stream_raw` for the streaming use case."
|
|
273
|
-
raise ArgumentError.new(message)
|
|
274
|
-
end
|
|
275
|
-
|
|
276
|
-
@client.request(
|
|
277
|
-
method: :post,
|
|
278
|
-
path: "threads/runs",
|
|
279
|
-
headers: {"openai-beta" => "assistants=v2"},
|
|
280
|
-
body: parsed,
|
|
281
|
-
model: OpenAI::Beta::Threads::Run,
|
|
282
|
-
security: {bearer_auth: true},
|
|
283
|
-
options: options
|
|
284
|
-
)
|
|
285
|
-
end
|
|
286
|
-
|
|
287
|
-
def stream
|
|
288
|
-
raise NotImplementedError.new("higher level helpers are coming soon!")
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
# @deprecated The Assistants API is deprecated in favor of the Responses API
|
|
292
|
-
#
|
|
293
|
-
# See {OpenAI::Resources::Beta::Threads#create_and_run} for non-streaming
|
|
294
|
-
# counterpart.
|
|
295
|
-
#
|
|
296
|
-
# Create a thread and run it in one request.
|
|
297
|
-
#
|
|
298
|
-
# @overload stream_raw(assistant_id:, instructions: nil, max_completion_tokens: nil, max_prompt_tokens: nil, metadata: nil, model: nil, parallel_tool_calls: nil, response_format: nil, temperature: nil, thread: nil, tool_choice: nil, tool_resources: nil, tools: nil, top_p: nil, truncation_strategy: nil, request_options: {})
|
|
299
|
-
#
|
|
300
|
-
# @param assistant_id [String]
|
|
301
|
-
# The ID of the
|
|
302
|
-
# [assistant](https://developers.openai.com/api/docs/assistants/migration) to use
|
|
303
|
-
# to execute this run.
|
|
304
|
-
#
|
|
305
|
-
# @param instructions [String, nil]
|
|
306
|
-
# Override the default system message of the assistant. This is useful for
|
|
307
|
-
# modifying the behavior on a per-run basis.
|
|
308
|
-
#
|
|
309
|
-
# @param max_completion_tokens [Integer, nil]
|
|
310
|
-
# The maximum number of completion tokens that may be used over the course of the
|
|
311
|
-
# run. The run will make a best effort to use only the number of completion tokens
|
|
312
|
-
# specified, across multiple turns of the run. If the run exceeds the number of
|
|
313
|
-
# completion tokens specified, the run will end with status `incomplete`. See
|
|
314
|
-
# `incomplete_details` for more info.
|
|
315
|
-
#
|
|
316
|
-
# @param max_prompt_tokens [Integer, nil]
|
|
317
|
-
# The maximum number of prompt tokens that may be used over the course of the run.
|
|
318
|
-
# The run will make a best effort to use only the number of prompt tokens
|
|
319
|
-
# specified, across multiple turns of the run. If the run exceeds the number of
|
|
320
|
-
# prompt tokens specified, the run will end with status `incomplete`. See
|
|
321
|
-
# `incomplete_details` for more info.
|
|
322
|
-
#
|
|
323
|
-
# @param metadata [Hash{Symbol=>String}, nil]
|
|
324
|
-
# Set of 16 key-value pairs that can be attached to an object. This can be useful
|
|
325
|
-
# for storing additional information about the object in a structured format, and
|
|
326
|
-
# querying for objects via API or the dashboard.
|
|
327
|
-
#
|
|
328
|
-
# Keys are strings with a maximum length of 64 characters. Values are strings with
|
|
329
|
-
# a maximum length of 512 characters.
|
|
330
|
-
#
|
|
331
|
-
# @param model [String, Symbol, OpenAI::Models::ChatModel, nil]
|
|
332
|
-
# The ID of the
|
|
333
|
-
# [Model](https://developers.openai.com/api/reference/resources/models) to be used
|
|
334
|
-
# to execute this run. If a value is provided here, it will override the model
|
|
335
|
-
# associated with the assistant. If not, the model associated with the assistant
|
|
336
|
-
# will be used.
|
|
337
|
-
#
|
|
338
|
-
# @param parallel_tool_calls [Boolean]
|
|
339
|
-
# Whether to enable
|
|
340
|
-
# [parallel function calling](https://developers.openai.com/api/docs/guides/function-calling#parallel-function-calling)
|
|
341
|
-
# during tool use.
|
|
342
|
-
#
|
|
343
|
-
# @param response_format [Symbol, :auto, OpenAI::Models::ResponseFormatText, OpenAI::Models::ResponseFormatJSONObject, OpenAI::Models::ResponseFormatJSONSchema, nil]
|
|
344
|
-
# Specifies the format that the model must output. Compatible with
|
|
345
|
-
# [GPT-4o](https://developers.openai.com/api/docs/models/gpt-4o),
|
|
346
|
-
# [GPT-4 Turbo](https://developers.openai.com/api/docs/models/gpt-4-turbo), and
|
|
347
|
-
# all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
|
|
348
|
-
#
|
|
349
|
-
# Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
|
|
350
|
-
# Outputs which ensures the model will match your supplied JSON schema. Learn more
|
|
351
|
-
# in the
|
|
352
|
-
# [Structured Outputs guide](https://developers.openai.com/api/docs/guides/structured-outputs).
|
|
353
|
-
#
|
|
354
|
-
# Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
|
|
355
|
-
# message the model generates is valid JSON.
|
|
356
|
-
#
|
|
357
|
-
# **Important:** when using JSON mode, you **must** also instruct the model to
|
|
358
|
-
# produce JSON yourself via a system or user message. Without this, the model may
|
|
359
|
-
# generate an unending stream of whitespace until the generation reaches the token
|
|
360
|
-
# limit, resulting in a long-running and seemingly "stuck" request. Also note that
|
|
361
|
-
# the message content may be partially cut off if `finish_reason="length"`, which
|
|
362
|
-
# indicates the generation exceeded `max_tokens` or the conversation exceeded the
|
|
363
|
-
# max context length.
|
|
364
|
-
#
|
|
365
|
-
# @param temperature [Float, nil]
|
|
366
|
-
# What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
367
|
-
# make the output more random, while lower values like 0.2 will make it more
|
|
368
|
-
# focused and deterministic.
|
|
369
|
-
#
|
|
370
|
-
# @param thread [OpenAI::Models::Beta::ThreadCreateAndRunParams::Thread]
|
|
371
|
-
# Options to create a new thread. If no thread is provided when running a request,
|
|
372
|
-
# an empty thread will be created.
|
|
373
|
-
#
|
|
374
|
-
# @param tool_choice [Symbol, OpenAI::Models::Beta::AssistantToolChoiceOption::Auto, OpenAI::Models::Beta::AssistantToolChoice, nil]
|
|
375
|
-
# Controls which (if any) tool is called by the model. `none` means the model will
|
|
376
|
-
# not call any tools and instead generates a message. `auto` is the default value
|
|
377
|
-
# and means the model can pick between generating a message or calling one or more
|
|
378
|
-
# tools. `required` means the model must call one or more tools before responding
|
|
379
|
-
# to the user. Specifying a particular tool like `{"type": "file_search"}` or
|
|
380
|
-
# `{"type": "function", "function": {"name": "my_function"}}` forces the model to
|
|
381
|
-
# call that tool.
|
|
382
|
-
#
|
|
383
|
-
# @param tool_resources [OpenAI::Models::Beta::ThreadCreateAndRunParams::ToolResources, nil]
|
|
384
|
-
# A set of resources that are used by the assistant's tools. The resources are
|
|
385
|
-
# specific to the type of tool. For example, the `code_interpreter` tool requires
|
|
386
|
-
# a list of file IDs, while the `file_search` tool requires a list of vector store
|
|
387
|
-
# IDs.
|
|
388
|
-
#
|
|
389
|
-
# @param tools [Array<OpenAI::Models::Beta::CodeInterpreterTool, OpenAI::Models::Beta::FileSearchTool, OpenAI::Models::Beta::FunctionTool>, nil]
|
|
390
|
-
# Override the tools the assistant can use for this run. This is useful for
|
|
391
|
-
# modifying the behavior on a per-run basis.
|
|
392
|
-
#
|
|
393
|
-
# @param top_p [Float, nil]
|
|
394
|
-
# An alternative to sampling with temperature, called nucleus sampling, where the
|
|
395
|
-
# model considers the results of the tokens with top_p probability mass. So 0.1
|
|
396
|
-
# means only the tokens comprising the top 10% probability mass are considered.
|
|
397
|
-
#
|
|
398
|
-
# We generally recommend altering this or temperature but not both.
|
|
399
|
-
#
|
|
400
|
-
# @param truncation_strategy [OpenAI::Models::Beta::ThreadCreateAndRunParams::TruncationStrategy, nil]
|
|
401
|
-
# Controls for how a thread will be truncated prior to the run. Use this to
|
|
402
|
-
# control the initial context window of the run.
|
|
403
|
-
#
|
|
404
|
-
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
405
|
-
#
|
|
406
|
-
# @return [OpenAI::Internal::Stream<OpenAI::Models::Beta::AssistantStreamEvent::ThreadCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunQueued, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunInProgress, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunRequiresAction, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCompleted, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunIncomplete, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunFailed, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCancelling, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunCancelled, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunExpired, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepInProgress, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepDelta, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepCompleted, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepFailed, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepCancelled, OpenAI::Models::Beta::AssistantStreamEvent::ThreadRunStepExpired, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageCreated, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageInProgress, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageDelta, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageCompleted, OpenAI::Models::Beta::AssistantStreamEvent::ThreadMessageIncomplete, OpenAI::Models::Beta::AssistantStreamEvent::ErrorEvent>]
|
|
407
|
-
#
|
|
408
|
-
# @see OpenAI::Models::Beta::ThreadCreateAndRunParams
|
|
409
|
-
def stream_raw(params)
|
|
410
|
-
parsed, options = OpenAI::Beta::ThreadCreateAndRunParams.dump_request(params)
|
|
411
|
-
unless parsed.fetch(:stream, true)
|
|
412
|
-
message = "Please use `#create_and_run` for the non-streaming use case."
|
|
413
|
-
raise ArgumentError.new(message)
|
|
414
|
-
end
|
|
415
|
-
|
|
416
|
-
parsed.store(:stream, true)
|
|
417
|
-
@client.request(
|
|
418
|
-
method: :post,
|
|
419
|
-
path: "threads/runs",
|
|
420
|
-
headers: {
|
|
421
|
-
"openai-beta" => "assistants=v2",
|
|
422
|
-
"accept" => "text/event-stream",
|
|
423
|
-
"accept-encoding" => "identity"
|
|
424
|
-
},
|
|
425
|
-
body: parsed,
|
|
426
|
-
stream: OpenAI::Internal::Stream,
|
|
427
|
-
model: OpenAI::Beta::AssistantStreamEvent,
|
|
428
|
-
security: {bearer_auth: true},
|
|
429
|
-
options: options
|
|
430
|
-
)
|
|
431
|
-
end
|
|
432
|
-
|
|
433
|
-
# @api private
|
|
434
|
-
#
|
|
435
|
-
# @param client [OpenAI::Client]
|
|
436
|
-
def initialize(client:)
|
|
437
|
-
@client = client
|
|
438
|
-
@runs = OpenAI::Resources::Beta::Threads::Runs.new(client: client)
|
|
439
|
-
@messages = OpenAI::Resources::Beta::Threads::Messages.new(client: client)
|
|
440
|
-
end
|
|
441
|
-
end
|
|
442
|
-
end
|
|
443
|
-
end
|
|
444
|
-
end
|