├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml ├── pull_request_template.md └── workflows │ ├── ci.yml │ ├── create-releases.yml │ ├── publish-pypi.yml │ └── release-doctor.yml ├── .gitignore ├── .inline-snapshot └── external │ ├── .gitignore │ ├── 173417d553406f034f643e5db3f8d591fb691ebac56f5ae39a22cc7d455c5353.bin │ ├── 2018feb66ae13fcf5333d61b95849decc68d3f63bd38172889367e1afb1e04f7.bin │ ├── 4cc50a6135d254573a502310e6af1246f55edb6ad95fa24059f160996b68866d.bin │ ├── 569c877e69429d4cbc1577d2cd6dd33878095c68badc6b6654a69769b391a1c1.bin │ ├── 7e5ea4d12e7cc064399b6631415e65923f182256b6e6b752950a3aaa2ad2320a.bin │ ├── 83b060bae42eb41c4f1edbb7c1542b954b37d9dfd1910b964ddebc9677e6ae85.bin │ ├── a247c49c5fcd492bfb7a02a3306ad615ed8d8f649888ebfddfbc3ee151f44d46.bin │ ├── a491adda08c3d4fde95f5b2ee3f60f7f745f1a56d82e62f58031cc2add502380.bin │ ├── c6aa7e397b7123c3501f25df3a05d4daf7e8ad6d61ffa406ab5361fe36a8d5b1.bin │ ├── d615580118391ee13492193e3a8bb74642d23ac1ca13fe37cb6e889b66f759f6.bin │ ├── e2aad469b71d1d4894ff833ea147020a9d875eb7ce644a0ff355581690a4cbfd.bin │ └── f82268f2fefd5cfbc7eeb59c297688be2f6ca0849a6e4f17851b517310841d9b.bin ├── .python-version ├── .release-please-manifest.json ├── .stats.yml ├── Brewfile ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── api.md ├── bin ├── check-release-environment └── publish-pypi ├── examples ├── .keep ├── assistant.py ├── assistant_stream.py ├── assistant_stream_helpers.py ├── async_demo.py ├── audio.py ├── azure.py ├── azure_ad.py ├── demo.py ├── generate_file.sh ├── module_client.py ├── parsing.py ├── parsing_stream.py ├── parsing_tools.py ├── parsing_tools_stream.py ├── picture.py ├── realtime │ ├── audio_util.py │ ├── azure_realtime.py │ └── push_to_talk_app.py ├── responses │ ├── __init__.py │ ├── background.py │ ├── background_async.py │ ├── background_streaming.py │ ├── background_streaming_async.py │ ├── streaming.py │ ├── streaming_tools.py │ ├── structured_outputs.py │ └── structured_outputs_tools.py ├── speech_to_text.py ├── streaming.py ├── text_to_speech.py └── uploads.py ├── helpers.md ├── mypy.ini ├── noxfile.py ├── pyproject.toml ├── release-please-config.json ├── requirements-dev.lock ├── requirements.lock ├── scripts ├── bootstrap ├── format ├── lint ├── mock ├── test └── utils │ ├── ruffen-docs.py │ └── upload-artifact.sh ├── src └── openai │ ├── __init__.py │ ├── __main__.py │ ├── _base_client.py │ ├── _client.py │ ├── _compat.py │ ├── _constants.py │ ├── _exceptions.py │ ├── _extras │ ├── __init__.py │ ├── _common.py │ ├── numpy_proxy.py │ ├── pandas_proxy.py │ └── sounddevice_proxy.py │ ├── _files.py │ ├── _legacy_response.py │ ├── _models.py │ ├── _module_client.py │ ├── _qs.py │ ├── _resource.py │ ├── _response.py │ ├── _streaming.py │ ├── _types.py │ ├── _utils │ ├── __init__.py │ ├── _logs.py │ ├── _proxy.py │ ├── _reflection.py │ ├── _resources_proxy.py │ ├── _streams.py │ ├── _sync.py │ ├── _transform.py │ ├── _typing.py │ └── _utils.py │ ├── _version.py │ ├── cli │ ├── __init__.py │ ├── _api │ │ ├── __init__.py │ │ ├── _main.py │ │ ├── audio.py │ │ ├── chat │ │ │ ├── __init__.py │ │ │ └── completions.py │ │ ├── completions.py │ │ ├── files.py │ │ ├── image.py │ │ └── models.py │ ├── _cli.py │ ├── _errors.py │ ├── _models.py │ ├── _progress.py │ ├── _tools │ │ ├── __init__.py │ │ ├── _main.py │ │ ├── fine_tunes.py │ │ └── migrate.py │ └── _utils.py │ ├── helpers │ ├── __init__.py │ ├── local_audio_player.py │ └── microphone.py │ ├── lib │ ├── .keep │ ├── __init__.py │ ├── _old_api.py │ ├── _parsing │ │ ├── __init__.py │ │ ├── _completions.py │ │ └── _responses.py │ ├── _pydantic.py │ ├── _tools.py │ ├── _validators.py │ ├── azure.py │ └── streaming │ │ ├── __init__.py │ │ ├── _assistants.py │ │ ├── _deltas.py │ │ ├── chat │ │ ├── __init__.py │ │ ├── _completions.py │ │ ├── _events.py │ │ └── _types.py │ │ └── responses │ │ ├── __init__.py │ │ ├── _events.py │ │ ├── _responses.py │ │ └── _types.py │ ├── pagination.py │ ├── py.typed │ ├── resources │ ├── __init__.py │ ├── audio │ │ ├── __init__.py │ │ ├── audio.py │ │ ├── speech.py │ │ ├── transcriptions.py │ │ └── translations.py │ ├── batches.py │ ├── beta │ │ ├── __init__.py │ │ ├── assistants.py │ │ ├── beta.py │ │ ├── chat │ │ │ ├── __init__.py │ │ │ ├── chat.py │ │ │ └── completions.py │ │ ├── realtime │ │ │ ├── __init__.py │ │ │ ├── realtime.py │ │ │ ├── sessions.py │ │ │ └── transcription_sessions.py │ │ └── threads │ │ │ ├── __init__.py │ │ │ ├── messages.py │ │ │ ├── runs │ │ │ ├── __init__.py │ │ │ ├── runs.py │ │ │ └── steps.py │ │ │ └── threads.py │ ├── chat │ │ ├── __init__.py │ │ ├── chat.py │ │ └── completions │ │ │ ├── __init__.py │ │ │ ├── completions.py │ │ │ └── messages.py │ ├── completions.py │ ├── containers │ │ ├── __init__.py │ │ ├── containers.py │ │ └── files │ │ │ ├── __init__.py │ │ │ ├── content.py │ │ │ └── files.py │ ├── embeddings.py │ ├── evals │ │ ├── __init__.py │ │ ├── evals.py │ │ └── runs │ │ │ ├── __init__.py │ │ │ ├── output_items.py │ │ │ └── runs.py │ ├── files.py │ ├── fine_tuning │ │ ├── __init__.py │ │ ├── alpha │ │ │ ├── __init__.py │ │ │ ├── alpha.py │ │ │ └── graders.py │ │ ├── checkpoints │ │ │ ├── __init__.py │ │ │ ├── checkpoints.py │ │ │ └── permissions.py │ │ ├── fine_tuning.py │ │ └── jobs │ │ │ ├── __init__.py │ │ │ ├── checkpoints.py │ │ │ └── jobs.py │ ├── images.py │ ├── models.py │ ├── moderations.py │ ├── responses │ │ ├── __init__.py │ │ ├── input_items.py │ │ └── responses.py │ ├── uploads │ │ ├── __init__.py │ │ ├── parts.py │ │ └── uploads.py │ └── vector_stores │ │ ├── __init__.py │ │ ├── file_batches.py │ │ ├── files.py │ │ └── vector_stores.py │ ├── types │ ├── __init__.py │ ├── audio │ │ ├── __init__.py │ │ ├── speech_create_params.py │ │ ├── speech_model.py │ │ ├── transcription.py │ │ ├── transcription_create_params.py │ │ ├── transcription_create_response.py │ │ ├── transcription_include.py │ │ ├── transcription_segment.py │ │ ├── transcription_stream_event.py │ │ ├── transcription_text_delta_event.py │ │ ├── transcription_text_done_event.py │ │ ├── transcription_verbose.py │ │ ├── transcription_word.py │ │ ├── translation.py │ │ ├── translation_create_params.py │ │ ├── translation_create_response.py │ │ └── translation_verbose.py │ ├── audio_model.py │ ├── audio_response_format.py │ ├── auto_file_chunking_strategy_param.py │ ├── batch.py │ ├── batch_create_params.py │ ├── batch_error.py │ ├── batch_list_params.py │ ├── batch_request_counts.py │ ├── beta │ │ ├── __init__.py │ │ ├── assistant.py │ │ ├── assistant_create_params.py │ │ ├── assistant_deleted.py │ │ ├── assistant_list_params.py │ │ ├── assistant_response_format_option.py │ │ ├── assistant_response_format_option_param.py │ │ ├── assistant_stream_event.py │ │ ├── assistant_tool.py │ │ ├── assistant_tool_choice.py │ │ ├── assistant_tool_choice_function.py │ │ ├── assistant_tool_choice_function_param.py │ │ ├── assistant_tool_choice_option.py │ │ ├── assistant_tool_choice_option_param.py │ │ ├── assistant_tool_choice_param.py │ │ ├── assistant_tool_param.py │ │ ├── assistant_update_params.py │ │ ├── chat │ │ │ └── __init__.py │ │ ├── code_interpreter_tool.py │ │ ├── code_interpreter_tool_param.py │ │ ├── file_search_tool.py │ │ ├── file_search_tool_param.py │ │ ├── function_tool.py │ │ ├── function_tool_param.py │ │ ├── realtime │ │ │ ├── __init__.py │ │ │ ├── conversation_created_event.py │ │ │ ├── conversation_item.py │ │ │ ├── conversation_item_content.py │ │ │ ├── conversation_item_content_param.py │ │ │ ├── conversation_item_create_event.py │ │ │ ├── conversation_item_create_event_param.py │ │ │ ├── conversation_item_created_event.py │ │ │ ├── conversation_item_delete_event.py │ │ │ ├── conversation_item_delete_event_param.py │ │ │ ├── conversation_item_deleted_event.py │ │ │ ├── conversation_item_input_audio_transcription_completed_event.py │ │ │ ├── conversation_item_input_audio_transcription_delta_event.py │ │ │ ├── conversation_item_input_audio_transcription_failed_event.py │ │ │ ├── conversation_item_param.py │ │ │ ├── conversation_item_retrieve_event.py │ │ │ ├── conversation_item_retrieve_event_param.py │ │ │ ├── conversation_item_truncate_event.py │ │ │ ├── conversation_item_truncate_event_param.py │ │ │ ├── conversation_item_truncated_event.py │ │ │ ├── conversation_item_with_reference.py │ │ │ ├── conversation_item_with_reference_param.py │ │ │ ├── error_event.py │ │ │ ├── input_audio_buffer_append_event.py │ │ │ ├── input_audio_buffer_append_event_param.py │ │ │ ├── input_audio_buffer_clear_event.py │ │ │ ├── input_audio_buffer_clear_event_param.py │ │ │ ├── input_audio_buffer_cleared_event.py │ │ │ ├── input_audio_buffer_commit_event.py │ │ │ ├── input_audio_buffer_commit_event_param.py │ │ │ ├── input_audio_buffer_committed_event.py │ │ │ ├── input_audio_buffer_speech_started_event.py │ │ │ ├── input_audio_buffer_speech_stopped_event.py │ │ │ ├── rate_limits_updated_event.py │ │ │ ├── realtime_client_event.py │ │ │ ├── realtime_client_event_param.py │ │ │ ├── realtime_connect_params.py │ │ │ ├── realtime_response.py │ │ │ ├── realtime_response_status.py │ │ │ ├── realtime_response_usage.py │ │ │ ├── realtime_server_event.py │ │ │ ├── response_audio_delta_event.py │ │ │ ├── response_audio_done_event.py │ │ │ ├── response_audio_transcript_delta_event.py │ │ │ ├── response_audio_transcript_done_event.py │ │ │ ├── response_cancel_event.py │ │ │ ├── response_cancel_event_param.py │ │ │ ├── response_content_part_added_event.py │ │ │ ├── response_content_part_done_event.py │ │ │ ├── response_create_event.py │ │ │ ├── response_create_event_param.py │ │ │ ├── response_created_event.py │ │ │ ├── response_done_event.py │ │ │ ├── response_function_call_arguments_delta_event.py │ │ │ ├── response_function_call_arguments_done_event.py │ │ │ ├── response_output_item_added_event.py │ │ │ ├── response_output_item_done_event.py │ │ │ ├── response_text_delta_event.py │ │ │ ├── response_text_done_event.py │ │ │ ├── session.py │ │ │ ├── session_create_params.py │ │ │ ├── session_create_response.py │ │ │ ├── session_created_event.py │ │ │ ├── session_update_event.py │ │ │ ├── session_update_event_param.py │ │ │ ├── session_updated_event.py │ │ │ ├── transcription_session.py │ │ │ ├── transcription_session_create_params.py │ │ │ ├── transcription_session_update.py │ │ │ ├── transcription_session_update_param.py │ │ │ └── transcription_session_updated_event.py │ │ ├── thread.py │ │ ├── thread_create_and_run_params.py │ │ ├── thread_create_params.py │ │ ├── thread_deleted.py │ │ ├── thread_update_params.py │ │ └── threads │ │ │ ├── __init__.py │ │ │ ├── annotation.py │ │ │ ├── annotation_delta.py │ │ │ ├── file_citation_annotation.py │ │ │ ├── file_citation_delta_annotation.py │ │ │ ├── file_path_annotation.py │ │ │ ├── file_path_delta_annotation.py │ │ │ ├── image_file.py │ │ │ ├── image_file_content_block.py │ │ │ ├── image_file_content_block_param.py │ │ │ ├── image_file_delta.py │ │ │ ├── image_file_delta_block.py │ │ │ ├── image_file_param.py │ │ │ ├── image_url.py │ │ │ ├── image_url_content_block.py │ │ │ ├── image_url_content_block_param.py │ │ │ ├── image_url_delta.py │ │ │ ├── image_url_delta_block.py │ │ │ ├── image_url_param.py │ │ │ ├── message.py │ │ │ ├── message_content.py │ │ │ ├── message_content_delta.py │ │ │ ├── message_content_part_param.py │ │ │ ├── message_create_params.py │ │ │ ├── message_deleted.py │ │ │ ├── message_delta.py │ │ │ ├── message_delta_event.py │ │ │ ├── message_list_params.py │ │ │ ├── message_update_params.py │ │ │ ├── refusal_content_block.py │ │ │ ├── refusal_delta_block.py │ │ │ ├── required_action_function_tool_call.py │ │ │ ├── run.py │ │ │ ├── run_create_params.py │ │ │ ├── run_list_params.py │ │ │ ├── run_status.py │ │ │ ├── run_submit_tool_outputs_params.py │ │ │ ├── run_update_params.py │ │ │ ├── runs │ │ │ ├── __init__.py │ │ │ ├── code_interpreter_logs.py │ │ │ ├── code_interpreter_output_image.py │ │ │ ├── code_interpreter_tool_call.py │ │ │ ├── code_interpreter_tool_call_delta.py │ │ │ ├── file_search_tool_call.py │ │ │ ├── file_search_tool_call_delta.py │ │ │ ├── function_tool_call.py │ │ │ ├── function_tool_call_delta.py │ │ │ ├── message_creation_step_details.py │ │ │ ├── run_step.py │ │ │ ├── run_step_delta.py │ │ │ ├── run_step_delta_event.py │ │ │ ├── run_step_delta_message_delta.py │ │ │ ├── run_step_include.py │ │ │ ├── step_list_params.py │ │ │ ├── step_retrieve_params.py │ │ │ ├── tool_call.py │ │ │ ├── tool_call_delta.py │ │ │ ├── tool_call_delta_object.py │ │ │ └── tool_calls_step_details.py │ │ │ ├── text.py │ │ │ ├── text_content_block.py │ │ │ ├── text_content_block_param.py │ │ │ ├── text_delta.py │ │ │ └── text_delta_block.py │ ├── chat │ │ ├── __init__.py │ │ ├── chat_completion.py │ │ ├── chat_completion_assistant_message_param.py │ │ ├── chat_completion_audio.py │ │ ├── chat_completion_audio_param.py │ │ ├── chat_completion_chunk.py │ │ ├── chat_completion_content_part_image_param.py │ │ ├── chat_completion_content_part_input_audio_param.py │ │ ├── chat_completion_content_part_param.py │ │ ├── chat_completion_content_part_refusal_param.py │ │ ├── chat_completion_content_part_text_param.py │ │ ├── chat_completion_deleted.py │ │ ├── chat_completion_developer_message_param.py │ │ ├── chat_completion_function_call_option_param.py │ │ ├── chat_completion_function_message_param.py │ │ ├── chat_completion_message.py │ │ ├── chat_completion_message_param.py │ │ ├── chat_completion_message_tool_call.py │ │ ├── chat_completion_message_tool_call_param.py │ │ ├── chat_completion_modality.py │ │ ├── chat_completion_named_tool_choice_param.py │ │ ├── chat_completion_prediction_content_param.py │ │ ├── chat_completion_reasoning_effort.py │ │ ├── chat_completion_role.py │ │ ├── chat_completion_store_message.py │ │ ├── chat_completion_stream_options_param.py │ │ ├── chat_completion_system_message_param.py │ │ ├── chat_completion_token_logprob.py │ │ ├── chat_completion_tool_choice_option_param.py │ │ ├── chat_completion_tool_message_param.py │ │ ├── chat_completion_tool_param.py │ │ ├── chat_completion_user_message_param.py │ │ ├── completion_create_params.py │ │ ├── completion_list_params.py │ │ ├── completion_update_params.py │ │ ├── completions │ │ │ ├── __init__.py │ │ │ └── message_list_params.py │ │ ├── parsed_chat_completion.py │ │ └── parsed_function_tool_call.py │ ├── chat_model.py │ ├── completion.py │ ├── completion_choice.py │ ├── completion_create_params.py │ ├── completion_usage.py │ ├── container_create_params.py │ ├── container_create_response.py │ ├── container_list_params.py │ ├── container_list_response.py │ ├── container_retrieve_response.py │ ├── containers │ │ ├── __init__.py │ │ ├── file_create_params.py │ │ ├── file_create_response.py │ │ ├── file_list_params.py │ │ ├── file_list_response.py │ │ ├── file_retrieve_response.py │ │ └── files │ │ │ └── __init__.py │ ├── create_embedding_response.py │ ├── embedding.py │ ├── embedding_create_params.py │ ├── embedding_model.py │ ├── eval_create_params.py │ ├── eval_create_response.py │ ├── eval_custom_data_source_config.py │ ├── eval_delete_response.py │ ├── eval_list_params.py │ ├── eval_list_response.py │ ├── eval_retrieve_response.py │ ├── eval_stored_completions_data_source_config.py │ ├── eval_update_params.py │ ├── eval_update_response.py │ ├── evals │ │ ├── __init__.py │ │ ├── create_eval_completions_run_data_source.py │ │ ├── create_eval_completions_run_data_source_param.py │ │ ├── create_eval_jsonl_run_data_source.py │ │ ├── create_eval_jsonl_run_data_source_param.py │ │ ├── eval_api_error.py │ │ ├── run_cancel_response.py │ │ ├── run_create_params.py │ │ ├── run_create_response.py │ │ ├── run_delete_response.py │ │ ├── run_list_params.py │ │ ├── run_list_response.py │ │ ├── run_retrieve_response.py │ │ └── runs │ │ │ ├── __init__.py │ │ │ ├── output_item_list_params.py │ │ │ ├── output_item_list_response.py │ │ │ └── output_item_retrieve_response.py │ ├── file_chunking_strategy.py │ ├── file_chunking_strategy_param.py │ ├── file_content.py │ ├── file_create_params.py │ ├── file_deleted.py │ ├── file_list_params.py │ ├── file_object.py │ ├── file_purpose.py │ ├── fine_tuning │ │ ├── __init__.py │ │ ├── alpha │ │ │ ├── __init__.py │ │ │ ├── grader_run_params.py │ │ │ ├── grader_run_response.py │ │ │ ├── grader_validate_params.py │ │ │ └── grader_validate_response.py │ │ ├── checkpoints │ │ │ ├── __init__.py │ │ │ ├── permission_create_params.py │ │ │ ├── permission_create_response.py │ │ │ ├── permission_delete_response.py │ │ │ ├── permission_retrieve_params.py │ │ │ └── permission_retrieve_response.py │ │ ├── dpo_hyperparameters.py │ │ ├── dpo_hyperparameters_param.py │ │ ├── dpo_method.py │ │ ├── dpo_method_param.py │ │ ├── fine_tuning_job.py │ │ ├── fine_tuning_job_event.py │ │ ├── fine_tuning_job_integration.py │ │ ├── fine_tuning_job_wandb_integration.py │ │ ├── fine_tuning_job_wandb_integration_object.py │ │ ├── job_create_params.py │ │ ├── job_list_events_params.py │ │ ├── job_list_params.py │ │ ├── jobs │ │ │ ├── __init__.py │ │ │ ├── checkpoint_list_params.py │ │ │ └── fine_tuning_job_checkpoint.py │ │ ├── reinforcement_hyperparameters.py │ │ ├── reinforcement_hyperparameters_param.py │ │ ├── reinforcement_method.py │ │ ├── reinforcement_method_param.py │ │ ├── supervised_hyperparameters.py │ │ ├── supervised_hyperparameters_param.py │ │ ├── supervised_method.py │ │ └── supervised_method_param.py │ ├── graders │ │ ├── __init__.py │ │ ├── label_model_grader.py │ │ ├── label_model_grader_param.py │ │ ├── multi_grader.py │ │ ├── multi_grader_param.py │ │ ├── python_grader.py │ │ ├── python_grader_param.py │ │ ├── score_model_grader.py │ │ ├── score_model_grader_param.py │ │ ├── string_check_grader.py │ │ ├── string_check_grader_param.py │ │ ├── text_similarity_grader.py │ │ └── text_similarity_grader_param.py │ ├── image.py │ ├── image_create_variation_params.py │ ├── image_edit_params.py │ ├── image_generate_params.py │ ├── image_model.py │ ├── images_response.py │ ├── model.py │ ├── model_deleted.py │ ├── moderation.py │ ├── moderation_create_params.py │ ├── moderation_create_response.py │ ├── moderation_image_url_input_param.py │ ├── moderation_model.py │ ├── moderation_multi_modal_input_param.py │ ├── moderation_text_input_param.py │ ├── other_file_chunking_strategy_object.py │ ├── responses │ │ ├── __init__.py │ │ ├── computer_tool.py │ │ ├── computer_tool_param.py │ │ ├── easy_input_message.py │ │ ├── easy_input_message_param.py │ │ ├── file_search_tool.py │ │ ├── file_search_tool_param.py │ │ ├── function_tool.py │ │ ├── function_tool_param.py │ │ ├── input_item_list_params.py │ │ ├── parsed_response.py │ │ ├── response.py │ │ ├── response_audio_delta_event.py │ │ ├── response_audio_done_event.py │ │ ├── response_audio_transcript_delta_event.py │ │ ├── response_audio_transcript_done_event.py │ │ ├── response_code_interpreter_call_code_delta_event.py │ │ ├── response_code_interpreter_call_code_done_event.py │ │ ├── response_code_interpreter_call_completed_event.py │ │ ├── response_code_interpreter_call_in_progress_event.py │ │ ├── response_code_interpreter_call_interpreting_event.py │ │ ├── response_code_interpreter_tool_call.py │ │ ├── response_code_interpreter_tool_call_param.py │ │ ├── response_completed_event.py │ │ ├── response_computer_tool_call.py │ │ ├── response_computer_tool_call_output_item.py │ │ ├── response_computer_tool_call_output_screenshot.py │ │ ├── response_computer_tool_call_output_screenshot_param.py │ │ ├── response_computer_tool_call_param.py │ │ ├── response_content_part_added_event.py │ │ ├── response_content_part_done_event.py │ │ ├── response_create_params.py │ │ ├── response_created_event.py │ │ ├── response_error.py │ │ ├── response_error_event.py │ │ ├── response_failed_event.py │ │ ├── response_file_search_call_completed_event.py │ │ ├── response_file_search_call_in_progress_event.py │ │ ├── response_file_search_call_searching_event.py │ │ ├── response_file_search_tool_call.py │ │ ├── response_file_search_tool_call_param.py │ │ ├── response_format_text_config.py │ │ ├── response_format_text_config_param.py │ │ ├── response_format_text_json_schema_config.py │ │ ├── response_format_text_json_schema_config_param.py │ │ ├── response_function_call_arguments_delta_event.py │ │ ├── response_function_call_arguments_done_event.py │ │ ├── response_function_tool_call.py │ │ ├── response_function_tool_call_item.py │ │ ├── response_function_tool_call_output_item.py │ │ ├── response_function_tool_call_param.py │ │ ├── response_function_web_search.py │ │ ├── response_function_web_search_param.py │ │ ├── response_image_gen_call_completed_event.py │ │ ├── response_image_gen_call_generating_event.py │ │ ├── response_image_gen_call_in_progress_event.py │ │ ├── response_image_gen_call_partial_image_event.py │ │ ├── response_in_progress_event.py │ │ ├── response_includable.py │ │ ├── response_incomplete_event.py │ │ ├── response_input_content.py │ │ ├── response_input_content_param.py │ │ ├── response_input_file.py │ │ ├── response_input_file_param.py │ │ ├── response_input_image.py │ │ ├── response_input_image_param.py │ │ ├── response_input_item_param.py │ │ ├── response_input_message_content_list.py │ │ ├── response_input_message_content_list_param.py │ │ ├── response_input_message_item.py │ │ ├── response_input_param.py │ │ ├── response_input_text.py │ │ ├── response_input_text_param.py │ │ ├── response_item.py │ │ ├── response_item_list.py │ │ ├── response_mcp_call_arguments_delta_event.py │ │ ├── response_mcp_call_arguments_done_event.py │ │ ├── response_mcp_call_completed_event.py │ │ ├── response_mcp_call_failed_event.py │ │ ├── response_mcp_call_in_progress_event.py │ │ ├── response_mcp_list_tools_completed_event.py │ │ ├── response_mcp_list_tools_failed_event.py │ │ ├── response_mcp_list_tools_in_progress_event.py │ │ ├── response_output_item.py │ │ ├── response_output_item_added_event.py │ │ ├── response_output_item_done_event.py │ │ ├── response_output_message.py │ │ ├── response_output_message_param.py │ │ ├── response_output_refusal.py │ │ ├── response_output_refusal_param.py │ │ ├── response_output_text.py │ │ ├── response_output_text_annotation_added_event.py │ │ ├── response_output_text_param.py │ │ ├── response_queued_event.py │ │ ├── response_reasoning_delta_event.py │ │ ├── response_reasoning_done_event.py │ │ ├── response_reasoning_item.py │ │ ├── response_reasoning_item_param.py │ │ ├── response_reasoning_summary_delta_event.py │ │ ├── response_reasoning_summary_done_event.py │ │ ├── response_reasoning_summary_part_added_event.py │ │ ├── response_reasoning_summary_part_done_event.py │ │ ├── response_reasoning_summary_text_delta_event.py │ │ ├── response_reasoning_summary_text_done_event.py │ │ ├── response_refusal_delta_event.py │ │ ├── response_refusal_done_event.py │ │ ├── response_retrieve_params.py │ │ ├── response_status.py │ │ ├── response_stream_event.py │ │ ├── response_text_config.py │ │ ├── response_text_config_param.py │ │ ├── response_text_delta_event.py │ │ ├── response_text_done_event.py │ │ ├── response_usage.py │ │ ├── response_web_search_call_completed_event.py │ │ ├── response_web_search_call_in_progress_event.py │ │ ├── response_web_search_call_searching_event.py │ │ ├── tool.py │ │ ├── tool_choice_function.py │ │ ├── tool_choice_function_param.py │ │ ├── tool_choice_options.py │ │ ├── tool_choice_types.py │ │ ├── tool_choice_types_param.py │ │ ├── tool_param.py │ │ ├── web_search_tool.py │ │ └── web_search_tool_param.py │ ├── shared │ │ ├── __init__.py │ │ ├── all_models.py │ │ ├── chat_model.py │ │ ├── comparison_filter.py │ │ ├── compound_filter.py │ │ ├── error_object.py │ │ ├── function_definition.py │ │ ├── function_parameters.py │ │ ├── metadata.py │ │ ├── reasoning.py │ │ ├── reasoning_effort.py │ │ ├── response_format_json_object.py │ │ ├── response_format_json_schema.py │ │ ├── response_format_text.py │ │ └── responses_model.py │ ├── shared_params │ │ ├── __init__.py │ │ ├── chat_model.py │ │ ├── comparison_filter.py │ │ ├── compound_filter.py │ │ ├── function_definition.py │ │ ├── function_parameters.py │ │ ├── metadata.py │ │ ├── reasoning.py │ │ ├── reasoning_effort.py │ │ ├── response_format_json_object.py │ │ ├── response_format_json_schema.py │ │ ├── response_format_text.py │ │ └── responses_model.py │ ├── static_file_chunking_strategy.py │ ├── static_file_chunking_strategy_object.py │ ├── static_file_chunking_strategy_object_param.py │ ├── static_file_chunking_strategy_param.py │ ├── upload.py │ ├── upload_complete_params.py │ ├── upload_create_params.py │ ├── uploads │ │ ├── __init__.py │ │ ├── part_create_params.py │ │ └── upload_part.py │ ├── vector_store.py │ ├── vector_store_create_params.py │ ├── vector_store_deleted.py │ ├── vector_store_list_params.py │ ├── vector_store_search_params.py │ ├── vector_store_search_response.py │ ├── vector_store_update_params.py │ ├── vector_stores │ │ ├── __init__.py │ │ ├── file_batch_create_params.py │ │ ├── file_batch_list_files_params.py │ │ ├── file_content_response.py │ │ ├── file_create_params.py │ │ ├── file_list_params.py │ │ ├── file_update_params.py │ │ ├── vector_store_file.py │ │ ├── vector_store_file_batch.py │ │ └── vector_store_file_deleted.py │ └── websocket_connection_options.py │ └── version.py └── tests ├── __init__.py ├── api_resources ├── __init__.py ├── audio │ ├── __init__.py │ ├── test_speech.py │ ├── test_transcriptions.py │ └── test_translations.py ├── beta │ ├── __init__.py │ ├── realtime │ │ ├── __init__.py │ │ ├── test_sessions.py │ │ └── test_transcription_sessions.py │ ├── test_assistants.py │ ├── test_realtime.py │ ├── test_threads.py │ └── threads │ │ ├── __init__.py │ │ ├── runs │ │ ├── __init__.py │ │ └── test_steps.py │ │ ├── test_messages.py │ │ └── test_runs.py ├── chat │ ├── __init__.py │ ├── completions │ │ ├── __init__.py │ │ └── test_messages.py │ └── test_completions.py ├── containers │ ├── __init__.py │ ├── files │ │ ├── __init__.py │ │ └── test_content.py │ └── test_files.py ├── evals │ ├── __init__.py │ ├── runs │ │ ├── __init__.py │ │ └── test_output_items.py │ └── test_runs.py ├── fine_tuning │ ├── __init__.py │ ├── alpha │ │ ├── __init__.py │ │ └── test_graders.py │ ├── checkpoints │ │ ├── __init__.py │ │ └── test_permissions.py │ ├── jobs │ │ ├── __init__.py │ │ └── test_checkpoints.py │ └── test_jobs.py ├── responses │ ├── __init__.py │ └── test_input_items.py ├── test_batches.py ├── test_completions.py ├── test_containers.py ├── test_embeddings.py ├── test_evals.py ├── test_files.py ├── test_images.py ├── test_models.py ├── test_moderations.py ├── test_responses.py ├── test_uploads.py ├── test_vector_stores.py ├── uploads │ ├── __init__.py │ └── test_parts.py └── vector_stores │ ├── __init__.py │ ├── test_file_batches.py │ └── test_files.py ├── conftest.py ├── lib ├── __init__.py ├── chat │ ├── __init__.py │ ├── _utils.py │ ├── test_completions.py │ └── test_completions_streaming.py ├── schema_types │ └── query.py ├── test_assistants.py ├── test_audio.py ├── test_azure.py ├── test_old_api.py └── test_pydantic.py ├── sample_file.txt ├── test_client.py ├── test_deepcopy.py ├── test_extract_files.py ├── test_files.py ├── test_legacy_response.py ├── test_models.py ├── test_module_client.py ├── test_qs.py ├── test_required_args.py ├── test_response.py ├── test_streaming.py ├── test_transform.py ├── test_utils ├── test_logging.py ├── test_proxy.py └── test_typing.py └── utils.py /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="3.9" 2 | FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} 3 | 4 | USER vscode 5 | 6 | RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash 7 | ENV PATH=/home/vscode/.rye/shims:$PATH 8 | 9 | RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc 10 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This file is used to automatically assign reviewers to PRs 2 | # For more information see: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 3 | 4 | * @openai/sdks-team 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: OpenAI support 4 | url: https://help.openai.com/ 5 | about: | 6 | Please only file issues here that you believe represent actual bugs or feature requests for the OpenAI Python library. 7 | If you're having general trouble with the OpenAI API, please visit our help center to get support. 8 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | - [ ] I understand that this repository is auto-generated and my pull request may not be merged 7 | 8 | ## Changes being requested 9 | 10 | ## Additional context & links 11 | -------------------------------------------------------------------------------- /.github/workflows/release-doctor.yml: -------------------------------------------------------------------------------- 1 | name: Release Doctor 2 | on: 3 | push: 4 | branches: 5 | - main 6 | workflow_dispatch: 7 | 8 | jobs: 9 | release_doctor: 10 | name: release doctor 11 | runs-on: ubuntu-latest 12 | environment: publish 13 | if: github.repository == 'openai/openai-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | 18 | - name: Check release environment 19 | run: | 20 | bash ./bin/check-release-environment 21 | env: 22 | STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }} 23 | PYPI_TOKEN: ${{ secrets.OPENAI_PYPI_TOKEN || secrets.PYPI_TOKEN }} 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .prism.log 2 | .vscode 3 | _dev 4 | 5 | __pycache__ 6 | .mypy_cache 7 | 8 | dist 9 | 10 | .venv 11 | .idea 12 | 13 | .env 14 | .envrc 15 | codegen.log 16 | Brewfile.lock.json 17 | 18 | .DS_Store 19 | 20 | examples/*.mp3 21 | -------------------------------------------------------------------------------- /.inline-snapshot/external/.gitignore: -------------------------------------------------------------------------------- 1 | # ignore all snapshots which are not refered in the source 2 | *-new.* 3 | -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.9.18 2 | -------------------------------------------------------------------------------- /.release-please-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | ".": "1.82.1" 3 | } -------------------------------------------------------------------------------- /.stats.yml: -------------------------------------------------------------------------------- 1 | configured_endpoints: 111 2 | openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml 3 | openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c 4 | config_hash: 535b6e5f26a295d609b259c8cb8f656c 5 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | brew "rye" 2 | 3 | -------------------------------------------------------------------------------- /bin/check-release-environment: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | errors=() 4 | 5 | if [ -z "${STAINLESS_API_KEY}" ]; then 6 | errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.") 7 | fi 8 | 9 | if [ -z "${PYPI_TOKEN}" ]; then 10 | errors+=("The OPENAI_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") 11 | fi 12 | 13 | lenErrors=${#errors[@]} 14 | 15 | if [[ lenErrors -gt 0 ]]; then 16 | echo -e "Found the following errors in the release environment:\n" 17 | 18 | for error in "${errors[@]}"; do 19 | echo -e "- $error\n" 20 | done 21 | 22 | exit 1 23 | fi 24 | 25 | echo "The environment is ready to push releases!" 26 | -------------------------------------------------------------------------------- /bin/publish-pypi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eux 4 | mkdir -p dist 5 | rye build --clean 6 | rye publish --yes --token=$PYPI_TOKEN 7 | -------------------------------------------------------------------------------- /examples/.keep: -------------------------------------------------------------------------------- 1 | File generated from our OpenAPI spec by Stainless. 2 | 3 | This directory can be used to store example files demonstrating usage of this SDK. 4 | It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. -------------------------------------------------------------------------------- /examples/async_demo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S poetry run python 2 | 3 | import asyncio 4 | 5 | from openai import AsyncOpenAI 6 | 7 | # gets API Key from environment variable OPENAI_API_KEY 8 | client = AsyncOpenAI() 9 | 10 | 11 | async def main() -> None: 12 | stream = await client.completions.create( 13 | model="gpt-3.5-turbo-instruct", 14 | prompt="Say this is a test", 15 | stream=True, 16 | ) 17 | async for completion in stream: 18 | print(completion.choices[0].text, end="") 19 | print() 20 | 21 | 22 | asyncio.run(main()) 23 | -------------------------------------------------------------------------------- /examples/generate_file.sh: -------------------------------------------------------------------------------- 1 | # generate a text file with random data for testing file uploads 2 | wanted_size=$((1024*2048*512)) 3 | file_size=$(( ((wanted_size/12)+1)*12 )) 4 | read_size=$((file_size*3/4)) 5 | 6 | echo "wanted=$wanted_size file=$file_size read=$read_size" 7 | 8 | dd if=/dev/urandom bs=$read_size count=1 | base64 > /tmp/small_test_file.txt 9 | 10 | truncate -s "$wanted_size" /tmp/big_test_file.txt 11 | -------------------------------------------------------------------------------- /examples/module_client.py: -------------------------------------------------------------------------------- 1 | import openai 2 | 3 | # will default to `os.environ['OPENAI_API_KEY']` if not explicitly set 4 | openai.api_key = "..." 5 | 6 | # all client options can be configured just like the `OpenAI` instantiation counterpart 7 | openai.base_url = "https://..." 8 | openai.default_headers = {"x-foo": "true"} 9 | 10 | # all API calls work in the exact same fashion as well 11 | stream = openai.chat.completions.create( 12 | model="gpt-4", 13 | messages=[ 14 | { 15 | "role": "user", 16 | "content": "How do I output all files in a directory using Python?", 17 | }, 18 | ], 19 | stream=True, 20 | ) 21 | 22 | for chunk in stream: 23 | print(chunk.choices[0].delta.content or "", end="", flush=True) 24 | 25 | print() 26 | -------------------------------------------------------------------------------- /examples/parsing.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | import rich 4 | from pydantic import BaseModel 5 | 6 | from openai import OpenAI 7 | 8 | 9 | class Step(BaseModel): 10 | explanation: str 11 | output: str 12 | 13 | 14 | class MathResponse(BaseModel): 15 | steps: List[Step] 16 | final_answer: str 17 | 18 | 19 | client = OpenAI() 20 | 21 | completion = client.beta.chat.completions.parse( 22 | model="gpt-4o-2024-08-06", 23 | messages=[ 24 | {"role": "system", "content": "You are a helpful math tutor."}, 25 | {"role": "user", "content": "solve 8x + 31 = 2"}, 26 | ], 27 | response_format=MathResponse, 28 | ) 29 | 30 | message = completion.choices[0].message 31 | if message.parsed: 32 | rich.print(message.parsed.steps) 33 | 34 | print("answer: ", message.parsed.final_answer) 35 | else: 36 | print(message.refusal) 37 | -------------------------------------------------------------------------------- /examples/picture.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from openai import OpenAI 4 | 5 | # gets OPENAI_API_KEY from your environment variables 6 | openai = OpenAI() 7 | 8 | prompt = "An astronaut lounging in a tropical resort in space, pixel art" 9 | model = "dall-e-3" 10 | 11 | 12 | def main() -> None: 13 | # Generate an image based on the prompt 14 | response = openai.images.generate(prompt=prompt, model=model) 15 | 16 | # Prints response containing a URL link to image 17 | print(response) 18 | 19 | 20 | if __name__ == "__main__": 21 | main() 22 | -------------------------------------------------------------------------------- /examples/responses/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/openai-python/9173f3d37594ba603c350ac2263e12c5423b51b9/examples/responses/__init__.py -------------------------------------------------------------------------------- /examples/responses/streaming.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | import rich 4 | from pydantic import BaseModel 5 | 6 | from openai import OpenAI 7 | 8 | 9 | class Step(BaseModel): 10 | explanation: str 11 | output: str 12 | 13 | 14 | class MathResponse(BaseModel): 15 | steps: List[Step] 16 | final_answer: str 17 | 18 | 19 | client = OpenAI() 20 | 21 | with client.responses.stream( 22 | input="solve 8x + 31 = 2", 23 | model="gpt-4o-2024-08-06", 24 | text_format=MathResponse, 25 | ) as stream: 26 | for event in stream: 27 | if "output_text" in event.type: 28 | rich.print(event) 29 | 30 | rich.print(stream.get_final_response()) 31 | -------------------------------------------------------------------------------- /examples/speech_to_text.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rye run python 2 | 3 | import asyncio 4 | 5 | from openai import AsyncOpenAI 6 | from openai.helpers import Microphone 7 | 8 | # gets OPENAI_API_KEY from your environment variables 9 | openai = AsyncOpenAI() 10 | 11 | 12 | async def main() -> None: 13 | print("Recording for the next 10 seconds...") 14 | recording = await Microphone(timeout=10).record() 15 | print("Recording complete") 16 | transcription = await openai.audio.transcriptions.create( 17 | model="whisper-1", 18 | file=recording, 19 | ) 20 | 21 | print(transcription.text) 22 | 23 | 24 | if __name__ == "__main__": 25 | asyncio.run(main()) 26 | -------------------------------------------------------------------------------- /noxfile.py: -------------------------------------------------------------------------------- 1 | import nox 2 | 3 | 4 | @nox.session(reuse_venv=True, name="test-pydantic-v1") 5 | def test_pydantic_v1(session: nox.Session) -> None: 6 | session.install("-r", "requirements-dev.lock") 7 | session.install("pydantic<2") 8 | 9 | session.run("pytest", "--showlocals", "--ignore=tests/functional", *session.posargs) 10 | -------------------------------------------------------------------------------- /scripts/bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then 8 | brew bundle check >/dev/null 2>&1 || { 9 | echo "==> Installing Homebrew dependencies…" 10 | brew bundle 11 | } 12 | fi 13 | 14 | echo "==> Installing Python dependencies…" 15 | 16 | # experimental uv support makes installations significantly faster 17 | rye config --set-bool behavior.use-uv=true 18 | 19 | rye sync 20 | -------------------------------------------------------------------------------- /scripts/format: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | echo "==> Running formatters" 8 | rye run format 9 | -------------------------------------------------------------------------------- /scripts/lint: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | echo "==> Running lints" 8 | rye run lint 9 | 10 | echo "==> Making sure it imports" 11 | rye run python -c 'import openai' 12 | -------------------------------------------------------------------------------- /scripts/utils/upload-artifact.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -exuo pipefail 3 | 4 | RESPONSE=$(curl -X POST "$URL" \ 5 | -H "Authorization: Bearer $AUTH" \ 6 | -H "Content-Type: application/json") 7 | 8 | SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') 9 | 10 | if [[ "$SIGNED_URL" == "null" ]]; then 11 | echo -e "\033[31mFailed to get signed URL.\033[0m" 12 | exit 1 13 | fi 14 | 15 | UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ 16 | -H "Content-Type: application/gzip" \ 17 | --data-binary @- "$SIGNED_URL" 2>&1) 18 | 19 | if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then 20 | echo -e "\033[32mUploaded build to Stainless storage.\033[0m" 21 | echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/openai-python/$SHA'\033[0m" 22 | else 23 | echo -e "\033[31mFailed to upload artifact.\033[0m" 24 | exit 1 25 | fi 26 | -------------------------------------------------------------------------------- /src/openai/__main__.py: -------------------------------------------------------------------------------- 1 | from .cli import main 2 | 3 | main() 4 | -------------------------------------------------------------------------------- /src/openai/_constants.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import httpx 4 | 5 | RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response" 6 | OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" 7 | 8 | # default timeout is 10 minutes 9 | DEFAULT_TIMEOUT = httpx.Timeout(timeout=600, connect=5.0) 10 | DEFAULT_MAX_RETRIES = 2 11 | DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=1000, max_keepalive_connections=100) 12 | 13 | INITIAL_RETRY_DELAY = 0.5 14 | MAX_RETRY_DELAY = 8.0 15 | -------------------------------------------------------------------------------- /src/openai/_extras/__init__.py: -------------------------------------------------------------------------------- 1 | from .numpy_proxy import numpy as numpy, has_numpy as has_numpy 2 | from .pandas_proxy import pandas as pandas 3 | from .sounddevice_proxy import sounddevice as sounddevice 4 | -------------------------------------------------------------------------------- /src/openai/_extras/_common.py: -------------------------------------------------------------------------------- 1 | from .._exceptions import OpenAIError 2 | 3 | INSTRUCTIONS = """ 4 | 5 | OpenAI error: 6 | 7 | missing `{library}` 8 | 9 | This feature requires additional dependencies: 10 | 11 | $ pip install openai[{extra}] 12 | 13 | """ 14 | 15 | 16 | def format_instructions(*, library: str, extra: str) -> str: 17 | return INSTRUCTIONS.format(library=library, extra=extra) 18 | 19 | 20 | class MissingDependencyError(OpenAIError): 21 | pass 22 | -------------------------------------------------------------------------------- /src/openai/_extras/pandas_proxy.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING, Any 4 | from typing_extensions import override 5 | 6 | from .._utils import LazyProxy 7 | from ._common import MissingDependencyError, format_instructions 8 | 9 | if TYPE_CHECKING: 10 | import pandas as pandas 11 | 12 | 13 | PANDAS_INSTRUCTIONS = format_instructions(library="pandas", extra="datalib") 14 | 15 | 16 | class PandasProxy(LazyProxy[Any]): 17 | @override 18 | def __load__(self) -> Any: 19 | try: 20 | import pandas 21 | except ImportError as err: 22 | raise MissingDependencyError(PANDAS_INSTRUCTIONS) from err 23 | 24 | return pandas 25 | 26 | 27 | if not TYPE_CHECKING: 28 | pandas = PandasProxy() 29 | -------------------------------------------------------------------------------- /src/openai/_extras/sounddevice_proxy.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING, Any 4 | from typing_extensions import override 5 | 6 | from .._utils import LazyProxy 7 | from ._common import MissingDependencyError, format_instructions 8 | 9 | if TYPE_CHECKING: 10 | import sounddevice as sounddevice # type: ignore 11 | 12 | 13 | SOUNDDEVICE_INSTRUCTIONS = format_instructions(library="sounddevice", extra="voice_helpers") 14 | 15 | 16 | class SounddeviceProxy(LazyProxy[Any]): 17 | @override 18 | def __load__(self) -> Any: 19 | try: 20 | import sounddevice # type: ignore 21 | except ImportError as err: 22 | raise MissingDependencyError(SOUNDDEVICE_INSTRUCTIONS) from err 23 | 24 | return sounddevice 25 | 26 | 27 | if not TYPE_CHECKING: 28 | sounddevice = SounddeviceProxy() 29 | -------------------------------------------------------------------------------- /src/openai/_utils/_resources_proxy.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import Any 4 | from typing_extensions import override 5 | 6 | from ._proxy import LazyProxy 7 | 8 | 9 | class ResourcesProxy(LazyProxy[Any]): 10 | """A proxy for the `openai.resources` module. 11 | 12 | This is used so that we can lazily import `openai.resources` only when 13 | needed *and* so that users can just import `openai` and reference `openai.resources` 14 | """ 15 | 16 | @override 17 | def __load__(self) -> Any: 18 | import importlib 19 | 20 | mod = importlib.import_module("openai.resources") 21 | return mod 22 | 23 | 24 | resources = ResourcesProxy().__as_proxied__() 25 | -------------------------------------------------------------------------------- /src/openai/_utils/_streams.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | from typing_extensions import Iterator, AsyncIterator 3 | 4 | 5 | def consume_sync_iterator(iterator: Iterator[Any]) -> None: 6 | for _ in iterator: 7 | ... 8 | 9 | 10 | async def consume_async_iterator(iterator: AsyncIterator[Any]) -> None: 11 | async for _ in iterator: 12 | ... 13 | -------------------------------------------------------------------------------- /src/openai/_version.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | __title__ = "openai" 4 | __version__ = "1.82.1" # x-release-please-version 5 | -------------------------------------------------------------------------------- /src/openai/cli/__init__.py: -------------------------------------------------------------------------------- 1 | from ._cli import main as main 2 | -------------------------------------------------------------------------------- /src/openai/cli/_api/__init__.py: -------------------------------------------------------------------------------- 1 | from ._main import register_commands as register_commands 2 | -------------------------------------------------------------------------------- /src/openai/cli/_api/_main.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from argparse import ArgumentParser 4 | 5 | from . import chat, audio, files, image, models, completions 6 | 7 | 8 | def register_commands(parser: ArgumentParser) -> None: 9 | subparsers = parser.add_subparsers(help="All API subcommands") 10 | 11 | chat.register(subparsers) 12 | image.register(subparsers) 13 | audio.register(subparsers) 14 | files.register(subparsers) 15 | models.register(subparsers) 16 | completions.register(subparsers) 17 | -------------------------------------------------------------------------------- /src/openai/cli/_api/chat/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | from argparse import ArgumentParser 5 | 6 | from . import completions 7 | 8 | if TYPE_CHECKING: 9 | from argparse import _SubParsersAction 10 | 11 | 12 | def register(subparser: _SubParsersAction[ArgumentParser]) -> None: 13 | completions.register(subparser) 14 | -------------------------------------------------------------------------------- /src/openai/cli/_errors.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import sys 4 | 5 | import pydantic 6 | 7 | from ._utils import Colors, organization_info 8 | from .._exceptions import APIError, OpenAIError 9 | 10 | 11 | class CLIError(OpenAIError): ... 12 | 13 | 14 | class SilentCLIError(CLIError): ... 15 | 16 | 17 | def display_error(err: CLIError | APIError | pydantic.ValidationError) -> None: 18 | if isinstance(err, SilentCLIError): 19 | return 20 | 21 | sys.stderr.write("{}{}Error:{} {}\n".format(organization_info(), Colors.FAIL, Colors.ENDC, err)) 22 | -------------------------------------------------------------------------------- /src/openai/cli/_models.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | from typing_extensions import ClassVar 3 | 4 | import pydantic 5 | 6 | from .. import _models 7 | from .._compat import PYDANTIC_V2, ConfigDict 8 | 9 | 10 | class BaseModel(_models.BaseModel): 11 | if PYDANTIC_V2: 12 | model_config: ClassVar[ConfigDict] = ConfigDict(extra="ignore", arbitrary_types_allowed=True) 13 | else: 14 | 15 | class Config(pydantic.BaseConfig): # type: ignore 16 | extra: Any = pydantic.Extra.ignore # type: ignore 17 | arbitrary_types_allowed: bool = True 18 | -------------------------------------------------------------------------------- /src/openai/cli/_tools/__init__.py: -------------------------------------------------------------------------------- 1 | from ._main import register_commands as register_commands 2 | -------------------------------------------------------------------------------- /src/openai/cli/_tools/_main.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import TYPE_CHECKING 4 | from argparse import ArgumentParser 5 | 6 | from . import migrate, fine_tunes 7 | 8 | if TYPE_CHECKING: 9 | from argparse import _SubParsersAction 10 | 11 | 12 | def register_commands(parser: ArgumentParser, subparser: _SubParsersAction[ArgumentParser]) -> None: 13 | migrate.register(subparser) 14 | 15 | namespaced = parser.add_subparsers(title="Tools", help="Convenience client side tools") 16 | 17 | fine_tunes.register(namespaced) 18 | -------------------------------------------------------------------------------- /src/openai/helpers/__init__.py: -------------------------------------------------------------------------------- 1 | from .microphone import Microphone 2 | from .local_audio_player import LocalAudioPlayer 3 | 4 | __all__ = ["Microphone", "LocalAudioPlayer"] 5 | -------------------------------------------------------------------------------- /src/openai/lib/.keep: -------------------------------------------------------------------------------- 1 | File generated from our OpenAPI spec by Stainless. 2 | 3 | This directory can be used to store custom files to expand the SDK. 4 | It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. -------------------------------------------------------------------------------- /src/openai/lib/__init__.py: -------------------------------------------------------------------------------- 1 | from ._tools import pydantic_function_tool as pydantic_function_tool 2 | from ._parsing import ResponseFormatT as ResponseFormatT 3 | -------------------------------------------------------------------------------- /src/openai/lib/_parsing/__init__.py: -------------------------------------------------------------------------------- 1 | from ._completions import ( 2 | ResponseFormatT as ResponseFormatT, 3 | has_parseable_input, 4 | has_parseable_input as has_parseable_input, 5 | maybe_parse_content as maybe_parse_content, 6 | validate_input_tools as validate_input_tools, 7 | parse_chat_completion as parse_chat_completion, 8 | get_input_tool_by_name as get_input_tool_by_name, 9 | solve_response_format_t as solve_response_format_t, 10 | parse_function_tool_arguments as parse_function_tool_arguments, 11 | type_to_response_format_param as type_to_response_format_param, 12 | ) 13 | -------------------------------------------------------------------------------- /src/openai/lib/streaming/__init__.py: -------------------------------------------------------------------------------- 1 | from ._assistants import ( 2 | AssistantEventHandler as AssistantEventHandler, 3 | AssistantEventHandlerT as AssistantEventHandlerT, 4 | AssistantStreamManager as AssistantStreamManager, 5 | AsyncAssistantEventHandler as AsyncAssistantEventHandler, 6 | AsyncAssistantEventHandlerT as AsyncAssistantEventHandlerT, 7 | AsyncAssistantStreamManager as AsyncAssistantStreamManager, 8 | ) 9 | -------------------------------------------------------------------------------- /src/openai/lib/streaming/chat/_types.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing_extensions import TypeAlias 4 | 5 | from ....types.chat import ParsedChoice, ParsedChatCompletion, ParsedChatCompletionMessage 6 | 7 | ParsedChatCompletionSnapshot: TypeAlias = ParsedChatCompletion[object] 8 | """Snapshot type representing an in-progress accumulation of 9 | a `ParsedChatCompletion` object. 10 | """ 11 | 12 | ParsedChatCompletionMessageSnapshot: TypeAlias = ParsedChatCompletionMessage[object] 13 | """Snapshot type representing an in-progress accumulation of 14 | a `ParsedChatCompletionMessage` object. 15 | 16 | If the content has been fully accumulated, the `.parsed` content will be 17 | the `response_format` instance, otherwise it'll be the raw JSON parsed version. 18 | """ 19 | 20 | ParsedChoiceSnapshot: TypeAlias = ParsedChoice[object] 21 | -------------------------------------------------------------------------------- /src/openai/lib/streaming/responses/__init__.py: -------------------------------------------------------------------------------- 1 | from ._events import ( 2 | ResponseTextDoneEvent as ResponseTextDoneEvent, 3 | ResponseTextDeltaEvent as ResponseTextDeltaEvent, 4 | ResponseFunctionCallArgumentsDeltaEvent as ResponseFunctionCallArgumentsDeltaEvent, 5 | ) 6 | from ._responses import ( 7 | ResponseStream as ResponseStream, 8 | AsyncResponseStream as AsyncResponseStream, 9 | ResponseStreamEvent as ResponseStreamEvent, 10 | ResponseStreamState as ResponseStreamState, 11 | ResponseStreamManager as ResponseStreamManager, 12 | AsyncResponseStreamManager as AsyncResponseStreamManager, 13 | ) 14 | -------------------------------------------------------------------------------- /src/openai/lib/streaming/responses/_types.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing_extensions import TypeAlias 4 | 5 | from ....types.responses import ParsedResponse 6 | 7 | ParsedResponseSnapshot: TypeAlias = ParsedResponse[object] 8 | """Snapshot type representing an in-progress accumulation of 9 | a `ParsedResponse` object. 10 | """ 11 | -------------------------------------------------------------------------------- /src/openai/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/openai-python/9173f3d37594ba603c350ac2263e12c5423b51b9/src/openai/py.typed -------------------------------------------------------------------------------- /src/openai/resources/beta/chat/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from .chat import Chat, AsyncChat 4 | from .completions import Completions, AsyncCompletions 5 | 6 | __all__ = [ 7 | "Completions", 8 | "AsyncCompletions", 9 | "Chat", 10 | "AsyncChat", 11 | ] 12 | -------------------------------------------------------------------------------- /src/openai/resources/beta/chat/chat.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from ...._compat import cached_property 6 | from .completions import Completions, AsyncCompletions 7 | from ...._resource import SyncAPIResource, AsyncAPIResource 8 | 9 | __all__ = ["Chat", "AsyncChat"] 10 | 11 | 12 | class Chat(SyncAPIResource): 13 | @cached_property 14 | def completions(self) -> Completions: 15 | return Completions(self._client) 16 | 17 | 18 | class AsyncChat(AsyncAPIResource): 19 | @cached_property 20 | def completions(self) -> AsyncCompletions: 21 | return AsyncCompletions(self._client) 22 | -------------------------------------------------------------------------------- /src/openai/types/audio/speech_model.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["SpeechModel"] 6 | 7 | SpeechModel: TypeAlias = Literal["tts-1", "tts-1-hd", "gpt-4o-mini-tts"] 8 | -------------------------------------------------------------------------------- /src/openai/types/audio/transcription_create_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import TypeAlias 5 | 6 | from .transcription import Transcription 7 | from .transcription_verbose import TranscriptionVerbose 8 | 9 | __all__ = ["TranscriptionCreateResponse"] 10 | 11 | TranscriptionCreateResponse: TypeAlias = Union[Transcription, TranscriptionVerbose] 12 | -------------------------------------------------------------------------------- /src/openai/types/audio/transcription_include.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["TranscriptionInclude"] 6 | 7 | TranscriptionInclude: TypeAlias = Literal["logprobs"] 8 | -------------------------------------------------------------------------------- /src/openai/types/audio/transcription_stream_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ..._utils import PropertyInfo 7 | from .transcription_text_done_event import TranscriptionTextDoneEvent 8 | from .transcription_text_delta_event import TranscriptionTextDeltaEvent 9 | 10 | __all__ = ["TranscriptionStreamEvent"] 11 | 12 | TranscriptionStreamEvent: TypeAlias = Annotated[ 13 | Union[TranscriptionTextDeltaEvent, TranscriptionTextDoneEvent], PropertyInfo(discriminator="type") 14 | ] 15 | -------------------------------------------------------------------------------- /src/openai/types/audio/transcription_verbose.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List, Optional 4 | 5 | from ..._models import BaseModel 6 | from .transcription_word import TranscriptionWord 7 | from .transcription_segment import TranscriptionSegment 8 | 9 | __all__ = ["TranscriptionVerbose"] 10 | 11 | 12 | class TranscriptionVerbose(BaseModel): 13 | duration: float 14 | """The duration of the input audio.""" 15 | 16 | language: str 17 | """The language of the input audio.""" 18 | 19 | text: str 20 | """The transcribed text.""" 21 | 22 | segments: Optional[List[TranscriptionSegment]] = None 23 | """Segments of the transcribed text and their corresponding details.""" 24 | 25 | words: Optional[List[TranscriptionWord]] = None 26 | """Extracted words and their corresponding timestamps.""" 27 | -------------------------------------------------------------------------------- /src/openai/types/audio/transcription_word.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from ..._models import BaseModel 4 | 5 | __all__ = ["TranscriptionWord"] 6 | 7 | 8 | class TranscriptionWord(BaseModel): 9 | end: float 10 | """End time of the word in seconds.""" 11 | 12 | start: float 13 | """Start time of the word in seconds.""" 14 | 15 | word: str 16 | """The text content of the word.""" 17 | -------------------------------------------------------------------------------- /src/openai/types/audio/translation.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from ..._models import BaseModel 4 | 5 | __all__ = ["Translation"] 6 | 7 | 8 | class Translation(BaseModel): 9 | text: str 10 | -------------------------------------------------------------------------------- /src/openai/types/audio/translation_create_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import TypeAlias 5 | 6 | from .translation import Translation 7 | from .translation_verbose import TranslationVerbose 8 | 9 | __all__ = ["TranslationCreateResponse"] 10 | 11 | TranslationCreateResponse: TypeAlias = Union[Translation, TranslationVerbose] 12 | -------------------------------------------------------------------------------- /src/openai/types/audio/translation_verbose.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List, Optional 4 | 5 | from ..._models import BaseModel 6 | from .transcription_segment import TranscriptionSegment 7 | 8 | __all__ = ["TranslationVerbose"] 9 | 10 | 11 | class TranslationVerbose(BaseModel): 12 | duration: float 13 | """The duration of the input audio.""" 14 | 15 | language: str 16 | """The language of the output translation (always `english`).""" 17 | 18 | text: str 19 | """The translated text.""" 20 | 21 | segments: Optional[List[TranscriptionSegment]] = None 22 | """Segments of the translated text and their corresponding details.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/audio_model.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["AudioModel"] 6 | 7 | AudioModel: TypeAlias = Literal["whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe"] 8 | -------------------------------------------------------------------------------- /src/openai/types/audio_response_format.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["AudioResponseFormat"] 6 | 7 | AudioResponseFormat: TypeAlias = Literal["json", "text", "srt", "verbose_json", "vtt"] 8 | -------------------------------------------------------------------------------- /src/openai/types/auto_file_chunking_strategy_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["AutoFileChunkingStrategyParam"] 8 | 9 | 10 | class AutoFileChunkingStrategyParam(TypedDict, total=False): 11 | type: Required[Literal["auto"]] 12 | """Always `auto`.""" 13 | -------------------------------------------------------------------------------- /src/openai/types/batch_error.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | 5 | from .._models import BaseModel 6 | 7 | __all__ = ["BatchError"] 8 | 9 | 10 | class BatchError(BaseModel): 11 | code: Optional[str] = None 12 | """An error code identifying the error type.""" 13 | 14 | line: Optional[int] = None 15 | """The line number of the input file where the error occurred, if applicable.""" 16 | 17 | message: Optional[str] = None 18 | """A human-readable message providing more details about the error.""" 19 | 20 | param: Optional[str] = None 21 | """The name of the parameter that caused the error, if applicable.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/batch_list_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import TypedDict 6 | 7 | __all__ = ["BatchListParams"] 8 | 9 | 10 | class BatchListParams(TypedDict, total=False): 11 | after: str 12 | """A cursor for use in pagination. 13 | 14 | `after` is an object ID that defines your place in the list. For instance, if 15 | you make a list request and receive 100 objects, ending with obj_foo, your 16 | subsequent call can include after=obj_foo in order to fetch the next page of the 17 | list. 18 | """ 19 | 20 | limit: int 21 | """A limit on the number of objects to be returned. 22 | 23 | Limit can range between 1 and 100, and the default is 20. 24 | """ 25 | -------------------------------------------------------------------------------- /src/openai/types/batch_request_counts.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from .._models import BaseModel 4 | 5 | __all__ = ["BatchRequestCounts"] 6 | 7 | 8 | class BatchRequestCounts(BaseModel): 9 | completed: int 10 | """Number of requests that have been completed successfully.""" 11 | 12 | failed: int 13 | """Number of requests that have failed.""" 14 | 15 | total: int 16 | """Total number of requests in the batch.""" 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_deleted.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["AssistantDeleted"] 8 | 9 | 10 | class AssistantDeleted(BaseModel): 11 | id: str 12 | 13 | deleted: bool 14 | 15 | object: Literal["assistant.deleted"] 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_response_format_option.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Literal, TypeAlias 5 | 6 | from ..shared.response_format_text import ResponseFormatText 7 | from ..shared.response_format_json_object import ResponseFormatJSONObject 8 | from ..shared.response_format_json_schema import ResponseFormatJSONSchema 9 | 10 | __all__ = ["AssistantResponseFormatOption"] 11 | 12 | AssistantResponseFormatOption: TypeAlias = Union[ 13 | Literal["auto"], ResponseFormatText, ResponseFormatJSONObject, ResponseFormatJSONSchema 14 | ] 15 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_response_format_option_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import Literal, TypeAlias 7 | 8 | from ..shared_params.response_format_text import ResponseFormatText 9 | from ..shared_params.response_format_json_object import ResponseFormatJSONObject 10 | from ..shared_params.response_format_json_schema import ResponseFormatJSONSchema 11 | 12 | __all__ = ["AssistantResponseFormatOptionParam"] 13 | 14 | AssistantResponseFormatOptionParam: TypeAlias = Union[ 15 | Literal["auto"], ResponseFormatText, ResponseFormatJSONObject, ResponseFormatJSONSchema 16 | ] 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_tool.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ..._utils import PropertyInfo 7 | from .function_tool import FunctionTool 8 | from .file_search_tool import FileSearchTool 9 | from .code_interpreter_tool import CodeInterpreterTool 10 | 11 | __all__ = ["AssistantTool"] 12 | 13 | AssistantTool: TypeAlias = Annotated[ 14 | Union[CodeInterpreterTool, FileSearchTool, FunctionTool], PropertyInfo(discriminator="type") 15 | ] 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_tool_choice.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ..._models import BaseModel 7 | from .assistant_tool_choice_function import AssistantToolChoiceFunction 8 | 9 | __all__ = ["AssistantToolChoice"] 10 | 11 | 12 | class AssistantToolChoice(BaseModel): 13 | type: Literal["function", "code_interpreter", "file_search"] 14 | """The type of the tool. If type is `function`, the function name must be set""" 15 | 16 | function: Optional[AssistantToolChoiceFunction] = None 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_tool_choice_function.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from ..._models import BaseModel 4 | 5 | __all__ = ["AssistantToolChoiceFunction"] 6 | 7 | 8 | class AssistantToolChoiceFunction(BaseModel): 9 | name: str 10 | """The name of the function to call.""" 11 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_tool_choice_function_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Required, TypedDict 6 | 7 | __all__ = ["AssistantToolChoiceFunctionParam"] 8 | 9 | 10 | class AssistantToolChoiceFunctionParam(TypedDict, total=False): 11 | name: Required[str] 12 | """The name of the function to call.""" 13 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_tool_choice_option.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Literal, TypeAlias 5 | 6 | from .assistant_tool_choice import AssistantToolChoice 7 | 8 | __all__ = ["AssistantToolChoiceOption"] 9 | 10 | AssistantToolChoiceOption: TypeAlias = Union[Literal["none", "auto", "required"], AssistantToolChoice] 11 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_tool_choice_option_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import Literal, TypeAlias 7 | 8 | from .assistant_tool_choice_param import AssistantToolChoiceParam 9 | 10 | __all__ = ["AssistantToolChoiceOptionParam"] 11 | 12 | AssistantToolChoiceOptionParam: TypeAlias = Union[Literal["none", "auto", "required"], AssistantToolChoiceParam] 13 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_tool_choice_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | from .assistant_tool_choice_function_param import AssistantToolChoiceFunctionParam 8 | 9 | __all__ = ["AssistantToolChoiceParam"] 10 | 11 | 12 | class AssistantToolChoiceParam(TypedDict, total=False): 13 | type: Required[Literal["function", "code_interpreter", "file_search"]] 14 | """The type of the tool. If type is `function`, the function name must be set""" 15 | 16 | function: AssistantToolChoiceFunctionParam 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/assistant_tool_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import TypeAlias 7 | 8 | from .function_tool_param import FunctionToolParam 9 | from .file_search_tool_param import FileSearchToolParam 10 | from .code_interpreter_tool_param import CodeInterpreterToolParam 11 | 12 | __all__ = ["AssistantToolParam"] 13 | 14 | AssistantToolParam: TypeAlias = Union[CodeInterpreterToolParam, FileSearchToolParam, FunctionToolParam] 15 | -------------------------------------------------------------------------------- /src/openai/types/beta/chat/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | -------------------------------------------------------------------------------- /src/openai/types/beta/code_interpreter_tool.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["CodeInterpreterTool"] 8 | 9 | 10 | class CodeInterpreterTool(BaseModel): 11 | type: Literal["code_interpreter"] 12 | """The type of tool being defined: `code_interpreter`""" 13 | -------------------------------------------------------------------------------- /src/openai/types/beta/code_interpreter_tool_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["CodeInterpreterToolParam"] 8 | 9 | 10 | class CodeInterpreterToolParam(TypedDict, total=False): 11 | type: Required[Literal["code_interpreter"]] 12 | """The type of tool being defined: `code_interpreter`""" 13 | -------------------------------------------------------------------------------- /src/openai/types/beta/function_tool.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | from ..shared.function_definition import FunctionDefinition 7 | 8 | __all__ = ["FunctionTool"] 9 | 10 | 11 | class FunctionTool(BaseModel): 12 | function: FunctionDefinition 13 | 14 | type: Literal["function"] 15 | """The type of tool being defined: `function`""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/function_tool_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | from ..shared_params.function_definition import FunctionDefinition 8 | 9 | __all__ = ["FunctionToolParam"] 10 | 11 | 12 | class FunctionToolParam(TypedDict, total=False): 13 | function: Required[FunctionDefinition] 14 | 15 | type: Required[Literal["function"]] 16 | """The type of tool being defined: `function`""" 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/conversation_item_created_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | from .conversation_item import ConversationItem 7 | 8 | __all__ = ["ConversationItemCreatedEvent"] 9 | 10 | 11 | class ConversationItemCreatedEvent(BaseModel): 12 | event_id: str 13 | """The unique ID of the server event.""" 14 | 15 | item: ConversationItem 16 | """The item to add to the conversation.""" 17 | 18 | previous_item_id: str 19 | """ 20 | The ID of the preceding item in the Conversation context, allows the client to 21 | understand the order of the conversation. 22 | """ 23 | 24 | type: Literal["conversation.item.created"] 25 | """The event type, must be `conversation.item.created`.""" 26 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/conversation_item_delete_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["ConversationItemDeleteEvent"] 9 | 10 | 11 | class ConversationItemDeleteEvent(BaseModel): 12 | item_id: str 13 | """The ID of the item to delete.""" 14 | 15 | type: Literal["conversation.item.delete"] 16 | """The event type, must be `conversation.item.delete`.""" 17 | 18 | event_id: Optional[str] = None 19 | """Optional client-generated ID used to identify this event.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/conversation_item_delete_event_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ConversationItemDeleteEventParam"] 8 | 9 | 10 | class ConversationItemDeleteEventParam(TypedDict, total=False): 11 | item_id: Required[str] 12 | """The ID of the item to delete.""" 13 | 14 | type: Required[Literal["conversation.item.delete"]] 15 | """The event type, must be `conversation.item.delete`.""" 16 | 17 | event_id: str 18 | """Optional client-generated ID used to identify this event.""" 19 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/conversation_item_deleted_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["ConversationItemDeletedEvent"] 8 | 9 | 10 | class ConversationItemDeletedEvent(BaseModel): 11 | event_id: str 12 | """The unique ID of the server event.""" 13 | 14 | item_id: str 15 | """The ID of the item that was deleted.""" 16 | 17 | type: Literal["conversation.item.deleted"] 18 | """The event type, must be `conversation.item.deleted`.""" 19 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/conversation_item_retrieve_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["ConversationItemRetrieveEvent"] 9 | 10 | 11 | class ConversationItemRetrieveEvent(BaseModel): 12 | item_id: str 13 | """The ID of the item to retrieve.""" 14 | 15 | type: Literal["conversation.item.retrieve"] 16 | """The event type, must be `conversation.item.retrieve`.""" 17 | 18 | event_id: Optional[str] = None 19 | """Optional client-generated ID used to identify this event.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/conversation_item_retrieve_event_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ConversationItemRetrieveEventParam"] 8 | 9 | 10 | class ConversationItemRetrieveEventParam(TypedDict, total=False): 11 | item_id: Required[str] 12 | """The ID of the item to retrieve.""" 13 | 14 | type: Required[Literal["conversation.item.retrieve"]] 15 | """The event type, must be `conversation.item.retrieve`.""" 16 | 17 | event_id: str 18 | """Optional client-generated ID used to identify this event.""" 19 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/conversation_item_truncated_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["ConversationItemTruncatedEvent"] 8 | 9 | 10 | class ConversationItemTruncatedEvent(BaseModel): 11 | audio_end_ms: int 12 | """The duration up to which the audio was truncated, in milliseconds.""" 13 | 14 | content_index: int 15 | """The index of the content part that was truncated.""" 16 | 17 | event_id: str 18 | """The unique ID of the server event.""" 19 | 20 | item_id: str 21 | """The ID of the assistant message item that was truncated.""" 22 | 23 | type: Literal["conversation.item.truncated"] 24 | """The event type, must be `conversation.item.truncated`.""" 25 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/input_audio_buffer_append_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["InputAudioBufferAppendEvent"] 9 | 10 | 11 | class InputAudioBufferAppendEvent(BaseModel): 12 | audio: str 13 | """Base64-encoded audio bytes. 14 | 15 | This must be in the format specified by the `input_audio_format` field in the 16 | session configuration. 17 | """ 18 | 19 | type: Literal["input_audio_buffer.append"] 20 | """The event type, must be `input_audio_buffer.append`.""" 21 | 22 | event_id: Optional[str] = None 23 | """Optional client-generated ID used to identify this event.""" 24 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/input_audio_buffer_append_event_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["InputAudioBufferAppendEventParam"] 8 | 9 | 10 | class InputAudioBufferAppendEventParam(TypedDict, total=False): 11 | audio: Required[str] 12 | """Base64-encoded audio bytes. 13 | 14 | This must be in the format specified by the `input_audio_format` field in the 15 | session configuration. 16 | """ 17 | 18 | type: Required[Literal["input_audio_buffer.append"]] 19 | """The event type, must be `input_audio_buffer.append`.""" 20 | 21 | event_id: str 22 | """Optional client-generated ID used to identify this event.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/input_audio_buffer_clear_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["InputAudioBufferClearEvent"] 9 | 10 | 11 | class InputAudioBufferClearEvent(BaseModel): 12 | type: Literal["input_audio_buffer.clear"] 13 | """The event type, must be `input_audio_buffer.clear`.""" 14 | 15 | event_id: Optional[str] = None 16 | """Optional client-generated ID used to identify this event.""" 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/input_audio_buffer_clear_event_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["InputAudioBufferClearEventParam"] 8 | 9 | 10 | class InputAudioBufferClearEventParam(TypedDict, total=False): 11 | type: Required[Literal["input_audio_buffer.clear"]] 12 | """The event type, must be `input_audio_buffer.clear`.""" 13 | 14 | event_id: str 15 | """Optional client-generated ID used to identify this event.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/input_audio_buffer_cleared_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["InputAudioBufferClearedEvent"] 8 | 9 | 10 | class InputAudioBufferClearedEvent(BaseModel): 11 | event_id: str 12 | """The unique ID of the server event.""" 13 | 14 | type: Literal["input_audio_buffer.cleared"] 15 | """The event type, must be `input_audio_buffer.cleared`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/input_audio_buffer_commit_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["InputAudioBufferCommitEvent"] 9 | 10 | 11 | class InputAudioBufferCommitEvent(BaseModel): 12 | type: Literal["input_audio_buffer.commit"] 13 | """The event type, must be `input_audio_buffer.commit`.""" 14 | 15 | event_id: Optional[str] = None 16 | """Optional client-generated ID used to identify this event.""" 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/input_audio_buffer_commit_event_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["InputAudioBufferCommitEventParam"] 8 | 9 | 10 | class InputAudioBufferCommitEventParam(TypedDict, total=False): 11 | type: Required[Literal["input_audio_buffer.commit"]] 12 | """The event type, must be `input_audio_buffer.commit`.""" 13 | 14 | event_id: str 15 | """Optional client-generated ID used to identify this event.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/input_audio_buffer_committed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["InputAudioBufferCommittedEvent"] 8 | 9 | 10 | class InputAudioBufferCommittedEvent(BaseModel): 11 | event_id: str 12 | """The unique ID of the server event.""" 13 | 14 | item_id: str 15 | """The ID of the user message item that will be created.""" 16 | 17 | previous_item_id: str 18 | """The ID of the preceding item after which the new item will be inserted.""" 19 | 20 | type: Literal["input_audio_buffer.committed"] 21 | """The event type, must be `input_audio_buffer.committed`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/realtime_connect_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Required, TypedDict 6 | 7 | __all__ = ["RealtimeConnectParams"] 8 | 9 | 10 | class RealtimeConnectParams(TypedDict, total=False): 11 | model: Required[str] 12 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/response_audio_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["ResponseAudioDoneEvent"] 8 | 9 | 10 | class ResponseAudioDoneEvent(BaseModel): 11 | content_index: int 12 | """The index of the content part in the item's content array.""" 13 | 14 | event_id: str 15 | """The unique ID of the server event.""" 16 | 17 | item_id: str 18 | """The ID of the item.""" 19 | 20 | output_index: int 21 | """The index of the output item in the response.""" 22 | 23 | response_id: str 24 | """The ID of the response.""" 25 | 26 | type: Literal["response.audio.done"] 27 | """The event type, must be `response.audio.done`.""" 28 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/response_cancel_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["ResponseCancelEvent"] 9 | 10 | 11 | class ResponseCancelEvent(BaseModel): 12 | type: Literal["response.cancel"] 13 | """The event type, must be `response.cancel`.""" 14 | 15 | event_id: Optional[str] = None 16 | """Optional client-generated ID used to identify this event.""" 17 | 18 | response_id: Optional[str] = None 19 | """ 20 | A specific response ID to cancel - if not provided, will cancel an in-progress 21 | response in the default conversation. 22 | """ 23 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/response_cancel_event_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ResponseCancelEventParam"] 8 | 9 | 10 | class ResponseCancelEventParam(TypedDict, total=False): 11 | type: Required[Literal["response.cancel"]] 12 | """The event type, must be `response.cancel`.""" 13 | 14 | event_id: str 15 | """Optional client-generated ID used to identify this event.""" 16 | 17 | response_id: str 18 | """ 19 | A specific response ID to cancel - if not provided, will cancel an in-progress 20 | response in the default conversation. 21 | """ 22 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/response_created_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | from .realtime_response import RealtimeResponse 7 | 8 | __all__ = ["ResponseCreatedEvent"] 9 | 10 | 11 | class ResponseCreatedEvent(BaseModel): 12 | event_id: str 13 | """The unique ID of the server event.""" 14 | 15 | response: RealtimeResponse 16 | """The response resource.""" 17 | 18 | type: Literal["response.created"] 19 | """The event type, must be `response.created`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/response_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | from .realtime_response import RealtimeResponse 7 | 8 | __all__ = ["ResponseDoneEvent"] 9 | 10 | 11 | class ResponseDoneEvent(BaseModel): 12 | event_id: str 13 | """The unique ID of the server event.""" 14 | 15 | response: RealtimeResponse 16 | """The response resource.""" 17 | 18 | type: Literal["response.done"] 19 | """The event type, must be `response.done`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/response_output_item_added_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | from .conversation_item import ConversationItem 7 | 8 | __all__ = ["ResponseOutputItemAddedEvent"] 9 | 10 | 11 | class ResponseOutputItemAddedEvent(BaseModel): 12 | event_id: str 13 | """The unique ID of the server event.""" 14 | 15 | item: ConversationItem 16 | """The item to add to the conversation.""" 17 | 18 | output_index: int 19 | """The index of the output item in the Response.""" 20 | 21 | response_id: str 22 | """The ID of the Response to which the item belongs.""" 23 | 24 | type: Literal["response.output_item.added"] 25 | """The event type, must be `response.output_item.added`.""" 26 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/response_output_item_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | from .conversation_item import ConversationItem 7 | 8 | __all__ = ["ResponseOutputItemDoneEvent"] 9 | 10 | 11 | class ResponseOutputItemDoneEvent(BaseModel): 12 | event_id: str 13 | """The unique ID of the server event.""" 14 | 15 | item: ConversationItem 16 | """The item to add to the conversation.""" 17 | 18 | output_index: int 19 | """The index of the output item in the Response.""" 20 | 21 | response_id: str 22 | """The ID of the Response to which the item belongs.""" 23 | 24 | type: Literal["response.output_item.done"] 25 | """The event type, must be `response.output_item.done`.""" 26 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/response_text_delta_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["ResponseTextDeltaEvent"] 8 | 9 | 10 | class ResponseTextDeltaEvent(BaseModel): 11 | content_index: int 12 | """The index of the content part in the item's content array.""" 13 | 14 | delta: str 15 | """The text delta.""" 16 | 17 | event_id: str 18 | """The unique ID of the server event.""" 19 | 20 | item_id: str 21 | """The ID of the item.""" 22 | 23 | output_index: int 24 | """The index of the output item in the response.""" 25 | 26 | response_id: str 27 | """The ID of the response.""" 28 | 29 | type: Literal["response.text.delta"] 30 | """The event type, must be `response.text.delta`.""" 31 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/response_text_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["ResponseTextDoneEvent"] 8 | 9 | 10 | class ResponseTextDoneEvent(BaseModel): 11 | content_index: int 12 | """The index of the content part in the item's content array.""" 13 | 14 | event_id: str 15 | """The unique ID of the server event.""" 16 | 17 | item_id: str 18 | """The ID of the item.""" 19 | 20 | output_index: int 21 | """The index of the output item in the response.""" 22 | 23 | response_id: str 24 | """The ID of the response.""" 25 | 26 | text: str 27 | """The final text content.""" 28 | 29 | type: Literal["response.text.done"] 30 | """The event type, must be `response.text.done`.""" 31 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/session_created_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .session import Session 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["SessionCreatedEvent"] 9 | 10 | 11 | class SessionCreatedEvent(BaseModel): 12 | event_id: str 13 | """The unique ID of the server event.""" 14 | 15 | session: Session 16 | """Realtime session object configuration.""" 17 | 18 | type: Literal["session.created"] 19 | """The event type, must be `session.created`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/realtime/session_updated_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .session import Session 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["SessionUpdatedEvent"] 9 | 10 | 11 | class SessionUpdatedEvent(BaseModel): 12 | event_id: str 13 | """The unique ID of the server event.""" 14 | 15 | session: Session 16 | """Realtime session object configuration.""" 17 | 18 | type: Literal["session.updated"] 19 | """The event type, must be `session.updated`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/thread_deleted.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ThreadDeleted"] 8 | 9 | 10 | class ThreadDeleted(BaseModel): 11 | id: str 12 | 13 | deleted: bool 14 | 15 | object: Literal["thread.deleted"] 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/annotation.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ...._utils import PropertyInfo 7 | from .file_path_annotation import FilePathAnnotation 8 | from .file_citation_annotation import FileCitationAnnotation 9 | 10 | __all__ = ["Annotation"] 11 | 12 | Annotation: TypeAlias = Annotated[Union[FileCitationAnnotation, FilePathAnnotation], PropertyInfo(discriminator="type")] 13 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/annotation_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ...._utils import PropertyInfo 7 | from .file_path_delta_annotation import FilePathDeltaAnnotation 8 | from .file_citation_delta_annotation import FileCitationDeltaAnnotation 9 | 10 | __all__ = ["AnnotationDelta"] 11 | 12 | AnnotationDelta: TypeAlias = Annotated[ 13 | Union[FileCitationDeltaAnnotation, FilePathDeltaAnnotation], PropertyInfo(discriminator="type") 14 | ] 15 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/file_citation_annotation.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["FileCitationAnnotation", "FileCitation"] 8 | 9 | 10 | class FileCitation(BaseModel): 11 | file_id: str 12 | """The ID of the specific File the citation is from.""" 13 | 14 | 15 | class FileCitationAnnotation(BaseModel): 16 | end_index: int 17 | 18 | file_citation: FileCitation 19 | 20 | start_index: int 21 | 22 | text: str 23 | """The text in the message content that needs to be replaced.""" 24 | 25 | type: Literal["file_citation"] 26 | """Always `file_citation`.""" 27 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/file_path_annotation.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["FilePathAnnotation", "FilePath"] 8 | 9 | 10 | class FilePath(BaseModel): 11 | file_id: str 12 | """The ID of the file that was generated.""" 13 | 14 | 15 | class FilePathAnnotation(BaseModel): 16 | end_index: int 17 | 18 | file_path: FilePath 19 | 20 | start_index: int 21 | 22 | text: str 23 | """The text in the message content that needs to be replaced.""" 24 | 25 | type: Literal["file_path"] 26 | """Always `file_path`.""" 27 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_file.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["ImageFile"] 9 | 10 | 11 | class ImageFile(BaseModel): 12 | file_id: str 13 | """ 14 | The [File](https://platform.openai.com/docs/api-reference/files) ID of the image 15 | in the message content. Set `purpose="vision"` when uploading the File if you 16 | need to later display the file content. 17 | """ 18 | 19 | detail: Optional[Literal["auto", "low", "high"]] = None 20 | """Specifies the detail level of the image if specified by the user. 21 | 22 | `low` uses fewer tokens, you can opt in to high resolution using `high`. 23 | """ 24 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_file_content_block.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | from .image_file import ImageFile 7 | 8 | __all__ = ["ImageFileContentBlock"] 9 | 10 | 11 | class ImageFileContentBlock(BaseModel): 12 | image_file: ImageFile 13 | 14 | type: Literal["image_file"] 15 | """Always `image_file`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_file_content_block_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | from .image_file_param import ImageFileParam 8 | 9 | __all__ = ["ImageFileContentBlockParam"] 10 | 11 | 12 | class ImageFileContentBlockParam(TypedDict, total=False): 13 | image_file: Required[ImageFileParam] 14 | 15 | type: Required[Literal["image_file"]] 16 | """Always `image_file`.""" 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_file_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["ImageFileDelta"] 9 | 10 | 11 | class ImageFileDelta(BaseModel): 12 | detail: Optional[Literal["auto", "low", "high"]] = None 13 | """Specifies the detail level of the image if specified by the user. 14 | 15 | `low` uses fewer tokens, you can opt in to high resolution using `high`. 16 | """ 17 | 18 | file_id: Optional[str] = None 19 | """ 20 | The [File](https://platform.openai.com/docs/api-reference/files) ID of the image 21 | in the message content. Set `purpose="vision"` when uploading the File if you 22 | need to later display the file content. 23 | """ 24 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_file_delta_block.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | from .image_file_delta import ImageFileDelta 8 | 9 | __all__ = ["ImageFileDeltaBlock"] 10 | 11 | 12 | class ImageFileDeltaBlock(BaseModel): 13 | index: int 14 | """The index of the content part in the message.""" 15 | 16 | type: Literal["image_file"] 17 | """Always `image_file`.""" 18 | 19 | image_file: Optional[ImageFileDelta] = None 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_file_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ImageFileParam"] 8 | 9 | 10 | class ImageFileParam(TypedDict, total=False): 11 | file_id: Required[str] 12 | """ 13 | The [File](https://platform.openai.com/docs/api-reference/files) ID of the image 14 | in the message content. Set `purpose="vision"` when uploading the File if you 15 | need to later display the file content. 16 | """ 17 | 18 | detail: Literal["auto", "low", "high"] 19 | """Specifies the detail level of the image if specified by the user. 20 | 21 | `low` uses fewer tokens, you can opt in to high resolution using `high`. 22 | """ 23 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_url.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["ImageURL"] 9 | 10 | 11 | class ImageURL(BaseModel): 12 | url: str 13 | """ 14 | The external URL of the image, must be a supported image types: jpeg, jpg, png, 15 | gif, webp. 16 | """ 17 | 18 | detail: Optional[Literal["auto", "low", "high"]] = None 19 | """Specifies the detail level of the image. 20 | 21 | `low` uses fewer tokens, you can opt in to high resolution using `high`. Default 22 | value is `auto` 23 | """ 24 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_url_content_block.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .image_url import ImageURL 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["ImageURLContentBlock"] 9 | 10 | 11 | class ImageURLContentBlock(BaseModel): 12 | image_url: ImageURL 13 | 14 | type: Literal["image_url"] 15 | """The type of the content part.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_url_content_block_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | from .image_url_param import ImageURLParam 8 | 9 | __all__ = ["ImageURLContentBlockParam"] 10 | 11 | 12 | class ImageURLContentBlockParam(TypedDict, total=False): 13 | image_url: Required[ImageURLParam] 14 | 15 | type: Required[Literal["image_url"]] 16 | """The type of the content part.""" 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_url_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["ImageURLDelta"] 9 | 10 | 11 | class ImageURLDelta(BaseModel): 12 | detail: Optional[Literal["auto", "low", "high"]] = None 13 | """Specifies the detail level of the image. 14 | 15 | `low` uses fewer tokens, you can opt in to high resolution using `high`. 16 | """ 17 | 18 | url: Optional[str] = None 19 | """ 20 | The URL of the image, must be a supported image types: jpeg, jpg, png, gif, 21 | webp. 22 | """ 23 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_url_delta_block.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | from .image_url_delta import ImageURLDelta 8 | 9 | __all__ = ["ImageURLDeltaBlock"] 10 | 11 | 12 | class ImageURLDeltaBlock(BaseModel): 13 | index: int 14 | """The index of the content part in the message.""" 15 | 16 | type: Literal["image_url"] 17 | """Always `image_url`.""" 18 | 19 | image_url: Optional[ImageURLDelta] = None 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/image_url_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ImageURLParam"] 8 | 9 | 10 | class ImageURLParam(TypedDict, total=False): 11 | url: Required[str] 12 | """ 13 | The external URL of the image, must be a supported image types: jpeg, jpg, png, 14 | gif, webp. 15 | """ 16 | 17 | detail: Literal["auto", "low", "high"] 18 | """Specifies the detail level of the image. 19 | 20 | `low` uses fewer tokens, you can opt in to high resolution using `high`. Default 21 | value is `auto` 22 | """ 23 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/message_content.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ...._utils import PropertyInfo 7 | from .text_content_block import TextContentBlock 8 | from .refusal_content_block import RefusalContentBlock 9 | from .image_url_content_block import ImageURLContentBlock 10 | from .image_file_content_block import ImageFileContentBlock 11 | 12 | __all__ = ["MessageContent"] 13 | 14 | 15 | MessageContent: TypeAlias = Annotated[ 16 | Union[ImageFileContentBlock, ImageURLContentBlock, TextContentBlock, RefusalContentBlock], 17 | PropertyInfo(discriminator="type"), 18 | ] 19 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/message_content_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ...._utils import PropertyInfo 7 | from .text_delta_block import TextDeltaBlock 8 | from .refusal_delta_block import RefusalDeltaBlock 9 | from .image_url_delta_block import ImageURLDeltaBlock 10 | from .image_file_delta_block import ImageFileDeltaBlock 11 | 12 | __all__ = ["MessageContentDelta"] 13 | 14 | MessageContentDelta: TypeAlias = Annotated[ 15 | Union[ImageFileDeltaBlock, TextDeltaBlock, RefusalDeltaBlock, ImageURLDeltaBlock], 16 | PropertyInfo(discriminator="type"), 17 | ] 18 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/message_content_part_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import TypeAlias 7 | 8 | from .text_content_block_param import TextContentBlockParam 9 | from .image_url_content_block_param import ImageURLContentBlockParam 10 | from .image_file_content_block_param import ImageFileContentBlockParam 11 | 12 | __all__ = ["MessageContentPartParam"] 13 | 14 | MessageContentPartParam: TypeAlias = Union[ImageFileContentBlockParam, ImageURLContentBlockParam, TextContentBlockParam] 15 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/message_deleted.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["MessageDeleted"] 8 | 9 | 10 | class MessageDeleted(BaseModel): 11 | id: str 12 | 13 | deleted: bool 14 | 15 | object: Literal["thread.message.deleted"] 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/message_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List, Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | from .message_content_delta import MessageContentDelta 8 | 9 | __all__ = ["MessageDelta"] 10 | 11 | 12 | class MessageDelta(BaseModel): 13 | content: Optional[List[MessageContentDelta]] = None 14 | """The content of the message in array of text and/or images.""" 15 | 16 | role: Optional[Literal["user", "assistant"]] = None 17 | """The entity that produced the message. One of `user` or `assistant`.""" 18 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/message_delta_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | from .message_delta import MessageDelta 7 | 8 | __all__ = ["MessageDeltaEvent"] 9 | 10 | 11 | class MessageDeltaEvent(BaseModel): 12 | id: str 13 | """The identifier of the message, which can be referenced in API endpoints.""" 14 | 15 | delta: MessageDelta 16 | """The delta containing the fields that have changed on the Message.""" 17 | 18 | object: Literal["thread.message.delta"] 19 | """The object type, which is always `thread.message.delta`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/message_update_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Optional 6 | from typing_extensions import Required, TypedDict 7 | 8 | from ...shared_params.metadata import Metadata 9 | 10 | __all__ = ["MessageUpdateParams"] 11 | 12 | 13 | class MessageUpdateParams(TypedDict, total=False): 14 | thread_id: Required[str] 15 | 16 | metadata: Optional[Metadata] 17 | """Set of 16 key-value pairs that can be attached to an object. 18 | 19 | This can be useful for storing additional information about the object in a 20 | structured format, and querying for objects via API or the dashboard. 21 | 22 | Keys are strings with a maximum length of 64 characters. Values are strings with 23 | a maximum length of 512 characters. 24 | """ 25 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/refusal_content_block.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["RefusalContentBlock"] 8 | 9 | 10 | class RefusalContentBlock(BaseModel): 11 | refusal: str 12 | 13 | type: Literal["refusal"] 14 | """Always `refusal`.""" 15 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/refusal_delta_block.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["RefusalDeltaBlock"] 9 | 10 | 11 | class RefusalDeltaBlock(BaseModel): 12 | index: int 13 | """The index of the refusal part in the message.""" 14 | 15 | type: Literal["refusal"] 16 | """Always `refusal`.""" 17 | 18 | refusal: Optional[str] = None 19 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/run_status.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["RunStatus"] 6 | 7 | RunStatus: TypeAlias = Literal[ 8 | "queued", 9 | "in_progress", 10 | "requires_action", 11 | "cancelling", 12 | "cancelled", 13 | "failed", 14 | "completed", 15 | "incomplete", 16 | "expired", 17 | ] 18 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/run_update_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Optional 6 | from typing_extensions import Required, TypedDict 7 | 8 | from ...shared_params.metadata import Metadata 9 | 10 | __all__ = ["RunUpdateParams"] 11 | 12 | 13 | class RunUpdateParams(TypedDict, total=False): 14 | thread_id: Required[str] 15 | 16 | metadata: Optional[Metadata] 17 | """Set of 16 key-value pairs that can be attached to an object. 18 | 19 | This can be useful for storing additional information about the object in a 20 | structured format, and querying for objects via API or the dashboard. 21 | 22 | Keys are strings with a maximum length of 64 characters. Values are strings with 23 | a maximum length of 512 characters. 24 | """ 25 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/code_interpreter_logs.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ....._models import BaseModel 7 | 8 | __all__ = ["CodeInterpreterLogs"] 9 | 10 | 11 | class CodeInterpreterLogs(BaseModel): 12 | index: int 13 | """The index of the output in the outputs array.""" 14 | 15 | type: Literal["logs"] 16 | """Always `logs`.""" 17 | 18 | logs: Optional[str] = None 19 | """The text output from the Code Interpreter tool call.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/code_interpreter_output_image.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ....._models import BaseModel 7 | 8 | __all__ = ["CodeInterpreterOutputImage", "Image"] 9 | 10 | 11 | class Image(BaseModel): 12 | file_id: Optional[str] = None 13 | """ 14 | The [file](https://platform.openai.com/docs/api-reference/files) ID of the 15 | image. 16 | """ 17 | 18 | 19 | class CodeInterpreterOutputImage(BaseModel): 20 | index: int 21 | """The index of the output in the outputs array.""" 22 | 23 | type: Literal["image"] 24 | """Always `image`.""" 25 | 26 | image: Optional[Image] = None 27 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/file_search_tool_call_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ....._models import BaseModel 7 | 8 | __all__ = ["FileSearchToolCallDelta"] 9 | 10 | 11 | class FileSearchToolCallDelta(BaseModel): 12 | file_search: object 13 | """For now, this is always going to be an empty object.""" 14 | 15 | index: int 16 | """The index of the tool call in the tool calls array.""" 17 | 18 | type: Literal["file_search"] 19 | """The type of tool call. 20 | 21 | This is always going to be `file_search` for this type of tool call. 22 | """ 23 | 24 | id: Optional[str] = None 25 | """The ID of the tool call object.""" 26 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/message_creation_step_details.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ....._models import BaseModel 6 | 7 | __all__ = ["MessageCreationStepDetails", "MessageCreation"] 8 | 9 | 10 | class MessageCreation(BaseModel): 11 | message_id: str 12 | """The ID of the message that was created by this run step.""" 13 | 14 | 15 | class MessageCreationStepDetails(BaseModel): 16 | message_creation: MessageCreation 17 | 18 | type: Literal["message_creation"] 19 | """Always `message_creation`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/run_step_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union, Optional 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ....._utils import PropertyInfo 7 | from ....._models import BaseModel 8 | from .tool_call_delta_object import ToolCallDeltaObject 9 | from .run_step_delta_message_delta import RunStepDeltaMessageDelta 10 | 11 | __all__ = ["RunStepDelta", "StepDetails"] 12 | 13 | StepDetails: TypeAlias = Annotated[ 14 | Union[RunStepDeltaMessageDelta, ToolCallDeltaObject], PropertyInfo(discriminator="type") 15 | ] 16 | 17 | 18 | class RunStepDelta(BaseModel): 19 | step_details: Optional[StepDetails] = None 20 | """The details of the run step.""" 21 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/run_step_delta_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ....._models import BaseModel 6 | from .run_step_delta import RunStepDelta 7 | 8 | __all__ = ["RunStepDeltaEvent"] 9 | 10 | 11 | class RunStepDeltaEvent(BaseModel): 12 | id: str 13 | """The identifier of the run step, which can be referenced in API endpoints.""" 14 | 15 | delta: RunStepDelta 16 | """The delta containing the fields that have changed on the run step.""" 17 | 18 | object: Literal["thread.run.step.delta"] 19 | """The object type, which is always `thread.run.step.delta`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/run_step_delta_message_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ....._models import BaseModel 7 | 8 | __all__ = ["RunStepDeltaMessageDelta", "MessageCreation"] 9 | 10 | 11 | class MessageCreation(BaseModel): 12 | message_id: Optional[str] = None 13 | """The ID of the message that was created by this run step.""" 14 | 15 | 16 | class RunStepDeltaMessageDelta(BaseModel): 17 | type: Literal["message_creation"] 18 | """Always `message_creation`.""" 19 | 20 | message_creation: Optional[MessageCreation] = None 21 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/run_step_include.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["RunStepInclude"] 6 | 7 | RunStepInclude: TypeAlias = Literal["step_details.tool_calls[*].file_search.results[*].content"] 8 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/tool_call.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ....._utils import PropertyInfo 7 | from .function_tool_call import FunctionToolCall 8 | from .file_search_tool_call import FileSearchToolCall 9 | from .code_interpreter_tool_call import CodeInterpreterToolCall 10 | 11 | __all__ = ["ToolCall"] 12 | 13 | ToolCall: TypeAlias = Annotated[ 14 | Union[CodeInterpreterToolCall, FileSearchToolCall, FunctionToolCall], PropertyInfo(discriminator="type") 15 | ] 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/tool_call_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ....._utils import PropertyInfo 7 | from .function_tool_call_delta import FunctionToolCallDelta 8 | from .file_search_tool_call_delta import FileSearchToolCallDelta 9 | from .code_interpreter_tool_call_delta import CodeInterpreterToolCallDelta 10 | 11 | __all__ = ["ToolCallDelta"] 12 | 13 | ToolCallDelta: TypeAlias = Annotated[ 14 | Union[CodeInterpreterToolCallDelta, FileSearchToolCallDelta, FunctionToolCallDelta], 15 | PropertyInfo(discriminator="type"), 16 | ] 17 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/tool_call_delta_object.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List, Optional 4 | from typing_extensions import Literal 5 | 6 | from ....._models import BaseModel 7 | from .tool_call_delta import ToolCallDelta 8 | 9 | __all__ = ["ToolCallDeltaObject"] 10 | 11 | 12 | class ToolCallDeltaObject(BaseModel): 13 | type: Literal["tool_calls"] 14 | """Always `tool_calls`.""" 15 | 16 | tool_calls: Optional[List[ToolCallDelta]] = None 17 | """An array of tool calls the run step was involved in. 18 | 19 | These can be associated with one of three types of tools: `code_interpreter`, 20 | `file_search`, or `function`. 21 | """ 22 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/runs/tool_calls_step_details.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List 4 | from typing_extensions import Literal 5 | 6 | from .tool_call import ToolCall 7 | from ....._models import BaseModel 8 | 9 | __all__ = ["ToolCallsStepDetails"] 10 | 11 | 12 | class ToolCallsStepDetails(BaseModel): 13 | tool_calls: List[ToolCall] 14 | """An array of tool calls the run step was involved in. 15 | 16 | These can be associated with one of three types of tools: `code_interpreter`, 17 | `file_search`, or `function`. 18 | """ 19 | 20 | type: Literal["tool_calls"] 21 | """Always `tool_calls`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/text.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List 4 | 5 | from ...._models import BaseModel 6 | from .annotation import Annotation 7 | 8 | __all__ = ["Text"] 9 | 10 | 11 | class Text(BaseModel): 12 | annotations: List[Annotation] 13 | 14 | value: str 15 | """The data that makes up the text.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/text_content_block.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .text import Text 6 | from ...._models import BaseModel 7 | 8 | __all__ = ["TextContentBlock"] 9 | 10 | 11 | class TextContentBlock(BaseModel): 12 | text: Text 13 | 14 | type: Literal["text"] 15 | """Always `text`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/text_content_block_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["TextContentBlockParam"] 8 | 9 | 10 | class TextContentBlockParam(TypedDict, total=False): 11 | text: Required[str] 12 | """Text content to be sent to the model""" 13 | 14 | type: Required[Literal["text"]] 15 | """Always `text`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/text_delta.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List, Optional 4 | 5 | from ...._models import BaseModel 6 | from .annotation_delta import AnnotationDelta 7 | 8 | __all__ = ["TextDelta"] 9 | 10 | 11 | class TextDelta(BaseModel): 12 | annotations: Optional[List[AnnotationDelta]] = None 13 | 14 | value: Optional[str] = None 15 | """The data that makes up the text.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/beta/threads/text_delta_block.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ...._models import BaseModel 7 | from .text_delta import TextDelta 8 | 9 | __all__ = ["TextDeltaBlock"] 10 | 11 | 12 | class TextDeltaBlock(BaseModel): 13 | index: int 14 | """The index of the content part in the message.""" 15 | 16 | type: Literal["text"] 17 | """Always `text`.""" 18 | 19 | text: Optional[TextDelta] = None 20 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_audio.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from ..._models import BaseModel 4 | 5 | __all__ = ["ChatCompletionAudio"] 6 | 7 | 8 | class ChatCompletionAudio(BaseModel): 9 | id: str 10 | """Unique identifier for this audio response.""" 11 | 12 | data: str 13 | """ 14 | Base64 encoded audio bytes generated by the model, in the format specified in 15 | the request. 16 | """ 17 | 18 | expires_at: int 19 | """ 20 | The Unix timestamp (in seconds) for when this audio response will no longer be 21 | accessible on the server for use in multi-turn conversations. 22 | """ 23 | 24 | transcript: str 25 | """Transcript of the audio generated by the model.""" 26 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_content_part_input_audio_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ChatCompletionContentPartInputAudioParam", "InputAudio"] 8 | 9 | 10 | class InputAudio(TypedDict, total=False): 11 | data: Required[str] 12 | """Base64 encoded audio data.""" 13 | 14 | format: Required[Literal["wav", "mp3"]] 15 | """The format of the encoded audio data. Currently supports "wav" and "mp3".""" 16 | 17 | 18 | class ChatCompletionContentPartInputAudioParam(TypedDict, total=False): 19 | input_audio: Required[InputAudio] 20 | 21 | type: Required[Literal["input_audio"]] 22 | """The type of the content part. Always `input_audio`.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_content_part_refusal_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ChatCompletionContentPartRefusalParam"] 8 | 9 | 10 | class ChatCompletionContentPartRefusalParam(TypedDict, total=False): 11 | refusal: Required[str] 12 | """The refusal message generated by the model.""" 13 | 14 | type: Required[Literal["refusal"]] 15 | """The type of the content part.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_content_part_text_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ChatCompletionContentPartTextParam"] 8 | 9 | 10 | class ChatCompletionContentPartTextParam(TypedDict, total=False): 11 | text: Required[str] 12 | """The text content.""" 13 | 14 | type: Required[Literal["text"]] 15 | """The type of the content part.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_deleted.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ChatCompletionDeleted"] 8 | 9 | 10 | class ChatCompletionDeleted(BaseModel): 11 | id: str 12 | """The ID of the chat completion that was deleted.""" 13 | 14 | deleted: bool 15 | """Whether the chat completion was deleted.""" 16 | 17 | object: Literal["chat.completion.deleted"] 18 | """The type of object being deleted.""" 19 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_function_call_option_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Required, TypedDict 6 | 7 | __all__ = ["ChatCompletionFunctionCallOptionParam"] 8 | 9 | 10 | class ChatCompletionFunctionCallOptionParam(TypedDict, total=False): 11 | name: Required[str] 12 | """The name of the function to call.""" 13 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_function_message_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Optional 6 | from typing_extensions import Literal, Required, TypedDict 7 | 8 | __all__ = ["ChatCompletionFunctionMessageParam"] 9 | 10 | 11 | class ChatCompletionFunctionMessageParam(TypedDict, total=False): 12 | content: Required[Optional[str]] 13 | """The contents of the function message.""" 14 | 15 | name: Required[str] 16 | """The name of the function to call.""" 17 | 18 | role: Required[Literal["function"]] 19 | """The role of the messages author, in this case `function`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_modality.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["ChatCompletionModality"] 6 | 7 | ChatCompletionModality: TypeAlias = Literal["text", "audio"] 8 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_named_tool_choice_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ChatCompletionNamedToolChoiceParam", "Function"] 8 | 9 | 10 | class Function(TypedDict, total=False): 11 | name: Required[str] 12 | """The name of the function to call.""" 13 | 14 | 15 | class ChatCompletionNamedToolChoiceParam(TypedDict, total=False): 16 | function: Required[Function] 17 | 18 | type: Required[Literal["function"]] 19 | """The type of the tool. Currently, only `function` is supported.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_reasoning_effort.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from ..shared.reasoning_effort import ReasoningEffort 4 | 5 | __all__ = ["ChatCompletionReasoningEffort"] 6 | 7 | ChatCompletionReasoningEffort = ReasoningEffort 8 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_role.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["ChatCompletionRole"] 6 | 7 | ChatCompletionRole: TypeAlias = Literal["developer", "system", "user", "assistant", "tool", "function"] 8 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_store_message.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from .chat_completion_message import ChatCompletionMessage 4 | 5 | __all__ = ["ChatCompletionStoreMessage"] 6 | 7 | 8 | class ChatCompletionStoreMessage(ChatCompletionMessage): 9 | id: str 10 | """The identifier of the chat message.""" 11 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_tool_choice_option_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import Literal, TypeAlias 7 | 8 | from .chat_completion_named_tool_choice_param import ChatCompletionNamedToolChoiceParam 9 | 10 | __all__ = ["ChatCompletionToolChoiceOptionParam"] 11 | 12 | ChatCompletionToolChoiceOptionParam: TypeAlias = Union[ 13 | Literal["none", "auto", "required"], ChatCompletionNamedToolChoiceParam 14 | ] 15 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_tool_message_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union, Iterable 6 | from typing_extensions import Literal, Required, TypedDict 7 | 8 | from .chat_completion_content_part_text_param import ChatCompletionContentPartTextParam 9 | 10 | __all__ = ["ChatCompletionToolMessageParam"] 11 | 12 | 13 | class ChatCompletionToolMessageParam(TypedDict, total=False): 14 | content: Required[Union[str, Iterable[ChatCompletionContentPartTextParam]]] 15 | """The contents of the tool message.""" 16 | 17 | role: Required[Literal["tool"]] 18 | """The role of the messages author, in this case `tool`.""" 19 | 20 | tool_call_id: Required[str] 21 | """Tool call that this message is responding to.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/chat/chat_completion_tool_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | from ..shared_params.function_definition import FunctionDefinition 8 | 9 | __all__ = ["ChatCompletionToolParam"] 10 | 11 | 12 | class ChatCompletionToolParam(TypedDict, total=False): 13 | function: Required[FunctionDefinition] 14 | 15 | type: Required[Literal["function"]] 16 | """The type of the tool. Currently, only `function` is supported.""" 17 | -------------------------------------------------------------------------------- /src/openai/types/chat/completion_update_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Optional 6 | from typing_extensions import Required, TypedDict 7 | 8 | from ..shared_params.metadata import Metadata 9 | 10 | __all__ = ["CompletionUpdateParams"] 11 | 12 | 13 | class CompletionUpdateParams(TypedDict, total=False): 14 | metadata: Required[Optional[Metadata]] 15 | """Set of 16 key-value pairs that can be attached to an object. 16 | 17 | This can be useful for storing additional information about the object in a 18 | structured format, and querying for objects via API or the dashboard. 19 | 20 | Keys are strings with a maximum length of 64 characters. Values are strings with 21 | a maximum length of 512 characters. 22 | """ 23 | -------------------------------------------------------------------------------- /src/openai/types/chat/completions/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from .message_list_params import MessageListParams as MessageListParams 6 | -------------------------------------------------------------------------------- /src/openai/types/chat/completions/message_list_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, TypedDict 6 | 7 | __all__ = ["MessageListParams"] 8 | 9 | 10 | class MessageListParams(TypedDict, total=False): 11 | after: str 12 | """Identifier for the last message from the previous pagination request.""" 13 | 14 | limit: int 15 | """Number of messages to retrieve.""" 16 | 17 | order: Literal["asc", "desc"] 18 | """Sort order for messages by timestamp. 19 | 20 | Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`. 21 | """ 22 | -------------------------------------------------------------------------------- /src/openai/types/chat_model.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from .shared import chat_model 4 | 5 | __all__ = ["ChatModel"] 6 | 7 | ChatModel = chat_model.ChatModel 8 | -------------------------------------------------------------------------------- /src/openai/types/containers/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from .file_list_params import FileListParams as FileListParams 6 | from .file_create_params import FileCreateParams as FileCreateParams 7 | from .file_list_response import FileListResponse as FileListResponse 8 | from .file_create_response import FileCreateResponse as FileCreateResponse 9 | from .file_retrieve_response import FileRetrieveResponse as FileRetrieveResponse 10 | -------------------------------------------------------------------------------- /src/openai/types/containers/file_create_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import TypedDict 6 | 7 | from ..._types import FileTypes 8 | 9 | __all__ = ["FileCreateParams"] 10 | 11 | 12 | class FileCreateParams(TypedDict, total=False): 13 | file: FileTypes 14 | """The File object (not file name) to be uploaded.""" 15 | 16 | file_id: str 17 | """Name of the file to create.""" 18 | -------------------------------------------------------------------------------- /src/openai/types/containers/file_create_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["FileCreateResponse"] 8 | 9 | 10 | class FileCreateResponse(BaseModel): 11 | id: str 12 | """Unique identifier for the file.""" 13 | 14 | bytes: int 15 | """Size of the file in bytes.""" 16 | 17 | container_id: str 18 | """The container this file belongs to.""" 19 | 20 | created_at: int 21 | """Unix timestamp (in seconds) when the file was created.""" 22 | 23 | object: Literal["container.file"] 24 | """The type of this object (`container.file`).""" 25 | 26 | path: str 27 | """Path of the file in the container.""" 28 | 29 | source: str 30 | """Source of the file (e.g., `user`, `assistant`).""" 31 | -------------------------------------------------------------------------------- /src/openai/types/containers/file_list_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["FileListResponse"] 8 | 9 | 10 | class FileListResponse(BaseModel): 11 | id: str 12 | """Unique identifier for the file.""" 13 | 14 | bytes: int 15 | """Size of the file in bytes.""" 16 | 17 | container_id: str 18 | """The container this file belongs to.""" 19 | 20 | created_at: int 21 | """Unix timestamp (in seconds) when the file was created.""" 22 | 23 | object: Literal["container.file"] 24 | """The type of this object (`container.file`).""" 25 | 26 | path: str 27 | """Path of the file in the container.""" 28 | 29 | source: str 30 | """Source of the file (e.g., `user`, `assistant`).""" 31 | -------------------------------------------------------------------------------- /src/openai/types/containers/file_retrieve_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["FileRetrieveResponse"] 8 | 9 | 10 | class FileRetrieveResponse(BaseModel): 11 | id: str 12 | """Unique identifier for the file.""" 13 | 14 | bytes: int 15 | """Size of the file in bytes.""" 16 | 17 | container_id: str 18 | """The container this file belongs to.""" 19 | 20 | created_at: int 21 | """Unix timestamp (in seconds) when the file was created.""" 22 | 23 | object: Literal["container.file"] 24 | """The type of this object (`container.file`).""" 25 | 26 | path: str 27 | """Path of the file in the container.""" 28 | 29 | source: str 30 | """Source of the file (e.g., `user`, `assistant`).""" 31 | -------------------------------------------------------------------------------- /src/openai/types/containers/files/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | -------------------------------------------------------------------------------- /src/openai/types/embedding.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List 4 | from typing_extensions import Literal 5 | 6 | from .._models import BaseModel 7 | 8 | __all__ = ["Embedding"] 9 | 10 | 11 | class Embedding(BaseModel): 12 | embedding: List[float] 13 | """The embedding vector, which is a list of floats. 14 | 15 | The length of vector depends on the model as listed in the 16 | [embedding guide](https://platform.openai.com/docs/guides/embeddings). 17 | """ 18 | 19 | index: int 20 | """The index of the embedding in the list of embeddings.""" 21 | 22 | object: Literal["embedding"] 23 | """The object type, which is always "embedding".""" 24 | -------------------------------------------------------------------------------- /src/openai/types/embedding_model.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["EmbeddingModel"] 6 | 7 | EmbeddingModel: TypeAlias = Literal["text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large"] 8 | -------------------------------------------------------------------------------- /src/openai/types/eval_custom_data_source_config.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Dict 4 | from typing_extensions import Literal 5 | 6 | from pydantic import Field as FieldInfo 7 | 8 | from .._models import BaseModel 9 | 10 | __all__ = ["EvalCustomDataSourceConfig"] 11 | 12 | 13 | class EvalCustomDataSourceConfig(BaseModel): 14 | schema_: Dict[str, object] = FieldInfo(alias="schema") 15 | """ 16 | The json schema for the run data source items. Learn how to build JSON schemas 17 | [here](https://json-schema.org/). 18 | """ 19 | 20 | type: Literal["custom"] 21 | """The type of data source. Always `custom`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/eval_delete_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from .._models import BaseModel 4 | 5 | __all__ = ["EvalDeleteResponse"] 6 | 7 | 8 | class EvalDeleteResponse(BaseModel): 9 | deleted: bool 10 | 11 | eval_id: str 12 | 13 | object: str 14 | -------------------------------------------------------------------------------- /src/openai/types/eval_list_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, TypedDict 6 | 7 | __all__ = ["EvalListParams"] 8 | 9 | 10 | class EvalListParams(TypedDict, total=False): 11 | after: str 12 | """Identifier for the last eval from the previous pagination request.""" 13 | 14 | limit: int 15 | """Number of evals to retrieve.""" 16 | 17 | order: Literal["asc", "desc"] 18 | """Sort order for evals by timestamp. 19 | 20 | Use `asc` for ascending order or `desc` for descending order. 21 | """ 22 | 23 | order_by: Literal["created_at", "updated_at"] 24 | """Evals can be ordered by creation time or last updated time. 25 | 26 | Use `created_at` for creation time or `updated_at` for last updated time. 27 | """ 28 | -------------------------------------------------------------------------------- /src/openai/types/eval_update_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Optional 6 | from typing_extensions import TypedDict 7 | 8 | from .shared_params.metadata import Metadata 9 | 10 | __all__ = ["EvalUpdateParams"] 11 | 12 | 13 | class EvalUpdateParams(TypedDict, total=False): 14 | metadata: Optional[Metadata] 15 | """Set of 16 key-value pairs that can be attached to an object. 16 | 17 | This can be useful for storing additional information about the object in a 18 | structured format, and querying for objects via API or the dashboard. 19 | 20 | Keys are strings with a maximum length of 64 characters. Values are strings with 21 | a maximum length of 512 characters. 22 | """ 23 | 24 | name: str 25 | """Rename the evaluation.""" 26 | -------------------------------------------------------------------------------- /src/openai/types/evals/eval_api_error.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from ..._models import BaseModel 4 | 5 | __all__ = ["EvalAPIError"] 6 | 7 | 8 | class EvalAPIError(BaseModel): 9 | code: str 10 | """The error code.""" 11 | 12 | message: str 13 | """The error message.""" 14 | -------------------------------------------------------------------------------- /src/openai/types/evals/run_delete_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["RunDeleteResponse"] 8 | 9 | 10 | class RunDeleteResponse(BaseModel): 11 | deleted: Optional[bool] = None 12 | 13 | object: Optional[str] = None 14 | 15 | run_id: Optional[str] = None 16 | -------------------------------------------------------------------------------- /src/openai/types/evals/runs/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from .output_item_list_params import OutputItemListParams as OutputItemListParams 6 | from .output_item_list_response import OutputItemListResponse as OutputItemListResponse 7 | from .output_item_retrieve_response import OutputItemRetrieveResponse as OutputItemRetrieveResponse 8 | -------------------------------------------------------------------------------- /src/openai/types/file_chunking_strategy.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from .._utils import PropertyInfo 7 | from .other_file_chunking_strategy_object import OtherFileChunkingStrategyObject 8 | from .static_file_chunking_strategy_object import StaticFileChunkingStrategyObject 9 | 10 | __all__ = ["FileChunkingStrategy"] 11 | 12 | FileChunkingStrategy: TypeAlias = Annotated[ 13 | Union[StaticFileChunkingStrategyObject, OtherFileChunkingStrategyObject], PropertyInfo(discriminator="type") 14 | ] 15 | -------------------------------------------------------------------------------- /src/openai/types/file_chunking_strategy_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import TypeAlias 7 | 8 | from .auto_file_chunking_strategy_param import AutoFileChunkingStrategyParam 9 | from .static_file_chunking_strategy_object_param import StaticFileChunkingStrategyObjectParam 10 | 11 | __all__ = ["FileChunkingStrategyParam"] 12 | 13 | FileChunkingStrategyParam: TypeAlias = Union[AutoFileChunkingStrategyParam, StaticFileChunkingStrategyObjectParam] 14 | -------------------------------------------------------------------------------- /src/openai/types/file_content.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import TypeAlias 4 | 5 | __all__ = ["FileContent"] 6 | 7 | FileContent: TypeAlias = str 8 | -------------------------------------------------------------------------------- /src/openai/types/file_deleted.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .._models import BaseModel 6 | 7 | __all__ = ["FileDeleted"] 8 | 9 | 10 | class FileDeleted(BaseModel): 11 | id: str 12 | 13 | deleted: bool 14 | 15 | object: Literal["file"] 16 | -------------------------------------------------------------------------------- /src/openai/types/file_purpose.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["FilePurpose"] 6 | 7 | FilePurpose: TypeAlias = Literal["assistants", "batch", "fine-tune", "vision", "user_data", "evals"] 8 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/alpha/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from .grader_run_params import GraderRunParams as GraderRunParams 6 | from .grader_run_response import GraderRunResponse as GraderRunResponse 7 | from .grader_validate_params import GraderValidateParams as GraderValidateParams 8 | from .grader_validate_response import GraderValidateResponse as GraderValidateResponse 9 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/checkpoints/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from .permission_create_params import PermissionCreateParams as PermissionCreateParams 6 | from .permission_create_response import PermissionCreateResponse as PermissionCreateResponse 7 | from .permission_delete_response import PermissionDeleteResponse as PermissionDeleteResponse 8 | from .permission_retrieve_params import PermissionRetrieveParams as PermissionRetrieveParams 9 | from .permission_retrieve_response import PermissionRetrieveResponse as PermissionRetrieveResponse 10 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/checkpoints/permission_create_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import List 6 | from typing_extensions import Required, TypedDict 7 | 8 | __all__ = ["PermissionCreateParams"] 9 | 10 | 11 | class PermissionCreateParams(TypedDict, total=False): 12 | project_ids: Required[List[str]] 13 | """The project identifiers to grant access to.""" 14 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/checkpoints/permission_create_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["PermissionCreateResponse"] 8 | 9 | 10 | class PermissionCreateResponse(BaseModel): 11 | id: str 12 | """The permission identifier, which can be referenced in the API endpoints.""" 13 | 14 | created_at: int 15 | """The Unix timestamp (in seconds) for when the permission was created.""" 16 | 17 | object: Literal["checkpoint.permission"] 18 | """The object type, which is always "checkpoint.permission".""" 19 | 20 | project_id: str 21 | """The project identifier that the permission is for.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/checkpoints/permission_delete_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ...._models import BaseModel 6 | 7 | __all__ = ["PermissionDeleteResponse"] 8 | 9 | 10 | class PermissionDeleteResponse(BaseModel): 11 | id: str 12 | """The ID of the fine-tuned model checkpoint permission that was deleted.""" 13 | 14 | deleted: bool 15 | """Whether the fine-tuned model checkpoint permission was successfully deleted.""" 16 | 17 | object: Literal["checkpoint.permission"] 18 | """The object type, which is always "checkpoint.permission".""" 19 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/checkpoints/permission_retrieve_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, TypedDict 6 | 7 | __all__ = ["PermissionRetrieveParams"] 8 | 9 | 10 | class PermissionRetrieveParams(TypedDict, total=False): 11 | after: str 12 | """Identifier for the last permission ID from the previous pagination request.""" 13 | 14 | limit: int 15 | """Number of permissions to retrieve.""" 16 | 17 | order: Literal["ascending", "descending"] 18 | """The order in which to retrieve permissions.""" 19 | 20 | project_id: str 21 | """The ID of the project to get permissions for.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/dpo_method.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | 5 | from ..._models import BaseModel 6 | from .dpo_hyperparameters import DpoHyperparameters 7 | 8 | __all__ = ["DpoMethod"] 9 | 10 | 11 | class DpoMethod(BaseModel): 12 | hyperparameters: Optional[DpoHyperparameters] = None 13 | """The hyperparameters used for the DPO fine-tuning job.""" 14 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/dpo_method_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import TypedDict 6 | 7 | from .dpo_hyperparameters_param import DpoHyperparametersParam 8 | 9 | __all__ = ["DpoMethodParam"] 10 | 11 | 12 | class DpoMethodParam(TypedDict, total=False): 13 | hyperparameters: DpoHyperparametersParam 14 | """The hyperparameters used for the DPO fine-tuning job.""" 15 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/fine_tuning_job_integration.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from .fine_tuning_job_wandb_integration_object import FineTuningJobWandbIntegrationObject 4 | 5 | FineTuningJobIntegration = FineTuningJobWandbIntegrationObject 6 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/job_list_events_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import TypedDict 6 | 7 | __all__ = ["JobListEventsParams"] 8 | 9 | 10 | class JobListEventsParams(TypedDict, total=False): 11 | after: str 12 | """Identifier for the last event from the previous pagination request.""" 13 | 14 | limit: int 15 | """Number of events to retrieve.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/job_list_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Dict, Optional 6 | from typing_extensions import TypedDict 7 | 8 | __all__ = ["JobListParams"] 9 | 10 | 11 | class JobListParams(TypedDict, total=False): 12 | after: str 13 | """Identifier for the last job from the previous pagination request.""" 14 | 15 | limit: int 16 | """Number of fine-tuning jobs to retrieve.""" 17 | 18 | metadata: Optional[Dict[str, str]] 19 | """Optional metadata filter. 20 | 21 | To filter, use the syntax `metadata[k]=v`. Alternatively, set `metadata=null` to 22 | indicate no metadata. 23 | """ 24 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/jobs/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from .checkpoint_list_params import CheckpointListParams as CheckpointListParams 6 | from .fine_tuning_job_checkpoint import FineTuningJobCheckpoint as FineTuningJobCheckpoint 7 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/jobs/checkpoint_list_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import TypedDict 6 | 7 | __all__ = ["CheckpointListParams"] 8 | 9 | 10 | class CheckpointListParams(TypedDict, total=False): 11 | after: str 12 | """Identifier for the last checkpoint ID from the previous pagination request.""" 13 | 14 | limit: int 15 | """Number of checkpoints to retrieve.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/supervised_method.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | 5 | from ..._models import BaseModel 6 | from .supervised_hyperparameters import SupervisedHyperparameters 7 | 8 | __all__ = ["SupervisedMethod"] 9 | 10 | 11 | class SupervisedMethod(BaseModel): 12 | hyperparameters: Optional[SupervisedHyperparameters] = None 13 | """The hyperparameters used for the fine-tuning job.""" 14 | -------------------------------------------------------------------------------- /src/openai/types/fine_tuning/supervised_method_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import TypedDict 6 | 7 | from .supervised_hyperparameters_param import SupervisedHyperparametersParam 8 | 9 | __all__ = ["SupervisedMethodParam"] 10 | 11 | 12 | class SupervisedMethodParam(TypedDict, total=False): 13 | hyperparameters: SupervisedHyperparametersParam 14 | """The hyperparameters used for the fine-tuning job.""" 15 | -------------------------------------------------------------------------------- /src/openai/types/graders/python_grader.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["PythonGrader"] 9 | 10 | 11 | class PythonGrader(BaseModel): 12 | name: str 13 | """The name of the grader.""" 14 | 15 | source: str 16 | """The source code of the python script.""" 17 | 18 | type: Literal["python"] 19 | """The object type, which is always `python`.""" 20 | 21 | image_tag: Optional[str] = None 22 | """The image tag to use for the python script.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/graders/python_grader_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["PythonGraderParam"] 8 | 9 | 10 | class PythonGraderParam(TypedDict, total=False): 11 | name: Required[str] 12 | """The name of the grader.""" 13 | 14 | source: Required[str] 15 | """The source code of the python script.""" 16 | 17 | type: Required[Literal["python"]] 18 | """The object type, which is always `python`.""" 19 | 20 | image_tag: str 21 | """The image tag to use for the python script.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/graders/string_check_grader.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["StringCheckGrader"] 8 | 9 | 10 | class StringCheckGrader(BaseModel): 11 | input: str 12 | """The input text. This may include template strings.""" 13 | 14 | name: str 15 | """The name of the grader.""" 16 | 17 | operation: Literal["eq", "ne", "like", "ilike"] 18 | """The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.""" 19 | 20 | reference: str 21 | """The reference text. This may include template strings.""" 22 | 23 | type: Literal["string_check"] 24 | """The object type, which is always `string_check`.""" 25 | -------------------------------------------------------------------------------- /src/openai/types/image.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | 5 | from .._models import BaseModel 6 | 7 | __all__ = ["Image"] 8 | 9 | 10 | class Image(BaseModel): 11 | b64_json: Optional[str] = None 12 | """The base64-encoded JSON of the generated image. 13 | 14 | Default value for `gpt-image-1`, and only present if `response_format` is set to 15 | `b64_json` for `dall-e-2` and `dall-e-3`. 16 | """ 17 | 18 | revised_prompt: Optional[str] = None 19 | """For `dall-e-3` only, the revised prompt that was used to generate the image.""" 20 | 21 | url: Optional[str] = None 22 | """ 23 | When using `dall-e-2` or `dall-e-3`, the URL of the generated image if 24 | `response_format` is set to `url` (default value). Unsupported for 25 | `gpt-image-1`. 26 | """ 27 | -------------------------------------------------------------------------------- /src/openai/types/image_model.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["ImageModel"] 6 | 7 | ImageModel: TypeAlias = Literal["dall-e-2", "dall-e-3", "gpt-image-1"] 8 | -------------------------------------------------------------------------------- /src/openai/types/model.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .._models import BaseModel 6 | 7 | __all__ = ["Model"] 8 | 9 | 10 | class Model(BaseModel): 11 | id: str 12 | """The model identifier, which can be referenced in the API endpoints.""" 13 | 14 | created: int 15 | """The Unix timestamp (in seconds) when the model was created.""" 16 | 17 | object: Literal["model"] 18 | """The object type, which is always "model".""" 19 | 20 | owned_by: str 21 | """The organization that owns the model.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/model_deleted.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from .._models import BaseModel 4 | 5 | __all__ = ["ModelDeleted"] 6 | 7 | 8 | class ModelDeleted(BaseModel): 9 | id: str 10 | 11 | deleted: bool 12 | 13 | object: str 14 | -------------------------------------------------------------------------------- /src/openai/types/moderation_create_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List 4 | 5 | from .._models import BaseModel 6 | from .moderation import Moderation 7 | 8 | __all__ = ["ModerationCreateResponse"] 9 | 10 | 11 | class ModerationCreateResponse(BaseModel): 12 | id: str 13 | """The unique identifier for the moderation request.""" 14 | 15 | model: str 16 | """The model used to generate the moderation results.""" 17 | 18 | results: List[Moderation] 19 | """A list of moderation objects.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/moderation_image_url_input_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ModerationImageURLInputParam", "ImageURL"] 8 | 9 | 10 | class ImageURL(TypedDict, total=False): 11 | url: Required[str] 12 | """Either a URL of the image or the base64 encoded image data.""" 13 | 14 | 15 | class ModerationImageURLInputParam(TypedDict, total=False): 16 | image_url: Required[ImageURL] 17 | """Contains either an image URL or a data URL for a base64 encoded image.""" 18 | 19 | type: Required[Literal["image_url"]] 20 | """Always `image_url`.""" 21 | -------------------------------------------------------------------------------- /src/openai/types/moderation_model.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["ModerationModel"] 6 | 7 | ModerationModel: TypeAlias = Literal[ 8 | "omni-moderation-latest", "omni-moderation-2024-09-26", "text-moderation-latest", "text-moderation-stable" 9 | ] 10 | -------------------------------------------------------------------------------- /src/openai/types/moderation_multi_modal_input_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import TypeAlias 7 | 8 | from .moderation_text_input_param import ModerationTextInputParam 9 | from .moderation_image_url_input_param import ModerationImageURLInputParam 10 | 11 | __all__ = ["ModerationMultiModalInputParam"] 12 | 13 | ModerationMultiModalInputParam: TypeAlias = Union[ModerationImageURLInputParam, ModerationTextInputParam] 14 | -------------------------------------------------------------------------------- /src/openai/types/moderation_text_input_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ModerationTextInputParam"] 8 | 9 | 10 | class ModerationTextInputParam(TypedDict, total=False): 11 | text: Required[str] 12 | """A string of text to classify.""" 13 | 14 | type: Required[Literal["text"]] 15 | """Always `text`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/other_file_chunking_strategy_object.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .._models import BaseModel 6 | 7 | __all__ = ["OtherFileChunkingStrategyObject"] 8 | 9 | 10 | class OtherFileChunkingStrategyObject(BaseModel): 11 | type: Literal["other"] 12 | """Always `other`.""" 13 | -------------------------------------------------------------------------------- /src/openai/types/responses/computer_tool.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ComputerTool"] 8 | 9 | 10 | class ComputerTool(BaseModel): 11 | display_height: int 12 | """The height of the computer display.""" 13 | 14 | display_width: int 15 | """The width of the computer display.""" 16 | 17 | environment: Literal["windows", "mac", "linux", "ubuntu", "browser"] 18 | """The type of computer environment to control.""" 19 | 20 | type: Literal["computer_use_preview"] 21 | """The type of the computer use tool. Always `computer_use_preview`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/computer_tool_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ComputerToolParam"] 8 | 9 | 10 | class ComputerToolParam(TypedDict, total=False): 11 | display_height: Required[int] 12 | """The height of the computer display.""" 13 | 14 | display_width: Required[int] 15 | """The width of the computer display.""" 16 | 17 | environment: Required[Literal["windows", "mac", "linux", "ubuntu", "browser"]] 18 | """The type of computer environment to control.""" 19 | 20 | type: Required[Literal["computer_use_preview"]] 21 | """The type of the computer use tool. Always `computer_use_preview`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_audio_delta_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseAudioDeltaEvent"] 8 | 9 | 10 | class ResponseAudioDeltaEvent(BaseModel): 11 | delta: str 12 | """A chunk of Base64 encoded response audio bytes.""" 13 | 14 | sequence_number: int 15 | """A sequence number for this chunk of the stream response.""" 16 | 17 | type: Literal["response.audio.delta"] 18 | """The type of the event. Always `response.audio.delta`.""" 19 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_audio_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseAudioDoneEvent"] 8 | 9 | 10 | class ResponseAudioDoneEvent(BaseModel): 11 | sequence_number: int 12 | """The sequence number of the delta.""" 13 | 14 | type: Literal["response.audio.done"] 15 | """The type of the event. Always `response.audio.done`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_audio_transcript_delta_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseAudioTranscriptDeltaEvent"] 8 | 9 | 10 | class ResponseAudioTranscriptDeltaEvent(BaseModel): 11 | delta: str 12 | """The partial transcript of the audio response.""" 13 | 14 | sequence_number: int 15 | """The sequence number of this event.""" 16 | 17 | type: Literal["response.audio.transcript.delta"] 18 | """The type of the event. Always `response.audio.transcript.delta`.""" 19 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_audio_transcript_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseAudioTranscriptDoneEvent"] 8 | 9 | 10 | class ResponseAudioTranscriptDoneEvent(BaseModel): 11 | sequence_number: int 12 | """The sequence number of this event.""" 13 | 14 | type: Literal["response.audio.transcript.done"] 15 | """The type of the event. Always `response.audio.transcript.done`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_code_interpreter_call_code_delta_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseCodeInterpreterCallCodeDeltaEvent"] 8 | 9 | 10 | class ResponseCodeInterpreterCallCodeDeltaEvent(BaseModel): 11 | delta: str 12 | """The partial code snippet added by the code interpreter.""" 13 | 14 | output_index: int 15 | """The index of the output item that the code interpreter call is in progress.""" 16 | 17 | sequence_number: int 18 | """The sequence number of this event.""" 19 | 20 | type: Literal["response.code_interpreter_call.code.delta"] 21 | """The type of the event. Always `response.code_interpreter_call.code.delta`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_code_interpreter_call_code_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseCodeInterpreterCallCodeDoneEvent"] 8 | 9 | 10 | class ResponseCodeInterpreterCallCodeDoneEvent(BaseModel): 11 | code: str 12 | """The final code snippet output by the code interpreter.""" 13 | 14 | output_index: int 15 | """The index of the output item that the code interpreter call is in progress.""" 16 | 17 | sequence_number: int 18 | """The sequence number of this event.""" 19 | 20 | type: Literal["response.code_interpreter_call.code.done"] 21 | """The type of the event. Always `response.code_interpreter_call.code.done`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_completed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .response import Response 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["ResponseCompletedEvent"] 9 | 10 | 11 | class ResponseCompletedEvent(BaseModel): 12 | response: Response 13 | """Properties of the completed response.""" 14 | 15 | sequence_number: int 16 | """The sequence number for this event.""" 17 | 18 | type: Literal["response.completed"] 19 | """The type of the event. Always `response.completed`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_computer_tool_call_output_screenshot.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["ResponseComputerToolCallOutputScreenshot"] 9 | 10 | 11 | class ResponseComputerToolCallOutputScreenshot(BaseModel): 12 | type: Literal["computer_screenshot"] 13 | """Specifies the event type. 14 | 15 | For a computer screenshot, this property is always set to `computer_screenshot`. 16 | """ 17 | 18 | file_id: Optional[str] = None 19 | """The identifier of an uploaded file that contains the screenshot.""" 20 | 21 | image_url: Optional[str] = None 22 | """The URL of the screenshot image.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_computer_tool_call_output_screenshot_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ResponseComputerToolCallOutputScreenshotParam"] 8 | 9 | 10 | class ResponseComputerToolCallOutputScreenshotParam(TypedDict, total=False): 11 | type: Required[Literal["computer_screenshot"]] 12 | """Specifies the event type. 13 | 14 | For a computer screenshot, this property is always set to `computer_screenshot`. 15 | """ 16 | 17 | file_id: str 18 | """The identifier of an uploaded file that contains the screenshot.""" 19 | 20 | image_url: str 21 | """The URL of the screenshot image.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_created_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .response import Response 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["ResponseCreatedEvent"] 9 | 10 | 11 | class ResponseCreatedEvent(BaseModel): 12 | response: Response 13 | """The response that was created.""" 14 | 15 | sequence_number: int 16 | """The sequence number for this event.""" 17 | 18 | type: Literal["response.created"] 19 | """The type of the event. Always `response.created`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_error_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["ResponseErrorEvent"] 9 | 10 | 11 | class ResponseErrorEvent(BaseModel): 12 | code: Optional[str] = None 13 | """The error code.""" 14 | 15 | message: str 16 | """The error message.""" 17 | 18 | param: Optional[str] = None 19 | """The error parameter.""" 20 | 21 | sequence_number: int 22 | """The sequence number of this event.""" 23 | 24 | type: Literal["error"] 25 | """The type of the event. Always `error`.""" 26 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_failed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .response import Response 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["ResponseFailedEvent"] 9 | 10 | 11 | class ResponseFailedEvent(BaseModel): 12 | response: Response 13 | """The response that failed.""" 14 | 15 | sequence_number: int 16 | """The sequence number of this event.""" 17 | 18 | type: Literal["response.failed"] 19 | """The type of the event. Always `response.failed`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_file_search_call_completed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseFileSearchCallCompletedEvent"] 8 | 9 | 10 | class ResponseFileSearchCallCompletedEvent(BaseModel): 11 | item_id: str 12 | """The ID of the output item that the file search call is initiated.""" 13 | 14 | output_index: int 15 | """The index of the output item that the file search call is initiated.""" 16 | 17 | sequence_number: int 18 | """The sequence number of this event.""" 19 | 20 | type: Literal["response.file_search_call.completed"] 21 | """The type of the event. Always `response.file_search_call.completed`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_file_search_call_in_progress_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseFileSearchCallInProgressEvent"] 8 | 9 | 10 | class ResponseFileSearchCallInProgressEvent(BaseModel): 11 | item_id: str 12 | """The ID of the output item that the file search call is initiated.""" 13 | 14 | output_index: int 15 | """The index of the output item that the file search call is initiated.""" 16 | 17 | sequence_number: int 18 | """The sequence number of this event.""" 19 | 20 | type: Literal["response.file_search_call.in_progress"] 21 | """The type of the event. Always `response.file_search_call.in_progress`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_file_search_call_searching_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseFileSearchCallSearchingEvent"] 8 | 9 | 10 | class ResponseFileSearchCallSearchingEvent(BaseModel): 11 | item_id: str 12 | """The ID of the output item that the file search call is initiated.""" 13 | 14 | output_index: int 15 | """The index of the output item that the file search call is searching.""" 16 | 17 | sequence_number: int 18 | """The sequence number of this event.""" 19 | 20 | type: Literal["response.file_search_call.searching"] 21 | """The type of the event. Always `response.file_search_call.searching`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_format_text_config.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ..._utils import PropertyInfo 7 | from ..shared.response_format_text import ResponseFormatText 8 | from ..shared.response_format_json_object import ResponseFormatJSONObject 9 | from .response_format_text_json_schema_config import ResponseFormatTextJSONSchemaConfig 10 | 11 | __all__ = ["ResponseFormatTextConfig"] 12 | 13 | ResponseFormatTextConfig: TypeAlias = Annotated[ 14 | Union[ResponseFormatText, ResponseFormatTextJSONSchemaConfig, ResponseFormatJSONObject], 15 | PropertyInfo(discriminator="type"), 16 | ] 17 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_format_text_config_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import TypeAlias 7 | 8 | from ..shared_params.response_format_text import ResponseFormatText 9 | from ..shared_params.response_format_json_object import ResponseFormatJSONObject 10 | from .response_format_text_json_schema_config_param import ResponseFormatTextJSONSchemaConfigParam 11 | 12 | __all__ = ["ResponseFormatTextConfigParam"] 13 | 14 | ResponseFormatTextConfigParam: TypeAlias = Union[ 15 | ResponseFormatText, ResponseFormatTextJSONSchemaConfigParam, ResponseFormatJSONObject 16 | ] 17 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_function_call_arguments_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseFunctionCallArgumentsDoneEvent"] 8 | 9 | 10 | class ResponseFunctionCallArgumentsDoneEvent(BaseModel): 11 | arguments: str 12 | """The function-call arguments.""" 13 | 14 | item_id: str 15 | """The ID of the item.""" 16 | 17 | output_index: int 18 | """The index of the output item.""" 19 | 20 | sequence_number: int 21 | """The sequence number of this event.""" 22 | 23 | type: Literal["response.function_call_arguments.done"] 24 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_function_tool_call_item.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from .response_function_tool_call import ResponseFunctionToolCall 4 | 5 | __all__ = ["ResponseFunctionToolCallItem"] 6 | 7 | 8 | class ResponseFunctionToolCallItem(ResponseFunctionToolCall): 9 | id: str # type: ignore 10 | """The unique ID of the function tool call.""" 11 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_function_web_search.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseFunctionWebSearch"] 8 | 9 | 10 | class ResponseFunctionWebSearch(BaseModel): 11 | id: str 12 | """The unique ID of the web search tool call.""" 13 | 14 | status: Literal["in_progress", "searching", "completed", "failed"] 15 | """The status of the web search tool call.""" 16 | 17 | type: Literal["web_search_call"] 18 | """The type of the web search tool call. Always `web_search_call`.""" 19 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_function_web_search_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ResponseFunctionWebSearchParam"] 8 | 9 | 10 | class ResponseFunctionWebSearchParam(TypedDict, total=False): 11 | id: Required[str] 12 | """The unique ID of the web search tool call.""" 13 | 14 | status: Required[Literal["in_progress", "searching", "completed", "failed"]] 15 | """The status of the web search tool call.""" 16 | 17 | type: Required[Literal["web_search_call"]] 18 | """The type of the web search tool call. Always `web_search_call`.""" 19 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_image_gen_call_completed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseImageGenCallCompletedEvent"] 8 | 9 | 10 | class ResponseImageGenCallCompletedEvent(BaseModel): 11 | item_id: str 12 | """The unique identifier of the image generation item being processed.""" 13 | 14 | output_index: int 15 | """The index of the output item in the response's output array.""" 16 | 17 | sequence_number: int 18 | """The sequence number of this event.""" 19 | 20 | type: Literal["response.image_generation_call.completed"] 21 | """The type of the event. Always 'response.image_generation_call.completed'.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_image_gen_call_generating_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseImageGenCallGeneratingEvent"] 8 | 9 | 10 | class ResponseImageGenCallGeneratingEvent(BaseModel): 11 | item_id: str 12 | """The unique identifier of the image generation item being processed.""" 13 | 14 | output_index: int 15 | """The index of the output item in the response's output array.""" 16 | 17 | sequence_number: int 18 | """The sequence number of the image generation item being processed.""" 19 | 20 | type: Literal["response.image_generation_call.generating"] 21 | """The type of the event. Always 'response.image_generation_call.generating'.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_image_gen_call_in_progress_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseImageGenCallInProgressEvent"] 8 | 9 | 10 | class ResponseImageGenCallInProgressEvent(BaseModel): 11 | item_id: str 12 | """The unique identifier of the image generation item being processed.""" 13 | 14 | output_index: int 15 | """The index of the output item in the response's output array.""" 16 | 17 | sequence_number: int 18 | """The sequence number of the image generation item being processed.""" 19 | 20 | type: Literal["response.image_generation_call.in_progress"] 21 | """The type of the event. Always 'response.image_generation_call.in_progress'.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_in_progress_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .response import Response 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["ResponseInProgressEvent"] 9 | 10 | 11 | class ResponseInProgressEvent(BaseModel): 12 | response: Response 13 | """The response that is in progress.""" 14 | 15 | sequence_number: int 16 | """The sequence number of this event.""" 17 | 18 | type: Literal["response.in_progress"] 19 | """The type of the event. Always `response.in_progress`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_includable.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["ResponseIncludable"] 6 | 7 | ResponseIncludable: TypeAlias = Literal[ 8 | "file_search_call.results", 9 | "message.input_image.image_url", 10 | "computer_call_output.output.image_url", 11 | "reasoning.encrypted_content", 12 | ] 13 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_incomplete_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .response import Response 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["ResponseIncompleteEvent"] 9 | 10 | 11 | class ResponseIncompleteEvent(BaseModel): 12 | response: Response 13 | """The response that was incomplete.""" 14 | 15 | sequence_number: int 16 | """The sequence number of this event.""" 17 | 18 | type: Literal["response.incomplete"] 19 | """The type of the event. Always `response.incomplete`.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_input_content.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Annotated, TypeAlias 5 | 6 | from ..._utils import PropertyInfo 7 | from .response_input_file import ResponseInputFile 8 | from .response_input_text import ResponseInputText 9 | from .response_input_image import ResponseInputImage 10 | 11 | __all__ = ["ResponseInputContent"] 12 | 13 | ResponseInputContent: TypeAlias = Annotated[ 14 | Union[ResponseInputText, ResponseInputImage, ResponseInputFile], PropertyInfo(discriminator="type") 15 | ] 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_input_content_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import TypeAlias 7 | 8 | from .response_input_file_param import ResponseInputFileParam 9 | from .response_input_text_param import ResponseInputTextParam 10 | from .response_input_image_param import ResponseInputImageParam 11 | 12 | __all__ = ["ResponseInputContentParam"] 13 | 14 | ResponseInputContentParam: TypeAlias = Union[ResponseInputTextParam, ResponseInputImageParam, ResponseInputFileParam] 15 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_input_file.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal 5 | 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["ResponseInputFile"] 9 | 10 | 11 | class ResponseInputFile(BaseModel): 12 | type: Literal["input_file"] 13 | """The type of the input item. Always `input_file`.""" 14 | 15 | file_data: Optional[str] = None 16 | """The content of the file to be sent to the model.""" 17 | 18 | file_id: Optional[str] = None 19 | """The ID of the file to be sent to the model.""" 20 | 21 | filename: Optional[str] = None 22 | """The name of the file to be sent to the model.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_input_file_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Optional 6 | from typing_extensions import Literal, Required, TypedDict 7 | 8 | __all__ = ["ResponseInputFileParam"] 9 | 10 | 11 | class ResponseInputFileParam(TypedDict, total=False): 12 | type: Required[Literal["input_file"]] 13 | """The type of the input item. Always `input_file`.""" 14 | 15 | file_data: str 16 | """The content of the file to be sent to the model.""" 17 | 18 | file_id: Optional[str] 19 | """The ID of the file to be sent to the model.""" 20 | 21 | filename: str 22 | """The name of the file to be sent to the model.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_input_message_content_list.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List 4 | from typing_extensions import TypeAlias 5 | 6 | from .response_input_content import ResponseInputContent 7 | 8 | __all__ = ["ResponseInputMessageContentList"] 9 | 10 | ResponseInputMessageContentList: TypeAlias = List[ResponseInputContent] 11 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_input_message_content_list_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import List, Union 6 | from typing_extensions import TypeAlias 7 | 8 | from .response_input_file_param import ResponseInputFileParam 9 | from .response_input_text_param import ResponseInputTextParam 10 | from .response_input_image_param import ResponseInputImageParam 11 | 12 | __all__ = ["ResponseInputMessageContentListParam", "ResponseInputContentParam"] 13 | 14 | ResponseInputContentParam: TypeAlias = Union[ResponseInputTextParam, ResponseInputImageParam, ResponseInputFileParam] 15 | 16 | ResponseInputMessageContentListParam: TypeAlias = List[ResponseInputContentParam] 17 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_input_text.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseInputText"] 8 | 9 | 10 | class ResponseInputText(BaseModel): 11 | text: str 12 | """The text input to the model.""" 13 | 14 | type: Literal["input_text"] 15 | """The type of the input item. Always `input_text`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_input_text_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ResponseInputTextParam"] 8 | 9 | 10 | class ResponseInputTextParam(TypedDict, total=False): 11 | text: Required[str] 12 | """The text input to the model.""" 13 | 14 | type: Required[Literal["input_text"]] 15 | """The type of the input item. Always `input_text`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_item_list.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List 4 | from typing_extensions import Literal 5 | 6 | from ..._models import BaseModel 7 | from .response_item import ResponseItem 8 | 9 | __all__ = ["ResponseItemList"] 10 | 11 | 12 | class ResponseItemList(BaseModel): 13 | data: List[ResponseItem] 14 | """A list of items used to generate this response.""" 15 | 16 | first_id: str 17 | """The ID of the first item in the list.""" 18 | 19 | has_more: bool 20 | """Whether there are more items available.""" 21 | 22 | last_id: str 23 | """The ID of the last item in the list.""" 24 | 25 | object: Literal["list"] 26 | """The type of object returned, must be `list`.""" 27 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_mcp_call_arguments_delta_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseMcpCallArgumentsDeltaEvent"] 8 | 9 | 10 | class ResponseMcpCallArgumentsDeltaEvent(BaseModel): 11 | delta: object 12 | """The partial update to the arguments for the MCP tool call.""" 13 | 14 | item_id: str 15 | """The unique identifier of the MCP tool call item being processed.""" 16 | 17 | output_index: int 18 | """The index of the output item in the response's output array.""" 19 | 20 | sequence_number: int 21 | """The sequence number of this event.""" 22 | 23 | type: Literal["response.mcp_call.arguments_delta"] 24 | """The type of the event. Always 'response.mcp_call.arguments_delta'.""" 25 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_mcp_call_arguments_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseMcpCallArgumentsDoneEvent"] 8 | 9 | 10 | class ResponseMcpCallArgumentsDoneEvent(BaseModel): 11 | arguments: object 12 | """The finalized arguments for the MCP tool call.""" 13 | 14 | item_id: str 15 | """The unique identifier of the MCP tool call item being processed.""" 16 | 17 | output_index: int 18 | """The index of the output item in the response's output array.""" 19 | 20 | sequence_number: int 21 | """The sequence number of this event.""" 22 | 23 | type: Literal["response.mcp_call.arguments_done"] 24 | """The type of the event. Always 'response.mcp_call.arguments_done'.""" 25 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_mcp_call_completed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseMcpCallCompletedEvent"] 8 | 9 | 10 | class ResponseMcpCallCompletedEvent(BaseModel): 11 | sequence_number: int 12 | """The sequence number of this event.""" 13 | 14 | type: Literal["response.mcp_call.completed"] 15 | """The type of the event. Always 'response.mcp_call.completed'.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_mcp_call_failed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseMcpCallFailedEvent"] 8 | 9 | 10 | class ResponseMcpCallFailedEvent(BaseModel): 11 | sequence_number: int 12 | """The sequence number of this event.""" 13 | 14 | type: Literal["response.mcp_call.failed"] 15 | """The type of the event. Always 'response.mcp_call.failed'.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_mcp_call_in_progress_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseMcpCallInProgressEvent"] 8 | 9 | 10 | class ResponseMcpCallInProgressEvent(BaseModel): 11 | item_id: str 12 | """The unique identifier of the MCP tool call item being processed.""" 13 | 14 | output_index: int 15 | """The index of the output item in the response's output array.""" 16 | 17 | sequence_number: int 18 | """The sequence number of this event.""" 19 | 20 | type: Literal["response.mcp_call.in_progress"] 21 | """The type of the event. Always 'response.mcp_call.in_progress'.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_mcp_list_tools_completed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseMcpListToolsCompletedEvent"] 8 | 9 | 10 | class ResponseMcpListToolsCompletedEvent(BaseModel): 11 | sequence_number: int 12 | """The sequence number of this event.""" 13 | 14 | type: Literal["response.mcp_list_tools.completed"] 15 | """The type of the event. Always 'response.mcp_list_tools.completed'.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_mcp_list_tools_failed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseMcpListToolsFailedEvent"] 8 | 9 | 10 | class ResponseMcpListToolsFailedEvent(BaseModel): 11 | sequence_number: int 12 | """The sequence number of this event.""" 13 | 14 | type: Literal["response.mcp_list_tools.failed"] 15 | """The type of the event. Always 'response.mcp_list_tools.failed'.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_mcp_list_tools_in_progress_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseMcpListToolsInProgressEvent"] 8 | 9 | 10 | class ResponseMcpListToolsInProgressEvent(BaseModel): 11 | sequence_number: int 12 | """The sequence number of this event.""" 13 | 14 | type: Literal["response.mcp_list_tools.in_progress"] 15 | """The type of the event. Always 'response.mcp_list_tools.in_progress'.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_output_item_added_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | from .response_output_item import ResponseOutputItem 7 | 8 | __all__ = ["ResponseOutputItemAddedEvent"] 9 | 10 | 11 | class ResponseOutputItemAddedEvent(BaseModel): 12 | item: ResponseOutputItem 13 | """The output item that was added.""" 14 | 15 | output_index: int 16 | """The index of the output item that was added.""" 17 | 18 | sequence_number: int 19 | """The sequence number of this event.""" 20 | 21 | type: Literal["response.output_item.added"] 22 | """The type of the event. Always `response.output_item.added`.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_output_item_done_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | from .response_output_item import ResponseOutputItem 7 | 8 | __all__ = ["ResponseOutputItemDoneEvent"] 9 | 10 | 11 | class ResponseOutputItemDoneEvent(BaseModel): 12 | item: ResponseOutputItem 13 | """The output item that was marked done.""" 14 | 15 | output_index: int 16 | """The index of the output item that was marked done.""" 17 | 18 | sequence_number: int 19 | """The sequence number of this event.""" 20 | 21 | type: Literal["response.output_item.done"] 22 | """The type of the event. Always `response.output_item.done`.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_output_refusal.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseOutputRefusal"] 8 | 9 | 10 | class ResponseOutputRefusal(BaseModel): 11 | refusal: str 12 | """The refusal explanationfrom the model.""" 13 | 14 | type: Literal["refusal"] 15 | """The type of the refusal. Always `refusal`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_output_refusal_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ResponseOutputRefusalParam"] 8 | 9 | 10 | class ResponseOutputRefusalParam(TypedDict, total=False): 11 | refusal: Required[str] 12 | """The refusal explanationfrom the model.""" 13 | 14 | type: Required[Literal["refusal"]] 15 | """The type of the refusal. Always `refusal`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_queued_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .response import Response 6 | from ..._models import BaseModel 7 | 8 | __all__ = ["ResponseQueuedEvent"] 9 | 10 | 11 | class ResponseQueuedEvent(BaseModel): 12 | response: Response 13 | """The full response object that is queued.""" 14 | 15 | sequence_number: int 16 | """The sequence number for this event.""" 17 | 18 | type: Literal["response.queued"] 19 | """The type of the event. Always 'response.queued'.""" 20 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_retrieve_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import List 6 | from typing_extensions import TypedDict 7 | 8 | from .response_includable import ResponseIncludable 9 | 10 | __all__ = ["ResponseRetrieveParams"] 11 | 12 | 13 | class ResponseRetrieveParams(TypedDict, total=False): 14 | include: List[ResponseIncludable] 15 | """Additional fields to include in the response. 16 | 17 | See the `include` parameter for Response creation above for more information. 18 | """ 19 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_status.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["ResponseStatus"] 6 | 7 | ResponseStatus: TypeAlias = Literal["completed", "failed", "in_progress", "cancelled", "queued", "incomplete"] 8 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_web_search_call_completed_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseWebSearchCallCompletedEvent"] 8 | 9 | 10 | class ResponseWebSearchCallCompletedEvent(BaseModel): 11 | item_id: str 12 | """Unique ID for the output item associated with the web search call.""" 13 | 14 | output_index: int 15 | """The index of the output item that the web search call is associated with.""" 16 | 17 | sequence_number: int 18 | """The sequence number of the web search call being processed.""" 19 | 20 | type: Literal["response.web_search_call.completed"] 21 | """The type of the event. Always `response.web_search_call.completed`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_web_search_call_in_progress_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseWebSearchCallInProgressEvent"] 8 | 9 | 10 | class ResponseWebSearchCallInProgressEvent(BaseModel): 11 | item_id: str 12 | """Unique ID for the output item associated with the web search call.""" 13 | 14 | output_index: int 15 | """The index of the output item that the web search call is associated with.""" 16 | 17 | sequence_number: int 18 | """The sequence number of the web search call being processed.""" 19 | 20 | type: Literal["response.web_search_call.in_progress"] 21 | """The type of the event. Always `response.web_search_call.in_progress`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/response_web_search_call_searching_event.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseWebSearchCallSearchingEvent"] 8 | 9 | 10 | class ResponseWebSearchCallSearchingEvent(BaseModel): 11 | item_id: str 12 | """Unique ID for the output item associated with the web search call.""" 13 | 14 | output_index: int 15 | """The index of the output item that the web search call is associated with.""" 16 | 17 | sequence_number: int 18 | """The sequence number of the web search call being processed.""" 19 | 20 | type: Literal["response.web_search_call.searching"] 21 | """The type of the event. Always `response.web_search_call.searching`.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/responses/tool_choice_function.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ToolChoiceFunction"] 8 | 9 | 10 | class ToolChoiceFunction(BaseModel): 11 | name: str 12 | """The name of the function to call.""" 13 | 14 | type: Literal["function"] 15 | """For function calling, the type is always `function`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/tool_choice_function_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ToolChoiceFunctionParam"] 8 | 9 | 10 | class ToolChoiceFunctionParam(TypedDict, total=False): 11 | name: Required[str] 12 | """The name of the function to call.""" 13 | 14 | type: Required[Literal["function"]] 15 | """For function calling, the type is always `function`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/responses/tool_choice_options.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal, TypeAlias 4 | 5 | __all__ = ["ToolChoiceOptions"] 6 | 7 | ToolChoiceOptions: TypeAlias = Literal["none", "auto", "required"] 8 | -------------------------------------------------------------------------------- /src/openai/types/shared/all_models.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Literal, TypeAlias 5 | 6 | from .chat_model import ChatModel 7 | 8 | __all__ = ["AllModels"] 9 | 10 | AllModels: TypeAlias = Union[ 11 | str, ChatModel, Literal["o1-pro", "o1-pro-2025-03-19", "computer-use-preview", "computer-use-preview-2025-03-11"] 12 | ] 13 | -------------------------------------------------------------------------------- /src/openai/types/shared/compound_filter.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import List, Union 4 | from typing_extensions import Literal, TypeAlias 5 | 6 | from ..._models import BaseModel 7 | from .comparison_filter import ComparisonFilter 8 | 9 | __all__ = ["CompoundFilter", "Filter"] 10 | 11 | Filter: TypeAlias = Union[ComparisonFilter, object] 12 | 13 | 14 | class CompoundFilter(BaseModel): 15 | filters: List[Filter] 16 | """Array of filters to combine. 17 | 18 | Items can be `ComparisonFilter` or `CompoundFilter`. 19 | """ 20 | 21 | type: Literal["and", "or"] 22 | """Type of operation: `and` or `or`.""" 23 | -------------------------------------------------------------------------------- /src/openai/types/shared/error_object.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ErrorObject"] 8 | 9 | 10 | class ErrorObject(BaseModel): 11 | code: Optional[str] = None 12 | 13 | message: str 14 | 15 | param: Optional[str] = None 16 | 17 | type: str 18 | -------------------------------------------------------------------------------- /src/openai/types/shared/function_parameters.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Dict 4 | from typing_extensions import TypeAlias 5 | 6 | __all__ = ["FunctionParameters"] 7 | 8 | FunctionParameters: TypeAlias = Dict[str, object] 9 | -------------------------------------------------------------------------------- /src/openai/types/shared/metadata.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Dict 4 | from typing_extensions import TypeAlias 5 | 6 | __all__ = ["Metadata"] 7 | 8 | Metadata: TypeAlias = Dict[str, str] 9 | -------------------------------------------------------------------------------- /src/openai/types/shared/reasoning_effort.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | from typing_extensions import Literal, TypeAlias 5 | 6 | __all__ = ["ReasoningEffort"] 7 | 8 | ReasoningEffort: TypeAlias = Optional[Literal["low", "medium", "high"]] 9 | -------------------------------------------------------------------------------- /src/openai/types/shared/response_format_json_object.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseFormatJSONObject"] 8 | 9 | 10 | class ResponseFormatJSONObject(BaseModel): 11 | type: Literal["json_object"] 12 | """The type of response format being defined. Always `json_object`.""" 13 | -------------------------------------------------------------------------------- /src/openai/types/shared/response_format_text.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["ResponseFormatText"] 8 | 9 | 10 | class ResponseFormatText(BaseModel): 11 | type: Literal["text"] 12 | """The type of response format being defined. Always `text`.""" 13 | -------------------------------------------------------------------------------- /src/openai/types/shared/responses_model.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Union 4 | from typing_extensions import Literal, TypeAlias 5 | 6 | from .chat_model import ChatModel 7 | 8 | __all__ = ["ResponsesModel"] 9 | 10 | ResponsesModel: TypeAlias = Union[ 11 | str, ChatModel, Literal["o1-pro", "o1-pro-2025-03-19", "computer-use-preview", "computer-use-preview-2025-03-11"] 12 | ] 13 | -------------------------------------------------------------------------------- /src/openai/types/shared_params/compound_filter.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union, Iterable 6 | from typing_extensions import Literal, Required, TypeAlias, TypedDict 7 | 8 | from .comparison_filter import ComparisonFilter 9 | 10 | __all__ = ["CompoundFilter", "Filter"] 11 | 12 | Filter: TypeAlias = Union[ComparisonFilter, object] 13 | 14 | 15 | class CompoundFilter(TypedDict, total=False): 16 | filters: Required[Iterable[Filter]] 17 | """Array of filters to combine. 18 | 19 | Items can be `ComparisonFilter` or `CompoundFilter`. 20 | """ 21 | 22 | type: Required[Literal["and", "or"]] 23 | """Type of operation: `and` or `or`.""" 24 | -------------------------------------------------------------------------------- /src/openai/types/shared_params/function_parameters.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Dict 6 | from typing_extensions import TypeAlias 7 | 8 | __all__ = ["FunctionParameters"] 9 | 10 | FunctionParameters: TypeAlias = Dict[str, object] 11 | -------------------------------------------------------------------------------- /src/openai/types/shared_params/metadata.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Dict 6 | from typing_extensions import TypeAlias 7 | 8 | __all__ = ["Metadata"] 9 | 10 | Metadata: TypeAlias = Dict[str, str] 11 | -------------------------------------------------------------------------------- /src/openai/types/shared_params/reasoning_effort.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Optional 6 | from typing_extensions import Literal, TypeAlias 7 | 8 | __all__ = ["ReasoningEffort"] 9 | 10 | ReasoningEffort: TypeAlias = Optional[Literal["low", "medium", "high"]] 11 | -------------------------------------------------------------------------------- /src/openai/types/shared_params/response_format_json_object.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ResponseFormatJSONObject"] 8 | 9 | 10 | class ResponseFormatJSONObject(TypedDict, total=False): 11 | type: Required[Literal["json_object"]] 12 | """The type of response format being defined. Always `json_object`.""" 13 | -------------------------------------------------------------------------------- /src/openai/types/shared_params/response_format_text.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | __all__ = ["ResponseFormatText"] 8 | 9 | 10 | class ResponseFormatText(TypedDict, total=False): 11 | type: Required[Literal["text"]] 12 | """The type of response format being defined. Always `text`.""" 13 | -------------------------------------------------------------------------------- /src/openai/types/shared_params/responses_model.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import Union 6 | from typing_extensions import Literal, TypeAlias 7 | 8 | from ..shared.chat_model import ChatModel 9 | 10 | __all__ = ["ResponsesModel"] 11 | 12 | ResponsesModel: TypeAlias = Union[ 13 | str, ChatModel, Literal["o1-pro", "o1-pro-2025-03-19", "computer-use-preview", "computer-use-preview-2025-03-11"] 14 | ] 15 | -------------------------------------------------------------------------------- /src/openai/types/static_file_chunking_strategy.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from .._models import BaseModel 4 | 5 | __all__ = ["StaticFileChunkingStrategy"] 6 | 7 | 8 | class StaticFileChunkingStrategy(BaseModel): 9 | chunk_overlap_tokens: int 10 | """The number of tokens that overlap between chunks. The default value is `400`. 11 | 12 | Note that the overlap must not exceed half of `max_chunk_size_tokens`. 13 | """ 14 | 15 | max_chunk_size_tokens: int 16 | """The maximum number of tokens in each chunk. 17 | 18 | The default value is `800`. The minimum value is `100` and the maximum value is 19 | `4096`. 20 | """ 21 | -------------------------------------------------------------------------------- /src/openai/types/static_file_chunking_strategy_object.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .._models import BaseModel 6 | from .static_file_chunking_strategy import StaticFileChunkingStrategy 7 | 8 | __all__ = ["StaticFileChunkingStrategyObject"] 9 | 10 | 11 | class StaticFileChunkingStrategyObject(BaseModel): 12 | static: StaticFileChunkingStrategy 13 | 14 | type: Literal["static"] 15 | """Always `static`.""" 16 | -------------------------------------------------------------------------------- /src/openai/types/static_file_chunking_strategy_object_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Literal, Required, TypedDict 6 | 7 | from .static_file_chunking_strategy_param import StaticFileChunkingStrategyParam 8 | 9 | __all__ = ["StaticFileChunkingStrategyObjectParam"] 10 | 11 | 12 | class StaticFileChunkingStrategyObjectParam(TypedDict, total=False): 13 | static: Required[StaticFileChunkingStrategyParam] 14 | 15 | type: Required[Literal["static"]] 16 | """Always `static`.""" 17 | -------------------------------------------------------------------------------- /src/openai/types/static_file_chunking_strategy_param.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Required, TypedDict 6 | 7 | __all__ = ["StaticFileChunkingStrategyParam"] 8 | 9 | 10 | class StaticFileChunkingStrategyParam(TypedDict, total=False): 11 | chunk_overlap_tokens: Required[int] 12 | """The number of tokens that overlap between chunks. The default value is `400`. 13 | 14 | Note that the overlap must not exceed half of `max_chunk_size_tokens`. 15 | """ 16 | 17 | max_chunk_size_tokens: Required[int] 18 | """The maximum number of tokens in each chunk. 19 | 20 | The default value is `800`. The minimum value is `100` and the maximum value is 21 | `4096`. 22 | """ 23 | -------------------------------------------------------------------------------- /src/openai/types/upload_complete_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing import List 6 | from typing_extensions import Required, TypedDict 7 | 8 | __all__ = ["UploadCompleteParams"] 9 | 10 | 11 | class UploadCompleteParams(TypedDict, total=False): 12 | part_ids: Required[List[str]] 13 | """The ordered list of Part IDs.""" 14 | 15 | md5: str 16 | """ 17 | The optional md5 checksum for the file contents to verify if the bytes uploaded 18 | matches what you expect. 19 | """ 20 | -------------------------------------------------------------------------------- /src/openai/types/uploads/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from .upload_part import UploadPart as UploadPart 6 | from .part_create_params import PartCreateParams as PartCreateParams 7 | -------------------------------------------------------------------------------- /src/openai/types/uploads/part_create_params.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from typing_extensions import Required, TypedDict 6 | 7 | from ..._types import FileTypes 8 | 9 | __all__ = ["PartCreateParams"] 10 | 11 | 12 | class PartCreateParams(TypedDict, total=False): 13 | data: Required[FileTypes] 14 | """The chunk of bytes for this Part.""" 15 | -------------------------------------------------------------------------------- /src/openai/types/uploads/upload_part.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["UploadPart"] 8 | 9 | 10 | class UploadPart(BaseModel): 11 | id: str 12 | """The upload Part unique identifier, which can be referenced in API endpoints.""" 13 | 14 | created_at: int 15 | """The Unix timestamp (in seconds) for when the Part was created.""" 16 | 17 | object: Literal["upload.part"] 18 | """The object type, which is always `upload.part`.""" 19 | 20 | upload_id: str 21 | """The ID of the Upload object that this Part was added to.""" 22 | -------------------------------------------------------------------------------- /src/openai/types/vector_store_deleted.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from .._models import BaseModel 6 | 7 | __all__ = ["VectorStoreDeleted"] 8 | 9 | 10 | class VectorStoreDeleted(BaseModel): 11 | id: str 12 | 13 | deleted: bool 14 | 15 | object: Literal["vector_store.deleted"] 16 | -------------------------------------------------------------------------------- /src/openai/types/vector_stores/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | from .file_list_params import FileListParams as FileListParams 6 | from .vector_store_file import VectorStoreFile as VectorStoreFile 7 | from .file_create_params import FileCreateParams as FileCreateParams 8 | from .file_update_params import FileUpdateParams as FileUpdateParams 9 | from .file_content_response import FileContentResponse as FileContentResponse 10 | from .vector_store_file_batch import VectorStoreFileBatch as VectorStoreFileBatch 11 | from .file_batch_create_params import FileBatchCreateParams as FileBatchCreateParams 12 | from .vector_store_file_deleted import VectorStoreFileDeleted as VectorStoreFileDeleted 13 | from .file_batch_list_files_params import FileBatchListFilesParams as FileBatchListFilesParams 14 | -------------------------------------------------------------------------------- /src/openai/types/vector_stores/file_content_response.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing import Optional 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["FileContentResponse"] 8 | 9 | 10 | class FileContentResponse(BaseModel): 11 | text: Optional[str] = None 12 | """The text content""" 13 | 14 | type: Optional[str] = None 15 | """The content type (currently only `"text"`)""" 16 | -------------------------------------------------------------------------------- /src/openai/types/vector_stores/vector_store_file_deleted.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from typing_extensions import Literal 4 | 5 | from ..._models import BaseModel 6 | 7 | __all__ = ["VectorStoreFileDeleted"] 8 | 9 | 10 | class VectorStoreFileDeleted(BaseModel): 11 | id: str 12 | 13 | deleted: bool 14 | 15 | object: Literal["vector_store.file.deleted"] 16 | -------------------------------------------------------------------------------- /src/openai/version.py: -------------------------------------------------------------------------------- 1 | from ._version import __version__ 2 | 3 | VERSION: str = __version__ 4 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/audio/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/beta/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/beta/realtime/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/beta/test_realtime.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | from __future__ import annotations 4 | 5 | import os 6 | 7 | import pytest 8 | 9 | base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") 10 | 11 | 12 | class TestRealtime: 13 | parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) 14 | 15 | 16 | class TestAsyncRealtime: 17 | parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) 18 | -------------------------------------------------------------------------------- /tests/api_resources/beta/threads/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/beta/threads/runs/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/chat/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/chat/completions/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/containers/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/containers/files/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/evals/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/evals/runs/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/fine_tuning/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/fine_tuning/alpha/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/fine_tuning/checkpoints/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/fine_tuning/jobs/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/responses/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/uploads/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/api_resources/vector_stores/__init__.py: -------------------------------------------------------------------------------- 1 | # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | -------------------------------------------------------------------------------- /tests/lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/openai-python/9173f3d37594ba603c350ac2263e12c5423b51b9/tests/lib/__init__.py -------------------------------------------------------------------------------- /tests/lib/chat/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/openai-python/9173f3d37594ba603c350ac2263e12c5423b51b9/tests/lib/chat/__init__.py -------------------------------------------------------------------------------- /tests/lib/test_old_api.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | import openai 4 | from openai.lib._old_api import APIRemovedInV1 5 | 6 | 7 | def test_basic_attribute_access_works() -> None: 8 | for attr in dir(openai): 9 | getattr(openai, attr) 10 | 11 | 12 | def test_helpful_error_is_raised() -> None: 13 | with pytest.raises(APIRemovedInV1): 14 | openai.Completion.create() # type: ignore 15 | 16 | with pytest.raises(APIRemovedInV1): 17 | openai.ChatCompletion.create() # type: ignore 18 | -------------------------------------------------------------------------------- /tests/sample_file.txt: -------------------------------------------------------------------------------- 1 | Hello, world! 2 | --------------------------------------------------------------------------------