From b575f9a658e0223947ad94155262287a47da185f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 00:39:45 +0000 Subject: [PATCH 1/6] feat(api): api update (#11) --- pyproject.toml | 3 ++- requirements-dev.lock | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ef70dc0..81bbdc7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,11 +63,12 @@ format = { chain = [ "format:ruff", "format:docs", "fix:ruff", + # run formatting again to fix any inconsistencies when imports are stripped + "format:ruff", ]} "format:black" = "black ." "format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" "format:ruff" = "ruff format" -"format:isort" = "isort ." "lint" = { chain = [ "check:ruff", diff --git a/requirements-dev.lock b/requirements-dev.lock index 49c3be2..a75f425 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -80,7 +80,7 @@ pytz==2023.3.post1 # via dirty-equals respx==0.20.2 rich==13.7.1 -ruff==0.6.5 +ruff==0.6.9 setuptools==68.2.2 # via nodeenv six==1.16.0 From 04f25d91e512063832092b8e978007e7c0fa209a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 19:43:37 +0000 Subject: [PATCH 2/6] chore: rebuild project due to codegen change (#13) --- README.md | 4 +- pyproject.toml | 10 +- requirements-dev.lock | 23 +- requirements.lock | 8 +- src/omnistack/_base_client.py | 2 +- src/omnistack/_compat.py | 8 +- src/omnistack/_models.py | 19 +- src/omnistack/_types.py | 6 +- src/omnistack/_utils/__init__.py | 1 + src/omnistack/_utils/_transform.py | 9 +- src/omnistack/_utils/_utils.py | 17 + .../resources/assistants/__init__.py | 19 - .../resources/assistants/assistants.py | 631 ---------------- src/omnistack/resources/audio/__init__.py | 61 -- src/omnistack/resources/audio/audio.py | 166 ----- src/omnistack/resources/audio/speech.py | 234 ------ .../resources/audio/transcriptions.py | 287 ------- src/omnistack/resources/audio/translations.py | 257 ------- src/omnistack/resources/batches.py | 506 ------------- src/omnistack/resources/embeddings.py | 239 ------ src/omnistack/resources/files/__init__.py | 33 - src/omnistack/resources/files/content.py | 162 ---- src/omnistack/resources/files/files.py | 525 ------------- .../resources/fine_tuning/__init__.py | 33 - .../resources/fine_tuning/fine_tuning.py | 103 --- .../resources/fine_tuning/jobs/__init__.py | 47 -- .../resources/fine_tuning/jobs/checkpoints.py | 200 ----- .../resources/fine_tuning/jobs/events.py | 200 ----- .../resources/fine_tuning/jobs/jobs.py | 628 ---------------- src/omnistack/resources/images/__init__.py | 61 -- src/omnistack/resources/images/edits.py | 271 ------- src/omnistack/resources/images/generations.py | 263 ------- src/omnistack/resources/images/images.py | 166 ----- src/omnistack/resources/images/variations.py | 251 ------- src/omnistack/resources/models.py | 305 -------- src/omnistack/resources/moderations.py | 219 ------ .../resources/organization/__init__.py | 75 -- .../resources/organization/audit_logs.py | 323 -------- .../resources/organization/invites.py | 466 ------------ .../resources/organization/organization.py | 199 ----- .../organization/projects/__init__.py | 47 -- .../organization/projects/projects.py | 525 ------------- .../organization/projects/service_accounts.py | 384 ---------- .../resources/organization/projects/users.py | 472 ------------ src/omnistack/resources/organization/users.py | 448 ----------- src/omnistack/resources/projects/__init__.py | 47 -- src/omnistack/resources/projects/api_keys.py | 378 ---------- src/omnistack/resources/projects/projects.py | 134 ---- .../resources/projects/service_accounts.py | 169 ----- src/omnistack/resources/threads/__init__.py | 47 -- src/omnistack/resources/threads/messages.py | 511 ------------- .../resources/threads/runs/__init__.py | 33 - src/omnistack/resources/threads/runs/runs.py | 654 ---------------- src/omnistack/resources/threads/runs/steps.py | 378 ---------- src/omnistack/resources/threads/threads.py | 548 -------------- src/omnistack/resources/uploads/__init__.py | 33 - src/omnistack/resources/uploads/parts.py | 212 ------ src/omnistack/resources/uploads/uploads.py | 491 ------------ .../resources/vector_stores/__init__.py | 47 -- .../vector_stores/file_batches/__init__.py | 33 - .../file_batches/file_batches.py | 404 ---------- .../vector_stores/file_batches/files.py | 248 ------ .../resources/vector_stores/files.py | 528 ------------- .../resources/vector_stores/vector_stores.py | 704 ------------------ .../types/assistant_create_params.py | 281 ------- .../types/assistant_delete_response.py | 15 - src/omnistack/types/assistant_list_params.py | 39 - .../types/assistant_list_response.py | 20 - src/omnistack/types/assistant_object.py | 293 -------- src/omnistack/types/assistants/__init__.py | 7 - .../types/assistants/message_object.py | 234 ------ src/omnistack/types/assistants/run_object.py | 452 ----------- .../types/assistants/thread_object.py | 58 -- src/omnistack/types/audio/__init__.py | 9 - .../types/audio/speech_create_params.py | 36 - .../audio/transcription_create_params.py | 65 -- .../audio/transcription_create_response.py | 92 --- .../types/audio/translation_create_params.py | 47 -- .../audio/translation_create_response.py | 76 -- src/omnistack/types/batch.py | 108 --- src/omnistack/types/batch_create_params.py | 38 - src/omnistack/types/batch_list_params.py | 24 - src/omnistack/types/batch_list_response.py | 21 - .../types/embedding_create_params.py | 47 -- .../types/embedding_create_response.py | 45 -- src/omnistack/types/file_create_params.py | 23 - src/omnistack/types/file_delete_response.py | 15 - src/omnistack/types/file_list_params.py | 12 - src/omnistack/types/file_list_response.py | 15 - src/omnistack/types/files/__init__.py | 5 - .../types/files/content_retrieve_response.py | 7 - src/omnistack/types/fine_tuning/__init__.py | 8 - .../types/fine_tuning/fine_tuning_job.py | 157 ---- .../types/fine_tuning/job_create_params.py | 132 ---- .../types/fine_tuning/job_list_params.py | 15 - .../types/fine_tuning/job_list_response.py | 17 - .../types/fine_tuning/jobs/__init__.py | 8 - .../jobs/checkpoint_list_params.py | 15 - .../jobs/checkpoint_list_response.py | 59 -- .../fine_tuning/jobs/event_retrieve_params.py | 15 - .../jobs/event_retrieve_response.py | 26 - src/omnistack/types/image_response.py | 30 - src/omnistack/types/images/__init__.py | 7 - .../types/images/edit_create_params.py | 60 -- .../types/images/generation_create_params.py | 62 -- .../types/images/variation_create_params.py | 49 -- src/omnistack/types/model.py | 21 - src/omnistack/types/model_delete_response.py | 15 - src/omnistack/types/model_list_response.py | 15 - .../types/moderation_create_params.py | 59 -- .../types/moderation_create_response.py | 203 ----- src/omnistack/types/openai_file.py | 48 -- src/omnistack/types/organization/__init__.py | 20 - .../organization/audit_log_list_params.py | 108 --- .../organization/audit_log_list_response.py | 428 ----------- src/omnistack/types/organization/invite.py | 34 - .../organization/invite_create_params.py | 15 - .../organization/invite_delete_response.py | 16 - .../types/organization/invite_list_params.py | 24 - .../organization/invite_list_response.py | 28 - src/omnistack/types/organization/project.py | 28 - .../organization/project_create_params.py | 12 - .../types/organization/project_list_params.py | 30 - .../organization/project_list_response.py | 21 - .../types/organization/projects/__init__.py | 12 - .../projects/service_account_create_params.py | 12 - .../service_account_create_response.py | 35 - .../projects/service_account_list_params.py | 24 - .../projects/service_account_list_response.py | 21 - .../projects/user_create_params.py | 14 - .../projects/user_delete_response.py | 15 - .../organization/projects/user_list_params.py | 24 - .../projects/user_list_response.py | 20 - src/omnistack/types/organization/user.py | 27 - .../types/organization/user_create_params.py | 12 - .../organization/user_delete_response.py | 15 - .../types/organization/user_list_params.py | 24 - .../types/organization/user_list_response.py | 21 - src/omnistack/types/projects/__init__.py | 8 - .../types/projects/api_key_delete_response.py | 15 - .../types/projects/api_key_list_params.py | 24 - .../types/projects/api_key_list_response.py | 21 - .../service_account_delete_response.py | 15 - src/omnistack/types/thread_create_params.py | 326 -------- src/omnistack/types/thread_delete_response.py | 15 - src/omnistack/types/thread_update_params.py | 49 -- src/omnistack/types/threads/__init__.py | 12 - .../types/threads/message_create_params.py | 20 - .../types/threads/message_delete_response.py | 15 - .../types/threads/message_list_params.py | 42 -- .../types/threads/message_list_response.py | 20 - .../types/threads/run_create_params.py | 20 - .../types/threads/run_list_params.py | 39 - .../types/threads/run_list_response.py | 20 - .../threads/run_submit_tool_outputs_params.py | 33 - src/omnistack/types/threads/runs/__init__.py | 8 - .../types/threads/runs/run_step_object.py | 317 -------- .../types/threads/runs/step_list_params.py | 54 -- .../types/threads/runs/step_list_response.py | 20 - .../threads/runs/step_retrieve_params.py | 26 - src/omnistack/types/upload.py | 42 -- src/omnistack/types/upload_complete_params.py | 19 - src/omnistack/types/upload_create_params.py | 29 - src/omnistack/types/upload_part.py | 21 - src/omnistack/types/uploads/__init__.py | 5 - .../types/uploads/part_create_params.py | 14 - .../types/vector_store_create_params.py | 88 --- .../types/vector_store_delete_response.py | 15 - .../types/vector_store_list_params.py | 39 - .../types/vector_store_list_response.py | 20 - src/omnistack/types/vector_store_object.py | 79 -- .../types/vector_store_update_params.py | 35 - src/omnistack/types/vector_stores/__init__.py | 11 - .../vector_stores/file_batch_create_params.py | 61 -- .../vector_stores/file_batches/__init__.py | 6 - .../file_batches/file_list_params.py | 47 -- .../file_batches/file_list_response.py | 20 - .../types/vector_stores/file_create_params.py | 60 -- .../vector_stores/file_delete_response.py | 15 - .../types/vector_stores/file_list_params.py | 45 -- .../types/vector_stores/file_list_response.py | 20 - .../vector_store_file_batch_object.py | 52 -- .../vector_stores/vector_store_file_object.py | 94 --- tests/api_resources/assistants/__init__.py | 1 - tests/api_resources/audio/__init__.py | 1 - tests/api_resources/audio/test_speech.py | 156 ---- .../audio/test_transcriptions.py | 116 --- .../api_resources/audio/test_translations.py | 112 --- tests/api_resources/files/__init__.py | 1 - tests/api_resources/files/test_content.py | 97 --- tests/api_resources/fine_tuning/__init__.py | 1 - .../fine_tuning/jobs/__init__.py | 1 - .../fine_tuning/jobs/test_checkpoints.py | 116 --- .../fine_tuning/jobs/test_events.py | 116 --- tests/api_resources/fine_tuning/test_jobs.py | 398 ---------- tests/api_resources/images/__init__.py | 1 - tests/api_resources/images/test_edits.py | 118 --- .../api_resources/images/test_generations.py | 112 --- tests/api_resources/images/test_variations.py | 108 --- tests/api_resources/organization/__init__.py | 1 - .../organization/projects/__init__.py | 1 - .../projects/test_service_accounts.py | 300 -------- .../organization/projects/test_users.py | 418 ----------- .../organization/test_audit_logs.py | 112 --- .../organization/test_invites.py | 312 -------- .../organization/test_projects.py | 326 -------- .../api_resources/organization/test_users.py | 328 -------- tests/api_resources/projects/__init__.py | 1 - tests/api_resources/projects/test_api_keys.py | 309 -------- .../projects/test_service_accounts.py | 118 --- tests/api_resources/test_assistants.py | 364 --------- tests/api_resources/test_batches.py | 334 --------- tests/api_resources/test_embeddings.py | 112 --- tests/api_resources/test_files.py | 306 -------- tests/api_resources/test_models.py | 224 ------ tests/api_resources/test_moderations.py | 100 --- tests/api_resources/test_threads.py | 555 -------------- tests/api_resources/test_uploads.py | 280 ------- tests/api_resources/test_vector_stores.py | 428 ----------- tests/api_resources/threads/__init__.py | 1 - tests/api_resources/threads/runs/__init__.py | 1 - .../api_resources/threads/runs/test_steps.py | 284 ------- tests/api_resources/threads/test_messages.py | 432 ----------- tests/api_resources/threads/test_runs.py | 579 -------------- tests/api_resources/uploads/__init__.py | 1 - tests/api_resources/uploads/test_parts.py | 106 --- tests/api_resources/vector_stores/__init__.py | 1 - .../vector_stores/file_batches/__init__.py | 1 - .../vector_stores/file_batches/test_files.py | 144 ---- .../vector_stores/test_file_batches.py | 316 -------- .../api_resources/vector_stores/test_files.py | 420 ----------- tests/conftest.py | 14 +- tests/test_client.py | 21 +- tests/test_models.py | 21 +- tests/test_transform.py | 15 + 235 files changed, 113 insertions(+), 29241 deletions(-) delete mode 100644 src/omnistack/resources/assistants/__init__.py delete mode 100644 src/omnistack/resources/assistants/assistants.py delete mode 100644 src/omnistack/resources/audio/__init__.py delete mode 100644 src/omnistack/resources/audio/audio.py delete mode 100644 src/omnistack/resources/audio/speech.py delete mode 100644 src/omnistack/resources/audio/transcriptions.py delete mode 100644 src/omnistack/resources/audio/translations.py delete mode 100644 src/omnistack/resources/batches.py delete mode 100644 src/omnistack/resources/embeddings.py delete mode 100644 src/omnistack/resources/files/__init__.py delete mode 100644 src/omnistack/resources/files/content.py delete mode 100644 src/omnistack/resources/files/files.py delete mode 100644 src/omnistack/resources/fine_tuning/__init__.py delete mode 100644 src/omnistack/resources/fine_tuning/fine_tuning.py delete mode 100644 src/omnistack/resources/fine_tuning/jobs/__init__.py delete mode 100644 src/omnistack/resources/fine_tuning/jobs/checkpoints.py delete mode 100644 src/omnistack/resources/fine_tuning/jobs/events.py delete mode 100644 src/omnistack/resources/fine_tuning/jobs/jobs.py delete mode 100644 src/omnistack/resources/images/__init__.py delete mode 100644 src/omnistack/resources/images/edits.py delete mode 100644 src/omnistack/resources/images/generations.py delete mode 100644 src/omnistack/resources/images/images.py delete mode 100644 src/omnistack/resources/images/variations.py delete mode 100644 src/omnistack/resources/models.py delete mode 100644 src/omnistack/resources/moderations.py delete mode 100644 src/omnistack/resources/organization/__init__.py delete mode 100644 src/omnistack/resources/organization/audit_logs.py delete mode 100644 src/omnistack/resources/organization/invites.py delete mode 100644 src/omnistack/resources/organization/organization.py delete mode 100644 src/omnistack/resources/organization/projects/__init__.py delete mode 100644 src/omnistack/resources/organization/projects/projects.py delete mode 100644 src/omnistack/resources/organization/projects/service_accounts.py delete mode 100644 src/omnistack/resources/organization/projects/users.py delete mode 100644 src/omnistack/resources/organization/users.py delete mode 100644 src/omnistack/resources/projects/__init__.py delete mode 100644 src/omnistack/resources/projects/api_keys.py delete mode 100644 src/omnistack/resources/projects/projects.py delete mode 100644 src/omnistack/resources/projects/service_accounts.py delete mode 100644 src/omnistack/resources/threads/__init__.py delete mode 100644 src/omnistack/resources/threads/messages.py delete mode 100644 src/omnistack/resources/threads/runs/__init__.py delete mode 100644 src/omnistack/resources/threads/runs/runs.py delete mode 100644 src/omnistack/resources/threads/runs/steps.py delete mode 100644 src/omnistack/resources/threads/threads.py delete mode 100644 src/omnistack/resources/uploads/__init__.py delete mode 100644 src/omnistack/resources/uploads/parts.py delete mode 100644 src/omnistack/resources/uploads/uploads.py delete mode 100644 src/omnistack/resources/vector_stores/__init__.py delete mode 100644 src/omnistack/resources/vector_stores/file_batches/__init__.py delete mode 100644 src/omnistack/resources/vector_stores/file_batches/file_batches.py delete mode 100644 src/omnistack/resources/vector_stores/file_batches/files.py delete mode 100644 src/omnistack/resources/vector_stores/files.py delete mode 100644 src/omnistack/resources/vector_stores/vector_stores.py delete mode 100644 src/omnistack/types/assistant_create_params.py delete mode 100644 src/omnistack/types/assistant_delete_response.py delete mode 100644 src/omnistack/types/assistant_list_params.py delete mode 100644 src/omnistack/types/assistant_list_response.py delete mode 100644 src/omnistack/types/assistant_object.py delete mode 100644 src/omnistack/types/assistants/__init__.py delete mode 100644 src/omnistack/types/assistants/message_object.py delete mode 100644 src/omnistack/types/assistants/run_object.py delete mode 100644 src/omnistack/types/assistants/thread_object.py delete mode 100644 src/omnistack/types/audio/__init__.py delete mode 100644 src/omnistack/types/audio/speech_create_params.py delete mode 100644 src/omnistack/types/audio/transcription_create_params.py delete mode 100644 src/omnistack/types/audio/transcription_create_response.py delete mode 100644 src/omnistack/types/audio/translation_create_params.py delete mode 100644 src/omnistack/types/audio/translation_create_response.py delete mode 100644 src/omnistack/types/batch.py delete mode 100644 src/omnistack/types/batch_create_params.py delete mode 100644 src/omnistack/types/batch_list_params.py delete mode 100644 src/omnistack/types/batch_list_response.py delete mode 100644 src/omnistack/types/embedding_create_params.py delete mode 100644 src/omnistack/types/embedding_create_response.py delete mode 100644 src/omnistack/types/file_create_params.py delete mode 100644 src/omnistack/types/file_delete_response.py delete mode 100644 src/omnistack/types/file_list_params.py delete mode 100644 src/omnistack/types/file_list_response.py delete mode 100644 src/omnistack/types/files/__init__.py delete mode 100644 src/omnistack/types/files/content_retrieve_response.py delete mode 100644 src/omnistack/types/fine_tuning/__init__.py delete mode 100644 src/omnistack/types/fine_tuning/fine_tuning_job.py delete mode 100644 src/omnistack/types/fine_tuning/job_create_params.py delete mode 100644 src/omnistack/types/fine_tuning/job_list_params.py delete mode 100644 src/omnistack/types/fine_tuning/job_list_response.py delete mode 100644 src/omnistack/types/fine_tuning/jobs/__init__.py delete mode 100644 src/omnistack/types/fine_tuning/jobs/checkpoint_list_params.py delete mode 100644 src/omnistack/types/fine_tuning/jobs/checkpoint_list_response.py delete mode 100644 src/omnistack/types/fine_tuning/jobs/event_retrieve_params.py delete mode 100644 src/omnistack/types/fine_tuning/jobs/event_retrieve_response.py delete mode 100644 src/omnistack/types/image_response.py delete mode 100644 src/omnistack/types/images/__init__.py delete mode 100644 src/omnistack/types/images/edit_create_params.py delete mode 100644 src/omnistack/types/images/generation_create_params.py delete mode 100644 src/omnistack/types/images/variation_create_params.py delete mode 100644 src/omnistack/types/model.py delete mode 100644 src/omnistack/types/model_delete_response.py delete mode 100644 src/omnistack/types/model_list_response.py delete mode 100644 src/omnistack/types/moderation_create_params.py delete mode 100644 src/omnistack/types/moderation_create_response.py delete mode 100644 src/omnistack/types/openai_file.py delete mode 100644 src/omnistack/types/organization/__init__.py delete mode 100644 src/omnistack/types/organization/audit_log_list_params.py delete mode 100644 src/omnistack/types/organization/audit_log_list_response.py delete mode 100644 src/omnistack/types/organization/invite.py delete mode 100644 src/omnistack/types/organization/invite_create_params.py delete mode 100644 src/omnistack/types/organization/invite_delete_response.py delete mode 100644 src/omnistack/types/organization/invite_list_params.py delete mode 100644 src/omnistack/types/organization/invite_list_response.py delete mode 100644 src/omnistack/types/organization/project.py delete mode 100644 src/omnistack/types/organization/project_create_params.py delete mode 100644 src/omnistack/types/organization/project_list_params.py delete mode 100644 src/omnistack/types/organization/project_list_response.py delete mode 100644 src/omnistack/types/organization/projects/__init__.py delete mode 100644 src/omnistack/types/organization/projects/service_account_create_params.py delete mode 100644 src/omnistack/types/organization/projects/service_account_create_response.py delete mode 100644 src/omnistack/types/organization/projects/service_account_list_params.py delete mode 100644 src/omnistack/types/organization/projects/service_account_list_response.py delete mode 100644 src/omnistack/types/organization/projects/user_create_params.py delete mode 100644 src/omnistack/types/organization/projects/user_delete_response.py delete mode 100644 src/omnistack/types/organization/projects/user_list_params.py delete mode 100644 src/omnistack/types/organization/projects/user_list_response.py delete mode 100644 src/omnistack/types/organization/user.py delete mode 100644 src/omnistack/types/organization/user_create_params.py delete mode 100644 src/omnistack/types/organization/user_delete_response.py delete mode 100644 src/omnistack/types/organization/user_list_params.py delete mode 100644 src/omnistack/types/organization/user_list_response.py delete mode 100644 src/omnistack/types/projects/__init__.py delete mode 100644 src/omnistack/types/projects/api_key_delete_response.py delete mode 100644 src/omnistack/types/projects/api_key_list_params.py delete mode 100644 src/omnistack/types/projects/api_key_list_response.py delete mode 100644 src/omnistack/types/projects/service_account_delete_response.py delete mode 100644 src/omnistack/types/thread_create_params.py delete mode 100644 src/omnistack/types/thread_delete_response.py delete mode 100644 src/omnistack/types/thread_update_params.py delete mode 100644 src/omnistack/types/threads/__init__.py delete mode 100644 src/omnistack/types/threads/message_create_params.py delete mode 100644 src/omnistack/types/threads/message_delete_response.py delete mode 100644 src/omnistack/types/threads/message_list_params.py delete mode 100644 src/omnistack/types/threads/message_list_response.py delete mode 100644 src/omnistack/types/threads/run_create_params.py delete mode 100644 src/omnistack/types/threads/run_list_params.py delete mode 100644 src/omnistack/types/threads/run_list_response.py delete mode 100644 src/omnistack/types/threads/run_submit_tool_outputs_params.py delete mode 100644 src/omnistack/types/threads/runs/__init__.py delete mode 100644 src/omnistack/types/threads/runs/run_step_object.py delete mode 100644 src/omnistack/types/threads/runs/step_list_params.py delete mode 100644 src/omnistack/types/threads/runs/step_list_response.py delete mode 100644 src/omnistack/types/threads/runs/step_retrieve_params.py delete mode 100644 src/omnistack/types/upload.py delete mode 100644 src/omnistack/types/upload_complete_params.py delete mode 100644 src/omnistack/types/upload_create_params.py delete mode 100644 src/omnistack/types/upload_part.py delete mode 100644 src/omnistack/types/uploads/__init__.py delete mode 100644 src/omnistack/types/uploads/part_create_params.py delete mode 100644 src/omnistack/types/vector_store_create_params.py delete mode 100644 src/omnistack/types/vector_store_delete_response.py delete mode 100644 src/omnistack/types/vector_store_list_params.py delete mode 100644 src/omnistack/types/vector_store_list_response.py delete mode 100644 src/omnistack/types/vector_store_object.py delete mode 100644 src/omnistack/types/vector_store_update_params.py delete mode 100644 src/omnistack/types/vector_stores/__init__.py delete mode 100644 src/omnistack/types/vector_stores/file_batch_create_params.py delete mode 100644 src/omnistack/types/vector_stores/file_batches/__init__.py delete mode 100644 src/omnistack/types/vector_stores/file_batches/file_list_params.py delete mode 100644 src/omnistack/types/vector_stores/file_batches/file_list_response.py delete mode 100644 src/omnistack/types/vector_stores/file_create_params.py delete mode 100644 src/omnistack/types/vector_stores/file_delete_response.py delete mode 100644 src/omnistack/types/vector_stores/file_list_params.py delete mode 100644 src/omnistack/types/vector_stores/file_list_response.py delete mode 100644 src/omnistack/types/vector_stores/vector_store_file_batch_object.py delete mode 100644 src/omnistack/types/vector_stores/vector_store_file_object.py delete mode 100644 tests/api_resources/assistants/__init__.py delete mode 100644 tests/api_resources/audio/__init__.py delete mode 100644 tests/api_resources/audio/test_speech.py delete mode 100644 tests/api_resources/audio/test_transcriptions.py delete mode 100644 tests/api_resources/audio/test_translations.py delete mode 100644 tests/api_resources/files/__init__.py delete mode 100644 tests/api_resources/files/test_content.py delete mode 100644 tests/api_resources/fine_tuning/__init__.py delete mode 100644 tests/api_resources/fine_tuning/jobs/__init__.py delete mode 100644 tests/api_resources/fine_tuning/jobs/test_checkpoints.py delete mode 100644 tests/api_resources/fine_tuning/jobs/test_events.py delete mode 100644 tests/api_resources/fine_tuning/test_jobs.py delete mode 100644 tests/api_resources/images/__init__.py delete mode 100644 tests/api_resources/images/test_edits.py delete mode 100644 tests/api_resources/images/test_generations.py delete mode 100644 tests/api_resources/images/test_variations.py delete mode 100644 tests/api_resources/organization/__init__.py delete mode 100644 tests/api_resources/organization/projects/__init__.py delete mode 100644 tests/api_resources/organization/projects/test_service_accounts.py delete mode 100644 tests/api_resources/organization/projects/test_users.py delete mode 100644 tests/api_resources/organization/test_audit_logs.py delete mode 100644 tests/api_resources/organization/test_invites.py delete mode 100644 tests/api_resources/organization/test_projects.py delete mode 100644 tests/api_resources/organization/test_users.py delete mode 100644 tests/api_resources/projects/__init__.py delete mode 100644 tests/api_resources/projects/test_api_keys.py delete mode 100644 tests/api_resources/projects/test_service_accounts.py delete mode 100644 tests/api_resources/test_assistants.py delete mode 100644 tests/api_resources/test_batches.py delete mode 100644 tests/api_resources/test_embeddings.py delete mode 100644 tests/api_resources/test_files.py delete mode 100644 tests/api_resources/test_models.py delete mode 100644 tests/api_resources/test_moderations.py delete mode 100644 tests/api_resources/test_threads.py delete mode 100644 tests/api_resources/test_uploads.py delete mode 100644 tests/api_resources/test_vector_stores.py delete mode 100644 tests/api_resources/threads/__init__.py delete mode 100644 tests/api_resources/threads/runs/__init__.py delete mode 100644 tests/api_resources/threads/runs/test_steps.py delete mode 100644 tests/api_resources/threads/test_messages.py delete mode 100644 tests/api_resources/threads/test_runs.py delete mode 100644 tests/api_resources/uploads/__init__.py delete mode 100644 tests/api_resources/uploads/test_parts.py delete mode 100644 tests/api_resources/vector_stores/__init__.py delete mode 100644 tests/api_resources/vector_stores/file_batches/__init__.py delete mode 100644 tests/api_resources/vector_stores/file_batches/test_files.py delete mode 100644 tests/api_resources/vector_stores/test_file_batches.py delete mode 100644 tests/api_resources/vector_stores/test_files.py diff --git a/README.md b/README.md index d8ddaa4..3c404e5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![PyPI version](https://img.shields.io/pypi/v/omnistack.svg)](https://pypi.org/project/omnistack/) -The Omnistack Python library provides convenient access to the Omnistack REST API from any Python 3.7+ +The Omnistack Python library provides convenient access to the Omnistack REST API from any Python 3.8+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). @@ -335,7 +335,7 @@ print(omnistack.__version__) ## Requirements -Python 3.7 or higher. +Python 3.8 or higher. ## Contributing diff --git a/pyproject.toml b/pyproject.toml index 81bbdc7..cbf52f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,11 +16,10 @@ dependencies = [ "sniffio", "cached-property; python_version < '3.8'", ] -requires-python = ">= 3.7" +requires-python = ">= 3.8" classifiers = [ "Typing :: Typed", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -66,7 +65,6 @@ format = { chain = [ # run formatting again to fix any inconsistencies when imports are stripped "format:ruff", ]} -"format:black" = "black ." "format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" "format:ruff" = "ruff format" @@ -126,10 +124,6 @@ path = "README.md" pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' replacement = '[\1](https://github.com/OmniStack-sh/omnistack-python/tree/main/\g<2>)' -[tool.black] -line-length = 120 -target-version = ["py37"] - [tool.pytest.ini_options] testpaths = ["tests"] addopts = "--tb=short" @@ -144,7 +138,7 @@ filterwarnings = [ # there are a couple of flags that are still disabled by # default in strict mode as they are experimental and niche. typeCheckingMode = "strict" -pythonVersion = "3.7" +pythonVersion = "3.8" exclude = [ "_dev", diff --git a/requirements-dev.lock b/requirements-dev.lock index a75f425..e29a874 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -16,8 +16,6 @@ anyio==4.4.0 # via omnistack argcomplete==3.1.2 # via nox -attrs==23.1.0 - # via pytest certifi==2023.7.22 # via httpcore # via httpx @@ -28,8 +26,9 @@ distlib==0.3.7 # via virtualenv distro==1.8.0 # via omnistack -exceptiongroup==1.1.3 +exceptiongroup==1.2.2 # via anyio + # via pytest filelock==3.12.4 # via virtualenv h11==0.14.0 @@ -49,7 +48,7 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -mypy==1.11.2 +mypy==1.13.0 mypy-extensions==1.0.0 # via mypy nodeenv==1.8.0 @@ -60,20 +59,18 @@ packaging==23.2 # via pytest platformdirs==3.11.0 # via virtualenv -pluggy==1.3.0 - # via pytest -py==1.11.0 +pluggy==1.5.0 # via pytest -pydantic==2.7.1 +pydantic==2.9.2 # via omnistack -pydantic-core==2.18.2 +pydantic-core==2.23.4 # via pydantic pygments==2.18.0 # via rich pyright==1.1.380 -pytest==7.1.1 +pytest==8.3.3 # via pytest-asyncio -pytest-asyncio==0.21.1 +pytest-asyncio==0.24.0 python-dateutil==2.8.2 # via time-machine pytz==2023.3.post1 @@ -90,10 +87,10 @@ sniffio==1.3.0 # via httpx # via omnistack time-machine==2.9.0 -tomli==2.0.1 +tomli==2.0.2 # via mypy # via pytest -typing-extensions==4.8.0 +typing-extensions==4.12.2 # via anyio # via mypy # via omnistack diff --git a/requirements.lock b/requirements.lock index 253415e..1d545f9 100644 --- a/requirements.lock +++ b/requirements.lock @@ -19,7 +19,7 @@ certifi==2023.7.22 # via httpx distro==1.8.0 # via omnistack -exceptiongroup==1.1.3 +exceptiongroup==1.2.2 # via anyio h11==0.14.0 # via httpcore @@ -30,15 +30,15 @@ httpx==0.25.2 idna==3.4 # via anyio # via httpx -pydantic==2.7.1 +pydantic==2.9.2 # via omnistack -pydantic-core==2.18.2 +pydantic-core==2.23.4 # via pydantic sniffio==1.3.0 # via anyio # via httpx # via omnistack -typing-extensions==4.8.0 +typing-extensions==4.12.2 # via anyio # via omnistack # via pydantic diff --git a/src/omnistack/_base_client.py b/src/omnistack/_base_client.py index 4422453..635dc96 100644 --- a/src/omnistack/_base_client.py +++ b/src/omnistack/_base_client.py @@ -1575,7 +1575,7 @@ async def _request( except Exception as err: log.debug("Encountered Exception", exc_info=True) - if retries_taken > 0: + if remaining_retries > 0: return await self._retry_request( input_options, cast_to, diff --git a/src/omnistack/_compat.py b/src/omnistack/_compat.py index 162a6fb..4794129 100644 --- a/src/omnistack/_compat.py +++ b/src/omnistack/_compat.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self +from typing_extensions import Self, Literal import pydantic from pydantic.fields import FieldInfo @@ -133,13 +133,15 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: def model_dump( model: pydantic.BaseModel, *, - exclude: IncEx = None, + exclude: IncEx | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, warnings: bool = True, + mode: Literal["json", "python"] = "python", ) -> dict[str, Any]: - if PYDANTIC_V2: + if PYDANTIC_V2 or hasattr(model, "model_dump"): return model.model_dump( + mode=mode, exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, diff --git a/src/omnistack/_models.py b/src/omnistack/_models.py index d386eaa..6cb469e 100644 --- a/src/omnistack/_models.py +++ b/src/omnistack/_models.py @@ -37,6 +37,7 @@ PropertyInfo, is_list, is_given, + json_safe, lru_cache, is_mapping, parse_date, @@ -176,7 +177,7 @@ def __str__(self) -> str: # Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836. @classmethod @override - def construct( + def construct( # pyright: ignore[reportIncompatibleMethodOverride] cls: Type[ModelT], _fields_set: set[str] | None = None, **values: object, @@ -248,8 +249,8 @@ def model_dump( self, *, mode: Literal["json", "python"] | str = "python", - include: IncEx = None, - exclude: IncEx = None, + include: IncEx | None = None, + exclude: IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, @@ -279,8 +280,8 @@ def model_dump( Returns: A dictionary representation of the model. """ - if mode != "python": - raise ValueError("mode is only supported in Pydantic v2") + if mode not in {"json", "python"}: + raise ValueError("mode must be either 'json' or 'python'") if round_trip != False: raise ValueError("round_trip is only supported in Pydantic v2") if warnings != True: @@ -289,7 +290,7 @@ def model_dump( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") - return super().dict( # pyright: ignore[reportDeprecated] + dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, by_alias=by_alias, @@ -298,13 +299,15 @@ def model_dump( exclude_none=exclude_none, ) + return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped + @override def model_dump_json( self, *, indent: int | None = None, - include: IncEx = None, - exclude: IncEx = None, + include: IncEx | None = None, + exclude: IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, diff --git a/src/omnistack/_types.py b/src/omnistack/_types.py index de3ae5f..6e9a660 100644 --- a/src/omnistack/_types.py +++ b/src/omnistack/_types.py @@ -16,7 +16,7 @@ Optional, Sequence, ) -from typing_extensions import Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable +from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable import httpx import pydantic @@ -193,7 +193,9 @@ def get(self, __key: str) -> str | None: ... # Note: copied from Pydantic # https://github.com/pydantic/pydantic/blob/32ea570bf96e84234d2992e1ddf40ab8a565925a/pydantic/main.py#L49 -IncEx: TypeAlias = "set[int] | set[str] | dict[int, Any] | dict[str, Any] | None" +IncEx: TypeAlias = Union[ + Set[int], Set[str], Mapping[int, Union["IncEx", Literal[True]]], Mapping[str, Union["IncEx", Literal[True]]] +] PostParser = Callable[[Any], Any] diff --git a/src/omnistack/_utils/__init__.py b/src/omnistack/_utils/__init__.py index 3efe66c..a7cff3c 100644 --- a/src/omnistack/_utils/__init__.py +++ b/src/omnistack/_utils/__init__.py @@ -6,6 +6,7 @@ is_list as is_list, is_given as is_given, is_tuple as is_tuple, + json_safe as json_safe, lru_cache as lru_cache, is_mapping as is_mapping, is_tuple_t as is_tuple_t, diff --git a/src/omnistack/_utils/_transform.py b/src/omnistack/_utils/_transform.py index 47e262a..d7c0534 100644 --- a/src/omnistack/_utils/_transform.py +++ b/src/omnistack/_utils/_transform.py @@ -173,6 +173,11 @@ def _transform_recursive( # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + inner_type = extract_type_arg(stripped_type, 0) return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] @@ -186,7 +191,7 @@ def _transform_recursive( return data if isinstance(data, pydantic.BaseModel): - return model_dump(data, exclude_unset=True) + return model_dump(data, exclude_unset=True, mode="json") annotated_type = _get_annotated_type(annotation) if annotated_type is None: @@ -324,7 +329,7 @@ async def _async_transform_recursive( return data if isinstance(data, pydantic.BaseModel): - return model_dump(data, exclude_unset=True) + return model_dump(data, exclude_unset=True, mode="json") annotated_type = _get_annotated_type(annotation) if annotated_type is None: diff --git a/src/omnistack/_utils/_utils.py b/src/omnistack/_utils/_utils.py index 0bba17c..e5811bb 100644 --- a/src/omnistack/_utils/_utils.py +++ b/src/omnistack/_utils/_utils.py @@ -16,6 +16,7 @@ overload, ) from pathlib import Path +from datetime import date, datetime from typing_extensions import TypeGuard import sniffio @@ -395,3 +396,19 @@ def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]: maxsize=maxsize, ) return cast(Any, wrapper) # type: ignore[no-any-return] + + +def json_safe(data: object) -> object: + """Translates a mapping / sequence recursively in the same fashion + as `pydantic` v2's `model_dump(mode="json")`. + """ + if is_mapping(data): + return {json_safe(key): json_safe(value) for key, value in data.items()} + + if is_iterable(data) and not isinstance(data, (str, bytes, bytearray)): + return [json_safe(item) for item in data] + + if isinstance(data, (datetime, date)): + return data.isoformat() + + return data diff --git a/src/omnistack/resources/assistants/__init__.py b/src/omnistack/resources/assistants/__init__.py deleted file mode 100644 index 55a57ff..0000000 --- a/src/omnistack/resources/assistants/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .assistants import ( - AssistantsResource, - AsyncAssistantsResource, - AssistantsResourceWithRawResponse, - AsyncAssistantsResourceWithRawResponse, - AssistantsResourceWithStreamingResponse, - AsyncAssistantsResourceWithStreamingResponse, -) - -__all__ = [ - "AssistantsResource", - "AsyncAssistantsResource", - "AssistantsResourceWithRawResponse", - "AsyncAssistantsResourceWithRawResponse", - "AssistantsResourceWithStreamingResponse", - "AsyncAssistantsResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/assistants/assistants.py b/src/omnistack/resources/assistants/assistants.py deleted file mode 100644 index cc65412..0000000 --- a/src/omnistack/resources/assistants/assistants.py +++ /dev/null @@ -1,631 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Literal - -import httpx - -from ...types import assistant_list_params, assistant_create_params -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.assistant_object import AssistantObject -from ...types.assistant_list_response import AssistantListResponse -from ...types.assistant_delete_response import AssistantDeleteResponse - -__all__ = ["AssistantsResource", "AsyncAssistantsResource"] - - -class AssistantsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AssistantsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AssistantsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AssistantsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AssistantsResourceWithStreamingResponse(self) - - def create( - self, - assistant_id: str, - *, - description: Optional[str] | NotGiven = NOT_GIVEN, - instructions: Optional[str] | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - model: str | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - response_format: Optional[assistant_create_params.ResponseFormat] | NotGiven = NOT_GIVEN, - temperature: Optional[float] | NotGiven = NOT_GIVEN, - tool_resources: Optional[assistant_create_params.ToolResources] | NotGiven = NOT_GIVEN, - tools: Iterable[assistant_create_params.Tool] | NotGiven = NOT_GIVEN, - top_p: Optional[float] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AssistantObject: - """Modifies an assistant. - - Args: - description: The description of the assistant. - - The maximum length is 512 characters. - - instructions: The system instructions that the assistant uses. The maximum length is 256,000 - characters. - - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - model: ID of the model to use. You can use the - [List models](/docs/api-reference/models/list) API to see all of your available - models, or see our [Model overview](/docs/models/overview) for descriptions of - them. - - name: The name of the assistant. The maximum length is 256 characters. - - response_format: Specifies the format that the model must output. Compatible with - [GPT-4o](/docs/models/gpt-4o), - [GPT-4 Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models - since `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured - Outputs which ensures the model will match your supplied JSON schema. Learn more - in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the - message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to - produce JSON yourself via a system or user message. Without this, the model may - generate an unending stream of whitespace until the generation reaches the token - limit, resulting in a long-running and seemingly "stuck" request. Also note that - the message content may be partially cut off if `finish_reason="length"`, which - indicates the generation exceeded `max_tokens` or the conversation exceeded the - max context length. - - temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will - make the output more random, while lower values like 0.2 will make it more - focused and deterministic. - - tool_resources: A set of resources that are used by the assistant's tools. The resources are - specific to the type of tool. For example, the `code_interpreter` tool requires - a list of file IDs, while the `file_search` tool requires a list of vector store - IDs. - - tools: A list of tool enabled on the assistant. There can be a maximum of 128 tools per - assistant. Tools can be of types `code_interpreter`, `file_search`, or - `function`. - - top_p: An alternative to sampling with temperature, called nucleus sampling, where the - model considers the results of the tokens with top_p probability mass. So 0.1 - means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not assistant_id: - raise ValueError(f"Expected a non-empty value for `assistant_id` but received {assistant_id!r}") - return self._post( - f"/assistants/{assistant_id}", - body=maybe_transform( - { - "description": description, - "instructions": instructions, - "metadata": metadata, - "model": model, - "name": name, - "response_format": response_format, - "temperature": temperature, - "tool_resources": tool_resources, - "tools": tools, - "top_p": top_p, - }, - assistant_create_params.AssistantCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AssistantObject, - ) - - def retrieve( - self, - assistant_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AssistantObject: - """ - Retrieves an assistant. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not assistant_id: - raise ValueError(f"Expected a non-empty value for `assistant_id` but received {assistant_id!r}") - return self._get( - f"/assistants/{assistant_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AssistantObject, - ) - - def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AssistantListResponse: - """Returns a list of assistants. - - Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/assistants", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "before": before, - "limit": limit, - "order": order, - }, - assistant_list_params.AssistantListParams, - ), - ), - cast_to=AssistantListResponse, - ) - - def delete( - self, - assistant_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AssistantDeleteResponse: - """ - Delete an assistant. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not assistant_id: - raise ValueError(f"Expected a non-empty value for `assistant_id` but received {assistant_id!r}") - return self._delete( - f"/assistants/{assistant_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AssistantDeleteResponse, - ) - - -class AsyncAssistantsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAssistantsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncAssistantsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAssistantsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncAssistantsResourceWithStreamingResponse(self) - - async def create( - self, - assistant_id: str, - *, - description: Optional[str] | NotGiven = NOT_GIVEN, - instructions: Optional[str] | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - model: str | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - response_format: Optional[assistant_create_params.ResponseFormat] | NotGiven = NOT_GIVEN, - temperature: Optional[float] | NotGiven = NOT_GIVEN, - tool_resources: Optional[assistant_create_params.ToolResources] | NotGiven = NOT_GIVEN, - tools: Iterable[assistant_create_params.Tool] | NotGiven = NOT_GIVEN, - top_p: Optional[float] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AssistantObject: - """Modifies an assistant. - - Args: - description: The description of the assistant. - - The maximum length is 512 characters. - - instructions: The system instructions that the assistant uses. The maximum length is 256,000 - characters. - - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - model: ID of the model to use. You can use the - [List models](/docs/api-reference/models/list) API to see all of your available - models, or see our [Model overview](/docs/models/overview) for descriptions of - them. - - name: The name of the assistant. The maximum length is 256 characters. - - response_format: Specifies the format that the model must output. Compatible with - [GPT-4o](/docs/models/gpt-4o), - [GPT-4 Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models - since `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured - Outputs which ensures the model will match your supplied JSON schema. Learn more - in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the - message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to - produce JSON yourself via a system or user message. Without this, the model may - generate an unending stream of whitespace until the generation reaches the token - limit, resulting in a long-running and seemingly "stuck" request. Also note that - the message content may be partially cut off if `finish_reason="length"`, which - indicates the generation exceeded `max_tokens` or the conversation exceeded the - max context length. - - temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will - make the output more random, while lower values like 0.2 will make it more - focused and deterministic. - - tool_resources: A set of resources that are used by the assistant's tools. The resources are - specific to the type of tool. For example, the `code_interpreter` tool requires - a list of file IDs, while the `file_search` tool requires a list of vector store - IDs. - - tools: A list of tool enabled on the assistant. There can be a maximum of 128 tools per - assistant. Tools can be of types `code_interpreter`, `file_search`, or - `function`. - - top_p: An alternative to sampling with temperature, called nucleus sampling, where the - model considers the results of the tokens with top_p probability mass. So 0.1 - means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not assistant_id: - raise ValueError(f"Expected a non-empty value for `assistant_id` but received {assistant_id!r}") - return await self._post( - f"/assistants/{assistant_id}", - body=await async_maybe_transform( - { - "description": description, - "instructions": instructions, - "metadata": metadata, - "model": model, - "name": name, - "response_format": response_format, - "temperature": temperature, - "tool_resources": tool_resources, - "tools": tools, - "top_p": top_p, - }, - assistant_create_params.AssistantCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AssistantObject, - ) - - async def retrieve( - self, - assistant_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AssistantObject: - """ - Retrieves an assistant. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not assistant_id: - raise ValueError(f"Expected a non-empty value for `assistant_id` but received {assistant_id!r}") - return await self._get( - f"/assistants/{assistant_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AssistantObject, - ) - - async def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AssistantListResponse: - """Returns a list of assistants. - - Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/assistants", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "before": before, - "limit": limit, - "order": order, - }, - assistant_list_params.AssistantListParams, - ), - ), - cast_to=AssistantListResponse, - ) - - async def delete( - self, - assistant_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AssistantDeleteResponse: - """ - Delete an assistant. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not assistant_id: - raise ValueError(f"Expected a non-empty value for `assistant_id` but received {assistant_id!r}") - return await self._delete( - f"/assistants/{assistant_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AssistantDeleteResponse, - ) - - -class AssistantsResourceWithRawResponse: - def __init__(self, assistants: AssistantsResource) -> None: - self._assistants = assistants - - self.create = to_raw_response_wrapper( - assistants.create, - ) - self.retrieve = to_raw_response_wrapper( - assistants.retrieve, - ) - self.list = to_raw_response_wrapper( - assistants.list, - ) - self.delete = to_raw_response_wrapper( - assistants.delete, - ) - - -class AsyncAssistantsResourceWithRawResponse: - def __init__(self, assistants: AsyncAssistantsResource) -> None: - self._assistants = assistants - - self.create = async_to_raw_response_wrapper( - assistants.create, - ) - self.retrieve = async_to_raw_response_wrapper( - assistants.retrieve, - ) - self.list = async_to_raw_response_wrapper( - assistants.list, - ) - self.delete = async_to_raw_response_wrapper( - assistants.delete, - ) - - -class AssistantsResourceWithStreamingResponse: - def __init__(self, assistants: AssistantsResource) -> None: - self._assistants = assistants - - self.create = to_streamed_response_wrapper( - assistants.create, - ) - self.retrieve = to_streamed_response_wrapper( - assistants.retrieve, - ) - self.list = to_streamed_response_wrapper( - assistants.list, - ) - self.delete = to_streamed_response_wrapper( - assistants.delete, - ) - - -class AsyncAssistantsResourceWithStreamingResponse: - def __init__(self, assistants: AsyncAssistantsResource) -> None: - self._assistants = assistants - - self.create = async_to_streamed_response_wrapper( - assistants.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - assistants.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - assistants.list, - ) - self.delete = async_to_streamed_response_wrapper( - assistants.delete, - ) diff --git a/src/omnistack/resources/audio/__init__.py b/src/omnistack/resources/audio/__init__.py deleted file mode 100644 index 3dcedb4..0000000 --- a/src/omnistack/resources/audio/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .audio import ( - AudioResource, - AsyncAudioResource, - AudioResourceWithRawResponse, - AsyncAudioResourceWithRawResponse, - AudioResourceWithStreamingResponse, - AsyncAudioResourceWithStreamingResponse, -) -from .speech import ( - SpeechResource, - AsyncSpeechResource, - SpeechResourceWithRawResponse, - AsyncSpeechResourceWithRawResponse, - SpeechResourceWithStreamingResponse, - AsyncSpeechResourceWithStreamingResponse, -) -from .translations import ( - TranslationsResource, - AsyncTranslationsResource, - TranslationsResourceWithRawResponse, - AsyncTranslationsResourceWithRawResponse, - TranslationsResourceWithStreamingResponse, - AsyncTranslationsResourceWithStreamingResponse, -) -from .transcriptions import ( - TranscriptionsResource, - AsyncTranscriptionsResource, - TranscriptionsResourceWithRawResponse, - AsyncTranscriptionsResourceWithRawResponse, - TranscriptionsResourceWithStreamingResponse, - AsyncTranscriptionsResourceWithStreamingResponse, -) - -__all__ = [ - "SpeechResource", - "AsyncSpeechResource", - "SpeechResourceWithRawResponse", - "AsyncSpeechResourceWithRawResponse", - "SpeechResourceWithStreamingResponse", - "AsyncSpeechResourceWithStreamingResponse", - "TranscriptionsResource", - "AsyncTranscriptionsResource", - "TranscriptionsResourceWithRawResponse", - "AsyncTranscriptionsResourceWithRawResponse", - "TranscriptionsResourceWithStreamingResponse", - "AsyncTranscriptionsResourceWithStreamingResponse", - "TranslationsResource", - "AsyncTranslationsResource", - "TranslationsResourceWithRawResponse", - "AsyncTranslationsResourceWithRawResponse", - "TranslationsResourceWithStreamingResponse", - "AsyncTranslationsResourceWithStreamingResponse", - "AudioResource", - "AsyncAudioResource", - "AudioResourceWithRawResponse", - "AsyncAudioResourceWithRawResponse", - "AudioResourceWithStreamingResponse", - "AsyncAudioResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/audio/audio.py b/src/omnistack/resources/audio/audio.py deleted file mode 100644 index 82f9e93..0000000 --- a/src/omnistack/resources/audio/audio.py +++ /dev/null @@ -1,166 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .speech import ( - SpeechResource, - AsyncSpeechResource, - SpeechResourceWithRawResponse, - AsyncSpeechResourceWithRawResponse, - SpeechResourceWithStreamingResponse, - AsyncSpeechResourceWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from .translations import ( - TranslationsResource, - AsyncTranslationsResource, - TranslationsResourceWithRawResponse, - AsyncTranslationsResourceWithRawResponse, - TranslationsResourceWithStreamingResponse, - AsyncTranslationsResourceWithStreamingResponse, -) -from .transcriptions import ( - TranscriptionsResource, - AsyncTranscriptionsResource, - TranscriptionsResourceWithRawResponse, - AsyncTranscriptionsResourceWithRawResponse, - TranscriptionsResourceWithStreamingResponse, - AsyncTranscriptionsResourceWithStreamingResponse, -) - -__all__ = ["AudioResource", "AsyncAudioResource"] - - -class AudioResource(SyncAPIResource): - @cached_property - def speech(self) -> SpeechResource: - return SpeechResource(self._client) - - @cached_property - def transcriptions(self) -> TranscriptionsResource: - return TranscriptionsResource(self._client) - - @cached_property - def translations(self) -> TranslationsResource: - return TranslationsResource(self._client) - - @cached_property - def with_raw_response(self) -> AudioResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AudioResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AudioResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AudioResourceWithStreamingResponse(self) - - -class AsyncAudioResource(AsyncAPIResource): - @cached_property - def speech(self) -> AsyncSpeechResource: - return AsyncSpeechResource(self._client) - - @cached_property - def transcriptions(self) -> AsyncTranscriptionsResource: - return AsyncTranscriptionsResource(self._client) - - @cached_property - def translations(self) -> AsyncTranslationsResource: - return AsyncTranslationsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncAudioResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncAudioResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAudioResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncAudioResourceWithStreamingResponse(self) - - -class AudioResourceWithRawResponse: - def __init__(self, audio: AudioResource) -> None: - self._audio = audio - - @cached_property - def speech(self) -> SpeechResourceWithRawResponse: - return SpeechResourceWithRawResponse(self._audio.speech) - - @cached_property - def transcriptions(self) -> TranscriptionsResourceWithRawResponse: - return TranscriptionsResourceWithRawResponse(self._audio.transcriptions) - - @cached_property - def translations(self) -> TranslationsResourceWithRawResponse: - return TranslationsResourceWithRawResponse(self._audio.translations) - - -class AsyncAudioResourceWithRawResponse: - def __init__(self, audio: AsyncAudioResource) -> None: - self._audio = audio - - @cached_property - def speech(self) -> AsyncSpeechResourceWithRawResponse: - return AsyncSpeechResourceWithRawResponse(self._audio.speech) - - @cached_property - def transcriptions(self) -> AsyncTranscriptionsResourceWithRawResponse: - return AsyncTranscriptionsResourceWithRawResponse(self._audio.transcriptions) - - @cached_property - def translations(self) -> AsyncTranslationsResourceWithRawResponse: - return AsyncTranslationsResourceWithRawResponse(self._audio.translations) - - -class AudioResourceWithStreamingResponse: - def __init__(self, audio: AudioResource) -> None: - self._audio = audio - - @cached_property - def speech(self) -> SpeechResourceWithStreamingResponse: - return SpeechResourceWithStreamingResponse(self._audio.speech) - - @cached_property - def transcriptions(self) -> TranscriptionsResourceWithStreamingResponse: - return TranscriptionsResourceWithStreamingResponse(self._audio.transcriptions) - - @cached_property - def translations(self) -> TranslationsResourceWithStreamingResponse: - return TranslationsResourceWithStreamingResponse(self._audio.translations) - - -class AsyncAudioResourceWithStreamingResponse: - def __init__(self, audio: AsyncAudioResource) -> None: - self._audio = audio - - @cached_property - def speech(self) -> AsyncSpeechResourceWithStreamingResponse: - return AsyncSpeechResourceWithStreamingResponse(self._audio.speech) - - @cached_property - def transcriptions(self) -> AsyncTranscriptionsResourceWithStreamingResponse: - return AsyncTranscriptionsResourceWithStreamingResponse(self._audio.transcriptions) - - @cached_property - def translations(self) -> AsyncTranslationsResourceWithStreamingResponse: - return AsyncTranslationsResourceWithStreamingResponse(self._audio.translations) diff --git a/src/omnistack/resources/audio/speech.py b/src/omnistack/resources/audio/speech.py deleted file mode 100644 index 09fb518..0000000 --- a/src/omnistack/resources/audio/speech.py +++ /dev/null @@ -1,234 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, - to_custom_raw_response_wrapper, - to_custom_streamed_response_wrapper, - async_to_custom_raw_response_wrapper, - async_to_custom_streamed_response_wrapper, -) -from ...types.audio import speech_create_params -from ..._base_client import make_request_options - -__all__ = ["SpeechResource", "AsyncSpeechResource"] - - -class SpeechResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SpeechResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return SpeechResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SpeechResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return SpeechResourceWithStreamingResponse(self) - - def create( - self, - *, - input: str, - model: Union[str, Literal["tts-1", "tts-1-hd"]], - voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"], - response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN, - speed: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BinaryAPIResponse: - """ - Generates audio from the input text. - - Args: - input: The text to generate audio for. The maximum length is 4096 characters. - - model: One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` - - voice: The voice to use when generating the audio. Supported voices are `alloy`, - `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are - available in the - [Text to speech guide](/docs/guides/text-to-speech/voice-options). - - response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, - `wav`, and `pcm`. - - speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is - the default. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})} - return self._post( - "/audio/speech", - body=maybe_transform( - { - "input": input, - "model": model, - "voice": voice, - "response_format": response_format, - "speed": speed, - }, - speech_create_params.SpeechCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=BinaryAPIResponse, - ) - - -class AsyncSpeechResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSpeechResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncSpeechResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSpeechResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncSpeechResourceWithStreamingResponse(self) - - async def create( - self, - *, - input: str, - model: Union[str, Literal["tts-1", "tts-1-hd"]], - voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"], - response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN, - speed: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncBinaryAPIResponse: - """ - Generates audio from the input text. - - Args: - input: The text to generate audio for. The maximum length is 4096 characters. - - model: One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` - - voice: The voice to use when generating the audio. Supported voices are `alloy`, - `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are - available in the - [Text to speech guide](/docs/guides/text-to-speech/voice-options). - - response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, - `wav`, and `pcm`. - - speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is - the default. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})} - return await self._post( - "/audio/speech", - body=await async_maybe_transform( - { - "input": input, - "model": model, - "voice": voice, - "response_format": response_format, - "speed": speed, - }, - speech_create_params.SpeechCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AsyncBinaryAPIResponse, - ) - - -class SpeechResourceWithRawResponse: - def __init__(self, speech: SpeechResource) -> None: - self._speech = speech - - self.create = to_custom_raw_response_wrapper( - speech.create, - BinaryAPIResponse, - ) - - -class AsyncSpeechResourceWithRawResponse: - def __init__(self, speech: AsyncSpeechResource) -> None: - self._speech = speech - - self.create = async_to_custom_raw_response_wrapper( - speech.create, - AsyncBinaryAPIResponse, - ) - - -class SpeechResourceWithStreamingResponse: - def __init__(self, speech: SpeechResource) -> None: - self._speech = speech - - self.create = to_custom_streamed_response_wrapper( - speech.create, - StreamedBinaryAPIResponse, - ) - - -class AsyncSpeechResourceWithStreamingResponse: - def __init__(self, speech: AsyncSpeechResource) -> None: - self._speech = speech - - self.create = async_to_custom_streamed_response_wrapper( - speech.create, - AsyncStreamedBinaryAPIResponse, - ) diff --git a/src/omnistack/resources/audio/transcriptions.py b/src/omnistack/resources/audio/transcriptions.py deleted file mode 100644 index 9758308..0000000 --- a/src/omnistack/resources/audio/transcriptions.py +++ /dev/null @@ -1,287 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, List, Union, Mapping, cast -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ..._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...types.audio import transcription_create_params -from ..._base_client import make_request_options -from ...types.audio.transcription_create_response import TranscriptionCreateResponse - -__all__ = ["TranscriptionsResource", "AsyncTranscriptionsResource"] - - -class TranscriptionsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TranscriptionsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return TranscriptionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TranscriptionsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return TranscriptionsResourceWithStreamingResponse(self) - - def create( - self, - *, - file: FileTypes, - model: Union[str, Literal["whisper-1"]], - language: str | NotGiven = NOT_GIVEN, - prompt: str | NotGiven = NOT_GIVEN, - response_format: Literal["json", "text", "srt", "verbose_json", "vtt"] | NotGiven = NOT_GIVEN, - temperature: float | NotGiven = NOT_GIVEN, - timestamp_granularities: List[Literal["word", "segment"]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TranscriptionCreateResponse: - """ - Transcribes audio into the input language. - - Args: - file: - The audio file object (not file name) to transcribe, in one of these formats: - flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - - model: ID of the model to use. Only `whisper-1` (which is powered by our open source - Whisper V2 model) is currently available. - - language: The language of the input audio. Supplying the input language in - [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will - improve accuracy and latency. - - prompt: An optional text to guide the model's style or continue a previous audio - segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the - audio language. - - response_format: The format of the output, in one of these options: `json`, `text`, `srt`, - `verbose_json`, or `vtt`. - - temperature: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the - output more random, while lower values like 0.2 will make it more focused and - deterministic. If set to 0, the model will use - [log probability](https://en.wikipedia.org/wiki/Log_probability) to - automatically increase the temperature until certain thresholds are hit. - - timestamp_granularities: The timestamp granularities to populate for this transcription. - `response_format` must be set `verbose_json` to use timestamp granularities. - Either or both of these options are supported: `word`, or `segment`. Note: There - is no additional latency for segment timestamps, but generating word timestamps - incurs additional latency. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "file": file, - "model": model, - "language": language, - "prompt": prompt, - "response_format": response_format, - "temperature": temperature, - "timestamp_granularities": timestamp_granularities, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return cast( - TranscriptionCreateResponse, - self._post( - "/audio/transcriptions", - body=maybe_transform(body, transcription_create_params.TranscriptionCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, TranscriptionCreateResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - -class AsyncTranscriptionsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTranscriptionsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncTranscriptionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTranscriptionsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncTranscriptionsResourceWithStreamingResponse(self) - - async def create( - self, - *, - file: FileTypes, - model: Union[str, Literal["whisper-1"]], - language: str | NotGiven = NOT_GIVEN, - prompt: str | NotGiven = NOT_GIVEN, - response_format: Literal["json", "text", "srt", "verbose_json", "vtt"] | NotGiven = NOT_GIVEN, - temperature: float | NotGiven = NOT_GIVEN, - timestamp_granularities: List[Literal["word", "segment"]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TranscriptionCreateResponse: - """ - Transcribes audio into the input language. - - Args: - file: - The audio file object (not file name) to transcribe, in one of these formats: - flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - - model: ID of the model to use. Only `whisper-1` (which is powered by our open source - Whisper V2 model) is currently available. - - language: The language of the input audio. Supplying the input language in - [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will - improve accuracy and latency. - - prompt: An optional text to guide the model's style or continue a previous audio - segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the - audio language. - - response_format: The format of the output, in one of these options: `json`, `text`, `srt`, - `verbose_json`, or `vtt`. - - temperature: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the - output more random, while lower values like 0.2 will make it more focused and - deterministic. If set to 0, the model will use - [log probability](https://en.wikipedia.org/wiki/Log_probability) to - automatically increase the temperature until certain thresholds are hit. - - timestamp_granularities: The timestamp granularities to populate for this transcription. - `response_format` must be set `verbose_json` to use timestamp granularities. - Either or both of these options are supported: `word`, or `segment`. Note: There - is no additional latency for segment timestamps, but generating word timestamps - incurs additional latency. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "file": file, - "model": model, - "language": language, - "prompt": prompt, - "response_format": response_format, - "temperature": temperature, - "timestamp_granularities": timestamp_granularities, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return cast( - TranscriptionCreateResponse, - await self._post( - "/audio/transcriptions", - body=await async_maybe_transform(body, transcription_create_params.TranscriptionCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, TranscriptionCreateResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - -class TranscriptionsResourceWithRawResponse: - def __init__(self, transcriptions: TranscriptionsResource) -> None: - self._transcriptions = transcriptions - - self.create = to_raw_response_wrapper( - transcriptions.create, - ) - - -class AsyncTranscriptionsResourceWithRawResponse: - def __init__(self, transcriptions: AsyncTranscriptionsResource) -> None: - self._transcriptions = transcriptions - - self.create = async_to_raw_response_wrapper( - transcriptions.create, - ) - - -class TranscriptionsResourceWithStreamingResponse: - def __init__(self, transcriptions: TranscriptionsResource) -> None: - self._transcriptions = transcriptions - - self.create = to_streamed_response_wrapper( - transcriptions.create, - ) - - -class AsyncTranscriptionsResourceWithStreamingResponse: - def __init__(self, transcriptions: AsyncTranscriptionsResource) -> None: - self._transcriptions = transcriptions - - self.create = async_to_streamed_response_wrapper( - transcriptions.create, - ) diff --git a/src/omnistack/resources/audio/translations.py b/src/omnistack/resources/audio/translations.py deleted file mode 100644 index ebde822..0000000 --- a/src/omnistack/resources/audio/translations.py +++ /dev/null @@ -1,257 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, Union, Mapping, cast -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ..._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...types.audio import translation_create_params -from ..._base_client import make_request_options -from ...types.audio.translation_create_response import TranslationCreateResponse - -__all__ = ["TranslationsResource", "AsyncTranslationsResource"] - - -class TranslationsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TranslationsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return TranslationsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TranslationsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return TranslationsResourceWithStreamingResponse(self) - - def create( - self, - *, - file: FileTypes, - model: Union[str, Literal["whisper-1"]], - prompt: str | NotGiven = NOT_GIVEN, - response_format: Literal["json", "text", "srt", "verbose_json", "vtt"] | NotGiven = NOT_GIVEN, - temperature: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TranslationCreateResponse: - """ - Translates audio into English. - - Args: - file: The audio file object (not file name) translate, in one of these formats: flac, - mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - - model: ID of the model to use. Only `whisper-1` (which is powered by our open source - Whisper V2 model) is currently available. - - prompt: An optional text to guide the model's style or continue a previous audio - segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in - English. - - response_format: The format of the output, in one of these options: `json`, `text`, `srt`, - `verbose_json`, or `vtt`. - - temperature: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the - output more random, while lower values like 0.2 will make it more focused and - deterministic. If set to 0, the model will use - [log probability](https://en.wikipedia.org/wiki/Log_probability) to - automatically increase the temperature until certain thresholds are hit. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "file": file, - "model": model, - "prompt": prompt, - "response_format": response_format, - "temperature": temperature, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return cast( - TranslationCreateResponse, - self._post( - "/audio/translations", - body=maybe_transform(body, translation_create_params.TranslationCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, TranslationCreateResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - -class AsyncTranslationsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTranslationsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncTranslationsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTranslationsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncTranslationsResourceWithStreamingResponse(self) - - async def create( - self, - *, - file: FileTypes, - model: Union[str, Literal["whisper-1"]], - prompt: str | NotGiven = NOT_GIVEN, - response_format: Literal["json", "text", "srt", "verbose_json", "vtt"] | NotGiven = NOT_GIVEN, - temperature: float | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TranslationCreateResponse: - """ - Translates audio into English. - - Args: - file: The audio file object (not file name) translate, in one of these formats: flac, - mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - - model: ID of the model to use. Only `whisper-1` (which is powered by our open source - Whisper V2 model) is currently available. - - prompt: An optional text to guide the model's style or continue a previous audio - segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in - English. - - response_format: The format of the output, in one of these options: `json`, `text`, `srt`, - `verbose_json`, or `vtt`. - - temperature: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the - output more random, while lower values like 0.2 will make it more focused and - deterministic. If set to 0, the model will use - [log probability](https://en.wikipedia.org/wiki/Log_probability) to - automatically increase the temperature until certain thresholds are hit. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "file": file, - "model": model, - "prompt": prompt, - "response_format": response_format, - "temperature": temperature, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return cast( - TranslationCreateResponse, - await self._post( - "/audio/translations", - body=await async_maybe_transform(body, translation_create_params.TranslationCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast( - Any, TranslationCreateResponse - ), # Union types cannot be passed in as arguments in the type system - ), - ) - - -class TranslationsResourceWithRawResponse: - def __init__(self, translations: TranslationsResource) -> None: - self._translations = translations - - self.create = to_raw_response_wrapper( - translations.create, - ) - - -class AsyncTranslationsResourceWithRawResponse: - def __init__(self, translations: AsyncTranslationsResource) -> None: - self._translations = translations - - self.create = async_to_raw_response_wrapper( - translations.create, - ) - - -class TranslationsResourceWithStreamingResponse: - def __init__(self, translations: TranslationsResource) -> None: - self._translations = translations - - self.create = to_streamed_response_wrapper( - translations.create, - ) - - -class AsyncTranslationsResourceWithStreamingResponse: - def __init__(self, translations: AsyncTranslationsResource) -> None: - self._translations = translations - - self.create = async_to_streamed_response_wrapper( - translations.create, - ) diff --git a/src/omnistack/resources/batches.py b/src/omnistack/resources/batches.py deleted file mode 100644 index fb064e5..0000000 --- a/src/omnistack/resources/batches.py +++ /dev/null @@ -1,506 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import Literal - -import httpx - -from ..types import batch_list_params, batch_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..types.batch import Batch -from .._base_client import make_request_options -from ..types.batch_list_response import BatchListResponse - -__all__ = ["BatchesResource", "AsyncBatchesResource"] - - -class BatchesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BatchesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return BatchesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BatchesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return BatchesResourceWithStreamingResponse(self) - - def create( - self, - *, - completion_window: Literal["24h"], - endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"], - input_file_id: str, - metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Batch: - """ - Creates and executes a batch from an uploaded file of requests - - Args: - completion_window: The time frame within which the batch should be processed. Currently only `24h` - is supported. - - endpoint: The endpoint to be used for all requests in the batch. Currently - `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. - Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 - embedding inputs across all requests in the batch. - - input_file_id: The ID of an uploaded file that contains requests for the new batch. - - See [upload file](/docs/api-reference/files/create) for how to upload a file. - - Your input file must be formatted as a - [JSONL file](/docs/api-reference/batch/request-input), and must be uploaded with - the purpose `batch`. The file can contain up to 50,000 requests, and can be up - to 100 MB in size. - - metadata: Optional custom metadata for the batch. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/batches", - body=maybe_transform( - { - "completion_window": completion_window, - "endpoint": endpoint, - "input_file_id": input_file_id, - "metadata": metadata, - }, - batch_create_params.BatchCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Batch, - ) - - def retrieve( - self, - batch_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Batch: - """ - Retrieves a batch. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return self._get( - f"/batches/{batch_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Batch, - ) - - def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BatchListResponse: - """List your organization's batches. - - Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/batches", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "limit": limit, - }, - batch_list_params.BatchListParams, - ), - ), - cast_to=BatchListResponse, - ) - - def cancel( - self, - batch_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Batch: - """Cancels an in-progress batch. - - The batch will be in status `cancelling` for up to - 10 minutes, before changing to `cancelled`, where it will have partial results - (if any) available in the output file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return self._post( - f"/batches/{batch_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Batch, - ) - - -class AsyncBatchesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBatchesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncBatchesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBatchesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncBatchesResourceWithStreamingResponse(self) - - async def create( - self, - *, - completion_window: Literal["24h"], - endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"], - input_file_id: str, - metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Batch: - """ - Creates and executes a batch from an uploaded file of requests - - Args: - completion_window: The time frame within which the batch should be processed. Currently only `24h` - is supported. - - endpoint: The endpoint to be used for all requests in the batch. Currently - `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. - Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 - embedding inputs across all requests in the batch. - - input_file_id: The ID of an uploaded file that contains requests for the new batch. - - See [upload file](/docs/api-reference/files/create) for how to upload a file. - - Your input file must be formatted as a - [JSONL file](/docs/api-reference/batch/request-input), and must be uploaded with - the purpose `batch`. The file can contain up to 50,000 requests, and can be up - to 100 MB in size. - - metadata: Optional custom metadata for the batch. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/batches", - body=await async_maybe_transform( - { - "completion_window": completion_window, - "endpoint": endpoint, - "input_file_id": input_file_id, - "metadata": metadata, - }, - batch_create_params.BatchCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Batch, - ) - - async def retrieve( - self, - batch_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Batch: - """ - Retrieves a batch. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return await self._get( - f"/batches/{batch_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Batch, - ) - - async def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BatchListResponse: - """List your organization's batches. - - Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/batches", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "limit": limit, - }, - batch_list_params.BatchListParams, - ), - ), - cast_to=BatchListResponse, - ) - - async def cancel( - self, - batch_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Batch: - """Cancels an in-progress batch. - - The batch will be in status `cancelling` for up to - 10 minutes, before changing to `cancelled`, where it will have partial results - (if any) available in the output file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return await self._post( - f"/batches/{batch_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Batch, - ) - - -class BatchesResourceWithRawResponse: - def __init__(self, batches: BatchesResource) -> None: - self._batches = batches - - self.create = to_raw_response_wrapper( - batches.create, - ) - self.retrieve = to_raw_response_wrapper( - batches.retrieve, - ) - self.list = to_raw_response_wrapper( - batches.list, - ) - self.cancel = to_raw_response_wrapper( - batches.cancel, - ) - - -class AsyncBatchesResourceWithRawResponse: - def __init__(self, batches: AsyncBatchesResource) -> None: - self._batches = batches - - self.create = async_to_raw_response_wrapper( - batches.create, - ) - self.retrieve = async_to_raw_response_wrapper( - batches.retrieve, - ) - self.list = async_to_raw_response_wrapper( - batches.list, - ) - self.cancel = async_to_raw_response_wrapper( - batches.cancel, - ) - - -class BatchesResourceWithStreamingResponse: - def __init__(self, batches: BatchesResource) -> None: - self._batches = batches - - self.create = to_streamed_response_wrapper( - batches.create, - ) - self.retrieve = to_streamed_response_wrapper( - batches.retrieve, - ) - self.list = to_streamed_response_wrapper( - batches.list, - ) - self.cancel = to_streamed_response_wrapper( - batches.cancel, - ) - - -class AsyncBatchesResourceWithStreamingResponse: - def __init__(self, batches: AsyncBatchesResource) -> None: - self._batches = batches - - self.create = async_to_streamed_response_wrapper( - batches.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - batches.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - batches.list, - ) - self.cancel = async_to_streamed_response_wrapper( - batches.cancel, - ) diff --git a/src/omnistack/resources/embeddings.py b/src/omnistack/resources/embeddings.py deleted file mode 100644 index c64170d..0000000 --- a/src/omnistack/resources/embeddings.py +++ /dev/null @@ -1,239 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable -from typing_extensions import Literal - -import httpx - -from ..types import embedding_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options -from ..types.embedding_create_response import EmbeddingCreateResponse - -__all__ = ["EmbeddingsResource", "AsyncEmbeddingsResource"] - - -class EmbeddingsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EmbeddingsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return EmbeddingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EmbeddingsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return EmbeddingsResourceWithStreamingResponse(self) - - def create( - self, - *, - input: Union[str, List[str], Iterable[int], Iterable[Iterable[int]]], - model: Union[str, Literal["text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large"]], - dimensions: int | NotGiven = NOT_GIVEN, - encoding_format: Literal["float", "base64"] | NotGiven = NOT_GIVEN, - user: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmbeddingCreateResponse: - """ - Creates an embedding vector representing the input text. - - Args: - input: Input text to embed, encoded as a string or array of tokens. To embed multiple - inputs in a single request, pass an array of strings or array of token arrays. - The input must not exceed the max input tokens for the model (8192 tokens for - `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 - dimensions or less. - [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - for counting tokens. - - model: ID of the model to use. You can use the - [List models](/docs/api-reference/models/list) API to see all of your available - models, or see our [Model overview](/docs/models/overview) for descriptions of - them. - - dimensions: The number of dimensions the resulting output embeddings should have. Only - supported in `text-embedding-3` and later models. - - encoding_format: The format to return the embeddings in. Can be either `float` or - [`base64`](https://pypi.org/project/pybase64/). - - user: A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/embeddings", - body=maybe_transform( - { - "input": input, - "model": model, - "dimensions": dimensions, - "encoding_format": encoding_format, - "user": user, - }, - embedding_create_params.EmbeddingCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EmbeddingCreateResponse, - ) - - -class AsyncEmbeddingsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEmbeddingsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncEmbeddingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEmbeddingsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncEmbeddingsResourceWithStreamingResponse(self) - - async def create( - self, - *, - input: Union[str, List[str], Iterable[int], Iterable[Iterable[int]]], - model: Union[str, Literal["text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large"]], - dimensions: int | NotGiven = NOT_GIVEN, - encoding_format: Literal["float", "base64"] | NotGiven = NOT_GIVEN, - user: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmbeddingCreateResponse: - """ - Creates an embedding vector representing the input text. - - Args: - input: Input text to embed, encoded as a string or array of tokens. To embed multiple - inputs in a single request, pass an array of strings or array of token arrays. - The input must not exceed the max input tokens for the model (8192 tokens for - `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 - dimensions or less. - [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - for counting tokens. - - model: ID of the model to use. You can use the - [List models](/docs/api-reference/models/list) API to see all of your available - models, or see our [Model overview](/docs/models/overview) for descriptions of - them. - - dimensions: The number of dimensions the resulting output embeddings should have. Only - supported in `text-embedding-3` and later models. - - encoding_format: The format to return the embeddings in. Can be either `float` or - [`base64`](https://pypi.org/project/pybase64/). - - user: A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/embeddings", - body=await async_maybe_transform( - { - "input": input, - "model": model, - "dimensions": dimensions, - "encoding_format": encoding_format, - "user": user, - }, - embedding_create_params.EmbeddingCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EmbeddingCreateResponse, - ) - - -class EmbeddingsResourceWithRawResponse: - def __init__(self, embeddings: EmbeddingsResource) -> None: - self._embeddings = embeddings - - self.create = to_raw_response_wrapper( - embeddings.create, - ) - - -class AsyncEmbeddingsResourceWithRawResponse: - def __init__(self, embeddings: AsyncEmbeddingsResource) -> None: - self._embeddings = embeddings - - self.create = async_to_raw_response_wrapper( - embeddings.create, - ) - - -class EmbeddingsResourceWithStreamingResponse: - def __init__(self, embeddings: EmbeddingsResource) -> None: - self._embeddings = embeddings - - self.create = to_streamed_response_wrapper( - embeddings.create, - ) - - -class AsyncEmbeddingsResourceWithStreamingResponse: - def __init__(self, embeddings: AsyncEmbeddingsResource) -> None: - self._embeddings = embeddings - - self.create = async_to_streamed_response_wrapper( - embeddings.create, - ) diff --git a/src/omnistack/resources/files/__init__.py b/src/omnistack/resources/files/__init__.py deleted file mode 100644 index d1f68da..0000000 --- a/src/omnistack/resources/files/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .files import ( - FilesResource, - AsyncFilesResource, - FilesResourceWithRawResponse, - AsyncFilesResourceWithRawResponse, - FilesResourceWithStreamingResponse, - AsyncFilesResourceWithStreamingResponse, -) -from .content import ( - ContentResource, - AsyncContentResource, - ContentResourceWithRawResponse, - AsyncContentResourceWithRawResponse, - ContentResourceWithStreamingResponse, - AsyncContentResourceWithStreamingResponse, -) - -__all__ = [ - "ContentResource", - "AsyncContentResource", - "ContentResourceWithRawResponse", - "AsyncContentResourceWithRawResponse", - "ContentResourceWithStreamingResponse", - "AsyncContentResourceWithStreamingResponse", - "FilesResource", - "AsyncFilesResource", - "FilesResourceWithRawResponse", - "AsyncFilesResourceWithRawResponse", - "FilesResourceWithStreamingResponse", - "AsyncFilesResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/files/content.py b/src/omnistack/resources/files/content.py deleted file mode 100644 index f8136de..0000000 --- a/src/omnistack/resources/files/content.py +++ /dev/null @@ -1,162 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options - -__all__ = ["ContentResource", "AsyncContentResource"] - - -class ContentResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ContentResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return ContentResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ContentResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return ContentResourceWithStreamingResponse(self) - - def retrieve( - self, - file_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> str: - """ - Returns the contents of the specified file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return self._get( - f"/files/{file_id}/content", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=str, - ) - - -class AsyncContentResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncContentResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncContentResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncContentResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncContentResourceWithStreamingResponse(self) - - async def retrieve( - self, - file_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> str: - """ - Returns the contents of the specified file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return await self._get( - f"/files/{file_id}/content", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=str, - ) - - -class ContentResourceWithRawResponse: - def __init__(self, content: ContentResource) -> None: - self._content = content - - self.retrieve = to_raw_response_wrapper( - content.retrieve, - ) - - -class AsyncContentResourceWithRawResponse: - def __init__(self, content: AsyncContentResource) -> None: - self._content = content - - self.retrieve = async_to_raw_response_wrapper( - content.retrieve, - ) - - -class ContentResourceWithStreamingResponse: - def __init__(self, content: ContentResource) -> None: - self._content = content - - self.retrieve = to_streamed_response_wrapper( - content.retrieve, - ) - - -class AsyncContentResourceWithStreamingResponse: - def __init__(self, content: AsyncContentResource) -> None: - self._content = content - - self.retrieve = async_to_streamed_response_wrapper( - content.retrieve, - ) diff --git a/src/omnistack/resources/files/files.py b/src/omnistack/resources/files/files.py deleted file mode 100644 index b298370..0000000 --- a/src/omnistack/resources/files/files.py +++ /dev/null @@ -1,525 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Mapping, cast -from typing_extensions import Literal - -import httpx - -from ...types import file_list_params, file_create_params -from .content import ( - ContentResource, - AsyncContentResource, - ContentResourceWithRawResponse, - AsyncContentResourceWithRawResponse, - ContentResourceWithStreamingResponse, - AsyncContentResourceWithStreamingResponse, -) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ..._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.openai_file import OpenAIFile -from ...types.file_list_response import FileListResponse -from ...types.file_delete_response import FileDeleteResponse - -__all__ = ["FilesResource", "AsyncFilesResource"] - - -class FilesResource(SyncAPIResource): - @cached_property - def content(self) -> ContentResource: - return ContentResource(self._client) - - @cached_property - def with_raw_response(self) -> FilesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return FilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FilesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return FilesResourceWithStreamingResponse(self) - - def create( - self, - *, - file: FileTypes, - purpose: Literal["assistants", "batch", "fine-tune", "vision"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OpenAIFile: - """Upload a file that can be used across various endpoints. - - Individual files can be - up to 512 MB, and the size of all files uploaded by one organization can be up - to 100 GB. - - The Assistants API supports files up to 2 million tokens and of specific file - types. See the [Assistants Tools guide](/docs/assistants/tools) for details. - - The Fine-tuning API only supports `.jsonl` files. The input also has certain - required formats for fine-tuning - [chat](/docs/api-reference/fine-tuning/chat-input) or - [completions](/docs/api-reference/fine-tuning/completions-input) models. - - The Batch API only supports `.jsonl` files up to 100 MB in size. The input also - has a specific required [format](/docs/api-reference/batch/request-input). - - Please [contact us](https://help.openai.com/) if you need to increase these - storage limits. - - Args: - file: The File object (not file name) to be uploaded. - - purpose: The intended purpose of the uploaded file. - - Use "assistants" for [Assistants](/docs/api-reference/assistants) and - [Message](/docs/api-reference/messages) files, "vision" for Assistants image - file inputs, "batch" for [Batch API](/docs/guides/batch), and "fine-tune" for - [Fine-tuning](/docs/api-reference/fine-tuning). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "file": file, - "purpose": purpose, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return self._post( - "/files", - body=maybe_transform(body, file_create_params.FileCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=OpenAIFile, - ) - - def retrieve( - self, - file_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OpenAIFile: - """ - Returns information about a specific file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return self._get( - f"/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=OpenAIFile, - ) - - def list( - self, - *, - purpose: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: - """ - Returns a list of files that belong to the user's organization. - - Args: - purpose: Only return files with the given purpose. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/files", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"purpose": purpose}, file_list_params.FileListParams), - ), - cast_to=FileListResponse, - ) - - def delete( - self, - file_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileDeleteResponse: - """ - Delete a file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return self._delete( - f"/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileDeleteResponse, - ) - - -class AsyncFilesResource(AsyncAPIResource): - @cached_property - def content(self) -> AsyncContentResource: - return AsyncContentResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncFilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncFilesResourceWithStreamingResponse(self) - - async def create( - self, - *, - file: FileTypes, - purpose: Literal["assistants", "batch", "fine-tune", "vision"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OpenAIFile: - """Upload a file that can be used across various endpoints. - - Individual files can be - up to 512 MB, and the size of all files uploaded by one organization can be up - to 100 GB. - - The Assistants API supports files up to 2 million tokens and of specific file - types. See the [Assistants Tools guide](/docs/assistants/tools) for details. - - The Fine-tuning API only supports `.jsonl` files. The input also has certain - required formats for fine-tuning - [chat](/docs/api-reference/fine-tuning/chat-input) or - [completions](/docs/api-reference/fine-tuning/completions-input) models. - - The Batch API only supports `.jsonl` files up to 100 MB in size. The input also - has a specific required [format](/docs/api-reference/batch/request-input). - - Please [contact us](https://help.openai.com/) if you need to increase these - storage limits. - - Args: - file: The File object (not file name) to be uploaded. - - purpose: The intended purpose of the uploaded file. - - Use "assistants" for [Assistants](/docs/api-reference/assistants) and - [Message](/docs/api-reference/messages) files, "vision" for Assistants image - file inputs, "batch" for [Batch API](/docs/guides/batch), and "fine-tune" for - [Fine-tuning](/docs/api-reference/fine-tuning). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "file": file, - "purpose": purpose, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return await self._post( - "/files", - body=await async_maybe_transform(body, file_create_params.FileCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=OpenAIFile, - ) - - async def retrieve( - self, - file_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OpenAIFile: - """ - Returns information about a specific file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return await self._get( - f"/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=OpenAIFile, - ) - - async def list( - self, - *, - purpose: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: - """ - Returns a list of files that belong to the user's organization. - - Args: - purpose: Only return files with the given purpose. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/files", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"purpose": purpose}, file_list_params.FileListParams), - ), - cast_to=FileListResponse, - ) - - async def delete( - self, - file_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileDeleteResponse: - """ - Delete a file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return await self._delete( - f"/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileDeleteResponse, - ) - - -class FilesResourceWithRawResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.create = to_raw_response_wrapper( - files.create, - ) - self.retrieve = to_raw_response_wrapper( - files.retrieve, - ) - self.list = to_raw_response_wrapper( - files.list, - ) - self.delete = to_raw_response_wrapper( - files.delete, - ) - - @cached_property - def content(self) -> ContentResourceWithRawResponse: - return ContentResourceWithRawResponse(self._files.content) - - -class AsyncFilesResourceWithRawResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.create = async_to_raw_response_wrapper( - files.create, - ) - self.retrieve = async_to_raw_response_wrapper( - files.retrieve, - ) - self.list = async_to_raw_response_wrapper( - files.list, - ) - self.delete = async_to_raw_response_wrapper( - files.delete, - ) - - @cached_property - def content(self) -> AsyncContentResourceWithRawResponse: - return AsyncContentResourceWithRawResponse(self._files.content) - - -class FilesResourceWithStreamingResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.create = to_streamed_response_wrapper( - files.create, - ) - self.retrieve = to_streamed_response_wrapper( - files.retrieve, - ) - self.list = to_streamed_response_wrapper( - files.list, - ) - self.delete = to_streamed_response_wrapper( - files.delete, - ) - - @cached_property - def content(self) -> ContentResourceWithStreamingResponse: - return ContentResourceWithStreamingResponse(self._files.content) - - -class AsyncFilesResourceWithStreamingResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.create = async_to_streamed_response_wrapper( - files.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - files.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - files.list, - ) - self.delete = async_to_streamed_response_wrapper( - files.delete, - ) - - @cached_property - def content(self) -> AsyncContentResourceWithStreamingResponse: - return AsyncContentResourceWithStreamingResponse(self._files.content) diff --git a/src/omnistack/resources/fine_tuning/__init__.py b/src/omnistack/resources/fine_tuning/__init__.py deleted file mode 100644 index 2423dc8..0000000 --- a/src/omnistack/resources/fine_tuning/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .jobs import ( - JobsResource, - AsyncJobsResource, - JobsResourceWithRawResponse, - AsyncJobsResourceWithRawResponse, - JobsResourceWithStreamingResponse, - AsyncJobsResourceWithStreamingResponse, -) -from .fine_tuning import ( - FineTuningResource, - AsyncFineTuningResource, - FineTuningResourceWithRawResponse, - AsyncFineTuningResourceWithRawResponse, - FineTuningResourceWithStreamingResponse, - AsyncFineTuningResourceWithStreamingResponse, -) - -__all__ = [ - "JobsResource", - "AsyncJobsResource", - "JobsResourceWithRawResponse", - "AsyncJobsResourceWithRawResponse", - "JobsResourceWithStreamingResponse", - "AsyncJobsResourceWithStreamingResponse", - "FineTuningResource", - "AsyncFineTuningResource", - "FineTuningResourceWithRawResponse", - "AsyncFineTuningResourceWithRawResponse", - "FineTuningResourceWithStreamingResponse", - "AsyncFineTuningResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/fine_tuning/fine_tuning.py b/src/omnistack/resources/fine_tuning/fine_tuning.py deleted file mode 100644 index 80141d7..0000000 --- a/src/omnistack/resources/fine_tuning/fine_tuning.py +++ /dev/null @@ -1,103 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .jobs import ( - JobsResource, - AsyncJobsResource, - JobsResourceWithRawResponse, - AsyncJobsResourceWithRawResponse, - JobsResourceWithStreamingResponse, - AsyncJobsResourceWithStreamingResponse, -) -from ..._compat import cached_property -from .jobs.jobs import JobsResource, AsyncJobsResource -from ..._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["FineTuningResource", "AsyncFineTuningResource"] - - -class FineTuningResource(SyncAPIResource): - @cached_property - def jobs(self) -> JobsResource: - return JobsResource(self._client) - - @cached_property - def with_raw_response(self) -> FineTuningResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return FineTuningResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FineTuningResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return FineTuningResourceWithStreamingResponse(self) - - -class AsyncFineTuningResource(AsyncAPIResource): - @cached_property - def jobs(self) -> AsyncJobsResource: - return AsyncJobsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncFineTuningResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncFineTuningResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFineTuningResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncFineTuningResourceWithStreamingResponse(self) - - -class FineTuningResourceWithRawResponse: - def __init__(self, fine_tuning: FineTuningResource) -> None: - self._fine_tuning = fine_tuning - - @cached_property - def jobs(self) -> JobsResourceWithRawResponse: - return JobsResourceWithRawResponse(self._fine_tuning.jobs) - - -class AsyncFineTuningResourceWithRawResponse: - def __init__(self, fine_tuning: AsyncFineTuningResource) -> None: - self._fine_tuning = fine_tuning - - @cached_property - def jobs(self) -> AsyncJobsResourceWithRawResponse: - return AsyncJobsResourceWithRawResponse(self._fine_tuning.jobs) - - -class FineTuningResourceWithStreamingResponse: - def __init__(self, fine_tuning: FineTuningResource) -> None: - self._fine_tuning = fine_tuning - - @cached_property - def jobs(self) -> JobsResourceWithStreamingResponse: - return JobsResourceWithStreamingResponse(self._fine_tuning.jobs) - - -class AsyncFineTuningResourceWithStreamingResponse: - def __init__(self, fine_tuning: AsyncFineTuningResource) -> None: - self._fine_tuning = fine_tuning - - @cached_property - def jobs(self) -> AsyncJobsResourceWithStreamingResponse: - return AsyncJobsResourceWithStreamingResponse(self._fine_tuning.jobs) diff --git a/src/omnistack/resources/fine_tuning/jobs/__init__.py b/src/omnistack/resources/fine_tuning/jobs/__init__.py deleted file mode 100644 index 8fe4103..0000000 --- a/src/omnistack/resources/fine_tuning/jobs/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .jobs import ( - JobsResource, - AsyncJobsResource, - JobsResourceWithRawResponse, - AsyncJobsResourceWithRawResponse, - JobsResourceWithStreamingResponse, - AsyncJobsResourceWithStreamingResponse, -) -from .events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) -from .checkpoints import ( - CheckpointsResource, - AsyncCheckpointsResource, - CheckpointsResourceWithRawResponse, - AsyncCheckpointsResourceWithRawResponse, - CheckpointsResourceWithStreamingResponse, - AsyncCheckpointsResourceWithStreamingResponse, -) - -__all__ = [ - "EventsResource", - "AsyncEventsResource", - "EventsResourceWithRawResponse", - "AsyncEventsResourceWithRawResponse", - "EventsResourceWithStreamingResponse", - "AsyncEventsResourceWithStreamingResponse", - "CheckpointsResource", - "AsyncCheckpointsResource", - "CheckpointsResourceWithRawResponse", - "AsyncCheckpointsResourceWithRawResponse", - "CheckpointsResourceWithStreamingResponse", - "AsyncCheckpointsResourceWithStreamingResponse", - "JobsResource", - "AsyncJobsResource", - "JobsResourceWithRawResponse", - "AsyncJobsResourceWithRawResponse", - "JobsResourceWithStreamingResponse", - "AsyncJobsResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/fine_tuning/jobs/checkpoints.py b/src/omnistack/resources/fine_tuning/jobs/checkpoints.py deleted file mode 100644 index e2970e1..0000000 --- a/src/omnistack/resources/fine_tuning/jobs/checkpoints.py +++ /dev/null @@ -1,200 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.fine_tuning.jobs import checkpoint_list_params -from ....types.fine_tuning.jobs.checkpoint_list_response import CheckpointListResponse - -__all__ = ["CheckpointsResource", "AsyncCheckpointsResource"] - - -class CheckpointsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CheckpointsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return CheckpointsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CheckpointsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return CheckpointsResourceWithStreamingResponse(self) - - def list( - self, - fine_tuning_job_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CheckpointListResponse: - """ - List checkpoints for a fine-tuning job. - - Args: - after: Identifier for the last checkpoint ID from the previous pagination request. - - limit: Number of checkpoints to retrieve. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not fine_tuning_job_id: - raise ValueError(f"Expected a non-empty value for `fine_tuning_job_id` but received {fine_tuning_job_id!r}") - return self._get( - f"/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "limit": limit, - }, - checkpoint_list_params.CheckpointListParams, - ), - ), - cast_to=CheckpointListResponse, - ) - - -class AsyncCheckpointsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCheckpointsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncCheckpointsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCheckpointsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncCheckpointsResourceWithStreamingResponse(self) - - async def list( - self, - fine_tuning_job_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CheckpointListResponse: - """ - List checkpoints for a fine-tuning job. - - Args: - after: Identifier for the last checkpoint ID from the previous pagination request. - - limit: Number of checkpoints to retrieve. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not fine_tuning_job_id: - raise ValueError(f"Expected a non-empty value for `fine_tuning_job_id` but received {fine_tuning_job_id!r}") - return await self._get( - f"/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "limit": limit, - }, - checkpoint_list_params.CheckpointListParams, - ), - ), - cast_to=CheckpointListResponse, - ) - - -class CheckpointsResourceWithRawResponse: - def __init__(self, checkpoints: CheckpointsResource) -> None: - self._checkpoints = checkpoints - - self.list = to_raw_response_wrapper( - checkpoints.list, - ) - - -class AsyncCheckpointsResourceWithRawResponse: - def __init__(self, checkpoints: AsyncCheckpointsResource) -> None: - self._checkpoints = checkpoints - - self.list = async_to_raw_response_wrapper( - checkpoints.list, - ) - - -class CheckpointsResourceWithStreamingResponse: - def __init__(self, checkpoints: CheckpointsResource) -> None: - self._checkpoints = checkpoints - - self.list = to_streamed_response_wrapper( - checkpoints.list, - ) - - -class AsyncCheckpointsResourceWithStreamingResponse: - def __init__(self, checkpoints: AsyncCheckpointsResource) -> None: - self._checkpoints = checkpoints - - self.list = async_to_streamed_response_wrapper( - checkpoints.list, - ) diff --git a/src/omnistack/resources/fine_tuning/jobs/events.py b/src/omnistack/resources/fine_tuning/jobs/events.py deleted file mode 100644 index fc33286..0000000 --- a/src/omnistack/resources/fine_tuning/jobs/events.py +++ /dev/null @@ -1,200 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.fine_tuning.jobs import event_retrieve_params -from ....types.fine_tuning.jobs.event_retrieve_response import EventRetrieveResponse - -__all__ = ["EventsResource", "AsyncEventsResource"] - - -class EventsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EventsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return EventsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EventsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return EventsResourceWithStreamingResponse(self) - - def retrieve( - self, - fine_tuning_job_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EventRetrieveResponse: - """ - Get status updates for a fine-tuning job. - - Args: - after: Identifier for the last event from the previous pagination request. - - limit: Number of events to retrieve. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not fine_tuning_job_id: - raise ValueError(f"Expected a non-empty value for `fine_tuning_job_id` but received {fine_tuning_job_id!r}") - return self._get( - f"/fine_tuning/jobs/{fine_tuning_job_id}/events", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "limit": limit, - }, - event_retrieve_params.EventRetrieveParams, - ), - ), - cast_to=EventRetrieveResponse, - ) - - -class AsyncEventsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncEventsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncEventsResourceWithStreamingResponse(self) - - async def retrieve( - self, - fine_tuning_job_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EventRetrieveResponse: - """ - Get status updates for a fine-tuning job. - - Args: - after: Identifier for the last event from the previous pagination request. - - limit: Number of events to retrieve. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not fine_tuning_job_id: - raise ValueError(f"Expected a non-empty value for `fine_tuning_job_id` but received {fine_tuning_job_id!r}") - return await self._get( - f"/fine_tuning/jobs/{fine_tuning_job_id}/events", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "limit": limit, - }, - event_retrieve_params.EventRetrieveParams, - ), - ), - cast_to=EventRetrieveResponse, - ) - - -class EventsResourceWithRawResponse: - def __init__(self, events: EventsResource) -> None: - self._events = events - - self.retrieve = to_raw_response_wrapper( - events.retrieve, - ) - - -class AsyncEventsResourceWithRawResponse: - def __init__(self, events: AsyncEventsResource) -> None: - self._events = events - - self.retrieve = async_to_raw_response_wrapper( - events.retrieve, - ) - - -class EventsResourceWithStreamingResponse: - def __init__(self, events: EventsResource) -> None: - self._events = events - - self.retrieve = to_streamed_response_wrapper( - events.retrieve, - ) - - -class AsyncEventsResourceWithStreamingResponse: - def __init__(self, events: AsyncEventsResource) -> None: - self._events = events - - self.retrieve = async_to_streamed_response_wrapper( - events.retrieve, - ) diff --git a/src/omnistack/resources/fine_tuning/jobs/jobs.py b/src/omnistack/resources/fine_tuning/jobs/jobs.py deleted file mode 100644 index c519bea..0000000 --- a/src/omnistack/resources/fine_tuning/jobs/jobs.py +++ /dev/null @@ -1,628 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Iterable, Optional -from typing_extensions import Literal - -import httpx - -from .events import ( - EventsResource, - AsyncEventsResource, - EventsResourceWithRawResponse, - AsyncEventsResourceWithRawResponse, - EventsResourceWithStreamingResponse, - AsyncEventsResourceWithStreamingResponse, -) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from .checkpoints import ( - CheckpointsResource, - AsyncCheckpointsResource, - CheckpointsResourceWithRawResponse, - AsyncCheckpointsResourceWithRawResponse, - CheckpointsResourceWithStreamingResponse, - AsyncCheckpointsResourceWithStreamingResponse, -) -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.fine_tuning import job_list_params, job_create_params -from ....types.fine_tuning.fine_tuning_job import FineTuningJob -from ....types.fine_tuning.job_list_response import JobListResponse - -__all__ = ["JobsResource", "AsyncJobsResource"] - - -class JobsResource(SyncAPIResource): - @cached_property - def events(self) -> EventsResource: - return EventsResource(self._client) - - @cached_property - def checkpoints(self) -> CheckpointsResource: - return CheckpointsResource(self._client) - - @cached_property - def with_raw_response(self) -> JobsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return JobsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> JobsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return JobsResourceWithStreamingResponse(self) - - def create( - self, - *, - model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"]], - training_file: str, - hyperparameters: job_create_params.Hyperparameters | NotGiven = NOT_GIVEN, - integrations: Optional[Iterable[job_create_params.Integration]] | NotGiven = NOT_GIVEN, - seed: Optional[int] | NotGiven = NOT_GIVEN, - suffix: Optional[str] | NotGiven = NOT_GIVEN, - validation_file: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FineTuningJob: - """ - Creates a fine-tuning job which begins the process of creating a new model from - a given dataset. - - Response includes details of the enqueued job including job status and the name - of the fine-tuned models once complete. - - [Learn more about fine-tuning](/docs/guides/fine-tuning) - - Args: - model: The name of the model to fine-tune. You can select one of the - [supported models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned). - - training_file: The ID of an uploaded file that contains training data. - - See [upload file](/docs/api-reference/files/create) for how to upload a file. - - Your dataset must be formatted as a JSONL file. Additionally, you must upload - your file with the purpose `fine-tune`. - - The contents of the file should differ depending on if the model uses the - [chat](/docs/api-reference/fine-tuning/chat-input) or - [completions](/docs/api-reference/fine-tuning/completions-input) format. - - See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. - - hyperparameters: The hyperparameters used for the fine-tuning job. - - integrations: A list of integrations to enable for your fine-tuning job. - - seed: The seed controls the reproducibility of the job. Passing in the same seed and - job parameters should produce the same results, but may differ in rare cases. If - a seed is not specified, one will be generated for you. - - suffix: A string of up to 64 characters that will be added to your fine-tuned model - name. - - For example, a `suffix` of "custom-model-name" would produce a model name like - `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. - - validation_file: The ID of an uploaded file that contains validation data. - - If you provide this file, the data is used to generate validation metrics - periodically during fine-tuning. These metrics can be viewed in the fine-tuning - results file. The same data should not be present in both train and validation - files. - - Your dataset must be formatted as a JSONL file. You must upload your file with - the purpose `fine-tune`. - - See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/fine_tuning/jobs", - body=maybe_transform( - { - "model": model, - "training_file": training_file, - "hyperparameters": hyperparameters, - "integrations": integrations, - "seed": seed, - "suffix": suffix, - "validation_file": validation_file, - }, - job_create_params.JobCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FineTuningJob, - ) - - def retrieve( - self, - fine_tuning_job_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FineTuningJob: - """ - Get info about a fine-tuning job. - - [Learn more about fine-tuning](/docs/guides/fine-tuning) - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not fine_tuning_job_id: - raise ValueError(f"Expected a non-empty value for `fine_tuning_job_id` but received {fine_tuning_job_id!r}") - return self._get( - f"/fine_tuning/jobs/{fine_tuning_job_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FineTuningJob, - ) - - def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobListResponse: - """ - List your organization's fine-tuning jobs - - Args: - after: Identifier for the last job from the previous pagination request. - - limit: Number of fine-tuning jobs to retrieve. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/fine_tuning/jobs", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "limit": limit, - }, - job_list_params.JobListParams, - ), - ), - cast_to=JobListResponse, - ) - - def cancel( - self, - fine_tuning_job_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FineTuningJob: - """ - Immediately cancel a fine-tune job. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not fine_tuning_job_id: - raise ValueError(f"Expected a non-empty value for `fine_tuning_job_id` but received {fine_tuning_job_id!r}") - return self._post( - f"/fine_tuning/jobs/{fine_tuning_job_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FineTuningJob, - ) - - -class AsyncJobsResource(AsyncAPIResource): - @cached_property - def events(self) -> AsyncEventsResource: - return AsyncEventsResource(self._client) - - @cached_property - def checkpoints(self) -> AsyncCheckpointsResource: - return AsyncCheckpointsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncJobsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncJobsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncJobsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncJobsResourceWithStreamingResponse(self) - - async def create( - self, - *, - model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"]], - training_file: str, - hyperparameters: job_create_params.Hyperparameters | NotGiven = NOT_GIVEN, - integrations: Optional[Iterable[job_create_params.Integration]] | NotGiven = NOT_GIVEN, - seed: Optional[int] | NotGiven = NOT_GIVEN, - suffix: Optional[str] | NotGiven = NOT_GIVEN, - validation_file: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FineTuningJob: - """ - Creates a fine-tuning job which begins the process of creating a new model from - a given dataset. - - Response includes details of the enqueued job including job status and the name - of the fine-tuned models once complete. - - [Learn more about fine-tuning](/docs/guides/fine-tuning) - - Args: - model: The name of the model to fine-tune. You can select one of the - [supported models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned). - - training_file: The ID of an uploaded file that contains training data. - - See [upload file](/docs/api-reference/files/create) for how to upload a file. - - Your dataset must be formatted as a JSONL file. Additionally, you must upload - your file with the purpose `fine-tune`. - - The contents of the file should differ depending on if the model uses the - [chat](/docs/api-reference/fine-tuning/chat-input) or - [completions](/docs/api-reference/fine-tuning/completions-input) format. - - See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. - - hyperparameters: The hyperparameters used for the fine-tuning job. - - integrations: A list of integrations to enable for your fine-tuning job. - - seed: The seed controls the reproducibility of the job. Passing in the same seed and - job parameters should produce the same results, but may differ in rare cases. If - a seed is not specified, one will be generated for you. - - suffix: A string of up to 64 characters that will be added to your fine-tuned model - name. - - For example, a `suffix` of "custom-model-name" would produce a model name like - `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. - - validation_file: The ID of an uploaded file that contains validation data. - - If you provide this file, the data is used to generate validation metrics - periodically during fine-tuning. These metrics can be viewed in the fine-tuning - results file. The same data should not be present in both train and validation - files. - - Your dataset must be formatted as a JSONL file. You must upload your file with - the purpose `fine-tune`. - - See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/fine_tuning/jobs", - body=await async_maybe_transform( - { - "model": model, - "training_file": training_file, - "hyperparameters": hyperparameters, - "integrations": integrations, - "seed": seed, - "suffix": suffix, - "validation_file": validation_file, - }, - job_create_params.JobCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FineTuningJob, - ) - - async def retrieve( - self, - fine_tuning_job_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FineTuningJob: - """ - Get info about a fine-tuning job. - - [Learn more about fine-tuning](/docs/guides/fine-tuning) - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not fine_tuning_job_id: - raise ValueError(f"Expected a non-empty value for `fine_tuning_job_id` but received {fine_tuning_job_id!r}") - return await self._get( - f"/fine_tuning/jobs/{fine_tuning_job_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FineTuningJob, - ) - - async def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobListResponse: - """ - List your organization's fine-tuning jobs - - Args: - after: Identifier for the last job from the previous pagination request. - - limit: Number of fine-tuning jobs to retrieve. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/fine_tuning/jobs", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "limit": limit, - }, - job_list_params.JobListParams, - ), - ), - cast_to=JobListResponse, - ) - - async def cancel( - self, - fine_tuning_job_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FineTuningJob: - """ - Immediately cancel a fine-tune job. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not fine_tuning_job_id: - raise ValueError(f"Expected a non-empty value for `fine_tuning_job_id` but received {fine_tuning_job_id!r}") - return await self._post( - f"/fine_tuning/jobs/{fine_tuning_job_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FineTuningJob, - ) - - -class JobsResourceWithRawResponse: - def __init__(self, jobs: JobsResource) -> None: - self._jobs = jobs - - self.create = to_raw_response_wrapper( - jobs.create, - ) - self.retrieve = to_raw_response_wrapper( - jobs.retrieve, - ) - self.list = to_raw_response_wrapper( - jobs.list, - ) - self.cancel = to_raw_response_wrapper( - jobs.cancel, - ) - - @cached_property - def events(self) -> EventsResourceWithRawResponse: - return EventsResourceWithRawResponse(self._jobs.events) - - @cached_property - def checkpoints(self) -> CheckpointsResourceWithRawResponse: - return CheckpointsResourceWithRawResponse(self._jobs.checkpoints) - - -class AsyncJobsResourceWithRawResponse: - def __init__(self, jobs: AsyncJobsResource) -> None: - self._jobs = jobs - - self.create = async_to_raw_response_wrapper( - jobs.create, - ) - self.retrieve = async_to_raw_response_wrapper( - jobs.retrieve, - ) - self.list = async_to_raw_response_wrapper( - jobs.list, - ) - self.cancel = async_to_raw_response_wrapper( - jobs.cancel, - ) - - @cached_property - def events(self) -> AsyncEventsResourceWithRawResponse: - return AsyncEventsResourceWithRawResponse(self._jobs.events) - - @cached_property - def checkpoints(self) -> AsyncCheckpointsResourceWithRawResponse: - return AsyncCheckpointsResourceWithRawResponse(self._jobs.checkpoints) - - -class JobsResourceWithStreamingResponse: - def __init__(self, jobs: JobsResource) -> None: - self._jobs = jobs - - self.create = to_streamed_response_wrapper( - jobs.create, - ) - self.retrieve = to_streamed_response_wrapper( - jobs.retrieve, - ) - self.list = to_streamed_response_wrapper( - jobs.list, - ) - self.cancel = to_streamed_response_wrapper( - jobs.cancel, - ) - - @cached_property - def events(self) -> EventsResourceWithStreamingResponse: - return EventsResourceWithStreamingResponse(self._jobs.events) - - @cached_property - def checkpoints(self) -> CheckpointsResourceWithStreamingResponse: - return CheckpointsResourceWithStreamingResponse(self._jobs.checkpoints) - - -class AsyncJobsResourceWithStreamingResponse: - def __init__(self, jobs: AsyncJobsResource) -> None: - self._jobs = jobs - - self.create = async_to_streamed_response_wrapper( - jobs.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - jobs.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - jobs.list, - ) - self.cancel = async_to_streamed_response_wrapper( - jobs.cancel, - ) - - @cached_property - def events(self) -> AsyncEventsResourceWithStreamingResponse: - return AsyncEventsResourceWithStreamingResponse(self._jobs.events) - - @cached_property - def checkpoints(self) -> AsyncCheckpointsResourceWithStreamingResponse: - return AsyncCheckpointsResourceWithStreamingResponse(self._jobs.checkpoints) diff --git a/src/omnistack/resources/images/__init__.py b/src/omnistack/resources/images/__init__.py deleted file mode 100644 index 86dd7ca..0000000 --- a/src/omnistack/resources/images/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .edits import ( - EditsResource, - AsyncEditsResource, - EditsResourceWithRawResponse, - AsyncEditsResourceWithRawResponse, - EditsResourceWithStreamingResponse, - AsyncEditsResourceWithStreamingResponse, -) -from .images import ( - ImagesResource, - AsyncImagesResource, - ImagesResourceWithRawResponse, - AsyncImagesResourceWithRawResponse, - ImagesResourceWithStreamingResponse, - AsyncImagesResourceWithStreamingResponse, -) -from .variations import ( - VariationsResource, - AsyncVariationsResource, - VariationsResourceWithRawResponse, - AsyncVariationsResourceWithRawResponse, - VariationsResourceWithStreamingResponse, - AsyncVariationsResourceWithStreamingResponse, -) -from .generations import ( - GenerationsResource, - AsyncGenerationsResource, - GenerationsResourceWithRawResponse, - AsyncGenerationsResourceWithRawResponse, - GenerationsResourceWithStreamingResponse, - AsyncGenerationsResourceWithStreamingResponse, -) - -__all__ = [ - "GenerationsResource", - "AsyncGenerationsResource", - "GenerationsResourceWithRawResponse", - "AsyncGenerationsResourceWithRawResponse", - "GenerationsResourceWithStreamingResponse", - "AsyncGenerationsResourceWithStreamingResponse", - "EditsResource", - "AsyncEditsResource", - "EditsResourceWithRawResponse", - "AsyncEditsResourceWithRawResponse", - "EditsResourceWithStreamingResponse", - "AsyncEditsResourceWithStreamingResponse", - "VariationsResource", - "AsyncVariationsResource", - "VariationsResourceWithRawResponse", - "AsyncVariationsResourceWithRawResponse", - "VariationsResourceWithStreamingResponse", - "AsyncVariationsResourceWithStreamingResponse", - "ImagesResource", - "AsyncImagesResource", - "ImagesResourceWithRawResponse", - "AsyncImagesResourceWithRawResponse", - "ImagesResourceWithStreamingResponse", - "AsyncImagesResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/images/edits.py b/src/omnistack/resources/images/edits.py deleted file mode 100644 index f273ead..0000000 --- a/src/omnistack/resources/images/edits.py +++ /dev/null @@ -1,271 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Mapping, Optional, cast -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ..._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.images import edit_create_params -from ...types.image_response import ImageResponse - -__all__ = ["EditsResource", "AsyncEditsResource"] - - -class EditsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EditsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return EditsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EditsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return EditsResourceWithStreamingResponse(self) - - def create( - self, - *, - image: FileTypes, - prompt: str, - mask: FileTypes | NotGiven = NOT_GIVEN, - model: Union[str, Literal["dall-e-2"], None] | NotGiven = NOT_GIVEN, - n: Optional[int] | NotGiven = NOT_GIVEN, - response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN, - size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN, - user: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageResponse: - """ - Creates an edited or extended image given an original image and a prompt. - - Args: - image: The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask - is not provided, image must have transparency, which will be used as the mask. - - prompt: A text description of the desired image(s). The maximum length is 1000 - characters. - - mask: An additional image whose fully transparent areas (e.g. where alpha is zero) - indicate where `image` should be edited. Must be a valid PNG file, less than - 4MB, and have the same dimensions as `image`. - - model: The model to use for image generation. Only `dall-e-2` is supported at this - time. - - n: The number of images to generate. Must be between 1 and 10. - - response_format: The format in which the generated images are returned. Must be one of `url` or - `b64_json`. URLs are only valid for 60 minutes after the image has been - generated. - - size: The size of the generated images. Must be one of `256x256`, `512x512`, or - `1024x1024`. - - user: A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "image": image, - "prompt": prompt, - "mask": mask, - "model": model, - "n": n, - "response_format": response_format, - "size": size, - "user": user, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["image"], ["mask"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return self._post( - "/images/edits", - body=maybe_transform(body, edit_create_params.EditCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ImageResponse, - ) - - -class AsyncEditsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEditsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncEditsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEditsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncEditsResourceWithStreamingResponse(self) - - async def create( - self, - *, - image: FileTypes, - prompt: str, - mask: FileTypes | NotGiven = NOT_GIVEN, - model: Union[str, Literal["dall-e-2"], None] | NotGiven = NOT_GIVEN, - n: Optional[int] | NotGiven = NOT_GIVEN, - response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN, - size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN, - user: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageResponse: - """ - Creates an edited or extended image given an original image and a prompt. - - Args: - image: The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask - is not provided, image must have transparency, which will be used as the mask. - - prompt: A text description of the desired image(s). The maximum length is 1000 - characters. - - mask: An additional image whose fully transparent areas (e.g. where alpha is zero) - indicate where `image` should be edited. Must be a valid PNG file, less than - 4MB, and have the same dimensions as `image`. - - model: The model to use for image generation. Only `dall-e-2` is supported at this - time. - - n: The number of images to generate. Must be between 1 and 10. - - response_format: The format in which the generated images are returned. Must be one of `url` or - `b64_json`. URLs are only valid for 60 minutes after the image has been - generated. - - size: The size of the generated images. Must be one of `256x256`, `512x512`, or - `1024x1024`. - - user: A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "image": image, - "prompt": prompt, - "mask": mask, - "model": model, - "n": n, - "response_format": response_format, - "size": size, - "user": user, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["image"], ["mask"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return await self._post( - "/images/edits", - body=await async_maybe_transform(body, edit_create_params.EditCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ImageResponse, - ) - - -class EditsResourceWithRawResponse: - def __init__(self, edits: EditsResource) -> None: - self._edits = edits - - self.create = to_raw_response_wrapper( - edits.create, - ) - - -class AsyncEditsResourceWithRawResponse: - def __init__(self, edits: AsyncEditsResource) -> None: - self._edits = edits - - self.create = async_to_raw_response_wrapper( - edits.create, - ) - - -class EditsResourceWithStreamingResponse: - def __init__(self, edits: EditsResource) -> None: - self._edits = edits - - self.create = to_streamed_response_wrapper( - edits.create, - ) - - -class AsyncEditsResourceWithStreamingResponse: - def __init__(self, edits: AsyncEditsResource) -> None: - self._edits = edits - - self.create = async_to_streamed_response_wrapper( - edits.create, - ) diff --git a/src/omnistack/resources/images/generations.py b/src/omnistack/resources/images/generations.py deleted file mode 100644 index 383abd6..0000000 --- a/src/omnistack/resources/images/generations.py +++ /dev/null @@ -1,263 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Optional -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.images import generation_create_params -from ...types.image_response import ImageResponse - -__all__ = ["GenerationsResource", "AsyncGenerationsResource"] - - -class GenerationsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> GenerationsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return GenerationsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> GenerationsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return GenerationsResourceWithStreamingResponse(self) - - def create( - self, - *, - prompt: str, - model: Union[str, Literal["dall-e-2", "dall-e-3"], None] | NotGiven = NOT_GIVEN, - n: Optional[int] | NotGiven = NOT_GIVEN, - quality: Literal["standard", "hd"] | NotGiven = NOT_GIVEN, - response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN, - size: Optional[Literal["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"]] | NotGiven = NOT_GIVEN, - style: Optional[Literal["vivid", "natural"]] | NotGiven = NOT_GIVEN, - user: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageResponse: - """ - Creates an image given a prompt. - - Args: - prompt: A text description of the desired image(s). The maximum length is 1000 - characters for `dall-e-2` and 4000 characters for `dall-e-3`. - - model: The model to use for image generation. - - n: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only - `n=1` is supported. - - quality: The quality of the image that will be generated. `hd` creates images with finer - details and greater consistency across the image. This param is only supported - for `dall-e-3`. - - response_format: The format in which the generated images are returned. Must be one of `url` or - `b64_json`. URLs are only valid for 60 minutes after the image has been - generated. - - size: The size of the generated images. Must be one of `256x256`, `512x512`, or - `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or - `1024x1792` for `dall-e-3` models. - - style: The style of the generated images. Must be one of `vivid` or `natural`. Vivid - causes the model to lean towards generating hyper-real and dramatic images. - Natural causes the model to produce more natural, less hyper-real looking - images. This param is only supported for `dall-e-3`. - - user: A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/images/generations", - body=maybe_transform( - { - "prompt": prompt, - "model": model, - "n": n, - "quality": quality, - "response_format": response_format, - "size": size, - "style": style, - "user": user, - }, - generation_create_params.GenerationCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ImageResponse, - ) - - -class AsyncGenerationsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncGenerationsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncGenerationsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncGenerationsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncGenerationsResourceWithStreamingResponse(self) - - async def create( - self, - *, - prompt: str, - model: Union[str, Literal["dall-e-2", "dall-e-3"], None] | NotGiven = NOT_GIVEN, - n: Optional[int] | NotGiven = NOT_GIVEN, - quality: Literal["standard", "hd"] | NotGiven = NOT_GIVEN, - response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN, - size: Optional[Literal["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"]] | NotGiven = NOT_GIVEN, - style: Optional[Literal["vivid", "natural"]] | NotGiven = NOT_GIVEN, - user: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageResponse: - """ - Creates an image given a prompt. - - Args: - prompt: A text description of the desired image(s). The maximum length is 1000 - characters for `dall-e-2` and 4000 characters for `dall-e-3`. - - model: The model to use for image generation. - - n: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only - `n=1` is supported. - - quality: The quality of the image that will be generated. `hd` creates images with finer - details and greater consistency across the image. This param is only supported - for `dall-e-3`. - - response_format: The format in which the generated images are returned. Must be one of `url` or - `b64_json`. URLs are only valid for 60 minutes after the image has been - generated. - - size: The size of the generated images. Must be one of `256x256`, `512x512`, or - `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or - `1024x1792` for `dall-e-3` models. - - style: The style of the generated images. Must be one of `vivid` or `natural`. Vivid - causes the model to lean towards generating hyper-real and dramatic images. - Natural causes the model to produce more natural, less hyper-real looking - images. This param is only supported for `dall-e-3`. - - user: A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/images/generations", - body=await async_maybe_transform( - { - "prompt": prompt, - "model": model, - "n": n, - "quality": quality, - "response_format": response_format, - "size": size, - "style": style, - "user": user, - }, - generation_create_params.GenerationCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ImageResponse, - ) - - -class GenerationsResourceWithRawResponse: - def __init__(self, generations: GenerationsResource) -> None: - self._generations = generations - - self.create = to_raw_response_wrapper( - generations.create, - ) - - -class AsyncGenerationsResourceWithRawResponse: - def __init__(self, generations: AsyncGenerationsResource) -> None: - self._generations = generations - - self.create = async_to_raw_response_wrapper( - generations.create, - ) - - -class GenerationsResourceWithStreamingResponse: - def __init__(self, generations: GenerationsResource) -> None: - self._generations = generations - - self.create = to_streamed_response_wrapper( - generations.create, - ) - - -class AsyncGenerationsResourceWithStreamingResponse: - def __init__(self, generations: AsyncGenerationsResource) -> None: - self._generations = generations - - self.create = async_to_streamed_response_wrapper( - generations.create, - ) diff --git a/src/omnistack/resources/images/images.py b/src/omnistack/resources/images/images.py deleted file mode 100644 index ffecb99..0000000 --- a/src/omnistack/resources/images/images.py +++ /dev/null @@ -1,166 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .edits import ( - EditsResource, - AsyncEditsResource, - EditsResourceWithRawResponse, - AsyncEditsResourceWithRawResponse, - EditsResourceWithStreamingResponse, - AsyncEditsResourceWithStreamingResponse, -) -from ..._compat import cached_property -from .variations import ( - VariationsResource, - AsyncVariationsResource, - VariationsResourceWithRawResponse, - AsyncVariationsResourceWithRawResponse, - VariationsResourceWithStreamingResponse, - AsyncVariationsResourceWithStreamingResponse, -) -from ..._resource import SyncAPIResource, AsyncAPIResource -from .generations import ( - GenerationsResource, - AsyncGenerationsResource, - GenerationsResourceWithRawResponse, - AsyncGenerationsResourceWithRawResponse, - GenerationsResourceWithStreamingResponse, - AsyncGenerationsResourceWithStreamingResponse, -) - -__all__ = ["ImagesResource", "AsyncImagesResource"] - - -class ImagesResource(SyncAPIResource): - @cached_property - def generations(self) -> GenerationsResource: - return GenerationsResource(self._client) - - @cached_property - def edits(self) -> EditsResource: - return EditsResource(self._client) - - @cached_property - def variations(self) -> VariationsResource: - return VariationsResource(self._client) - - @cached_property - def with_raw_response(self) -> ImagesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return ImagesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ImagesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return ImagesResourceWithStreamingResponse(self) - - -class AsyncImagesResource(AsyncAPIResource): - @cached_property - def generations(self) -> AsyncGenerationsResource: - return AsyncGenerationsResource(self._client) - - @cached_property - def edits(self) -> AsyncEditsResource: - return AsyncEditsResource(self._client) - - @cached_property - def variations(self) -> AsyncVariationsResource: - return AsyncVariationsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncImagesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncImagesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncImagesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncImagesResourceWithStreamingResponse(self) - - -class ImagesResourceWithRawResponse: - def __init__(self, images: ImagesResource) -> None: - self._images = images - - @cached_property - def generations(self) -> GenerationsResourceWithRawResponse: - return GenerationsResourceWithRawResponse(self._images.generations) - - @cached_property - def edits(self) -> EditsResourceWithRawResponse: - return EditsResourceWithRawResponse(self._images.edits) - - @cached_property - def variations(self) -> VariationsResourceWithRawResponse: - return VariationsResourceWithRawResponse(self._images.variations) - - -class AsyncImagesResourceWithRawResponse: - def __init__(self, images: AsyncImagesResource) -> None: - self._images = images - - @cached_property - def generations(self) -> AsyncGenerationsResourceWithRawResponse: - return AsyncGenerationsResourceWithRawResponse(self._images.generations) - - @cached_property - def edits(self) -> AsyncEditsResourceWithRawResponse: - return AsyncEditsResourceWithRawResponse(self._images.edits) - - @cached_property - def variations(self) -> AsyncVariationsResourceWithRawResponse: - return AsyncVariationsResourceWithRawResponse(self._images.variations) - - -class ImagesResourceWithStreamingResponse: - def __init__(self, images: ImagesResource) -> None: - self._images = images - - @cached_property - def generations(self) -> GenerationsResourceWithStreamingResponse: - return GenerationsResourceWithStreamingResponse(self._images.generations) - - @cached_property - def edits(self) -> EditsResourceWithStreamingResponse: - return EditsResourceWithStreamingResponse(self._images.edits) - - @cached_property - def variations(self) -> VariationsResourceWithStreamingResponse: - return VariationsResourceWithStreamingResponse(self._images.variations) - - -class AsyncImagesResourceWithStreamingResponse: - def __init__(self, images: AsyncImagesResource) -> None: - self._images = images - - @cached_property - def generations(self) -> AsyncGenerationsResourceWithStreamingResponse: - return AsyncGenerationsResourceWithStreamingResponse(self._images.generations) - - @cached_property - def edits(self) -> AsyncEditsResourceWithStreamingResponse: - return AsyncEditsResourceWithStreamingResponse(self._images.edits) - - @cached_property - def variations(self) -> AsyncVariationsResourceWithStreamingResponse: - return AsyncVariationsResourceWithStreamingResponse(self._images.variations) diff --git a/src/omnistack/resources/images/variations.py b/src/omnistack/resources/images/variations.py deleted file mode 100644 index 243c7d8..0000000 --- a/src/omnistack/resources/images/variations.py +++ /dev/null @@ -1,251 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Mapping, Optional, cast -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ..._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.images import variation_create_params -from ...types.image_response import ImageResponse - -__all__ = ["VariationsResource", "AsyncVariationsResource"] - - -class VariationsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> VariationsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return VariationsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> VariationsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return VariationsResourceWithStreamingResponse(self) - - def create( - self, - *, - image: FileTypes, - model: Union[str, Literal["dall-e-2"], None] | NotGiven = NOT_GIVEN, - n: Optional[int] | NotGiven = NOT_GIVEN, - response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN, - size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN, - user: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageResponse: - """ - Creates a variation of a given image. - - Args: - image: The image to use as the basis for the variation(s). Must be a valid PNG file, - less than 4MB, and square. - - model: The model to use for image generation. Only `dall-e-2` is supported at this - time. - - n: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only - `n=1` is supported. - - response_format: The format in which the generated images are returned. Must be one of `url` or - `b64_json`. URLs are only valid for 60 minutes after the image has been - generated. - - size: The size of the generated images. Must be one of `256x256`, `512x512`, or - `1024x1024`. - - user: A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "image": image, - "model": model, - "n": n, - "response_format": response_format, - "size": size, - "user": user, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["image"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return self._post( - "/images/variations", - body=maybe_transform(body, variation_create_params.VariationCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ImageResponse, - ) - - -class AsyncVariationsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncVariationsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncVariationsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncVariationsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncVariationsResourceWithStreamingResponse(self) - - async def create( - self, - *, - image: FileTypes, - model: Union[str, Literal["dall-e-2"], None] | NotGiven = NOT_GIVEN, - n: Optional[int] | NotGiven = NOT_GIVEN, - response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN, - size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN, - user: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ImageResponse: - """ - Creates a variation of a given image. - - Args: - image: The image to use as the basis for the variation(s). Must be a valid PNG file, - less than 4MB, and square. - - model: The model to use for image generation. Only `dall-e-2` is supported at this - time. - - n: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only - `n=1` is supported. - - response_format: The format in which the generated images are returned. Must be one of `url` or - `b64_json`. URLs are only valid for 60 minutes after the image has been - generated. - - size: The size of the generated images. Must be one of `256x256`, `512x512`, or - `1024x1024`. - - user: A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - body = deepcopy_minimal( - { - "image": image, - "model": model, - "n": n, - "response_format": response_format, - "size": size, - "user": user, - } - ) - files = extract_files(cast(Mapping[str, object], body), paths=[["image"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return await self._post( - "/images/variations", - body=await async_maybe_transform(body, variation_create_params.VariationCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ImageResponse, - ) - - -class VariationsResourceWithRawResponse: - def __init__(self, variations: VariationsResource) -> None: - self._variations = variations - - self.create = to_raw_response_wrapper( - variations.create, - ) - - -class AsyncVariationsResourceWithRawResponse: - def __init__(self, variations: AsyncVariationsResource) -> None: - self._variations = variations - - self.create = async_to_raw_response_wrapper( - variations.create, - ) - - -class VariationsResourceWithStreamingResponse: - def __init__(self, variations: VariationsResource) -> None: - self._variations = variations - - self.create = to_streamed_response_wrapper( - variations.create, - ) - - -class AsyncVariationsResourceWithStreamingResponse: - def __init__(self, variations: AsyncVariationsResource) -> None: - self._variations = variations - - self.create = async_to_streamed_response_wrapper( - variations.create, - ) diff --git a/src/omnistack/resources/models.py b/src/omnistack/resources/models.py deleted file mode 100644 index ccfc261..0000000 --- a/src/omnistack/resources/models.py +++ /dev/null @@ -1,305 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..types.model import Model -from .._base_client import make_request_options -from ..types.model_list_response import ModelListResponse -from ..types.model_delete_response import ModelDeleteResponse - -__all__ = ["ModelsResource", "AsyncModelsResource"] - - -class ModelsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ModelsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return ModelsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ModelsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return ModelsResourceWithStreamingResponse(self) - - def retrieve( - self, - model: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Model: - """ - Retrieves a model instance, providing basic information about the model such as - the owner and permissioning. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not model: - raise ValueError(f"Expected a non-empty value for `model` but received {model!r}") - return self._get( - f"/models/{model}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Model, - ) - - def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ModelListResponse: - """ - Lists the currently available models, and provides basic information about each - one such as the owner and availability. - """ - return self._get( - "/models", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ModelListResponse, - ) - - def delete( - self, - model: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ModelDeleteResponse: - """Delete a fine-tuned model. - - You must have the Owner role in your organization to - delete a model. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not model: - raise ValueError(f"Expected a non-empty value for `model` but received {model!r}") - return self._delete( - f"/models/{model}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ModelDeleteResponse, - ) - - -class AsyncModelsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncModelsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncModelsResourceWithStreamingResponse(self) - - async def retrieve( - self, - model: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Model: - """ - Retrieves a model instance, providing basic information about the model such as - the owner and permissioning. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not model: - raise ValueError(f"Expected a non-empty value for `model` but received {model!r}") - return await self._get( - f"/models/{model}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Model, - ) - - async def list( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ModelListResponse: - """ - Lists the currently available models, and provides basic information about each - one such as the owner and availability. - """ - return await self._get( - "/models", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ModelListResponse, - ) - - async def delete( - self, - model: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ModelDeleteResponse: - """Delete a fine-tuned model. - - You must have the Owner role in your organization to - delete a model. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not model: - raise ValueError(f"Expected a non-empty value for `model` but received {model!r}") - return await self._delete( - f"/models/{model}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ModelDeleteResponse, - ) - - -class ModelsResourceWithRawResponse: - def __init__(self, models: ModelsResource) -> None: - self._models = models - - self.retrieve = to_raw_response_wrapper( - models.retrieve, - ) - self.list = to_raw_response_wrapper( - models.list, - ) - self.delete = to_raw_response_wrapper( - models.delete, - ) - - -class AsyncModelsResourceWithRawResponse: - def __init__(self, models: AsyncModelsResource) -> None: - self._models = models - - self.retrieve = async_to_raw_response_wrapper( - models.retrieve, - ) - self.list = async_to_raw_response_wrapper( - models.list, - ) - self.delete = async_to_raw_response_wrapper( - models.delete, - ) - - -class ModelsResourceWithStreamingResponse: - def __init__(self, models: ModelsResource) -> None: - self._models = models - - self.retrieve = to_streamed_response_wrapper( - models.retrieve, - ) - self.list = to_streamed_response_wrapper( - models.list, - ) - self.delete = to_streamed_response_wrapper( - models.delete, - ) - - -class AsyncModelsResourceWithStreamingResponse: - def __init__(self, models: AsyncModelsResource) -> None: - self._models = models - - self.retrieve = async_to_streamed_response_wrapper( - models.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - models.list, - ) - self.delete = async_to_streamed_response_wrapper( - models.delete, - ) diff --git a/src/omnistack/resources/moderations.py b/src/omnistack/resources/moderations.py deleted file mode 100644 index 61df8a5..0000000 --- a/src/omnistack/resources/moderations.py +++ /dev/null @@ -1,219 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable -from typing_extensions import Literal - -import httpx - -from ..types import moderation_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options -from ..types.moderation_create_response import ModerationCreateResponse - -__all__ = ["ModerationsResource", "AsyncModerationsResource"] - - -class ModerationsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ModerationsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return ModerationsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ModerationsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return ModerationsResourceWithStreamingResponse(self) - - def create( - self, - *, - input: Union[str, List[str], Iterable[moderation_create_params.InputUnionMember2]], - model: Union[ - str, - Literal[ - "omni-moderation-latest", - "omni-moderation-2024-09-26", - "text-moderation-latest", - "text-moderation-stable", - ], - ] - | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ModerationCreateResponse: - """Classifies if text and/or image inputs are potentially harmful. - - Learn more in - the [moderation guide](/docs/guides/moderation). - - Args: - input: Input (or inputs) to classify. Can be a single string, an array of strings, or - an array of multi-modal input objects similar to other models. - - model: The content moderation model you would like to use. Learn more in - [the moderation guide](/docs/guides/moderation), and learn about available - models [here](/docs/models/moderation). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/moderations", - body=maybe_transform( - { - "input": input, - "model": model, - }, - moderation_create_params.ModerationCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ModerationCreateResponse, - ) - - -class AsyncModerationsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncModerationsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncModerationsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncModerationsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncModerationsResourceWithStreamingResponse(self) - - async def create( - self, - *, - input: Union[str, List[str], Iterable[moderation_create_params.InputUnionMember2]], - model: Union[ - str, - Literal[ - "omni-moderation-latest", - "omni-moderation-2024-09-26", - "text-moderation-latest", - "text-moderation-stable", - ], - ] - | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ModerationCreateResponse: - """Classifies if text and/or image inputs are potentially harmful. - - Learn more in - the [moderation guide](/docs/guides/moderation). - - Args: - input: Input (or inputs) to classify. Can be a single string, an array of strings, or - an array of multi-modal input objects similar to other models. - - model: The content moderation model you would like to use. Learn more in - [the moderation guide](/docs/guides/moderation), and learn about available - models [here](/docs/models/moderation). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/moderations", - body=await async_maybe_transform( - { - "input": input, - "model": model, - }, - moderation_create_params.ModerationCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ModerationCreateResponse, - ) - - -class ModerationsResourceWithRawResponse: - def __init__(self, moderations: ModerationsResource) -> None: - self._moderations = moderations - - self.create = to_raw_response_wrapper( - moderations.create, - ) - - -class AsyncModerationsResourceWithRawResponse: - def __init__(self, moderations: AsyncModerationsResource) -> None: - self._moderations = moderations - - self.create = async_to_raw_response_wrapper( - moderations.create, - ) - - -class ModerationsResourceWithStreamingResponse: - def __init__(self, moderations: ModerationsResource) -> None: - self._moderations = moderations - - self.create = to_streamed_response_wrapper( - moderations.create, - ) - - -class AsyncModerationsResourceWithStreamingResponse: - def __init__(self, moderations: AsyncModerationsResource) -> None: - self._moderations = moderations - - self.create = async_to_streamed_response_wrapper( - moderations.create, - ) diff --git a/src/omnistack/resources/organization/__init__.py b/src/omnistack/resources/organization/__init__.py deleted file mode 100644 index 050484e..0000000 --- a/src/omnistack/resources/organization/__init__.py +++ /dev/null @@ -1,75 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from .invites import ( - InvitesResource, - AsyncInvitesResource, - InvitesResourceWithRawResponse, - AsyncInvitesResourceWithRawResponse, - InvitesResourceWithStreamingResponse, - AsyncInvitesResourceWithStreamingResponse, -) -from .projects import ( - ProjectsResource, - AsyncProjectsResource, - ProjectsResourceWithRawResponse, - AsyncProjectsResourceWithRawResponse, - ProjectsResourceWithStreamingResponse, - AsyncProjectsResourceWithStreamingResponse, -) -from .audit_logs import ( - AuditLogsResource, - AsyncAuditLogsResource, - AuditLogsResourceWithRawResponse, - AsyncAuditLogsResourceWithRawResponse, - AuditLogsResourceWithStreamingResponse, - AsyncAuditLogsResourceWithStreamingResponse, -) -from .organization import ( - OrganizationResource, - AsyncOrganizationResource, - OrganizationResourceWithRawResponse, - AsyncOrganizationResourceWithRawResponse, - OrganizationResourceWithStreamingResponse, - AsyncOrganizationResourceWithStreamingResponse, -) - -__all__ = [ - "AuditLogsResource", - "AsyncAuditLogsResource", - "AuditLogsResourceWithRawResponse", - "AsyncAuditLogsResourceWithRawResponse", - "AuditLogsResourceWithStreamingResponse", - "AsyncAuditLogsResourceWithStreamingResponse", - "InvitesResource", - "AsyncInvitesResource", - "InvitesResourceWithRawResponse", - "AsyncInvitesResourceWithRawResponse", - "InvitesResourceWithStreamingResponse", - "AsyncInvitesResourceWithStreamingResponse", - "UsersResource", - "AsyncUsersResource", - "UsersResourceWithRawResponse", - "AsyncUsersResourceWithRawResponse", - "UsersResourceWithStreamingResponse", - "AsyncUsersResourceWithStreamingResponse", - "ProjectsResource", - "AsyncProjectsResource", - "ProjectsResourceWithRawResponse", - "AsyncProjectsResourceWithRawResponse", - "ProjectsResourceWithStreamingResponse", - "AsyncProjectsResourceWithStreamingResponse", - "OrganizationResource", - "AsyncOrganizationResource", - "OrganizationResourceWithRawResponse", - "AsyncOrganizationResourceWithRawResponse", - "OrganizationResourceWithStreamingResponse", - "AsyncOrganizationResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/organization/audit_logs.py b/src/omnistack/resources/organization/audit_logs.py deleted file mode 100644 index ea081a5..0000000 --- a/src/omnistack/resources/organization/audit_logs.py +++ /dev/null @@ -1,323 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.organization import audit_log_list_params -from ...types.organization.audit_log_list_response import AuditLogListResponse - -__all__ = ["AuditLogsResource", "AsyncAuditLogsResource"] - - -class AuditLogsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AuditLogsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AuditLogsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AuditLogsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AuditLogsResourceWithStreamingResponse(self) - - def list( - self, - *, - actor_emails: List[str] | NotGiven = NOT_GIVEN, - actor_ids: List[str] | NotGiven = NOT_GIVEN, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - effective_at: audit_log_list_params.EffectiveAt | NotGiven = NOT_GIVEN, - event_types: List[ - Literal[ - "api_key.created", - "api_key.updated", - "api_key.deleted", - "invite.sent", - "invite.accepted", - "invite.deleted", - "login.succeeded", - "login.failed", - "logout.succeeded", - "logout.failed", - "organization.updated", - "project.created", - "project.updated", - "project.archived", - "service_account.created", - "service_account.updated", - "service_account.deleted", - "user.added", - "user.updated", - "user.deleted", - ] - ] - | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - project_ids: List[str] | NotGiven = NOT_GIVEN, - resource_ids: List[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AuditLogListResponse: - """ - List user actions and configuration changes within this organization. - - Args: - actor_emails: Return only events performed by users with these emails. - - actor_ids: Return only events performed by these actors. Can be a user ID, a service - account ID, or an api key tracking ID. - - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - effective_at: Return only events whose `effective_at` (Unix seconds) is in this range. - - event_types: Return only events with a `type` in one of these values. For example, - `project.created`. For all options, see the documentation for the - [audit log object](/docs/api-reference/audit-logs/object). - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - project_ids: Return only events for these projects. - - resource_ids: Return only events performed on these targets. For example, a project ID - updated. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/organization/audit_logs", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "actor_emails": actor_emails, - "actor_ids": actor_ids, - "after": after, - "before": before, - "effective_at": effective_at, - "event_types": event_types, - "limit": limit, - "project_ids": project_ids, - "resource_ids": resource_ids, - }, - audit_log_list_params.AuditLogListParams, - ), - ), - cast_to=AuditLogListResponse, - ) - - -class AsyncAuditLogsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAuditLogsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncAuditLogsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAuditLogsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncAuditLogsResourceWithStreamingResponse(self) - - async def list( - self, - *, - actor_emails: List[str] | NotGiven = NOT_GIVEN, - actor_ids: List[str] | NotGiven = NOT_GIVEN, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - effective_at: audit_log_list_params.EffectiveAt | NotGiven = NOT_GIVEN, - event_types: List[ - Literal[ - "api_key.created", - "api_key.updated", - "api_key.deleted", - "invite.sent", - "invite.accepted", - "invite.deleted", - "login.succeeded", - "login.failed", - "logout.succeeded", - "logout.failed", - "organization.updated", - "project.created", - "project.updated", - "project.archived", - "service_account.created", - "service_account.updated", - "service_account.deleted", - "user.added", - "user.updated", - "user.deleted", - ] - ] - | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - project_ids: List[str] | NotGiven = NOT_GIVEN, - resource_ids: List[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AuditLogListResponse: - """ - List user actions and configuration changes within this organization. - - Args: - actor_emails: Return only events performed by users with these emails. - - actor_ids: Return only events performed by these actors. Can be a user ID, a service - account ID, or an api key tracking ID. - - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - effective_at: Return only events whose `effective_at` (Unix seconds) is in this range. - - event_types: Return only events with a `type` in one of these values. For example, - `project.created`. For all options, see the documentation for the - [audit log object](/docs/api-reference/audit-logs/object). - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - project_ids: Return only events for these projects. - - resource_ids: Return only events performed on these targets. For example, a project ID - updated. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/organization/audit_logs", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "actor_emails": actor_emails, - "actor_ids": actor_ids, - "after": after, - "before": before, - "effective_at": effective_at, - "event_types": event_types, - "limit": limit, - "project_ids": project_ids, - "resource_ids": resource_ids, - }, - audit_log_list_params.AuditLogListParams, - ), - ), - cast_to=AuditLogListResponse, - ) - - -class AuditLogsResourceWithRawResponse: - def __init__(self, audit_logs: AuditLogsResource) -> None: - self._audit_logs = audit_logs - - self.list = to_raw_response_wrapper( - audit_logs.list, - ) - - -class AsyncAuditLogsResourceWithRawResponse: - def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: - self._audit_logs = audit_logs - - self.list = async_to_raw_response_wrapper( - audit_logs.list, - ) - - -class AuditLogsResourceWithStreamingResponse: - def __init__(self, audit_logs: AuditLogsResource) -> None: - self._audit_logs = audit_logs - - self.list = to_streamed_response_wrapper( - audit_logs.list, - ) - - -class AsyncAuditLogsResourceWithStreamingResponse: - def __init__(self, audit_logs: AsyncAuditLogsResource) -> None: - self._audit_logs = audit_logs - - self.list = async_to_streamed_response_wrapper( - audit_logs.list, - ) diff --git a/src/omnistack/resources/organization/invites.py b/src/omnistack/resources/organization/invites.py deleted file mode 100644 index 5e7161f..0000000 --- a/src/omnistack/resources/organization/invites.py +++ /dev/null @@ -1,466 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.organization import invite_list_params, invite_create_params -from ...types.organization.invite import Invite -from ...types.organization.invite_list_response import InviteListResponse -from ...types.organization.invite_delete_response import InviteDeleteResponse - -__all__ = ["InvitesResource", "AsyncInvitesResource"] - - -class InvitesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> InvitesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return InvitesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> InvitesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return InvitesResourceWithStreamingResponse(self) - - def create( - self, - *, - email: str, - role: Literal["reader", "owner"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Invite: - """Create an invite for a user to the organization. - - The invite must be accepted by - the user before they have access to the organization. - - Args: - email: Send an email to this address - - role: `owner` or `reader` - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/organization/invites", - body=maybe_transform( - { - "email": email, - "role": role, - }, - invite_create_params.InviteCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Invite, - ) - - def retrieve( - self, - invite_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Invite: - """ - Retrieves an invite. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not invite_id: - raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}") - return self._get( - f"/organization/invites/{invite_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Invite, - ) - - def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InviteListResponse: - """ - Returns a list of invites in the organization. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/organization/invites", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "limit": limit, - }, - invite_list_params.InviteListParams, - ), - ), - cast_to=InviteListResponse, - ) - - def delete( - self, - invite_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InviteDeleteResponse: - """Delete an invite. - - If the invite has already been accepted, it cannot be deleted. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not invite_id: - raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}") - return self._delete( - f"/organization/invites/{invite_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=InviteDeleteResponse, - ) - - -class AsyncInvitesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncInvitesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncInvitesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncInvitesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncInvitesResourceWithStreamingResponse(self) - - async def create( - self, - *, - email: str, - role: Literal["reader", "owner"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Invite: - """Create an invite for a user to the organization. - - The invite must be accepted by - the user before they have access to the organization. - - Args: - email: Send an email to this address - - role: `owner` or `reader` - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/organization/invites", - body=await async_maybe_transform( - { - "email": email, - "role": role, - }, - invite_create_params.InviteCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Invite, - ) - - async def retrieve( - self, - invite_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Invite: - """ - Retrieves an invite. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not invite_id: - raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}") - return await self._get( - f"/organization/invites/{invite_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Invite, - ) - - async def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InviteListResponse: - """ - Returns a list of invites in the organization. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/organization/invites", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "limit": limit, - }, - invite_list_params.InviteListParams, - ), - ), - cast_to=InviteListResponse, - ) - - async def delete( - self, - invite_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> InviteDeleteResponse: - """Delete an invite. - - If the invite has already been accepted, it cannot be deleted. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not invite_id: - raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}") - return await self._delete( - f"/organization/invites/{invite_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=InviteDeleteResponse, - ) - - -class InvitesResourceWithRawResponse: - def __init__(self, invites: InvitesResource) -> None: - self._invites = invites - - self.create = to_raw_response_wrapper( - invites.create, - ) - self.retrieve = to_raw_response_wrapper( - invites.retrieve, - ) - self.list = to_raw_response_wrapper( - invites.list, - ) - self.delete = to_raw_response_wrapper( - invites.delete, - ) - - -class AsyncInvitesResourceWithRawResponse: - def __init__(self, invites: AsyncInvitesResource) -> None: - self._invites = invites - - self.create = async_to_raw_response_wrapper( - invites.create, - ) - self.retrieve = async_to_raw_response_wrapper( - invites.retrieve, - ) - self.list = async_to_raw_response_wrapper( - invites.list, - ) - self.delete = async_to_raw_response_wrapper( - invites.delete, - ) - - -class InvitesResourceWithStreamingResponse: - def __init__(self, invites: InvitesResource) -> None: - self._invites = invites - - self.create = to_streamed_response_wrapper( - invites.create, - ) - self.retrieve = to_streamed_response_wrapper( - invites.retrieve, - ) - self.list = to_streamed_response_wrapper( - invites.list, - ) - self.delete = to_streamed_response_wrapper( - invites.delete, - ) - - -class AsyncInvitesResourceWithStreamingResponse: - def __init__(self, invites: AsyncInvitesResource) -> None: - self._invites = invites - - self.create = async_to_streamed_response_wrapper( - invites.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - invites.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - invites.list, - ) - self.delete = async_to_streamed_response_wrapper( - invites.delete, - ) diff --git a/src/omnistack/resources/organization/organization.py b/src/omnistack/resources/organization/organization.py deleted file mode 100644 index 709e431..0000000 --- a/src/omnistack/resources/organization/organization.py +++ /dev/null @@ -1,199 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from .invites import ( - InvitesResource, - AsyncInvitesResource, - InvitesResourceWithRawResponse, - AsyncInvitesResourceWithRawResponse, - InvitesResourceWithStreamingResponse, - AsyncInvitesResourceWithStreamingResponse, -) -from .projects import ( - ProjectsResource, - AsyncProjectsResource, - ProjectsResourceWithRawResponse, - AsyncProjectsResourceWithRawResponse, - ProjectsResourceWithStreamingResponse, - AsyncProjectsResourceWithStreamingResponse, -) -from ..._compat import cached_property -from .audit_logs import ( - AuditLogsResource, - AsyncAuditLogsResource, - AuditLogsResourceWithRawResponse, - AsyncAuditLogsResourceWithRawResponse, - AuditLogsResourceWithStreamingResponse, - AsyncAuditLogsResourceWithStreamingResponse, -) -from ..._resource import SyncAPIResource, AsyncAPIResource -from .projects.projects import ProjectsResource, AsyncProjectsResource - -__all__ = ["OrganizationResource", "AsyncOrganizationResource"] - - -class OrganizationResource(SyncAPIResource): - @cached_property - def audit_logs(self) -> AuditLogsResource: - return AuditLogsResource(self._client) - - @cached_property - def invites(self) -> InvitesResource: - return InvitesResource(self._client) - - @cached_property - def users(self) -> UsersResource: - return UsersResource(self._client) - - @cached_property - def projects(self) -> ProjectsResource: - return ProjectsResource(self._client) - - @cached_property - def with_raw_response(self) -> OrganizationResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return OrganizationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> OrganizationResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return OrganizationResourceWithStreamingResponse(self) - - -class AsyncOrganizationResource(AsyncAPIResource): - @cached_property - def audit_logs(self) -> AsyncAuditLogsResource: - return AsyncAuditLogsResource(self._client) - - @cached_property - def invites(self) -> AsyncInvitesResource: - return AsyncInvitesResource(self._client) - - @cached_property - def users(self) -> AsyncUsersResource: - return AsyncUsersResource(self._client) - - @cached_property - def projects(self) -> AsyncProjectsResource: - return AsyncProjectsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncOrganizationResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncOrganizationResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncOrganizationResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncOrganizationResourceWithStreamingResponse(self) - - -class OrganizationResourceWithRawResponse: - def __init__(self, organization: OrganizationResource) -> None: - self._organization = organization - - @cached_property - def audit_logs(self) -> AuditLogsResourceWithRawResponse: - return AuditLogsResourceWithRawResponse(self._organization.audit_logs) - - @cached_property - def invites(self) -> InvitesResourceWithRawResponse: - return InvitesResourceWithRawResponse(self._organization.invites) - - @cached_property - def users(self) -> UsersResourceWithRawResponse: - return UsersResourceWithRawResponse(self._organization.users) - - @cached_property - def projects(self) -> ProjectsResourceWithRawResponse: - return ProjectsResourceWithRawResponse(self._organization.projects) - - -class AsyncOrganizationResourceWithRawResponse: - def __init__(self, organization: AsyncOrganizationResource) -> None: - self._organization = organization - - @cached_property - def audit_logs(self) -> AsyncAuditLogsResourceWithRawResponse: - return AsyncAuditLogsResourceWithRawResponse(self._organization.audit_logs) - - @cached_property - def invites(self) -> AsyncInvitesResourceWithRawResponse: - return AsyncInvitesResourceWithRawResponse(self._organization.invites) - - @cached_property - def users(self) -> AsyncUsersResourceWithRawResponse: - return AsyncUsersResourceWithRawResponse(self._organization.users) - - @cached_property - def projects(self) -> AsyncProjectsResourceWithRawResponse: - return AsyncProjectsResourceWithRawResponse(self._organization.projects) - - -class OrganizationResourceWithStreamingResponse: - def __init__(self, organization: OrganizationResource) -> None: - self._organization = organization - - @cached_property - def audit_logs(self) -> AuditLogsResourceWithStreamingResponse: - return AuditLogsResourceWithStreamingResponse(self._organization.audit_logs) - - @cached_property - def invites(self) -> InvitesResourceWithStreamingResponse: - return InvitesResourceWithStreamingResponse(self._organization.invites) - - @cached_property - def users(self) -> UsersResourceWithStreamingResponse: - return UsersResourceWithStreamingResponse(self._organization.users) - - @cached_property - def projects(self) -> ProjectsResourceWithStreamingResponse: - return ProjectsResourceWithStreamingResponse(self._organization.projects) - - -class AsyncOrganizationResourceWithStreamingResponse: - def __init__(self, organization: AsyncOrganizationResource) -> None: - self._organization = organization - - @cached_property - def audit_logs(self) -> AsyncAuditLogsResourceWithStreamingResponse: - return AsyncAuditLogsResourceWithStreamingResponse(self._organization.audit_logs) - - @cached_property - def invites(self) -> AsyncInvitesResourceWithStreamingResponse: - return AsyncInvitesResourceWithStreamingResponse(self._organization.invites) - - @cached_property - def users(self) -> AsyncUsersResourceWithStreamingResponse: - return AsyncUsersResourceWithStreamingResponse(self._organization.users) - - @cached_property - def projects(self) -> AsyncProjectsResourceWithStreamingResponse: - return AsyncProjectsResourceWithStreamingResponse(self._organization.projects) diff --git a/src/omnistack/resources/organization/projects/__init__.py b/src/omnistack/resources/organization/projects/__init__.py deleted file mode 100644 index 0c11507..0000000 --- a/src/omnistack/resources/organization/projects/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from .projects import ( - ProjectsResource, - AsyncProjectsResource, - ProjectsResourceWithRawResponse, - AsyncProjectsResourceWithRawResponse, - ProjectsResourceWithStreamingResponse, - AsyncProjectsResourceWithStreamingResponse, -) -from .service_accounts import ( - ServiceAccountsResource, - AsyncServiceAccountsResource, - ServiceAccountsResourceWithRawResponse, - AsyncServiceAccountsResourceWithRawResponse, - ServiceAccountsResourceWithStreamingResponse, - AsyncServiceAccountsResourceWithStreamingResponse, -) - -__all__ = [ - "UsersResource", - "AsyncUsersResource", - "UsersResourceWithRawResponse", - "AsyncUsersResourceWithRawResponse", - "UsersResourceWithStreamingResponse", - "AsyncUsersResourceWithStreamingResponse", - "ServiceAccountsResource", - "AsyncServiceAccountsResource", - "ServiceAccountsResourceWithRawResponse", - "AsyncServiceAccountsResourceWithRawResponse", - "ServiceAccountsResourceWithStreamingResponse", - "AsyncServiceAccountsResourceWithStreamingResponse", - "ProjectsResource", - "AsyncProjectsResource", - "ProjectsResourceWithRawResponse", - "AsyncProjectsResourceWithRawResponse", - "ProjectsResourceWithStreamingResponse", - "AsyncProjectsResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/organization/projects/projects.py b/src/omnistack/resources/organization/projects/projects.py deleted file mode 100644 index aee6bbc..0000000 --- a/src/omnistack/resources/organization/projects/projects.py +++ /dev/null @@ -1,525 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .users import ( - UsersResource, - AsyncUsersResource, - UsersResourceWithRawResponse, - AsyncUsersResourceWithRawResponse, - UsersResourceWithStreamingResponse, - AsyncUsersResourceWithStreamingResponse, -) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from .service_accounts import ( - ServiceAccountsResource, - AsyncServiceAccountsResource, - ServiceAccountsResourceWithRawResponse, - AsyncServiceAccountsResourceWithRawResponse, - ServiceAccountsResourceWithStreamingResponse, - AsyncServiceAccountsResourceWithStreamingResponse, -) -from ....types.organization import project_list_params, project_create_params -from ....types.organization.project import Project -from ....types.organization.project_list_response import ProjectListResponse - -__all__ = ["ProjectsResource", "AsyncProjectsResource"] - - -class ProjectsResource(SyncAPIResource): - @cached_property - def users(self) -> UsersResource: - return UsersResource(self._client) - - @cached_property - def service_accounts(self) -> ServiceAccountsResource: - return ServiceAccountsResource(self._client) - - @cached_property - def with_raw_response(self) -> ProjectsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return ProjectsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProjectsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return ProjectsResourceWithStreamingResponse(self) - - def create( - self, - project_id: str, - *, - name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """ - Modifies a project in the organization. - - Args: - name: The updated name of the project, this name appears in reports. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return self._post( - f"/organization/projects/{project_id}", - body=maybe_transform({"name": name}, project_create_params.ProjectCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - - def retrieve( - self, - project_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """ - Retrieves a project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return self._get( - f"/organization/projects/{project_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - - def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - include_archived: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectListResponse: - """Returns a list of projects. - - Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - include_archived: If `true` returns all projects including those that have been `archived`. - Archived projects are not included by default. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/organization/projects", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "include_archived": include_archived, - "limit": limit, - }, - project_list_params.ProjectListParams, - ), - ), - cast_to=ProjectListResponse, - ) - - def archive( - self, - project_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """Archives a project in the organization. - - Archived projects cannot be used or - updated. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return self._post( - f"/organization/projects/{project_id}/archive", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - - -class AsyncProjectsResource(AsyncAPIResource): - @cached_property - def users(self) -> AsyncUsersResource: - return AsyncUsersResource(self._client) - - @cached_property - def service_accounts(self) -> AsyncServiceAccountsResource: - return AsyncServiceAccountsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncProjectsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProjectsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncProjectsResourceWithStreamingResponse(self) - - async def create( - self, - project_id: str, - *, - name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """ - Modifies a project in the organization. - - Args: - name: The updated name of the project, this name appears in reports. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return await self._post( - f"/organization/projects/{project_id}", - body=await async_maybe_transform({"name": name}, project_create_params.ProjectCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - - async def retrieve( - self, - project_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """ - Retrieves a project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return await self._get( - f"/organization/projects/{project_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - - async def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - include_archived: bool | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectListResponse: - """Returns a list of projects. - - Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - include_archived: If `true` returns all projects including those that have been `archived`. - Archived projects are not included by default. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/organization/projects", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "include_archived": include_archived, - "limit": limit, - }, - project_list_params.ProjectListParams, - ), - ), - cast_to=ProjectListResponse, - ) - - async def archive( - self, - project_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Project: - """Archives a project in the organization. - - Archived projects cannot be used or - updated. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return await self._post( - f"/organization/projects/{project_id}/archive", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Project, - ) - - -class ProjectsResourceWithRawResponse: - def __init__(self, projects: ProjectsResource) -> None: - self._projects = projects - - self.create = to_raw_response_wrapper( - projects.create, - ) - self.retrieve = to_raw_response_wrapper( - projects.retrieve, - ) - self.list = to_raw_response_wrapper( - projects.list, - ) - self.archive = to_raw_response_wrapper( - projects.archive, - ) - - @cached_property - def users(self) -> UsersResourceWithRawResponse: - return UsersResourceWithRawResponse(self._projects.users) - - @cached_property - def service_accounts(self) -> ServiceAccountsResourceWithRawResponse: - return ServiceAccountsResourceWithRawResponse(self._projects.service_accounts) - - -class AsyncProjectsResourceWithRawResponse: - def __init__(self, projects: AsyncProjectsResource) -> None: - self._projects = projects - - self.create = async_to_raw_response_wrapper( - projects.create, - ) - self.retrieve = async_to_raw_response_wrapper( - projects.retrieve, - ) - self.list = async_to_raw_response_wrapper( - projects.list, - ) - self.archive = async_to_raw_response_wrapper( - projects.archive, - ) - - @cached_property - def users(self) -> AsyncUsersResourceWithRawResponse: - return AsyncUsersResourceWithRawResponse(self._projects.users) - - @cached_property - def service_accounts(self) -> AsyncServiceAccountsResourceWithRawResponse: - return AsyncServiceAccountsResourceWithRawResponse(self._projects.service_accounts) - - -class ProjectsResourceWithStreamingResponse: - def __init__(self, projects: ProjectsResource) -> None: - self._projects = projects - - self.create = to_streamed_response_wrapper( - projects.create, - ) - self.retrieve = to_streamed_response_wrapper( - projects.retrieve, - ) - self.list = to_streamed_response_wrapper( - projects.list, - ) - self.archive = to_streamed_response_wrapper( - projects.archive, - ) - - @cached_property - def users(self) -> UsersResourceWithStreamingResponse: - return UsersResourceWithStreamingResponse(self._projects.users) - - @cached_property - def service_accounts(self) -> ServiceAccountsResourceWithStreamingResponse: - return ServiceAccountsResourceWithStreamingResponse(self._projects.service_accounts) - - -class AsyncProjectsResourceWithStreamingResponse: - def __init__(self, projects: AsyncProjectsResource) -> None: - self._projects = projects - - self.create = async_to_streamed_response_wrapper( - projects.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - projects.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - projects.list, - ) - self.archive = async_to_streamed_response_wrapper( - projects.archive, - ) - - @cached_property - def users(self) -> AsyncUsersResourceWithStreamingResponse: - return AsyncUsersResourceWithStreamingResponse(self._projects.users) - - @cached_property - def service_accounts(self) -> AsyncServiceAccountsResourceWithStreamingResponse: - return AsyncServiceAccountsResourceWithStreamingResponse(self._projects.service_accounts) diff --git a/src/omnistack/resources/organization/projects/service_accounts.py b/src/omnistack/resources/organization/projects/service_accounts.py deleted file mode 100644 index 73619eb..0000000 --- a/src/omnistack/resources/organization/projects/service_accounts.py +++ /dev/null @@ -1,384 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.organization.projects import service_account_list_params, service_account_create_params -from ....types.shared.project_service_account import ProjectServiceAccount -from ....types.organization.projects.service_account_list_response import ServiceAccountListResponse -from ....types.organization.projects.service_account_create_response import ServiceAccountCreateResponse - -__all__ = ["ServiceAccountsResource", "AsyncServiceAccountsResource"] - - -class ServiceAccountsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ServiceAccountsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return ServiceAccountsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ServiceAccountsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return ServiceAccountsResourceWithStreamingResponse(self) - - def create( - self, - project_id: str, - *, - name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceAccountCreateResponse: - """Creates a new service account in the project. - - This also returns an unredacted - API key for the service account. - - Args: - name: The name of the service account being created. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return self._post( - f"/organization/projects/{project_id}/service_accounts", - body=maybe_transform({"name": name}, service_account_create_params.ServiceAccountCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ServiceAccountCreateResponse, - ) - - def retrieve( - self, - service_account_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectServiceAccount: - """ - Retrieves a service account in the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not service_account_id: - raise ValueError(f"Expected a non-empty value for `service_account_id` but received {service_account_id!r}") - return self._get( - f"/organization/projects/{project_id}/service_accounts/{service_account_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectServiceAccount, - ) - - def list( - self, - project_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceAccountListResponse: - """ - Returns a list of service accounts in the project. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return self._get( - f"/organization/projects/{project_id}/service_accounts", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "limit": limit, - }, - service_account_list_params.ServiceAccountListParams, - ), - ), - cast_to=ServiceAccountListResponse, - ) - - -class AsyncServiceAccountsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncServiceAccountsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncServiceAccountsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncServiceAccountsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncServiceAccountsResourceWithStreamingResponse(self) - - async def create( - self, - project_id: str, - *, - name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceAccountCreateResponse: - """Creates a new service account in the project. - - This also returns an unredacted - API key for the service account. - - Args: - name: The name of the service account being created. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return await self._post( - f"/organization/projects/{project_id}/service_accounts", - body=await async_maybe_transform({"name": name}, service_account_create_params.ServiceAccountCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ServiceAccountCreateResponse, - ) - - async def retrieve( - self, - service_account_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectServiceAccount: - """ - Retrieves a service account in the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not service_account_id: - raise ValueError(f"Expected a non-empty value for `service_account_id` but received {service_account_id!r}") - return await self._get( - f"/organization/projects/{project_id}/service_accounts/{service_account_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectServiceAccount, - ) - - async def list( - self, - project_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceAccountListResponse: - """ - Returns a list of service accounts in the project. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return await self._get( - f"/organization/projects/{project_id}/service_accounts", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "limit": limit, - }, - service_account_list_params.ServiceAccountListParams, - ), - ), - cast_to=ServiceAccountListResponse, - ) - - -class ServiceAccountsResourceWithRawResponse: - def __init__(self, service_accounts: ServiceAccountsResource) -> None: - self._service_accounts = service_accounts - - self.create = to_raw_response_wrapper( - service_accounts.create, - ) - self.retrieve = to_raw_response_wrapper( - service_accounts.retrieve, - ) - self.list = to_raw_response_wrapper( - service_accounts.list, - ) - - -class AsyncServiceAccountsResourceWithRawResponse: - def __init__(self, service_accounts: AsyncServiceAccountsResource) -> None: - self._service_accounts = service_accounts - - self.create = async_to_raw_response_wrapper( - service_accounts.create, - ) - self.retrieve = async_to_raw_response_wrapper( - service_accounts.retrieve, - ) - self.list = async_to_raw_response_wrapper( - service_accounts.list, - ) - - -class ServiceAccountsResourceWithStreamingResponse: - def __init__(self, service_accounts: ServiceAccountsResource) -> None: - self._service_accounts = service_accounts - - self.create = to_streamed_response_wrapper( - service_accounts.create, - ) - self.retrieve = to_streamed_response_wrapper( - service_accounts.retrieve, - ) - self.list = to_streamed_response_wrapper( - service_accounts.list, - ) - - -class AsyncServiceAccountsResourceWithStreamingResponse: - def __init__(self, service_accounts: AsyncServiceAccountsResource) -> None: - self._service_accounts = service_accounts - - self.create = async_to_streamed_response_wrapper( - service_accounts.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - service_accounts.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - service_accounts.list, - ) diff --git a/src/omnistack/resources/organization/projects/users.py b/src/omnistack/resources/organization/projects/users.py deleted file mode 100644 index 153296e..0000000 --- a/src/omnistack/resources/organization/projects/users.py +++ /dev/null @@ -1,472 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.shared.project_user import ProjectUser -from ....types.organization.projects import user_list_params, user_create_params -from ....types.organization.projects.user_list_response import UserListResponse -from ....types.organization.projects.user_delete_response import UserDeleteResponse - -__all__ = ["UsersResource", "AsyncUsersResource"] - - -class UsersResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> UsersResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return UsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> UsersResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return UsersResourceWithStreamingResponse(self) - - def create( - self, - user_id: str, - *, - project_id: str, - role: Literal["owner", "member"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUser: - """ - Modifies a user's role in the project. - - Args: - role: `owner` or `member` - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return self._post( - f"/organization/projects/{project_id}/users/{user_id}", - body=maybe_transform({"role": role}, user_create_params.UserCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectUser, - ) - - def retrieve( - self, - user_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUser: - """ - Retrieves a user in the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return self._get( - f"/organization/projects/{project_id}/users/{user_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectUser, - ) - - def list( - self, - project_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserListResponse: - """ - Returns a list of users in the project. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return self._get( - f"/organization/projects/{project_id}/users", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "limit": limit, - }, - user_list_params.UserListParams, - ), - ), - cast_to=UserListResponse, - ) - - def delete( - self, - user_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserDeleteResponse: - """ - Deletes a user from the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return self._delete( - f"/organization/projects/{project_id}/users/{user_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=UserDeleteResponse, - ) - - -class AsyncUsersResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncUsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncUsersResourceWithStreamingResponse(self) - - async def create( - self, - user_id: str, - *, - project_id: str, - role: Literal["owner", "member"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUser: - """ - Modifies a user's role in the project. - - Args: - role: `owner` or `member` - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return await self._post( - f"/organization/projects/{project_id}/users/{user_id}", - body=await async_maybe_transform({"role": role}, user_create_params.UserCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectUser, - ) - - async def retrieve( - self, - user_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectUser: - """ - Retrieves a user in the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return await self._get( - f"/organization/projects/{project_id}/users/{user_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectUser, - ) - - async def list( - self, - project_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserListResponse: - """ - Returns a list of users in the project. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return await self._get( - f"/organization/projects/{project_id}/users", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "limit": limit, - }, - user_list_params.UserListParams, - ), - ), - cast_to=UserListResponse, - ) - - async def delete( - self, - user_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserDeleteResponse: - """ - Deletes a user from the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return await self._delete( - f"/organization/projects/{project_id}/users/{user_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=UserDeleteResponse, - ) - - -class UsersResourceWithRawResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.create = to_raw_response_wrapper( - users.create, - ) - self.retrieve = to_raw_response_wrapper( - users.retrieve, - ) - self.list = to_raw_response_wrapper( - users.list, - ) - self.delete = to_raw_response_wrapper( - users.delete, - ) - - -class AsyncUsersResourceWithRawResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.create = async_to_raw_response_wrapper( - users.create, - ) - self.retrieve = async_to_raw_response_wrapper( - users.retrieve, - ) - self.list = async_to_raw_response_wrapper( - users.list, - ) - self.delete = async_to_raw_response_wrapper( - users.delete, - ) - - -class UsersResourceWithStreamingResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.create = to_streamed_response_wrapper( - users.create, - ) - self.retrieve = to_streamed_response_wrapper( - users.retrieve, - ) - self.list = to_streamed_response_wrapper( - users.list, - ) - self.delete = to_streamed_response_wrapper( - users.delete, - ) - - -class AsyncUsersResourceWithStreamingResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.create = async_to_streamed_response_wrapper( - users.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - users.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - users.list, - ) - self.delete = async_to_streamed_response_wrapper( - users.delete, - ) diff --git a/src/omnistack/resources/organization/users.py b/src/omnistack/resources/organization/users.py deleted file mode 100644 index f145db8..0000000 --- a/src/omnistack/resources/organization/users.py +++ /dev/null @@ -1,448 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.organization import user_list_params, user_create_params -from ...types.organization.user import User -from ...types.organization.user_list_response import UserListResponse -from ...types.organization.user_delete_response import UserDeleteResponse - -__all__ = ["UsersResource", "AsyncUsersResource"] - - -class UsersResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> UsersResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return UsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> UsersResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return UsersResourceWithStreamingResponse(self) - - def create( - self, - user_id: str, - *, - role: Literal["owner", "reader"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> User: - """ - Modifies a user's role in the organization. - - Args: - role: `owner` or `reader` - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return self._post( - f"/organization/users/{user_id}", - body=maybe_transform({"role": role}, user_create_params.UserCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=User, - ) - - def retrieve( - self, - user_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> User: - """ - Retrieves a user by their identifier. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return self._get( - f"/organization/users/{user_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=User, - ) - - def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserListResponse: - """ - Lists all of the users in the organization. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/organization/users", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "limit": limit, - }, - user_list_params.UserListParams, - ), - ), - cast_to=UserListResponse, - ) - - def delete( - self, - user_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserDeleteResponse: - """ - Deletes a user from the organization. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return self._delete( - f"/organization/users/{user_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=UserDeleteResponse, - ) - - -class AsyncUsersResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncUsersResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncUsersResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncUsersResourceWithStreamingResponse(self) - - async def create( - self, - user_id: str, - *, - role: Literal["owner", "reader"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> User: - """ - Modifies a user's role in the organization. - - Args: - role: `owner` or `reader` - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return await self._post( - f"/organization/users/{user_id}", - body=await async_maybe_transform({"role": role}, user_create_params.UserCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=User, - ) - - async def retrieve( - self, - user_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> User: - """ - Retrieves a user by their identifier. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return await self._get( - f"/organization/users/{user_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=User, - ) - - async def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserListResponse: - """ - Lists all of the users in the organization. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/organization/users", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "limit": limit, - }, - user_list_params.UserListParams, - ), - ), - cast_to=UserListResponse, - ) - - async def delete( - self, - user_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UserDeleteResponse: - """ - Deletes a user from the organization. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not user_id: - raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}") - return await self._delete( - f"/organization/users/{user_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=UserDeleteResponse, - ) - - -class UsersResourceWithRawResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.create = to_raw_response_wrapper( - users.create, - ) - self.retrieve = to_raw_response_wrapper( - users.retrieve, - ) - self.list = to_raw_response_wrapper( - users.list, - ) - self.delete = to_raw_response_wrapper( - users.delete, - ) - - -class AsyncUsersResourceWithRawResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.create = async_to_raw_response_wrapper( - users.create, - ) - self.retrieve = async_to_raw_response_wrapper( - users.retrieve, - ) - self.list = async_to_raw_response_wrapper( - users.list, - ) - self.delete = async_to_raw_response_wrapper( - users.delete, - ) - - -class UsersResourceWithStreamingResponse: - def __init__(self, users: UsersResource) -> None: - self._users = users - - self.create = to_streamed_response_wrapper( - users.create, - ) - self.retrieve = to_streamed_response_wrapper( - users.retrieve, - ) - self.list = to_streamed_response_wrapper( - users.list, - ) - self.delete = to_streamed_response_wrapper( - users.delete, - ) - - -class AsyncUsersResourceWithStreamingResponse: - def __init__(self, users: AsyncUsersResource) -> None: - self._users = users - - self.create = async_to_streamed_response_wrapper( - users.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - users.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - users.list, - ) - self.delete = async_to_streamed_response_wrapper( - users.delete, - ) diff --git a/src/omnistack/resources/projects/__init__.py b/src/omnistack/resources/projects/__init__.py deleted file mode 100644 index e74d86f..0000000 --- a/src/omnistack/resources/projects/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .api_keys import ( - APIKeysResource, - AsyncAPIKeysResource, - APIKeysResourceWithRawResponse, - AsyncAPIKeysResourceWithRawResponse, - APIKeysResourceWithStreamingResponse, - AsyncAPIKeysResourceWithStreamingResponse, -) -from .projects import ( - ProjectsResource, - AsyncProjectsResource, - ProjectsResourceWithRawResponse, - AsyncProjectsResourceWithRawResponse, - ProjectsResourceWithStreamingResponse, - AsyncProjectsResourceWithStreamingResponse, -) -from .service_accounts import ( - ServiceAccountsResource, - AsyncServiceAccountsResource, - ServiceAccountsResourceWithRawResponse, - AsyncServiceAccountsResourceWithRawResponse, - ServiceAccountsResourceWithStreamingResponse, - AsyncServiceAccountsResourceWithStreamingResponse, -) - -__all__ = [ - "ServiceAccountsResource", - "AsyncServiceAccountsResource", - "ServiceAccountsResourceWithRawResponse", - "AsyncServiceAccountsResourceWithRawResponse", - "ServiceAccountsResourceWithStreamingResponse", - "AsyncServiceAccountsResourceWithStreamingResponse", - "APIKeysResource", - "AsyncAPIKeysResource", - "APIKeysResourceWithRawResponse", - "AsyncAPIKeysResourceWithRawResponse", - "APIKeysResourceWithStreamingResponse", - "AsyncAPIKeysResourceWithStreamingResponse", - "ProjectsResource", - "AsyncProjectsResource", - "ProjectsResourceWithRawResponse", - "AsyncProjectsResourceWithRawResponse", - "ProjectsResourceWithStreamingResponse", - "AsyncProjectsResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/projects/api_keys.py b/src/omnistack/resources/projects/api_keys.py deleted file mode 100644 index 970cb05..0000000 --- a/src/omnistack/resources/projects/api_keys.py +++ /dev/null @@ -1,378 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.projects import api_key_list_params -from ...types.shared.project_api_key import ProjectAPIKey -from ...types.projects.api_key_list_response import APIKeyListResponse -from ...types.projects.api_key_delete_response import APIKeyDeleteResponse - -__all__ = ["APIKeysResource", "AsyncAPIKeysResource"] - - -class APIKeysResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> APIKeysResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return APIKeysResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> APIKeysResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return APIKeysResourceWithStreamingResponse(self) - - def retrieve( - self, - key_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectAPIKey: - """ - Retrieves an API key in the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not key_id: - raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") - return self._get( - f"/organization/projects/{project_id}/api_keys/{key_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectAPIKey, - ) - - def list( - self, - project_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIKeyListResponse: - """ - Returns a list of API keys in the project. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return self._get( - f"/organization/projects/{project_id}/api_keys", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "limit": limit, - }, - api_key_list_params.APIKeyListParams, - ), - ), - cast_to=APIKeyListResponse, - ) - - def delete( - self, - key_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIKeyDeleteResponse: - """ - Deletes an API key from the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not key_id: - raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") - return self._delete( - f"/organization/projects/{project_id}/api_keys/{key_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=APIKeyDeleteResponse, - ) - - -class AsyncAPIKeysResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAPIKeysResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncAPIKeysResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAPIKeysResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncAPIKeysResourceWithStreamingResponse(self) - - async def retrieve( - self, - key_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectAPIKey: - """ - Retrieves an API key in the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not key_id: - raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") - return await self._get( - f"/organization/projects/{project_id}/api_keys/{key_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectAPIKey, - ) - - async def list( - self, - project_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIKeyListResponse: - """ - Returns a list of API keys in the project. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - return await self._get( - f"/organization/projects/{project_id}/api_keys", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "limit": limit, - }, - api_key_list_params.APIKeyListParams, - ), - ), - cast_to=APIKeyListResponse, - ) - - async def delete( - self, - key_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> APIKeyDeleteResponse: - """ - Deletes an API key from the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not key_id: - raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") - return await self._delete( - f"/organization/projects/{project_id}/api_keys/{key_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=APIKeyDeleteResponse, - ) - - -class APIKeysResourceWithRawResponse: - def __init__(self, api_keys: APIKeysResource) -> None: - self._api_keys = api_keys - - self.retrieve = to_raw_response_wrapper( - api_keys.retrieve, - ) - self.list = to_raw_response_wrapper( - api_keys.list, - ) - self.delete = to_raw_response_wrapper( - api_keys.delete, - ) - - -class AsyncAPIKeysResourceWithRawResponse: - def __init__(self, api_keys: AsyncAPIKeysResource) -> None: - self._api_keys = api_keys - - self.retrieve = async_to_raw_response_wrapper( - api_keys.retrieve, - ) - self.list = async_to_raw_response_wrapper( - api_keys.list, - ) - self.delete = async_to_raw_response_wrapper( - api_keys.delete, - ) - - -class APIKeysResourceWithStreamingResponse: - def __init__(self, api_keys: APIKeysResource) -> None: - self._api_keys = api_keys - - self.retrieve = to_streamed_response_wrapper( - api_keys.retrieve, - ) - self.list = to_streamed_response_wrapper( - api_keys.list, - ) - self.delete = to_streamed_response_wrapper( - api_keys.delete, - ) - - -class AsyncAPIKeysResourceWithStreamingResponse: - def __init__(self, api_keys: AsyncAPIKeysResource) -> None: - self._api_keys = api_keys - - self.retrieve = async_to_streamed_response_wrapper( - api_keys.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - api_keys.list, - ) - self.delete = async_to_streamed_response_wrapper( - api_keys.delete, - ) diff --git a/src/omnistack/resources/projects/projects.py b/src/omnistack/resources/projects/projects.py deleted file mode 100644 index 311b4af..0000000 --- a/src/omnistack/resources/projects/projects.py +++ /dev/null @@ -1,134 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .api_keys import ( - APIKeysResource, - AsyncAPIKeysResource, - APIKeysResourceWithRawResponse, - AsyncAPIKeysResourceWithRawResponse, - APIKeysResourceWithStreamingResponse, - AsyncAPIKeysResourceWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from .service_accounts import ( - ServiceAccountsResource, - AsyncServiceAccountsResource, - ServiceAccountsResourceWithRawResponse, - AsyncServiceAccountsResourceWithRawResponse, - ServiceAccountsResourceWithStreamingResponse, - AsyncServiceAccountsResourceWithStreamingResponse, -) - -__all__ = ["ProjectsResource", "AsyncProjectsResource"] - - -class ProjectsResource(SyncAPIResource): - @cached_property - def service_accounts(self) -> ServiceAccountsResource: - return ServiceAccountsResource(self._client) - - @cached_property - def api_keys(self) -> APIKeysResource: - return APIKeysResource(self._client) - - @cached_property - def with_raw_response(self) -> ProjectsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return ProjectsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProjectsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return ProjectsResourceWithStreamingResponse(self) - - -class AsyncProjectsResource(AsyncAPIResource): - @cached_property - def service_accounts(self) -> AsyncServiceAccountsResource: - return AsyncServiceAccountsResource(self._client) - - @cached_property - def api_keys(self) -> AsyncAPIKeysResource: - return AsyncAPIKeysResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncProjectsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProjectsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncProjectsResourceWithStreamingResponse(self) - - -class ProjectsResourceWithRawResponse: - def __init__(self, projects: ProjectsResource) -> None: - self._projects = projects - - @cached_property - def service_accounts(self) -> ServiceAccountsResourceWithRawResponse: - return ServiceAccountsResourceWithRawResponse(self._projects.service_accounts) - - @cached_property - def api_keys(self) -> APIKeysResourceWithRawResponse: - return APIKeysResourceWithRawResponse(self._projects.api_keys) - - -class AsyncProjectsResourceWithRawResponse: - def __init__(self, projects: AsyncProjectsResource) -> None: - self._projects = projects - - @cached_property - def service_accounts(self) -> AsyncServiceAccountsResourceWithRawResponse: - return AsyncServiceAccountsResourceWithRawResponse(self._projects.service_accounts) - - @cached_property - def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse: - return AsyncAPIKeysResourceWithRawResponse(self._projects.api_keys) - - -class ProjectsResourceWithStreamingResponse: - def __init__(self, projects: ProjectsResource) -> None: - self._projects = projects - - @cached_property - def service_accounts(self) -> ServiceAccountsResourceWithStreamingResponse: - return ServiceAccountsResourceWithStreamingResponse(self._projects.service_accounts) - - @cached_property - def api_keys(self) -> APIKeysResourceWithStreamingResponse: - return APIKeysResourceWithStreamingResponse(self._projects.api_keys) - - -class AsyncProjectsResourceWithStreamingResponse: - def __init__(self, projects: AsyncProjectsResource) -> None: - self._projects = projects - - @cached_property - def service_accounts(self) -> AsyncServiceAccountsResourceWithStreamingResponse: - return AsyncServiceAccountsResourceWithStreamingResponse(self._projects.service_accounts) - - @cached_property - def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse: - return AsyncAPIKeysResourceWithStreamingResponse(self._projects.api_keys) diff --git a/src/omnistack/resources/projects/service_accounts.py b/src/omnistack/resources/projects/service_accounts.py deleted file mode 100644 index 4f9793b..0000000 --- a/src/omnistack/resources/projects/service_accounts.py +++ /dev/null @@ -1,169 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.projects.service_account_delete_response import ServiceAccountDeleteResponse - -__all__ = ["ServiceAccountsResource", "AsyncServiceAccountsResource"] - - -class ServiceAccountsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ServiceAccountsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return ServiceAccountsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ServiceAccountsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return ServiceAccountsResourceWithStreamingResponse(self) - - def delete( - self, - service_account_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceAccountDeleteResponse: - """ - Deletes a service account from the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not service_account_id: - raise ValueError(f"Expected a non-empty value for `service_account_id` but received {service_account_id!r}") - return self._delete( - f"/organization/projects/{project_id}/service_accounts/{service_account_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ServiceAccountDeleteResponse, - ) - - -class AsyncServiceAccountsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncServiceAccountsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncServiceAccountsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncServiceAccountsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncServiceAccountsResourceWithStreamingResponse(self) - - async def delete( - self, - service_account_id: str, - *, - project_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceAccountDeleteResponse: - """ - Deletes a service account from the project. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not project_id: - raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") - if not service_account_id: - raise ValueError(f"Expected a non-empty value for `service_account_id` but received {service_account_id!r}") - return await self._delete( - f"/organization/projects/{project_id}/service_accounts/{service_account_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ServiceAccountDeleteResponse, - ) - - -class ServiceAccountsResourceWithRawResponse: - def __init__(self, service_accounts: ServiceAccountsResource) -> None: - self._service_accounts = service_accounts - - self.delete = to_raw_response_wrapper( - service_accounts.delete, - ) - - -class AsyncServiceAccountsResourceWithRawResponse: - def __init__(self, service_accounts: AsyncServiceAccountsResource) -> None: - self._service_accounts = service_accounts - - self.delete = async_to_raw_response_wrapper( - service_accounts.delete, - ) - - -class ServiceAccountsResourceWithStreamingResponse: - def __init__(self, service_accounts: ServiceAccountsResource) -> None: - self._service_accounts = service_accounts - - self.delete = to_streamed_response_wrapper( - service_accounts.delete, - ) - - -class AsyncServiceAccountsResourceWithStreamingResponse: - def __init__(self, service_accounts: AsyncServiceAccountsResource) -> None: - self._service_accounts = service_accounts - - self.delete = async_to_streamed_response_wrapper( - service_accounts.delete, - ) diff --git a/src/omnistack/resources/threads/__init__.py b/src/omnistack/resources/threads/__init__.py deleted file mode 100644 index d56b6d0..0000000 --- a/src/omnistack/resources/threads/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .runs import ( - RunsResource, - AsyncRunsResource, - RunsResourceWithRawResponse, - AsyncRunsResourceWithRawResponse, - RunsResourceWithStreamingResponse, - AsyncRunsResourceWithStreamingResponse, -) -from .threads import ( - ThreadsResource, - AsyncThreadsResource, - ThreadsResourceWithRawResponse, - AsyncThreadsResourceWithRawResponse, - ThreadsResourceWithStreamingResponse, - AsyncThreadsResourceWithStreamingResponse, -) -from .messages import ( - MessagesResource, - AsyncMessagesResource, - MessagesResourceWithRawResponse, - AsyncMessagesResourceWithRawResponse, - MessagesResourceWithStreamingResponse, - AsyncMessagesResourceWithStreamingResponse, -) - -__all__ = [ - "MessagesResource", - "AsyncMessagesResource", - "MessagesResourceWithRawResponse", - "AsyncMessagesResourceWithRawResponse", - "MessagesResourceWithStreamingResponse", - "AsyncMessagesResourceWithStreamingResponse", - "RunsResource", - "AsyncRunsResource", - "RunsResourceWithRawResponse", - "AsyncRunsResourceWithRawResponse", - "RunsResourceWithStreamingResponse", - "AsyncRunsResourceWithStreamingResponse", - "ThreadsResource", - "AsyncThreadsResource", - "ThreadsResourceWithRawResponse", - "AsyncThreadsResourceWithRawResponse", - "ThreadsResourceWithStreamingResponse", - "AsyncThreadsResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/threads/messages.py b/src/omnistack/resources/threads/messages.py deleted file mode 100644 index da89670..0000000 --- a/src/omnistack/resources/threads/messages.py +++ /dev/null @@ -1,511 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.threads import message_list_params, message_create_params -from ...types.assistants.message_object import MessageObject -from ...types.threads.message_list_response import MessageListResponse -from ...types.threads.message_delete_response import MessageDeleteResponse - -__all__ = ["MessagesResource", "AsyncMessagesResource"] - - -class MessagesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> MessagesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return MessagesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> MessagesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return MessagesResourceWithStreamingResponse(self) - - def create( - self, - message_id: str, - *, - thread_id: str, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageObject: - """ - Modifies a message. - - Args: - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not message_id: - raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") - return self._post( - f"/threads/{thread_id}/messages/{message_id}", - body=maybe_transform({"metadata": metadata}, message_create_params.MessageCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=MessageObject, - ) - - def retrieve( - self, - message_id: str, - *, - thread_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageObject: - """ - Retrieve a message. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not message_id: - raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") - return self._get( - f"/threads/{thread_id}/messages/{message_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=MessageObject, - ) - - def list( - self, - thread_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - run_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageListResponse: - """ - Returns a list of messages for a given thread. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - run_id: Filter messages by the run ID that generated them. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return self._get( - f"/threads/{thread_id}/messages", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "before": before, - "limit": limit, - "order": order, - "run_id": run_id, - }, - message_list_params.MessageListParams, - ), - ), - cast_to=MessageListResponse, - ) - - def delete( - self, - message_id: str, - *, - thread_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageDeleteResponse: - """ - Deletes a message. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not message_id: - raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") - return self._delete( - f"/threads/{thread_id}/messages/{message_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=MessageDeleteResponse, - ) - - -class AsyncMessagesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncMessagesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncMessagesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncMessagesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncMessagesResourceWithStreamingResponse(self) - - async def create( - self, - message_id: str, - *, - thread_id: str, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageObject: - """ - Modifies a message. - - Args: - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not message_id: - raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") - return await self._post( - f"/threads/{thread_id}/messages/{message_id}", - body=await async_maybe_transform({"metadata": metadata}, message_create_params.MessageCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=MessageObject, - ) - - async def retrieve( - self, - message_id: str, - *, - thread_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageObject: - """ - Retrieve a message. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not message_id: - raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") - return await self._get( - f"/threads/{thread_id}/messages/{message_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=MessageObject, - ) - - async def list( - self, - thread_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - run_id: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageListResponse: - """ - Returns a list of messages for a given thread. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - run_id: Filter messages by the run ID that generated them. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return await self._get( - f"/threads/{thread_id}/messages", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "before": before, - "limit": limit, - "order": order, - "run_id": run_id, - }, - message_list_params.MessageListParams, - ), - ), - cast_to=MessageListResponse, - ) - - async def delete( - self, - message_id: str, - *, - thread_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageDeleteResponse: - """ - Deletes a message. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not message_id: - raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") - return await self._delete( - f"/threads/{thread_id}/messages/{message_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=MessageDeleteResponse, - ) - - -class MessagesResourceWithRawResponse: - def __init__(self, messages: MessagesResource) -> None: - self._messages = messages - - self.create = to_raw_response_wrapper( - messages.create, - ) - self.retrieve = to_raw_response_wrapper( - messages.retrieve, - ) - self.list = to_raw_response_wrapper( - messages.list, - ) - self.delete = to_raw_response_wrapper( - messages.delete, - ) - - -class AsyncMessagesResourceWithRawResponse: - def __init__(self, messages: AsyncMessagesResource) -> None: - self._messages = messages - - self.create = async_to_raw_response_wrapper( - messages.create, - ) - self.retrieve = async_to_raw_response_wrapper( - messages.retrieve, - ) - self.list = async_to_raw_response_wrapper( - messages.list, - ) - self.delete = async_to_raw_response_wrapper( - messages.delete, - ) - - -class MessagesResourceWithStreamingResponse: - def __init__(self, messages: MessagesResource) -> None: - self._messages = messages - - self.create = to_streamed_response_wrapper( - messages.create, - ) - self.retrieve = to_streamed_response_wrapper( - messages.retrieve, - ) - self.list = to_streamed_response_wrapper( - messages.list, - ) - self.delete = to_streamed_response_wrapper( - messages.delete, - ) - - -class AsyncMessagesResourceWithStreamingResponse: - def __init__(self, messages: AsyncMessagesResource) -> None: - self._messages = messages - - self.create = async_to_streamed_response_wrapper( - messages.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - messages.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - messages.list, - ) - self.delete = async_to_streamed_response_wrapper( - messages.delete, - ) diff --git a/src/omnistack/resources/threads/runs/__init__.py b/src/omnistack/resources/threads/runs/__init__.py deleted file mode 100644 index 7094240..0000000 --- a/src/omnistack/resources/threads/runs/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .runs import ( - RunsResource, - AsyncRunsResource, - RunsResourceWithRawResponse, - AsyncRunsResourceWithRawResponse, - RunsResourceWithStreamingResponse, - AsyncRunsResourceWithStreamingResponse, -) -from .steps import ( - StepsResource, - AsyncStepsResource, - StepsResourceWithRawResponse, - AsyncStepsResourceWithRawResponse, - StepsResourceWithStreamingResponse, - AsyncStepsResourceWithStreamingResponse, -) - -__all__ = [ - "StepsResource", - "AsyncStepsResource", - "StepsResourceWithRawResponse", - "AsyncStepsResourceWithRawResponse", - "StepsResourceWithStreamingResponse", - "AsyncStepsResourceWithStreamingResponse", - "RunsResource", - "AsyncRunsResource", - "RunsResourceWithRawResponse", - "AsyncRunsResourceWithRawResponse", - "RunsResourceWithStreamingResponse", - "AsyncRunsResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/threads/runs/runs.py b/src/omnistack/resources/threads/runs/runs.py deleted file mode 100644 index 2bfdfcb..0000000 --- a/src/omnistack/resources/threads/runs/runs.py +++ /dev/null @@ -1,654 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Literal - -import httpx - -from .steps import ( - StepsResource, - AsyncStepsResource, - StepsResourceWithRawResponse, - AsyncStepsResourceWithRawResponse, - StepsResourceWithStreamingResponse, - AsyncStepsResourceWithStreamingResponse, -) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.threads import run_list_params, run_create_params, run_submit_tool_outputs_params -from ....types.assistants.run_object import RunObject -from ....types.threads.run_list_response import RunListResponse - -__all__ = ["RunsResource", "AsyncRunsResource"] - - -class RunsResource(SyncAPIResource): - @cached_property - def steps(self) -> StepsResource: - return StepsResource(self._client) - - @cached_property - def with_raw_response(self) -> RunsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return RunsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RunsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return RunsResourceWithStreamingResponse(self) - - def create( - self, - run_id: str, - *, - thread_id: str, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunObject: - """ - Modifies a run. - - Args: - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return self._post( - f"/threads/{thread_id}/runs/{run_id}", - body=maybe_transform({"metadata": metadata}, run_create_params.RunCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RunObject, - ) - - def retrieve( - self, - run_id: str, - *, - thread_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunObject: - """ - Retrieves a run. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return self._get( - f"/threads/{thread_id}/runs/{run_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RunObject, - ) - - def list( - self, - thread_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunListResponse: - """ - Returns a list of runs belonging to a thread. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return self._get( - f"/threads/{thread_id}/runs", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "before": before, - "limit": limit, - "order": order, - }, - run_list_params.RunListParams, - ), - ), - cast_to=RunListResponse, - ) - - def cancel( - self, - run_id: str, - *, - thread_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunObject: - """ - Cancels a run that is `in_progress`. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return self._post( - f"/threads/{thread_id}/runs/{run_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RunObject, - ) - - def submit_tool_outputs( - self, - run_id: str, - *, - thread_id: str, - tool_outputs: Iterable[run_submit_tool_outputs_params.ToolOutput], - stream: Optional[bool] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunObject: - """ - When a run has the `status: "requires_action"` and `required_action.type` is - `submit_tool_outputs`, this endpoint can be used to submit the outputs from the - tool calls once they're all completed. All outputs must be submitted in a single - request. - - Args: - tool_outputs: A list of tools for which the outputs are being submitted. - - stream: If `true`, returns a stream of events that happen during the Run as server-sent - events, terminating when the Run enters a terminal state with a `data: [DONE]` - message. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return self._post( - f"/threads/{thread_id}/runs/{run_id}/submit_tool_outputs", - body=maybe_transform( - { - "tool_outputs": tool_outputs, - "stream": stream, - }, - run_submit_tool_outputs_params.RunSubmitToolOutputsParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RunObject, - ) - - -class AsyncRunsResource(AsyncAPIResource): - @cached_property - def steps(self) -> AsyncStepsResource: - return AsyncStepsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncRunsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncRunsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRunsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncRunsResourceWithStreamingResponse(self) - - async def create( - self, - run_id: str, - *, - thread_id: str, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunObject: - """ - Modifies a run. - - Args: - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return await self._post( - f"/threads/{thread_id}/runs/{run_id}", - body=await async_maybe_transform({"metadata": metadata}, run_create_params.RunCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RunObject, - ) - - async def retrieve( - self, - run_id: str, - *, - thread_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunObject: - """ - Retrieves a run. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return await self._get( - f"/threads/{thread_id}/runs/{run_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RunObject, - ) - - async def list( - self, - thread_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunListResponse: - """ - Returns a list of runs belonging to a thread. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return await self._get( - f"/threads/{thread_id}/runs", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "before": before, - "limit": limit, - "order": order, - }, - run_list_params.RunListParams, - ), - ), - cast_to=RunListResponse, - ) - - async def cancel( - self, - run_id: str, - *, - thread_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunObject: - """ - Cancels a run that is `in_progress`. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return await self._post( - f"/threads/{thread_id}/runs/{run_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RunObject, - ) - - async def submit_tool_outputs( - self, - run_id: str, - *, - thread_id: str, - tool_outputs: Iterable[run_submit_tool_outputs_params.ToolOutput], - stream: Optional[bool] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunObject: - """ - When a run has the `status: "requires_action"` and `required_action.type` is - `submit_tool_outputs`, this endpoint can be used to submit the outputs from the - tool calls once they're all completed. All outputs must be submitted in a single - request. - - Args: - tool_outputs: A list of tools for which the outputs are being submitted. - - stream: If `true`, returns a stream of events that happen during the Run as server-sent - events, terminating when the Run enters a terminal state with a `data: [DONE]` - message. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return await self._post( - f"/threads/{thread_id}/runs/{run_id}/submit_tool_outputs", - body=await async_maybe_transform( - { - "tool_outputs": tool_outputs, - "stream": stream, - }, - run_submit_tool_outputs_params.RunSubmitToolOutputsParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RunObject, - ) - - -class RunsResourceWithRawResponse: - def __init__(self, runs: RunsResource) -> None: - self._runs = runs - - self.create = to_raw_response_wrapper( - runs.create, - ) - self.retrieve = to_raw_response_wrapper( - runs.retrieve, - ) - self.list = to_raw_response_wrapper( - runs.list, - ) - self.cancel = to_raw_response_wrapper( - runs.cancel, - ) - self.submit_tool_outputs = to_raw_response_wrapper( - runs.submit_tool_outputs, - ) - - @cached_property - def steps(self) -> StepsResourceWithRawResponse: - return StepsResourceWithRawResponse(self._runs.steps) - - -class AsyncRunsResourceWithRawResponse: - def __init__(self, runs: AsyncRunsResource) -> None: - self._runs = runs - - self.create = async_to_raw_response_wrapper( - runs.create, - ) - self.retrieve = async_to_raw_response_wrapper( - runs.retrieve, - ) - self.list = async_to_raw_response_wrapper( - runs.list, - ) - self.cancel = async_to_raw_response_wrapper( - runs.cancel, - ) - self.submit_tool_outputs = async_to_raw_response_wrapper( - runs.submit_tool_outputs, - ) - - @cached_property - def steps(self) -> AsyncStepsResourceWithRawResponse: - return AsyncStepsResourceWithRawResponse(self._runs.steps) - - -class RunsResourceWithStreamingResponse: - def __init__(self, runs: RunsResource) -> None: - self._runs = runs - - self.create = to_streamed_response_wrapper( - runs.create, - ) - self.retrieve = to_streamed_response_wrapper( - runs.retrieve, - ) - self.list = to_streamed_response_wrapper( - runs.list, - ) - self.cancel = to_streamed_response_wrapper( - runs.cancel, - ) - self.submit_tool_outputs = to_streamed_response_wrapper( - runs.submit_tool_outputs, - ) - - @cached_property - def steps(self) -> StepsResourceWithStreamingResponse: - return StepsResourceWithStreamingResponse(self._runs.steps) - - -class AsyncRunsResourceWithStreamingResponse: - def __init__(self, runs: AsyncRunsResource) -> None: - self._runs = runs - - self.create = async_to_streamed_response_wrapper( - runs.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - runs.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - runs.list, - ) - self.cancel = async_to_streamed_response_wrapper( - runs.cancel, - ) - self.submit_tool_outputs = async_to_streamed_response_wrapper( - runs.submit_tool_outputs, - ) - - @cached_property - def steps(self) -> AsyncStepsResourceWithStreamingResponse: - return AsyncStepsResourceWithStreamingResponse(self._runs.steps) diff --git a/src/omnistack/resources/threads/runs/steps.py b/src/omnistack/resources/threads/runs/steps.py deleted file mode 100644 index cbc4f1d..0000000 --- a/src/omnistack/resources/threads/runs/steps.py +++ /dev/null @@ -1,378 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Literal - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.threads.runs import step_list_params, step_retrieve_params -from ....types.threads.runs.run_step_object import RunStepObject -from ....types.threads.runs.step_list_response import StepListResponse - -__all__ = ["StepsResource", "AsyncStepsResource"] - - -class StepsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> StepsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return StepsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> StepsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return StepsResourceWithStreamingResponse(self) - - def retrieve( - self, - step_id: str, - *, - thread_id: str, - run_id: str, - include: List[Literal["step_details.tool_calls[*].file_search.results[*].content"]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunStepObject: - """ - Retrieves a run step. - - Args: - include: A list of additional fields to include in the response. Currently the only - supported value is `step_details.tool_calls[*].file_search.results[*].content` - to fetch the file search result content. - - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return self._get( - f"/threads/{thread_id}/runs/{run_id}/steps/{step_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"include": include}, step_retrieve_params.StepRetrieveParams), - ), - cast_to=RunStepObject, - ) - - def list( - self, - run_id: str, - *, - thread_id: str, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - include: List[Literal["step_details.tool_calls[*].file_search.results[*].content"]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StepListResponse: - """ - Returns a list of run steps belonging to a run. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - include: A list of additional fields to include in the response. Currently the only - supported value is `step_details.tool_calls[*].file_search.results[*].content` - to fetch the file search result content. - - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return self._get( - f"/threads/{thread_id}/runs/{run_id}/steps", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "before": before, - "include": include, - "limit": limit, - "order": order, - }, - step_list_params.StepListParams, - ), - ), - cast_to=StepListResponse, - ) - - -class AsyncStepsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncStepsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncStepsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncStepsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncStepsResourceWithStreamingResponse(self) - - async def retrieve( - self, - step_id: str, - *, - thread_id: str, - run_id: str, - include: List[Literal["step_details.tool_calls[*].file_search.results[*].content"]] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RunStepObject: - """ - Retrieves a run step. - - Args: - include: A list of additional fields to include in the response. Currently the only - supported value is `step_details.tool_calls[*].file_search.results[*].content` - to fetch the file search result content. - - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return await self._get( - f"/threads/{thread_id}/runs/{run_id}/steps/{step_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"include": include}, step_retrieve_params.StepRetrieveParams), - ), - cast_to=RunStepObject, - ) - - async def list( - self, - run_id: str, - *, - thread_id: str, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - include: List[Literal["step_details.tool_calls[*].file_search.results[*].content"]] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StepListResponse: - """ - Returns a list of run steps belonging to a run. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - include: A list of additional fields to include in the response. Currently the only - supported value is `step_details.tool_calls[*].file_search.results[*].content` - to fetch the file search result content. - - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - if not run_id: - raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}") - return await self._get( - f"/threads/{thread_id}/runs/{run_id}/steps", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "before": before, - "include": include, - "limit": limit, - "order": order, - }, - step_list_params.StepListParams, - ), - ), - cast_to=StepListResponse, - ) - - -class StepsResourceWithRawResponse: - def __init__(self, steps: StepsResource) -> None: - self._steps = steps - - self.retrieve = to_raw_response_wrapper( - steps.retrieve, - ) - self.list = to_raw_response_wrapper( - steps.list, - ) - - -class AsyncStepsResourceWithRawResponse: - def __init__(self, steps: AsyncStepsResource) -> None: - self._steps = steps - - self.retrieve = async_to_raw_response_wrapper( - steps.retrieve, - ) - self.list = async_to_raw_response_wrapper( - steps.list, - ) - - -class StepsResourceWithStreamingResponse: - def __init__(self, steps: StepsResource) -> None: - self._steps = steps - - self.retrieve = to_streamed_response_wrapper( - steps.retrieve, - ) - self.list = to_streamed_response_wrapper( - steps.list, - ) - - -class AsyncStepsResourceWithStreamingResponse: - def __init__(self, steps: AsyncStepsResource) -> None: - self._steps = steps - - self.retrieve = async_to_streamed_response_wrapper( - steps.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - steps.list, - ) diff --git a/src/omnistack/resources/threads/threads.py b/src/omnistack/resources/threads/threads.py deleted file mode 100644 index 8b51bbe..0000000 --- a/src/omnistack/resources/threads/threads.py +++ /dev/null @@ -1,548 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional - -import httpx - -from .runs import ( - RunsResource, - AsyncRunsResource, - RunsResourceWithRawResponse, - AsyncRunsResourceWithRawResponse, - RunsResourceWithStreamingResponse, - AsyncRunsResourceWithStreamingResponse, -) -from ...types import thread_create_params, thread_update_params -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from .messages import ( - MessagesResource, - AsyncMessagesResource, - MessagesResourceWithRawResponse, - AsyncMessagesResourceWithRawResponse, - MessagesResourceWithStreamingResponse, - AsyncMessagesResourceWithStreamingResponse, -) -from ..._compat import cached_property -from .runs.runs import RunsResource, AsyncRunsResource -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.thread_delete_response import ThreadDeleteResponse -from ...types.assistants.thread_object import ThreadObject - -__all__ = ["ThreadsResource", "AsyncThreadsResource"] - - -class ThreadsResource(SyncAPIResource): - @cached_property - def messages(self) -> MessagesResource: - return MessagesResource(self._client) - - @cached_property - def runs(self) -> RunsResource: - return RunsResource(self._client) - - @cached_property - def with_raw_response(self) -> ThreadsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return ThreadsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ThreadsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return ThreadsResourceWithStreamingResponse(self) - - def create( - self, - *, - messages: Iterable[thread_create_params.Message] | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - tool_resources: Optional[thread_create_params.ToolResources] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ThreadObject: - """ - Create a thread. - - Args: - messages: A list of [messages](/docs/api-reference/messages) to start the thread with. - - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - tool_resources: A set of resources that are made available to the assistant's tools in this - thread. The resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the `file_search` - tool requires a list of vector store IDs. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/threads", - body=maybe_transform( - { - "messages": messages, - "metadata": metadata, - "tool_resources": tool_resources, - }, - thread_create_params.ThreadCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ThreadObject, - ) - - def retrieve( - self, - thread_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ThreadObject: - """ - Retrieves a thread. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return self._get( - f"/threads/{thread_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ThreadObject, - ) - - def update( - self, - thread_id: str, - *, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - tool_resources: Optional[thread_update_params.ToolResources] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ThreadObject: - """ - Modifies a thread. - - Args: - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - tool_resources: A set of resources that are made available to the assistant's tools in this - thread. The resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the `file_search` - tool requires a list of vector store IDs. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return self._post( - f"/threads/{thread_id}", - body=maybe_transform( - { - "metadata": metadata, - "tool_resources": tool_resources, - }, - thread_update_params.ThreadUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ThreadObject, - ) - - def delete( - self, - thread_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ThreadDeleteResponse: - """ - Delete a thread. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return self._delete( - f"/threads/{thread_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ThreadDeleteResponse, - ) - - -class AsyncThreadsResource(AsyncAPIResource): - @cached_property - def messages(self) -> AsyncMessagesResource: - return AsyncMessagesResource(self._client) - - @cached_property - def runs(self) -> AsyncRunsResource: - return AsyncRunsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncThreadsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncThreadsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncThreadsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncThreadsResourceWithStreamingResponse(self) - - async def create( - self, - *, - messages: Iterable[thread_create_params.Message] | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - tool_resources: Optional[thread_create_params.ToolResources] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ThreadObject: - """ - Create a thread. - - Args: - messages: A list of [messages](/docs/api-reference/messages) to start the thread with. - - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - tool_resources: A set of resources that are made available to the assistant's tools in this - thread. The resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the `file_search` - tool requires a list of vector store IDs. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/threads", - body=await async_maybe_transform( - { - "messages": messages, - "metadata": metadata, - "tool_resources": tool_resources, - }, - thread_create_params.ThreadCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ThreadObject, - ) - - async def retrieve( - self, - thread_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ThreadObject: - """ - Retrieves a thread. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return await self._get( - f"/threads/{thread_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ThreadObject, - ) - - async def update( - self, - thread_id: str, - *, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - tool_resources: Optional[thread_update_params.ToolResources] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ThreadObject: - """ - Modifies a thread. - - Args: - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - tool_resources: A set of resources that are made available to the assistant's tools in this - thread. The resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the `file_search` - tool requires a list of vector store IDs. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return await self._post( - f"/threads/{thread_id}", - body=await async_maybe_transform( - { - "metadata": metadata, - "tool_resources": tool_resources, - }, - thread_update_params.ThreadUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ThreadObject, - ) - - async def delete( - self, - thread_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ThreadDeleteResponse: - """ - Delete a thread. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not thread_id: - raise ValueError(f"Expected a non-empty value for `thread_id` but received {thread_id!r}") - return await self._delete( - f"/threads/{thread_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ThreadDeleteResponse, - ) - - -class ThreadsResourceWithRawResponse: - def __init__(self, threads: ThreadsResource) -> None: - self._threads = threads - - self.create = to_raw_response_wrapper( - threads.create, - ) - self.retrieve = to_raw_response_wrapper( - threads.retrieve, - ) - self.update = to_raw_response_wrapper( - threads.update, - ) - self.delete = to_raw_response_wrapper( - threads.delete, - ) - - @cached_property - def messages(self) -> MessagesResourceWithRawResponse: - return MessagesResourceWithRawResponse(self._threads.messages) - - @cached_property - def runs(self) -> RunsResourceWithRawResponse: - return RunsResourceWithRawResponse(self._threads.runs) - - -class AsyncThreadsResourceWithRawResponse: - def __init__(self, threads: AsyncThreadsResource) -> None: - self._threads = threads - - self.create = async_to_raw_response_wrapper( - threads.create, - ) - self.retrieve = async_to_raw_response_wrapper( - threads.retrieve, - ) - self.update = async_to_raw_response_wrapper( - threads.update, - ) - self.delete = async_to_raw_response_wrapper( - threads.delete, - ) - - @cached_property - def messages(self) -> AsyncMessagesResourceWithRawResponse: - return AsyncMessagesResourceWithRawResponse(self._threads.messages) - - @cached_property - def runs(self) -> AsyncRunsResourceWithRawResponse: - return AsyncRunsResourceWithRawResponse(self._threads.runs) - - -class ThreadsResourceWithStreamingResponse: - def __init__(self, threads: ThreadsResource) -> None: - self._threads = threads - - self.create = to_streamed_response_wrapper( - threads.create, - ) - self.retrieve = to_streamed_response_wrapper( - threads.retrieve, - ) - self.update = to_streamed_response_wrapper( - threads.update, - ) - self.delete = to_streamed_response_wrapper( - threads.delete, - ) - - @cached_property - def messages(self) -> MessagesResourceWithStreamingResponse: - return MessagesResourceWithStreamingResponse(self._threads.messages) - - @cached_property - def runs(self) -> RunsResourceWithStreamingResponse: - return RunsResourceWithStreamingResponse(self._threads.runs) - - -class AsyncThreadsResourceWithStreamingResponse: - def __init__(self, threads: AsyncThreadsResource) -> None: - self._threads = threads - - self.create = async_to_streamed_response_wrapper( - threads.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - threads.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - threads.update, - ) - self.delete = async_to_streamed_response_wrapper( - threads.delete, - ) - - @cached_property - def messages(self) -> AsyncMessagesResourceWithStreamingResponse: - return AsyncMessagesResourceWithStreamingResponse(self._threads.messages) - - @cached_property - def runs(self) -> AsyncRunsResourceWithStreamingResponse: - return AsyncRunsResourceWithStreamingResponse(self._threads.runs) diff --git a/src/omnistack/resources/uploads/__init__.py b/src/omnistack/resources/uploads/__init__.py deleted file mode 100644 index cb02498..0000000 --- a/src/omnistack/resources/uploads/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .parts import ( - PartsResource, - AsyncPartsResource, - PartsResourceWithRawResponse, - AsyncPartsResourceWithRawResponse, - PartsResourceWithStreamingResponse, - AsyncPartsResourceWithStreamingResponse, -) -from .uploads import ( - UploadsResource, - AsyncUploadsResource, - UploadsResourceWithRawResponse, - AsyncUploadsResourceWithRawResponse, - UploadsResourceWithStreamingResponse, - AsyncUploadsResourceWithStreamingResponse, -) - -__all__ = [ - "PartsResource", - "AsyncPartsResource", - "PartsResourceWithRawResponse", - "AsyncPartsResourceWithRawResponse", - "PartsResourceWithStreamingResponse", - "AsyncPartsResourceWithStreamingResponse", - "UploadsResource", - "AsyncUploadsResource", - "UploadsResourceWithRawResponse", - "AsyncUploadsResourceWithRawResponse", - "UploadsResourceWithStreamingResponse", - "AsyncUploadsResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/uploads/parts.py b/src/omnistack/resources/uploads/parts.py deleted file mode 100644 index ccccdc8..0000000 --- a/src/omnistack/resources/uploads/parts.py +++ /dev/null @@ -1,212 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Mapping, cast - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ..._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.uploads import part_create_params -from ...types.upload_part import UploadPart - -__all__ = ["PartsResource", "AsyncPartsResource"] - - -class PartsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PartsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return PartsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PartsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return PartsResourceWithStreamingResponse(self) - - def create( - self, - upload_id: str, - *, - data: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UploadPart: - """ - Adds a [Part](/docs/api-reference/uploads/part-object) to an - [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk - of bytes from the file you are trying to upload. - - Each Part can be at most 64 MB, and you can add Parts until you hit the Upload - maximum of 8 GB. - - It is possible to add multiple Parts in parallel. You can decide the intended - order of the Parts when you - [complete the Upload](/docs/api-reference/uploads/complete). - - Args: - data: The chunk of bytes for this Part. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not upload_id: - raise ValueError(f"Expected a non-empty value for `upload_id` but received {upload_id!r}") - body = deepcopy_minimal({"data": data}) - files = extract_files(cast(Mapping[str, object], body), paths=[["data"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return self._post( - f"/uploads/{upload_id}/parts", - body=maybe_transform(body, part_create_params.PartCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=UploadPart, - ) - - -class AsyncPartsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPartsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncPartsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPartsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncPartsResourceWithStreamingResponse(self) - - async def create( - self, - upload_id: str, - *, - data: FileTypes, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> UploadPart: - """ - Adds a [Part](/docs/api-reference/uploads/part-object) to an - [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk - of bytes from the file you are trying to upload. - - Each Part can be at most 64 MB, and you can add Parts until you hit the Upload - maximum of 8 GB. - - It is possible to add multiple Parts in parallel. You can decide the intended - order of the Parts when you - [complete the Upload](/docs/api-reference/uploads/complete). - - Args: - data: The chunk of bytes for this Part. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not upload_id: - raise ValueError(f"Expected a non-empty value for `upload_id` but received {upload_id!r}") - body = deepcopy_minimal({"data": data}) - files = extract_files(cast(Mapping[str, object], body), paths=[["data"]]) - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} - return await self._post( - f"/uploads/{upload_id}/parts", - body=await async_maybe_transform(body, part_create_params.PartCreateParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=UploadPart, - ) - - -class PartsResourceWithRawResponse: - def __init__(self, parts: PartsResource) -> None: - self._parts = parts - - self.create = to_raw_response_wrapper( - parts.create, - ) - - -class AsyncPartsResourceWithRawResponse: - def __init__(self, parts: AsyncPartsResource) -> None: - self._parts = parts - - self.create = async_to_raw_response_wrapper( - parts.create, - ) - - -class PartsResourceWithStreamingResponse: - def __init__(self, parts: PartsResource) -> None: - self._parts = parts - - self.create = to_streamed_response_wrapper( - parts.create, - ) - - -class AsyncPartsResourceWithStreamingResponse: - def __init__(self, parts: AsyncPartsResource) -> None: - self._parts = parts - - self.create = async_to_streamed_response_wrapper( - parts.create, - ) diff --git a/src/omnistack/resources/uploads/uploads.py b/src/omnistack/resources/uploads/uploads.py deleted file mode 100644 index a0bc0dd..0000000 --- a/src/omnistack/resources/uploads/uploads.py +++ /dev/null @@ -1,491 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Literal - -import httpx - -from .parts import ( - PartsResource, - AsyncPartsResource, - PartsResourceWithRawResponse, - AsyncPartsResourceWithRawResponse, - PartsResourceWithStreamingResponse, - AsyncPartsResourceWithStreamingResponse, -) -from ...types import upload_create_params, upload_complete_params -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.upload import Upload - -__all__ = ["UploadsResource", "AsyncUploadsResource"] - - -class UploadsResource(SyncAPIResource): - @cached_property - def parts(self) -> PartsResource: - return PartsResource(self._client) - - @cached_property - def with_raw_response(self) -> UploadsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return UploadsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> UploadsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return UploadsResourceWithStreamingResponse(self) - - def create( - self, - *, - bytes: int, - filename: str, - mime_type: str, - purpose: Literal["assistants", "batch", "fine-tune", "vision"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Upload: - """ - Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that - you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an - Upload can accept at most 8 GB in total and expires after an hour after you - create it. - - Once you complete the Upload, we will create a - [File](/docs/api-reference/files/object) object that contains all the parts you - uploaded. This File is usable in the rest of our platform as a regular File - object. - - For certain `purpose`s, the correct `mime_type` must be specified. Please refer - to documentation for the supported MIME types for your use case: - - - [Assistants](/docs/assistants/tools/file-search/supported-files) - - For guidance on the proper filename extensions for each purpose, please follow - the documentation on [creating a File](/docs/api-reference/files/create). - - Args: - bytes: The number of bytes in the file you are uploading. - - filename: The name of the file to upload. - - mime_type: The MIME type of the file. - - This must fall within the supported MIME types for your file purpose. See the - supported MIME types for assistants and vision. - - purpose: The intended purpose of the uploaded file. - - See the - [documentation on File purposes](/docs/api-reference/files/create#files-create-purpose). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/uploads", - body=maybe_transform( - { - "bytes": bytes, - "filename": filename, - "mime_type": mime_type, - "purpose": purpose, - }, - upload_create_params.UploadCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Upload, - ) - - def cancel( - self, - upload_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Upload: - """Cancels the Upload. - - No Parts may be added after an Upload is cancelled. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not upload_id: - raise ValueError(f"Expected a non-empty value for `upload_id` but received {upload_id!r}") - return self._post( - f"/uploads/{upload_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Upload, - ) - - def complete( - self, - upload_id: str, - *, - part_ids: List[str], - md5: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Upload: - """ - Completes the [Upload](/docs/api-reference/uploads/object). - - Within the returned Upload object, there is a nested - [File](/docs/api-reference/files/object) object that is ready to use in the rest - of the platform. - - You can specify the order of the Parts by passing in an ordered list of the Part - IDs. - - The number of bytes uploaded upon completion must match the number of bytes - initially specified when creating the Upload object. No Parts may be added after - an Upload is completed. - - Args: - part_ids: The ordered list of Part IDs. - - md5: The optional md5 checksum for the file contents to verify if the bytes uploaded - matches what you expect. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not upload_id: - raise ValueError(f"Expected a non-empty value for `upload_id` but received {upload_id!r}") - return self._post( - f"/uploads/{upload_id}/complete", - body=maybe_transform( - { - "part_ids": part_ids, - "md5": md5, - }, - upload_complete_params.UploadCompleteParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Upload, - ) - - -class AsyncUploadsResource(AsyncAPIResource): - @cached_property - def parts(self) -> AsyncPartsResource: - return AsyncPartsResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncUploadsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncUploadsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncUploadsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncUploadsResourceWithStreamingResponse(self) - - async def create( - self, - *, - bytes: int, - filename: str, - mime_type: str, - purpose: Literal["assistants", "batch", "fine-tune", "vision"], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Upload: - """ - Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that - you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an - Upload can accept at most 8 GB in total and expires after an hour after you - create it. - - Once you complete the Upload, we will create a - [File](/docs/api-reference/files/object) object that contains all the parts you - uploaded. This File is usable in the rest of our platform as a regular File - object. - - For certain `purpose`s, the correct `mime_type` must be specified. Please refer - to documentation for the supported MIME types for your use case: - - - [Assistants](/docs/assistants/tools/file-search/supported-files) - - For guidance on the proper filename extensions for each purpose, please follow - the documentation on [creating a File](/docs/api-reference/files/create). - - Args: - bytes: The number of bytes in the file you are uploading. - - filename: The name of the file to upload. - - mime_type: The MIME type of the file. - - This must fall within the supported MIME types for your file purpose. See the - supported MIME types for assistants and vision. - - purpose: The intended purpose of the uploaded file. - - See the - [documentation on File purposes](/docs/api-reference/files/create#files-create-purpose). - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/uploads", - body=await async_maybe_transform( - { - "bytes": bytes, - "filename": filename, - "mime_type": mime_type, - "purpose": purpose, - }, - upload_create_params.UploadCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Upload, - ) - - async def cancel( - self, - upload_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Upload: - """Cancels the Upload. - - No Parts may be added after an Upload is cancelled. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not upload_id: - raise ValueError(f"Expected a non-empty value for `upload_id` but received {upload_id!r}") - return await self._post( - f"/uploads/{upload_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Upload, - ) - - async def complete( - self, - upload_id: str, - *, - part_ids: List[str], - md5: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Upload: - """ - Completes the [Upload](/docs/api-reference/uploads/object). - - Within the returned Upload object, there is a nested - [File](/docs/api-reference/files/object) object that is ready to use in the rest - of the platform. - - You can specify the order of the Parts by passing in an ordered list of the Part - IDs. - - The number of bytes uploaded upon completion must match the number of bytes - initially specified when creating the Upload object. No Parts may be added after - an Upload is completed. - - Args: - part_ids: The ordered list of Part IDs. - - md5: The optional md5 checksum for the file contents to verify if the bytes uploaded - matches what you expect. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not upload_id: - raise ValueError(f"Expected a non-empty value for `upload_id` but received {upload_id!r}") - return await self._post( - f"/uploads/{upload_id}/complete", - body=await async_maybe_transform( - { - "part_ids": part_ids, - "md5": md5, - }, - upload_complete_params.UploadCompleteParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Upload, - ) - - -class UploadsResourceWithRawResponse: - def __init__(self, uploads: UploadsResource) -> None: - self._uploads = uploads - - self.create = to_raw_response_wrapper( - uploads.create, - ) - self.cancel = to_raw_response_wrapper( - uploads.cancel, - ) - self.complete = to_raw_response_wrapper( - uploads.complete, - ) - - @cached_property - def parts(self) -> PartsResourceWithRawResponse: - return PartsResourceWithRawResponse(self._uploads.parts) - - -class AsyncUploadsResourceWithRawResponse: - def __init__(self, uploads: AsyncUploadsResource) -> None: - self._uploads = uploads - - self.create = async_to_raw_response_wrapper( - uploads.create, - ) - self.cancel = async_to_raw_response_wrapper( - uploads.cancel, - ) - self.complete = async_to_raw_response_wrapper( - uploads.complete, - ) - - @cached_property - def parts(self) -> AsyncPartsResourceWithRawResponse: - return AsyncPartsResourceWithRawResponse(self._uploads.parts) - - -class UploadsResourceWithStreamingResponse: - def __init__(self, uploads: UploadsResource) -> None: - self._uploads = uploads - - self.create = to_streamed_response_wrapper( - uploads.create, - ) - self.cancel = to_streamed_response_wrapper( - uploads.cancel, - ) - self.complete = to_streamed_response_wrapper( - uploads.complete, - ) - - @cached_property - def parts(self) -> PartsResourceWithStreamingResponse: - return PartsResourceWithStreamingResponse(self._uploads.parts) - - -class AsyncUploadsResourceWithStreamingResponse: - def __init__(self, uploads: AsyncUploadsResource) -> None: - self._uploads = uploads - - self.create = async_to_streamed_response_wrapper( - uploads.create, - ) - self.cancel = async_to_streamed_response_wrapper( - uploads.cancel, - ) - self.complete = async_to_streamed_response_wrapper( - uploads.complete, - ) - - @cached_property - def parts(self) -> AsyncPartsResourceWithStreamingResponse: - return AsyncPartsResourceWithStreamingResponse(self._uploads.parts) diff --git a/src/omnistack/resources/vector_stores/__init__.py b/src/omnistack/resources/vector_stores/__init__.py deleted file mode 100644 index d83a42b..0000000 --- a/src/omnistack/resources/vector_stores/__init__.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .files import ( - FilesResource, - AsyncFilesResource, - FilesResourceWithRawResponse, - AsyncFilesResourceWithRawResponse, - FilesResourceWithStreamingResponse, - AsyncFilesResourceWithStreamingResponse, -) -from .file_batches import ( - FileBatchesResource, - AsyncFileBatchesResource, - FileBatchesResourceWithRawResponse, - AsyncFileBatchesResourceWithRawResponse, - FileBatchesResourceWithStreamingResponse, - AsyncFileBatchesResourceWithStreamingResponse, -) -from .vector_stores import ( - VectorStoresResource, - AsyncVectorStoresResource, - VectorStoresResourceWithRawResponse, - AsyncVectorStoresResourceWithRawResponse, - VectorStoresResourceWithStreamingResponse, - AsyncVectorStoresResourceWithStreamingResponse, -) - -__all__ = [ - "FilesResource", - "AsyncFilesResource", - "FilesResourceWithRawResponse", - "AsyncFilesResourceWithRawResponse", - "FilesResourceWithStreamingResponse", - "AsyncFilesResourceWithStreamingResponse", - "FileBatchesResource", - "AsyncFileBatchesResource", - "FileBatchesResourceWithRawResponse", - "AsyncFileBatchesResourceWithRawResponse", - "FileBatchesResourceWithStreamingResponse", - "AsyncFileBatchesResourceWithStreamingResponse", - "VectorStoresResource", - "AsyncVectorStoresResource", - "VectorStoresResourceWithRawResponse", - "AsyncVectorStoresResourceWithRawResponse", - "VectorStoresResourceWithStreamingResponse", - "AsyncVectorStoresResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/vector_stores/file_batches/__init__.py b/src/omnistack/resources/vector_stores/file_batches/__init__.py deleted file mode 100644 index 7c39c7d..0000000 --- a/src/omnistack/resources/vector_stores/file_batches/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .files import ( - FilesResource, - AsyncFilesResource, - FilesResourceWithRawResponse, - AsyncFilesResourceWithRawResponse, - FilesResourceWithStreamingResponse, - AsyncFilesResourceWithStreamingResponse, -) -from .file_batches import ( - FileBatchesResource, - AsyncFileBatchesResource, - FileBatchesResourceWithRawResponse, - AsyncFileBatchesResourceWithRawResponse, - FileBatchesResourceWithStreamingResponse, - AsyncFileBatchesResourceWithStreamingResponse, -) - -__all__ = [ - "FilesResource", - "AsyncFilesResource", - "FilesResourceWithRawResponse", - "AsyncFilesResourceWithRawResponse", - "FilesResourceWithStreamingResponse", - "AsyncFilesResourceWithStreamingResponse", - "FileBatchesResource", - "AsyncFileBatchesResource", - "FileBatchesResourceWithRawResponse", - "AsyncFileBatchesResourceWithRawResponse", - "FileBatchesResourceWithStreamingResponse", - "AsyncFileBatchesResourceWithStreamingResponse", -] diff --git a/src/omnistack/resources/vector_stores/file_batches/file_batches.py b/src/omnistack/resources/vector_stores/file_batches/file_batches.py deleted file mode 100644 index a861b72..0000000 --- a/src/omnistack/resources/vector_stores/file_batches/file_batches.py +++ /dev/null @@ -1,404 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List - -import httpx - -from .files import ( - FilesResource, - AsyncFilesResource, - FilesResourceWithRawResponse, - AsyncFilesResourceWithRawResponse, - FilesResourceWithStreamingResponse, - AsyncFilesResourceWithStreamingResponse, -) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.vector_stores import file_batch_create_params -from ....types.vector_stores.vector_store_file_batch_object import VectorStoreFileBatchObject - -__all__ = ["FileBatchesResource", "AsyncFileBatchesResource"] - - -class FileBatchesResource(SyncAPIResource): - @cached_property - def files(self) -> FilesResource: - return FilesResource(self._client) - - @cached_property - def with_raw_response(self) -> FileBatchesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return FileBatchesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FileBatchesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return FileBatchesResourceWithStreamingResponse(self) - - def create( - self, - vector_store_id: str, - *, - file_ids: List[str], - chunking_strategy: file_batch_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileBatchObject: - """ - Create a vector store file batch. - - Args: - file_ids: A list of [File](/docs/api-reference/files) IDs that the vector store should - use. Useful for tools like `file_search` that can access files. - - chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto` - strategy. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return self._post( - f"/vector_stores/{vector_store_id}/file_batches", - body=maybe_transform( - { - "file_ids": file_ids, - "chunking_strategy": chunking_strategy, - }, - file_batch_create_params.FileBatchCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileBatchObject, - ) - - def retrieve( - self, - batch_id: str, - *, - vector_store_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileBatchObject: - """ - Retrieves a vector store file batch. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return self._get( - f"/vector_stores/{vector_store_id}/file_batches/{batch_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileBatchObject, - ) - - def cancel( - self, - batch_id: str, - *, - vector_store_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileBatchObject: - """Cancel a vector store file batch. - - This attempts to cancel the processing of - files in this batch as soon as possible. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return self._post( - f"/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileBatchObject, - ) - - -class AsyncFileBatchesResource(AsyncAPIResource): - @cached_property - def files(self) -> AsyncFilesResource: - return AsyncFilesResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncFileBatchesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncFileBatchesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFileBatchesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncFileBatchesResourceWithStreamingResponse(self) - - async def create( - self, - vector_store_id: str, - *, - file_ids: List[str], - chunking_strategy: file_batch_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileBatchObject: - """ - Create a vector store file batch. - - Args: - file_ids: A list of [File](/docs/api-reference/files) IDs that the vector store should - use. Useful for tools like `file_search` that can access files. - - chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto` - strategy. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return await self._post( - f"/vector_stores/{vector_store_id}/file_batches", - body=await async_maybe_transform( - { - "file_ids": file_ids, - "chunking_strategy": chunking_strategy, - }, - file_batch_create_params.FileBatchCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileBatchObject, - ) - - async def retrieve( - self, - batch_id: str, - *, - vector_store_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileBatchObject: - """ - Retrieves a vector store file batch. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return await self._get( - f"/vector_stores/{vector_store_id}/file_batches/{batch_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileBatchObject, - ) - - async def cancel( - self, - batch_id: str, - *, - vector_store_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileBatchObject: - """Cancel a vector store file batch. - - This attempts to cancel the processing of - files in this batch as soon as possible. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return await self._post( - f"/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileBatchObject, - ) - - -class FileBatchesResourceWithRawResponse: - def __init__(self, file_batches: FileBatchesResource) -> None: - self._file_batches = file_batches - - self.create = to_raw_response_wrapper( - file_batches.create, - ) - self.retrieve = to_raw_response_wrapper( - file_batches.retrieve, - ) - self.cancel = to_raw_response_wrapper( - file_batches.cancel, - ) - - @cached_property - def files(self) -> FilesResourceWithRawResponse: - return FilesResourceWithRawResponse(self._file_batches.files) - - -class AsyncFileBatchesResourceWithRawResponse: - def __init__(self, file_batches: AsyncFileBatchesResource) -> None: - self._file_batches = file_batches - - self.create = async_to_raw_response_wrapper( - file_batches.create, - ) - self.retrieve = async_to_raw_response_wrapper( - file_batches.retrieve, - ) - self.cancel = async_to_raw_response_wrapper( - file_batches.cancel, - ) - - @cached_property - def files(self) -> AsyncFilesResourceWithRawResponse: - return AsyncFilesResourceWithRawResponse(self._file_batches.files) - - -class FileBatchesResourceWithStreamingResponse: - def __init__(self, file_batches: FileBatchesResource) -> None: - self._file_batches = file_batches - - self.create = to_streamed_response_wrapper( - file_batches.create, - ) - self.retrieve = to_streamed_response_wrapper( - file_batches.retrieve, - ) - self.cancel = to_streamed_response_wrapper( - file_batches.cancel, - ) - - @cached_property - def files(self) -> FilesResourceWithStreamingResponse: - return FilesResourceWithStreamingResponse(self._file_batches.files) - - -class AsyncFileBatchesResourceWithStreamingResponse: - def __init__(self, file_batches: AsyncFileBatchesResource) -> None: - self._file_batches = file_batches - - self.create = async_to_streamed_response_wrapper( - file_batches.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - file_batches.retrieve, - ) - self.cancel = async_to_streamed_response_wrapper( - file_batches.cancel, - ) - - @cached_property - def files(self) -> AsyncFilesResourceWithStreamingResponse: - return AsyncFilesResourceWithStreamingResponse(self._file_batches.files) diff --git a/src/omnistack/resources/vector_stores/file_batches/files.py b/src/omnistack/resources/vector_stores/file_batches/files.py deleted file mode 100644 index b733dd3..0000000 --- a/src/omnistack/resources/vector_stores/file_batches/files.py +++ /dev/null @@ -1,248 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal - -import httpx - -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.vector_stores.file_batches import file_list_params -from ....types.vector_stores.file_batches.file_list_response import FileListResponse - -__all__ = ["FilesResource", "AsyncFilesResource"] - - -class FilesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> FilesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return FilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FilesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return FilesResourceWithStreamingResponse(self) - - def list( - self, - batch_id: str, - *, - vector_store_id: str, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - filter: Literal["in_progress", "completed", "failed", "cancelled"] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: - """ - Returns a list of vector store files in a batch. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - filter: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return self._get( - f"/vector_stores/{vector_store_id}/file_batches/{batch_id}/files", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "before": before, - "filter": filter, - "limit": limit, - "order": order, - }, - file_list_params.FileListParams, - ), - ), - cast_to=FileListResponse, - ) - - -class AsyncFilesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncFilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncFilesResourceWithStreamingResponse(self) - - async def list( - self, - batch_id: str, - *, - vector_store_id: str, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - filter: Literal["in_progress", "completed", "failed", "cancelled"] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: - """ - Returns a list of vector store files in a batch. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - filter: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not batch_id: - raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") - return await self._get( - f"/vector_stores/{vector_store_id}/file_batches/{batch_id}/files", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "before": before, - "filter": filter, - "limit": limit, - "order": order, - }, - file_list_params.FileListParams, - ), - ), - cast_to=FileListResponse, - ) - - -class FilesResourceWithRawResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.list = to_raw_response_wrapper( - files.list, - ) - - -class AsyncFilesResourceWithRawResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.list = async_to_raw_response_wrapper( - files.list, - ) - - -class FilesResourceWithStreamingResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.list = to_streamed_response_wrapper( - files.list, - ) - - -class AsyncFilesResourceWithStreamingResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.list = async_to_streamed_response_wrapper( - files.list, - ) diff --git a/src/omnistack/resources/vector_stores/files.py b/src/omnistack/resources/vector_stores/files.py deleted file mode 100644 index 9c452e9..0000000 --- a/src/omnistack/resources/vector_stores/files.py +++ /dev/null @@ -1,528 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.vector_stores import file_list_params, file_create_params -from ...types.vector_stores.file_list_response import FileListResponse -from ...types.vector_stores.file_delete_response import FileDeleteResponse -from ...types.vector_stores.vector_store_file_object import VectorStoreFileObject - -__all__ = ["FilesResource", "AsyncFilesResource"] - - -class FilesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> FilesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return FilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FilesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return FilesResourceWithStreamingResponse(self) - - def create( - self, - vector_store_id: str, - *, - file_id: str, - chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileObject: - """ - Create a vector store file by attaching a [File](/docs/api-reference/files) to a - [vector store](/docs/api-reference/vector-stores/object). - - Args: - file_id: A [File](/docs/api-reference/files) ID that the vector store should use. Useful - for tools like `file_search` that can access files. - - chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto` - strategy. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return self._post( - f"/vector_stores/{vector_store_id}/files", - body=maybe_transform( - { - "file_id": file_id, - "chunking_strategy": chunking_strategy, - }, - file_create_params.FileCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileObject, - ) - - def retrieve( - self, - file_id: str, - *, - vector_store_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileObject: - """ - Retrieves a vector store file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return self._get( - f"/vector_stores/{vector_store_id}/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileObject, - ) - - def list( - self, - vector_store_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - filter: Literal["in_progress", "completed", "failed", "cancelled"] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: - """ - Returns a list of vector store files. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - filter: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return self._get( - f"/vector_stores/{vector_store_id}/files", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "before": before, - "filter": filter, - "limit": limit, - "order": order, - }, - file_list_params.FileListParams, - ), - ), - cast_to=FileListResponse, - ) - - def delete( - self, - file_id: str, - *, - vector_store_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileDeleteResponse: - """Delete a vector store file. - - This will remove the file from the vector store but - the file itself will not be deleted. To delete the file, use the - [delete file](/docs/api-reference/files/delete) endpoint. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return self._delete( - f"/vector_stores/{vector_store_id}/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileDeleteResponse, - ) - - -class AsyncFilesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncFilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncFilesResourceWithStreamingResponse(self) - - async def create( - self, - vector_store_id: str, - *, - file_id: str, - chunking_strategy: file_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileObject: - """ - Create a vector store file by attaching a [File](/docs/api-reference/files) to a - [vector store](/docs/api-reference/vector-stores/object). - - Args: - file_id: A [File](/docs/api-reference/files) ID that the vector store should use. Useful - for tools like `file_search` that can access files. - - chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto` - strategy. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return await self._post( - f"/vector_stores/{vector_store_id}/files", - body=await async_maybe_transform( - { - "file_id": file_id, - "chunking_strategy": chunking_strategy, - }, - file_create_params.FileCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileObject, - ) - - async def retrieve( - self, - file_id: str, - *, - vector_store_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreFileObject: - """ - Retrieves a vector store file. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return await self._get( - f"/vector_stores/{vector_store_id}/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFileObject, - ) - - async def list( - self, - vector_store_id: str, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - filter: Literal["in_progress", "completed", "failed", "cancelled"] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileListResponse: - """ - Returns a list of vector store files. - - Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - filter: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return await self._get( - f"/vector_stores/{vector_store_id}/files", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "before": before, - "filter": filter, - "limit": limit, - "order": order, - }, - file_list_params.FileListParams, - ), - ), - cast_to=FileListResponse, - ) - - async def delete( - self, - file_id: str, - *, - vector_store_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FileDeleteResponse: - """Delete a vector store file. - - This will remove the file from the vector store but - the file itself will not be deleted. To delete the file, use the - [delete file](/docs/api-reference/files/delete) endpoint. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return await self._delete( - f"/vector_stores/{vector_store_id}/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileDeleteResponse, - ) - - -class FilesResourceWithRawResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.create = to_raw_response_wrapper( - files.create, - ) - self.retrieve = to_raw_response_wrapper( - files.retrieve, - ) - self.list = to_raw_response_wrapper( - files.list, - ) - self.delete = to_raw_response_wrapper( - files.delete, - ) - - -class AsyncFilesResourceWithRawResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.create = async_to_raw_response_wrapper( - files.create, - ) - self.retrieve = async_to_raw_response_wrapper( - files.retrieve, - ) - self.list = async_to_raw_response_wrapper( - files.list, - ) - self.delete = async_to_raw_response_wrapper( - files.delete, - ) - - -class FilesResourceWithStreamingResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.create = to_streamed_response_wrapper( - files.create, - ) - self.retrieve = to_streamed_response_wrapper( - files.retrieve, - ) - self.list = to_streamed_response_wrapper( - files.list, - ) - self.delete = to_streamed_response_wrapper( - files.delete, - ) - - -class AsyncFilesResourceWithStreamingResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.create = async_to_streamed_response_wrapper( - files.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - files.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - files.list, - ) - self.delete = async_to_streamed_response_wrapper( - files.delete, - ) diff --git a/src/omnistack/resources/vector_stores/vector_stores.py b/src/omnistack/resources/vector_stores/vector_stores.py deleted file mode 100644 index d5a9da2..0000000 --- a/src/omnistack/resources/vector_stores/vector_stores.py +++ /dev/null @@ -1,704 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import Literal - -import httpx - -from .files import ( - FilesResource, - AsyncFilesResource, - FilesResourceWithRawResponse, - AsyncFilesResourceWithRawResponse, - FilesResourceWithStreamingResponse, - AsyncFilesResourceWithStreamingResponse, -) -from ...types import vector_store_list_params, vector_store_create_params, vector_store_update_params -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .file_batches import ( - FileBatchesResource, - AsyncFileBatchesResource, - FileBatchesResourceWithRawResponse, - AsyncFileBatchesResourceWithRawResponse, - FileBatchesResourceWithStreamingResponse, - AsyncFileBatchesResourceWithStreamingResponse, -) -from ..._base_client import make_request_options -from .file_batches.file_batches import FileBatchesResource, AsyncFileBatchesResource -from ...types.vector_store_object import VectorStoreObject -from ...types.vector_store_list_response import VectorStoreListResponse -from ...types.vector_store_delete_response import VectorStoreDeleteResponse - -__all__ = ["VectorStoresResource", "AsyncVectorStoresResource"] - - -class VectorStoresResource(SyncAPIResource): - @cached_property - def files(self) -> FilesResource: - return FilesResource(self._client) - - @cached_property - def file_batches(self) -> FileBatchesResource: - return FileBatchesResource(self._client) - - @cached_property - def with_raw_response(self) -> VectorStoresResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return VectorStoresResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> VectorStoresResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return VectorStoresResourceWithStreamingResponse(self) - - def create( - self, - *, - chunking_strategy: vector_store_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN, - expires_after: vector_store_create_params.ExpiresAfter | NotGiven = NOT_GIVEN, - file_ids: List[str] | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreObject: - """ - Create a vector store. - - Args: - chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto` - strategy. Only applicable if `file_ids` is non-empty. - - expires_after: The expiration policy for a vector store. - - file_ids: A list of [File](/docs/api-reference/files) IDs that the vector store should - use. Useful for tools like `file_search` that can access files. - - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - name: The name of the vector store. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/vector_stores", - body=maybe_transform( - { - "chunking_strategy": chunking_strategy, - "expires_after": expires_after, - "file_ids": file_ids, - "metadata": metadata, - "name": name, - }, - vector_store_create_params.VectorStoreCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreObject, - ) - - def retrieve( - self, - vector_store_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreObject: - """ - Retrieves a vector store. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return self._get( - f"/vector_stores/{vector_store_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreObject, - ) - - def update( - self, - vector_store_id: str, - *, - expires_after: Optional[vector_store_update_params.ExpiresAfter] | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreObject: - """ - Modifies a vector store. - - Args: - expires_after: The expiration policy for a vector store. - - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - name: The name of the vector store. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return self._post( - f"/vector_stores/{vector_store_id}", - body=maybe_transform( - { - "expires_after": expires_after, - "metadata": metadata, - "name": name, - }, - vector_store_update_params.VectorStoreUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreObject, - ) - - def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreListResponse: - """Returns a list of vector stores. - - Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/vector_stores", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "after": after, - "before": before, - "limit": limit, - "order": order, - }, - vector_store_list_params.VectorStoreListParams, - ), - ), - cast_to=VectorStoreListResponse, - ) - - def delete( - self, - vector_store_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreDeleteResponse: - """ - Delete a vector store. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return self._delete( - f"/vector_stores/{vector_store_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreDeleteResponse, - ) - - -class AsyncVectorStoresResource(AsyncAPIResource): - @cached_property - def files(self) -> AsyncFilesResource: - return AsyncFilesResource(self._client) - - @cached_property - def file_batches(self) -> AsyncFileBatchesResource: - return AsyncFileBatchesResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncVectorStoresResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return the - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#accessing-raw-response-data-eg-headers - """ - return AsyncVectorStoresResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncVectorStoresResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/omnistack-python#with_streaming_response - """ - return AsyncVectorStoresResourceWithStreamingResponse(self) - - async def create( - self, - *, - chunking_strategy: vector_store_create_params.ChunkingStrategy | NotGiven = NOT_GIVEN, - expires_after: vector_store_create_params.ExpiresAfter | NotGiven = NOT_GIVEN, - file_ids: List[str] | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreObject: - """ - Create a vector store. - - Args: - chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto` - strategy. Only applicable if `file_ids` is non-empty. - - expires_after: The expiration policy for a vector store. - - file_ids: A list of [File](/docs/api-reference/files) IDs that the vector store should - use. Useful for tools like `file_search` that can access files. - - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - name: The name of the vector store. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/vector_stores", - body=await async_maybe_transform( - { - "chunking_strategy": chunking_strategy, - "expires_after": expires_after, - "file_ids": file_ids, - "metadata": metadata, - "name": name, - }, - vector_store_create_params.VectorStoreCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreObject, - ) - - async def retrieve( - self, - vector_store_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreObject: - """ - Retrieves a vector store. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return await self._get( - f"/vector_stores/{vector_store_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreObject, - ) - - async def update( - self, - vector_store_id: str, - *, - expires_after: Optional[vector_store_update_params.ExpiresAfter] | NotGiven = NOT_GIVEN, - metadata: Optional[object] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreObject: - """ - Modifies a vector store. - - Args: - expires_after: The expiration policy for a vector store. - - metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful - for storing additional information about the object in a structured format. Keys - can be a maximum of 64 characters long and values can be a maximum of 512 - characters long. - - name: The name of the vector store. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return await self._post( - f"/vector_stores/{vector_store_id}", - body=await async_maybe_transform( - { - "expires_after": expires_after, - "metadata": metadata, - "name": name, - }, - vector_store_update_params.VectorStoreUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreObject, - ) - - async def list( - self, - *, - after: str | NotGiven = NOT_GIVEN, - before: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreListResponse: - """Returns a list of vector stores. - - Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include before=obj_foo in order to - fetch the previous page of the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/vector_stores", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "after": after, - "before": before, - "limit": limit, - "order": order, - }, - vector_store_list_params.VectorStoreListParams, - ), - ), - cast_to=VectorStoreListResponse, - ) - - async def delete( - self, - vector_store_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> VectorStoreDeleteResponse: - """ - Delete a vector store. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_id: - raise ValueError(f"Expected a non-empty value for `vector_store_id` but received {vector_store_id!r}") - return await self._delete( - f"/vector_stores/{vector_store_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreDeleteResponse, - ) - - -class VectorStoresResourceWithRawResponse: - def __init__(self, vector_stores: VectorStoresResource) -> None: - self._vector_stores = vector_stores - - self.create = to_raw_response_wrapper( - vector_stores.create, - ) - self.retrieve = to_raw_response_wrapper( - vector_stores.retrieve, - ) - self.update = to_raw_response_wrapper( - vector_stores.update, - ) - self.list = to_raw_response_wrapper( - vector_stores.list, - ) - self.delete = to_raw_response_wrapper( - vector_stores.delete, - ) - - @cached_property - def files(self) -> FilesResourceWithRawResponse: - return FilesResourceWithRawResponse(self._vector_stores.files) - - @cached_property - def file_batches(self) -> FileBatchesResourceWithRawResponse: - return FileBatchesResourceWithRawResponse(self._vector_stores.file_batches) - - -class AsyncVectorStoresResourceWithRawResponse: - def __init__(self, vector_stores: AsyncVectorStoresResource) -> None: - self._vector_stores = vector_stores - - self.create = async_to_raw_response_wrapper( - vector_stores.create, - ) - self.retrieve = async_to_raw_response_wrapper( - vector_stores.retrieve, - ) - self.update = async_to_raw_response_wrapper( - vector_stores.update, - ) - self.list = async_to_raw_response_wrapper( - vector_stores.list, - ) - self.delete = async_to_raw_response_wrapper( - vector_stores.delete, - ) - - @cached_property - def files(self) -> AsyncFilesResourceWithRawResponse: - return AsyncFilesResourceWithRawResponse(self._vector_stores.files) - - @cached_property - def file_batches(self) -> AsyncFileBatchesResourceWithRawResponse: - return AsyncFileBatchesResourceWithRawResponse(self._vector_stores.file_batches) - - -class VectorStoresResourceWithStreamingResponse: - def __init__(self, vector_stores: VectorStoresResource) -> None: - self._vector_stores = vector_stores - - self.create = to_streamed_response_wrapper( - vector_stores.create, - ) - self.retrieve = to_streamed_response_wrapper( - vector_stores.retrieve, - ) - self.update = to_streamed_response_wrapper( - vector_stores.update, - ) - self.list = to_streamed_response_wrapper( - vector_stores.list, - ) - self.delete = to_streamed_response_wrapper( - vector_stores.delete, - ) - - @cached_property - def files(self) -> FilesResourceWithStreamingResponse: - return FilesResourceWithStreamingResponse(self._vector_stores.files) - - @cached_property - def file_batches(self) -> FileBatchesResourceWithStreamingResponse: - return FileBatchesResourceWithStreamingResponse(self._vector_stores.file_batches) - - -class AsyncVectorStoresResourceWithStreamingResponse: - def __init__(self, vector_stores: AsyncVectorStoresResource) -> None: - self._vector_stores = vector_stores - - self.create = async_to_streamed_response_wrapper( - vector_stores.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - vector_stores.retrieve, - ) - self.update = async_to_streamed_response_wrapper( - vector_stores.update, - ) - self.list = async_to_streamed_response_wrapper( - vector_stores.list, - ) - self.delete = async_to_streamed_response_wrapper( - vector_stores.delete, - ) - - @cached_property - def files(self) -> AsyncFilesResourceWithStreamingResponse: - return AsyncFilesResourceWithStreamingResponse(self._vector_stores.files) - - @cached_property - def file_batches(self) -> AsyncFileBatchesResourceWithStreamingResponse: - return AsyncFileBatchesResourceWithStreamingResponse(self._vector_stores.file_batches) diff --git a/src/omnistack/types/assistant_create_params.py b/src/omnistack/types/assistant_create_params.py deleted file mode 100644 index 0583bdc..0000000 --- a/src/omnistack/types/assistant_create_params.py +++ /dev/null @@ -1,281 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, List, Union, Iterable, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = [ - "AssistantCreateParams", - "ResponseFormat", - "ResponseFormatResponseFormatText", - "ResponseFormatResponseFormatJsonObject", - "ResponseFormatResponseFormatJsonSchema", - "ResponseFormatResponseFormatJsonSchemaJsonSchema", - "ToolResources", - "ToolResourcesCodeInterpreter", - "ToolResourcesFileSearch", - "Tool", - "ToolAssistantToolsCode", - "ToolAssistantToolsFileSearch", - "ToolAssistantToolsFileSearchFileSearch", - "ToolAssistantToolsFileSearchFileSearchRankingOptions", - "ToolAssistantToolsFunction", - "ToolAssistantToolsFunctionFunction", -] - - -class AssistantCreateParams(TypedDict, total=False): - description: Optional[str] - """The description of the assistant. The maximum length is 512 characters.""" - - instructions: Optional[str] - """The system instructions that the assistant uses. - - The maximum length is 256,000 characters. - """ - - metadata: Optional[object] - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - model: str - """ID of the model to use. - - You can use the [List models](/docs/api-reference/models/list) API to see all of - your available models, or see our [Model overview](/docs/models/overview) for - descriptions of them. - """ - - name: Optional[str] - """The name of the assistant. The maximum length is 256 characters.""" - - response_format: Optional[ResponseFormat] - """Specifies the format that the model must output. - - Compatible with [GPT-4o](/docs/models/gpt-4o), - [GPT-4 Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models - since `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured - Outputs which ensures the model will match your supplied JSON schema. Learn more - in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the - message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to - produce JSON yourself via a system or user message. Without this, the model may - generate an unending stream of whitespace until the generation reaches the token - limit, resulting in a long-running and seemingly "stuck" request. Also note that - the message content may be partially cut off if `finish_reason="length"`, which - indicates the generation exceeded `max_tokens` or the conversation exceeded the - max context length. - """ - - temperature: Optional[float] - """What sampling temperature to use, between 0 and 2. - - Higher values like 0.8 will make the output more random, while lower values like - 0.2 will make it more focused and deterministic. - """ - - tool_resources: Optional[ToolResources] - """A set of resources that are used by the assistant's tools. - - The resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the `file_search` - tool requires a list of vector store IDs. - """ - - tools: Iterable[Tool] - """A list of tool enabled on the assistant. - - There can be a maximum of 128 tools per assistant. Tools can be of types - `code_interpreter`, `file_search`, or `function`. - """ - - top_p: Optional[float] - """ - An alternative to sampling with temperature, called nucleus sampling, where the - model considers the results of the tokens with top_p probability mass. So 0.1 - means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - """ - - -class ResponseFormatResponseFormatText(TypedDict, total=False): - type: Required[Literal["text"]] - """The type of response format being defined: `text`""" - - -class ResponseFormatResponseFormatJsonObject(TypedDict, total=False): - type: Required[Literal["json_object"]] - """The type of response format being defined: `json_object`""" - - -class ResponseFormatResponseFormatJsonSchemaJsonSchema(TypedDict, total=False): - name: Required[str] - """The name of the response format. - - Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length - of 64. - """ - - description: str - """ - A description of what the response format is for, used by the model to determine - how to respond in the format. - """ - - schema: Dict[str, object] - """The schema for the response format, described as a JSON Schema object.""" - - strict: Optional[bool] - """Whether to enable strict schema adherence when generating the output. - - If set to true, the model will always follow the exact schema defined in the - `schema` field. Only a subset of JSON Schema is supported when `strict` is - `true`. To learn more, read the - [Structured Outputs guide](/docs/guides/structured-outputs). - """ - - -class ResponseFormatResponseFormatJsonSchema(TypedDict, total=False): - json_schema: Required[ResponseFormatResponseFormatJsonSchemaJsonSchema] - - type: Required[Literal["json_schema"]] - """The type of response format being defined: `json_schema`""" - - -ResponseFormat: TypeAlias = Union[ - Literal["auto"], - ResponseFormatResponseFormatText, - ResponseFormatResponseFormatJsonObject, - ResponseFormatResponseFormatJsonSchema, -] - - -class ToolResourcesCodeInterpreter(TypedDict, total=False): - file_ids: List[str] - """ - Overrides the list of [file](/docs/api-reference/files) IDs made available to - the `code_interpreter` tool. There can be a maximum of 20 files associated with - the tool. - """ - - -class ToolResourcesFileSearch(TypedDict, total=False): - vector_store_ids: List[str] - """ - Overrides the [vector store](/docs/api-reference/vector-stores/object) attached - to this assistant. There can be a maximum of 1 vector store attached to the - assistant. - """ - - -class ToolResources(TypedDict, total=False): - code_interpreter: ToolResourcesCodeInterpreter - - file_search: ToolResourcesFileSearch - - -class ToolAssistantToolsCode(TypedDict, total=False): - type: Required[Literal["code_interpreter"]] - """The type of tool being defined: `code_interpreter`""" - - -class ToolAssistantToolsFileSearchFileSearchRankingOptions(TypedDict, total=False): - score_threshold: Required[float] - """The score threshold for the file search. - - All values must be a floating point number between 0 and 1. - """ - - ranker: Literal["auto", "default_2024_08_21"] - """The ranker to use for the file search. - - If not specified will use the `auto` ranker. - """ - - -class ToolAssistantToolsFileSearchFileSearch(TypedDict, total=False): - max_num_results: int - """The maximum number of results the file search tool should output. - - The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number - should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - """ - - ranking_options: ToolAssistantToolsFileSearchFileSearchRankingOptions - """The ranking options for the file search. - - If not specified, the file search tool will use the `auto` ranker and a - score_threshold of 0. - - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - """ - - -class ToolAssistantToolsFileSearch(TypedDict, total=False): - type: Required[Literal["file_search"]] - """The type of tool being defined: `file_search`""" - - file_search: ToolAssistantToolsFileSearchFileSearch - """Overrides for the file search tool.""" - - -class ToolAssistantToolsFunctionFunction(TypedDict, total=False): - name: Required[str] - """The name of the function to be called. - - Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length - of 64. - """ - - description: str - """ - A description of what the function does, used by the model to choose when and - how to call the function. - """ - - parameters: Dict[str, object] - """The parameters the functions accepts, described as a JSON Schema object. - - See the [guide](/docs/guides/function-calling) for examples, and the - [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for - documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - """ - - strict: Optional[bool] - """Whether to enable strict schema adherence when generating the function call. - - If set to true, the model will follow the exact schema defined in the - `parameters` field. Only a subset of JSON Schema is supported when `strict` is - `true`. Learn more about Structured Outputs in the - [function calling guide](docs/guides/function-calling). - """ - - -class ToolAssistantToolsFunction(TypedDict, total=False): - function: Required[ToolAssistantToolsFunctionFunction] - - type: Required[Literal["function"]] - """The type of tool being defined: `function`""" - - -Tool: TypeAlias = Union[ToolAssistantToolsCode, ToolAssistantToolsFileSearch, ToolAssistantToolsFunction] diff --git a/src/omnistack/types/assistant_delete_response.py b/src/omnistack/types/assistant_delete_response.py deleted file mode 100644 index 0420704..0000000 --- a/src/omnistack/types/assistant_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["AssistantDeleteResponse"] - - -class AssistantDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["assistant.deleted"] diff --git a/src/omnistack/types/assistant_list_params.py b/src/omnistack/types/assistant_list_params.py deleted file mode 100644 index f54f631..0000000 --- a/src/omnistack/types/assistant_list_params.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["AssistantListParams"] - - -class AssistantListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - before: str - """A cursor for use in pagination. - - `before` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page - of the list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: Literal["asc", "desc"] - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ diff --git a/src/omnistack/types/assistant_list_response.py b/src/omnistack/types/assistant_list_response.py deleted file mode 100644 index dfc90bf..0000000 --- a/src/omnistack/types/assistant_list_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .._models import BaseModel -from .assistant_object import AssistantObject - -__all__ = ["AssistantListResponse"] - - -class AssistantListResponse(BaseModel): - data: List[AssistantObject] - - first_id: str - - has_more: bool - - last_id: str - - object: str diff --git a/src/omnistack/types/assistant_object.py b/src/omnistack/types/assistant_object.py deleted file mode 100644 index 9875732..0000000 --- a/src/omnistack/types/assistant_object.py +++ /dev/null @@ -1,293 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = [ - "AssistantObject", - "Tool", - "ToolAssistantToolsCode", - "ToolAssistantToolsFileSearch", - "ToolAssistantToolsFileSearchFileSearch", - "ToolAssistantToolsFileSearchFileSearchRankingOptions", - "ToolAssistantToolsFunction", - "ToolAssistantToolsFunctionFunction", - "ResponseFormat", - "ResponseFormatResponseFormatText", - "ResponseFormatResponseFormatJsonObject", - "ResponseFormatResponseFormatJsonSchema", - "ResponseFormatResponseFormatJsonSchemaJsonSchema", - "ToolResources", - "ToolResourcesCodeInterpreter", - "ToolResourcesFileSearch", -] - - -class ToolAssistantToolsCode(BaseModel): - type: Literal["code_interpreter"] - """The type of tool being defined: `code_interpreter`""" - - -class ToolAssistantToolsFileSearchFileSearchRankingOptions(BaseModel): - score_threshold: float - """The score threshold for the file search. - - All values must be a floating point number between 0 and 1. - """ - - ranker: Optional[Literal["auto", "default_2024_08_21"]] = None - """The ranker to use for the file search. - - If not specified will use the `auto` ranker. - """ - - -class ToolAssistantToolsFileSearchFileSearch(BaseModel): - max_num_results: Optional[int] = None - """The maximum number of results the file search tool should output. - - The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number - should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - """ - - ranking_options: Optional[ToolAssistantToolsFileSearchFileSearchRankingOptions] = None - """The ranking options for the file search. - - If not specified, the file search tool will use the `auto` ranker and a - score_threshold of 0. - - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - """ - - -class ToolAssistantToolsFileSearch(BaseModel): - type: Literal["file_search"] - """The type of tool being defined: `file_search`""" - - file_search: Optional[ToolAssistantToolsFileSearchFileSearch] = None - """Overrides for the file search tool.""" - - -class ToolAssistantToolsFunctionFunction(BaseModel): - name: str - """The name of the function to be called. - - Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length - of 64. - """ - - description: Optional[str] = None - """ - A description of what the function does, used by the model to choose when and - how to call the function. - """ - - parameters: Optional[Dict[str, object]] = None - """The parameters the functions accepts, described as a JSON Schema object. - - See the [guide](/docs/guides/function-calling) for examples, and the - [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for - documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - """ - - strict: Optional[bool] = None - """Whether to enable strict schema adherence when generating the function call. - - If set to true, the model will follow the exact schema defined in the - `parameters` field. Only a subset of JSON Schema is supported when `strict` is - `true`. Learn more about Structured Outputs in the - [function calling guide](docs/guides/function-calling). - """ - - -class ToolAssistantToolsFunction(BaseModel): - function: ToolAssistantToolsFunctionFunction - - type: Literal["function"] - """The type of tool being defined: `function`""" - - -Tool: TypeAlias = Union[ToolAssistantToolsCode, ToolAssistantToolsFileSearch, ToolAssistantToolsFunction] - - -class ResponseFormatResponseFormatText(BaseModel): - type: Literal["text"] - """The type of response format being defined: `text`""" - - -class ResponseFormatResponseFormatJsonObject(BaseModel): - type: Literal["json_object"] - """The type of response format being defined: `json_object`""" - - -class ResponseFormatResponseFormatJsonSchemaJsonSchema(BaseModel): - name: str - """The name of the response format. - - Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length - of 64. - """ - - description: Optional[str] = None - """ - A description of what the response format is for, used by the model to determine - how to respond in the format. - """ - - schema_: Optional[Dict[str, object]] = FieldInfo(alias="schema", default=None) - """The schema for the response format, described as a JSON Schema object.""" - - strict: Optional[bool] = None - """Whether to enable strict schema adherence when generating the output. - - If set to true, the model will always follow the exact schema defined in the - `schema` field. Only a subset of JSON Schema is supported when `strict` is - `true`. To learn more, read the - [Structured Outputs guide](/docs/guides/structured-outputs). - """ - - -class ResponseFormatResponseFormatJsonSchema(BaseModel): - json_schema: ResponseFormatResponseFormatJsonSchemaJsonSchema - - type: Literal["json_schema"] - """The type of response format being defined: `json_schema`""" - - -ResponseFormat: TypeAlias = Union[ - Literal["auto"], - ResponseFormatResponseFormatText, - ResponseFormatResponseFormatJsonObject, - ResponseFormatResponseFormatJsonSchema, - None, -] - - -class ToolResourcesCodeInterpreter(BaseModel): - file_ids: Optional[List[str]] = None - """ - A list of [file](/docs/api-reference/files) IDs made available to the - `code_interpreter`` tool. There can be a maximum of 20 files associated with the - tool. - """ - - -class ToolResourcesFileSearch(BaseModel): - vector_store_ids: Optional[List[str]] = None - """ - The ID of the [vector store](/docs/api-reference/vector-stores/object) attached - to this assistant. There can be a maximum of 1 vector store attached to the - assistant. - """ - - -class ToolResources(BaseModel): - code_interpreter: Optional[ToolResourcesCodeInterpreter] = None - - file_search: Optional[ToolResourcesFileSearch] = None - - -class AssistantObject(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints.""" - - created_at: int - """The Unix timestamp (in seconds) for when the assistant was created.""" - - description: Optional[str] = None - """The description of the assistant. The maximum length is 512 characters.""" - - instructions: Optional[str] = None - """The system instructions that the assistant uses. - - The maximum length is 256,000 characters. - """ - - metadata: Optional[object] = None - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - model: str - """ID of the model to use. - - You can use the [List models](/docs/api-reference/models/list) API to see all of - your available models, or see our [Model overview](/docs/models/overview) for - descriptions of them. - """ - - name: Optional[str] = None - """The name of the assistant. The maximum length is 256 characters.""" - - object: Literal["assistant"] - """The object type, which is always `assistant`.""" - - tools: List[Tool] - """A list of tool enabled on the assistant. - - There can be a maximum of 128 tools per assistant. Tools can be of types - `code_interpreter`, `file_search`, or `function`. - """ - - response_format: Optional[ResponseFormat] = None - """Specifies the format that the model must output. - - Compatible with [GPT-4o](/docs/models/gpt-4o), - [GPT-4 Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models - since `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured - Outputs which ensures the model will match your supplied JSON schema. Learn more - in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the - message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to - produce JSON yourself via a system or user message. Without this, the model may - generate an unending stream of whitespace until the generation reaches the token - limit, resulting in a long-running and seemingly "stuck" request. Also note that - the message content may be partially cut off if `finish_reason="length"`, which - indicates the generation exceeded `max_tokens` or the conversation exceeded the - max context length. - """ - - temperature: Optional[float] = None - """What sampling temperature to use, between 0 and 2. - - Higher values like 0.8 will make the output more random, while lower values like - 0.2 will make it more focused and deterministic. - """ - - tool_resources: Optional[ToolResources] = None - """A set of resources that are used by the assistant's tools. - - The resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the `file_search` - tool requires a list of vector store IDs. - """ - - top_p: Optional[float] = None - """ - An alternative to sampling with temperature, called nucleus sampling, where the - model considers the results of the tokens with top_p probability mass. So 0.1 - means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - """ diff --git a/src/omnistack/types/assistants/__init__.py b/src/omnistack/types/assistants/__init__.py deleted file mode 100644 index 0a9d22d..0000000 --- a/src/omnistack/types/assistants/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .run_object import RunObject as RunObject -from .thread_object import ThreadObject as ThreadObject -from .message_object import MessageObject as MessageObject diff --git a/src/omnistack/types/assistants/message_object.py b/src/omnistack/types/assistants/message_object.py deleted file mode 100644 index 62f5b14..0000000 --- a/src/omnistack/types/assistants/message_object.py +++ /dev/null @@ -1,234 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from ..._models import BaseModel - -__all__ = [ - "MessageObject", - "Attachment", - "AttachmentTool", - "AttachmentToolAssistantToolsCode", - "AttachmentToolAssistantToolsFileSearchTypeOnly", - "Content", - "ContentMessageContentImageFileObject", - "ContentMessageContentImageFileObjectImageFile", - "ContentMessageContentImageURLObject", - "ContentMessageContentImageURLObjectImageURL", - "ContentMessageContentTextObject", - "ContentMessageContentTextObjectText", - "ContentMessageContentTextObjectTextAnnotation", - "ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFileCitationObject", - "ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFileCitationObjectFileCitation", - "ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFilePathObject", - "ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFilePathObjectFilePath", - "ContentMessageContentRefusalObject", - "IncompleteDetails", -] - - -class AttachmentToolAssistantToolsCode(BaseModel): - type: Literal["code_interpreter"] - """The type of tool being defined: `code_interpreter`""" - - -class AttachmentToolAssistantToolsFileSearchTypeOnly(BaseModel): - type: Literal["file_search"] - """The type of tool being defined: `file_search`""" - - -AttachmentTool: TypeAlias = Union[AttachmentToolAssistantToolsCode, AttachmentToolAssistantToolsFileSearchTypeOnly] - - -class Attachment(BaseModel): - file_id: Optional[str] = None - """The ID of the file to attach to the message.""" - - tools: Optional[List[AttachmentTool]] = None - """The tools to add this file to.""" - - -class ContentMessageContentImageFileObjectImageFile(BaseModel): - file_id: str - """The [File](/docs/api-reference/files) ID of the image in the message content. - - Set `purpose="vision"` when uploading the File if you need to later display the - file content. - """ - - detail: Optional[Literal["auto", "low", "high"]] = None - """Specifies the detail level of the image if specified by the user. - - `low` uses fewer tokens, you can opt in to high resolution using `high`. - """ - - -class ContentMessageContentImageFileObject(BaseModel): - image_file: ContentMessageContentImageFileObjectImageFile - - type: Literal["image_file"] - """Always `image_file`.""" - - -class ContentMessageContentImageURLObjectImageURL(BaseModel): - url: str - """ - The external URL of the image, must be a supported image types: jpeg, jpg, png, - gif, webp. - """ - - detail: Optional[Literal["auto", "low", "high"]] = None - """Specifies the detail level of the image. - - `low` uses fewer tokens, you can opt in to high resolution using `high`. Default - value is `auto` - """ - - -class ContentMessageContentImageURLObject(BaseModel): - image_url: ContentMessageContentImageURLObjectImageURL - - type: Literal["image_url"] - """The type of the content part.""" - - -class ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFileCitationObjectFileCitation( - BaseModel -): - file_id: str - """The ID of the specific File the citation is from.""" - - -class ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFileCitationObject(BaseModel): - end_index: int - - file_citation: ( - ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFileCitationObjectFileCitation - ) - - start_index: int - - text: str - """The text in the message content that needs to be replaced.""" - - type: Literal["file_citation"] - """Always `file_citation`.""" - - -class ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFilePathObjectFilePath(BaseModel): - file_id: str - """The ID of the file that was generated.""" - - -class ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFilePathObject(BaseModel): - end_index: int - - file_path: ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFilePathObjectFilePath - - start_index: int - - text: str - """The text in the message content that needs to be replaced.""" - - type: Literal["file_path"] - """Always `file_path`.""" - - -ContentMessageContentTextObjectTextAnnotation: TypeAlias = Union[ - ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFileCitationObject, - ContentMessageContentTextObjectTextAnnotationMessageContentTextAnnotationsFilePathObject, -] - - -class ContentMessageContentTextObjectText(BaseModel): - annotations: List[ContentMessageContentTextObjectTextAnnotation] - - value: str - """The data that makes up the text.""" - - -class ContentMessageContentTextObject(BaseModel): - text: ContentMessageContentTextObjectText - - type: Literal["text"] - """Always `text`.""" - - -class ContentMessageContentRefusalObject(BaseModel): - refusal: str - - type: Literal["refusal"] - """Always `refusal`.""" - - -Content: TypeAlias = Union[ - ContentMessageContentImageFileObject, - ContentMessageContentImageURLObject, - ContentMessageContentTextObject, - ContentMessageContentRefusalObject, -] - - -class IncompleteDetails(BaseModel): - reason: Literal["content_filter", "max_tokens", "run_cancelled", "run_expired", "run_failed"] - """The reason the message is incomplete.""" - - -class MessageObject(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints.""" - - assistant_id: Optional[str] = None - """ - If applicable, the ID of the [assistant](/docs/api-reference/assistants) that - authored this message. - """ - - attachments: Optional[List[Attachment]] = None - """A list of files attached to the message, and the tools they were added to.""" - - completed_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the message was completed.""" - - content: List[Content] - """The content of the message in array of text and/or images.""" - - created_at: int - """The Unix timestamp (in seconds) for when the message was created.""" - - incomplete_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the message was marked as incomplete.""" - - incomplete_details: Optional[IncompleteDetails] = None - """On an incomplete message, details about why the message is incomplete.""" - - metadata: Optional[object] = None - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - object: Literal["thread.message"] - """The object type, which is always `thread.message`.""" - - role: Literal["user", "assistant"] - """The entity that produced the message. One of `user` or `assistant`.""" - - run_id: Optional[str] = None - """ - The ID of the [run](/docs/api-reference/runs) associated with the creation of - this message. Value is `null` when messages are created manually using the - create message or create thread endpoints. - """ - - status: Literal["in_progress", "incomplete", "completed"] - """ - The status of the message, which can be either `in_progress`, `incomplete`, or - `completed`. - """ - - thread_id: str - """The [thread](/docs/api-reference/threads) ID that this message belongs to.""" diff --git a/src/omnistack/types/assistants/run_object.py b/src/omnistack/types/assistants/run_object.py deleted file mode 100644 index af73b03..0000000 --- a/src/omnistack/types/assistants/run_object.py +++ /dev/null @@ -1,452 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = [ - "RunObject", - "IncompleteDetails", - "LastError", - "RequiredAction", - "RequiredActionSubmitToolOutputs", - "RequiredActionSubmitToolOutputsToolCall", - "RequiredActionSubmitToolOutputsToolCallFunction", - "ResponseFormat", - "ResponseFormatResponseFormatText", - "ResponseFormatResponseFormatJsonObject", - "ResponseFormatResponseFormatJsonSchema", - "ResponseFormatResponseFormatJsonSchemaJsonSchema", - "ToolChoice", - "ToolChoiceAssistantsNamedToolChoice", - "ToolChoiceAssistantsNamedToolChoiceFunction", - "Tool", - "ToolAssistantToolsCode", - "ToolAssistantToolsFileSearch", - "ToolAssistantToolsFileSearchFileSearch", - "ToolAssistantToolsFileSearchFileSearchRankingOptions", - "ToolAssistantToolsFunction", - "ToolAssistantToolsFunctionFunction", - "TruncationStrategy", - "Usage", -] - - -class IncompleteDetails(BaseModel): - reason: Optional[Literal["max_completion_tokens", "max_prompt_tokens"]] = None - """The reason why the run is incomplete. - - This will point to which specific token limit was reached over the course of the - run. - """ - - -class LastError(BaseModel): - code: Literal["server_error", "rate_limit_exceeded", "invalid_prompt"] - """One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.""" - - message: str - """A human-readable description of the error.""" - - -class RequiredActionSubmitToolOutputsToolCallFunction(BaseModel): - arguments: str - """The arguments that the model expects you to pass to the function.""" - - name: str - """The name of the function.""" - - -class RequiredActionSubmitToolOutputsToolCall(BaseModel): - id: str - """The ID of the tool call. - - This ID must be referenced when you submit the tool outputs in using the - [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) - endpoint. - """ - - function: RequiredActionSubmitToolOutputsToolCallFunction - """The function definition.""" - - type: Literal["function"] - """The type of tool call the output is required for. - - For now, this is always `function`. - """ - - -class RequiredActionSubmitToolOutputs(BaseModel): - tool_calls: List[RequiredActionSubmitToolOutputsToolCall] - """A list of the relevant tool calls.""" - - -class RequiredAction(BaseModel): - submit_tool_outputs: RequiredActionSubmitToolOutputs - """Details on the tool outputs needed for this run to continue.""" - - type: Literal["submit_tool_outputs"] - """For now, this is always `submit_tool_outputs`.""" - - -class ResponseFormatResponseFormatText(BaseModel): - type: Literal["text"] - """The type of response format being defined: `text`""" - - -class ResponseFormatResponseFormatJsonObject(BaseModel): - type: Literal["json_object"] - """The type of response format being defined: `json_object`""" - - -class ResponseFormatResponseFormatJsonSchemaJsonSchema(BaseModel): - name: str - """The name of the response format. - - Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length - of 64. - """ - - description: Optional[str] = None - """ - A description of what the response format is for, used by the model to determine - how to respond in the format. - """ - - schema_: Optional[Dict[str, object]] = FieldInfo(alias="schema", default=None) - """The schema for the response format, described as a JSON Schema object.""" - - strict: Optional[bool] = None - """Whether to enable strict schema adherence when generating the output. - - If set to true, the model will always follow the exact schema defined in the - `schema` field. Only a subset of JSON Schema is supported when `strict` is - `true`. To learn more, read the - [Structured Outputs guide](/docs/guides/structured-outputs). - """ - - -class ResponseFormatResponseFormatJsonSchema(BaseModel): - json_schema: ResponseFormatResponseFormatJsonSchemaJsonSchema - - type: Literal["json_schema"] - """The type of response format being defined: `json_schema`""" - - -ResponseFormat: TypeAlias = Union[ - Literal["auto"], - ResponseFormatResponseFormatText, - ResponseFormatResponseFormatJsonObject, - ResponseFormatResponseFormatJsonSchema, - None, -] - - -class ToolChoiceAssistantsNamedToolChoiceFunction(BaseModel): - name: str - """The name of the function to call.""" - - -class ToolChoiceAssistantsNamedToolChoice(BaseModel): - type: Literal["function", "code_interpreter", "file_search"] - """The type of the tool. If type is `function`, the function name must be set""" - - function: Optional[ToolChoiceAssistantsNamedToolChoiceFunction] = None - - -ToolChoice: TypeAlias = Union[Literal["none", "auto", "required"], ToolChoiceAssistantsNamedToolChoice, None] - - -class ToolAssistantToolsCode(BaseModel): - type: Literal["code_interpreter"] - """The type of tool being defined: `code_interpreter`""" - - -class ToolAssistantToolsFileSearchFileSearchRankingOptions(BaseModel): - score_threshold: float - """The score threshold for the file search. - - All values must be a floating point number between 0 and 1. - """ - - ranker: Optional[Literal["auto", "default_2024_08_21"]] = None - """The ranker to use for the file search. - - If not specified will use the `auto` ranker. - """ - - -class ToolAssistantToolsFileSearchFileSearch(BaseModel): - max_num_results: Optional[int] = None - """The maximum number of results the file search tool should output. - - The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number - should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - """ - - ranking_options: Optional[ToolAssistantToolsFileSearchFileSearchRankingOptions] = None - """The ranking options for the file search. - - If not specified, the file search tool will use the `auto` ranker and a - score_threshold of 0. - - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - """ - - -class ToolAssistantToolsFileSearch(BaseModel): - type: Literal["file_search"] - """The type of tool being defined: `file_search`""" - - file_search: Optional[ToolAssistantToolsFileSearchFileSearch] = None - """Overrides for the file search tool.""" - - -class ToolAssistantToolsFunctionFunction(BaseModel): - name: str - """The name of the function to be called. - - Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length - of 64. - """ - - description: Optional[str] = None - """ - A description of what the function does, used by the model to choose when and - how to call the function. - """ - - parameters: Optional[Dict[str, object]] = None - """The parameters the functions accepts, described as a JSON Schema object. - - See the [guide](/docs/guides/function-calling) for examples, and the - [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for - documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - """ - - strict: Optional[bool] = None - """Whether to enable strict schema adherence when generating the function call. - - If set to true, the model will follow the exact schema defined in the - `parameters` field. Only a subset of JSON Schema is supported when `strict` is - `true`. Learn more about Structured Outputs in the - [function calling guide](docs/guides/function-calling). - """ - - -class ToolAssistantToolsFunction(BaseModel): - function: ToolAssistantToolsFunctionFunction - - type: Literal["function"] - """The type of tool being defined: `function`""" - - -Tool: TypeAlias = Union[ToolAssistantToolsCode, ToolAssistantToolsFileSearch, ToolAssistantToolsFunction] - - -class TruncationStrategy(BaseModel): - type: Literal["auto", "last_messages"] - """The truncation strategy to use for the thread. - - The default is `auto`. If set to `last_messages`, the thread will be truncated - to the n most recent messages in the thread. When set to `auto`, messages in the - middle of the thread will be dropped to fit the context length of the model, - `max_prompt_tokens`. - """ - - last_messages: Optional[int] = None - """ - The number of most recent messages from the thread when constructing the context - for the run. - """ - - -class Usage(BaseModel): - completion_tokens: int - """Number of completion tokens used over the course of the run.""" - - prompt_tokens: int - """Number of prompt tokens used over the course of the run.""" - - total_tokens: int - """Total number of tokens used (prompt + completion).""" - - -class RunObject(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints.""" - - assistant_id: str - """ - The ID of the [assistant](/docs/api-reference/assistants) used for execution of - this run. - """ - - cancelled_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the run was cancelled.""" - - completed_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the run was completed.""" - - created_at: int - """The Unix timestamp (in seconds) for when the run was created.""" - - expires_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the run will expire.""" - - failed_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the run failed.""" - - incomplete_details: Optional[IncompleteDetails] = None - """Details on why the run is incomplete. - - Will be `null` if the run is not incomplete. - """ - - instructions: str - """ - The instructions that the [assistant](/docs/api-reference/assistants) used for - this run. - """ - - last_error: Optional[LastError] = None - """The last error associated with this run. Will be `null` if there are no errors.""" - - max_completion_tokens: Optional[int] = None - """ - The maximum number of completion tokens specified to have been used over the - course of the run. - """ - - max_prompt_tokens: Optional[int] = None - """ - The maximum number of prompt tokens specified to have been used over the course - of the run. - """ - - metadata: Optional[object] = None - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - model: str - """ - The model that the [assistant](/docs/api-reference/assistants) used for this - run. - """ - - object: Literal["thread.run"] - """The object type, which is always `thread.run`.""" - - parallel_tool_calls: bool - """ - Whether to enable - [parallel function calling](/docs/guides/function-calling/parallel-function-calling) - during tool use. - """ - - required_action: Optional[RequiredAction] = None - """Details on the action required to continue the run. - - Will be `null` if no action is required. - """ - - response_format: Optional[ResponseFormat] = None - """Specifies the format that the model must output. - - Compatible with [GPT-4o](/docs/models/gpt-4o), - [GPT-4 Turbo](/docs/models/gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models - since `gpt-3.5-turbo-1106`. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured - Outputs which ensures the model will match your supplied JSON schema. Learn more - in the [Structured Outputs guide](/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the - message the model generates is valid JSON. - - **Important:** when using JSON mode, you **must** also instruct the model to - produce JSON yourself via a system or user message. Without this, the model may - generate an unending stream of whitespace until the generation reaches the token - limit, resulting in a long-running and seemingly "stuck" request. Also note that - the message content may be partially cut off if `finish_reason="length"`, which - indicates the generation exceeded `max_tokens` or the conversation exceeded the - max context length. - """ - - started_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the run was started.""" - - status: Literal[ - "queued", - "in_progress", - "requires_action", - "cancelling", - "cancelled", - "failed", - "completed", - "incomplete", - "expired", - ] - """ - The status of the run, which can be either `queued`, `in_progress`, - `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, - `incomplete`, or `expired`. - """ - - thread_id: str - """ - The ID of the [thread](/docs/api-reference/threads) that was executed on as a - part of this run. - """ - - tool_choice: Optional[ToolChoice] = None - """ - Controls which (if any) tool is called by the model. `none` means the model will - not call any tools and instead generates a message. `auto` is the default value - and means the model can pick between generating a message or calling one or more - tools. `required` means the model must call one or more tools before responding - to the user. Specifying a particular tool like `{"type": "file_search"}` or - `{"type": "function", "function": {"name": "my_function"}}` forces the model to - call that tool. - """ - - tools: List[Tool] - """ - The list of tools that the [assistant](/docs/api-reference/assistants) used for - this run. - """ - - truncation_strategy: Optional[TruncationStrategy] = None - """Controls for how a thread will be truncated prior to the run. - - Use this to control the intial context window of the run. - """ - - usage: Optional[Usage] = None - """Usage statistics related to the run. - - This value will be `null` if the run is not in a terminal state (i.e. - `in_progress`, `queued`, etc.). - """ - - temperature: Optional[float] = None - """The sampling temperature used for this run. If not set, defaults to 1.""" - - top_p: Optional[float] = None - """The nucleus sampling value used for this run. If not set, defaults to 1.""" diff --git a/src/omnistack/types/assistants/thread_object.py b/src/omnistack/types/assistants/thread_object.py deleted file mode 100644 index c126b21..0000000 --- a/src/omnistack/types/assistants/thread_object.py +++ /dev/null @@ -1,58 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["ThreadObject", "ToolResources", "ToolResourcesCodeInterpreter", "ToolResourcesFileSearch"] - - -class ToolResourcesCodeInterpreter(BaseModel): - file_ids: Optional[List[str]] = None - """ - A list of [file](/docs/api-reference/files) IDs made available to the - `code_interpreter` tool. There can be a maximum of 20 files associated with the - tool. - """ - - -class ToolResourcesFileSearch(BaseModel): - vector_store_ids: Optional[List[str]] = None - """ - The [vector store](/docs/api-reference/vector-stores/object) attached to this - thread. There can be a maximum of 1 vector store attached to the thread. - """ - - -class ToolResources(BaseModel): - code_interpreter: Optional[ToolResourcesCodeInterpreter] = None - - file_search: Optional[ToolResourcesFileSearch] = None - - -class ThreadObject(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints.""" - - created_at: int - """The Unix timestamp (in seconds) for when the thread was created.""" - - metadata: Optional[object] = None - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - object: Literal["thread"] - """The object type, which is always `thread`.""" - - tool_resources: Optional[ToolResources] = None - """ - A set of resources that are made available to the assistant's tools in this - thread. The resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the `file_search` - tool requires a list of vector store IDs. - """ diff --git a/src/omnistack/types/audio/__init__.py b/src/omnistack/types/audio/__init__.py deleted file mode 100644 index 6cc7122..0000000 --- a/src/omnistack/types/audio/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .speech_create_params import SpeechCreateParams as SpeechCreateParams -from .translation_create_params import TranslationCreateParams as TranslationCreateParams -from .transcription_create_params import TranscriptionCreateParams as TranscriptionCreateParams -from .translation_create_response import TranslationCreateResponse as TranslationCreateResponse -from .transcription_create_response import TranscriptionCreateResponse as TranscriptionCreateResponse diff --git a/src/omnistack/types/audio/speech_create_params.py b/src/omnistack/types/audio/speech_create_params.py deleted file mode 100644 index 8c86c76..0000000 --- a/src/omnistack/types/audio/speech_create_params.py +++ /dev/null @@ -1,36 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["SpeechCreateParams"] - - -class SpeechCreateParams(TypedDict, total=False): - input: Required[str] - """The text to generate audio for. The maximum length is 4096 characters.""" - - model: Required[Union[str, Literal["tts-1", "tts-1-hd"]]] - """One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd`""" - - voice: Required[Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"]] - """The voice to use when generating the audio. - - Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. - Previews of the voices are available in the - [Text to speech guide](/docs/guides/text-to-speech/voice-options). - """ - - response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] - """The format to audio in. - - Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`. - """ - - speed: float - """The speed of the generated audio. - - Select a value from `0.25` to `4.0`. `1.0` is the default. - """ diff --git a/src/omnistack/types/audio/transcription_create_params.py b/src/omnistack/types/audio/transcription_create_params.py deleted file mode 100644 index 607fff6..0000000 --- a/src/omnistack/types/audio/transcription_create_params.py +++ /dev/null @@ -1,65 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union -from typing_extensions import Literal, Required, TypedDict - -from ..._types import FileTypes - -__all__ = ["TranscriptionCreateParams"] - - -class TranscriptionCreateParams(TypedDict, total=False): - file: Required[FileTypes] - """ - The audio file object (not file name) to transcribe, in one of these formats: - flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - """ - - model: Required[Union[str, Literal["whisper-1"]]] - """ID of the model to use. - - Only `whisper-1` (which is powered by our open source Whisper V2 model) is - currently available. - """ - - language: str - """The language of the input audio. - - Supplying the input language in - [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will - improve accuracy and latency. - """ - - prompt: str - """An optional text to guide the model's style or continue a previous audio - segment. - - The [prompt](/docs/guides/speech-to-text/prompting) should match the audio - language. - """ - - response_format: Literal["json", "text", "srt", "verbose_json", "vtt"] - """ - The format of the output, in one of these options: `json`, `text`, `srt`, - `verbose_json`, or `vtt`. - """ - - temperature: float - """The sampling temperature, between 0 and 1. - - Higher values like 0.8 will make the output more random, while lower values like - 0.2 will make it more focused and deterministic. If set to 0, the model will use - [log probability](https://en.wikipedia.org/wiki/Log_probability) to - automatically increase the temperature until certain thresholds are hit. - """ - - timestamp_granularities: List[Literal["word", "segment"]] - """The timestamp granularities to populate for this transcription. - - `response_format` must be set `verbose_json` to use timestamp granularities. - Either or both of these options are supported: `word`, or `segment`. Note: There - is no additional latency for segment timestamps, but generating word timestamps - incurs additional latency. - """ diff --git a/src/omnistack/types/audio/transcription_create_response.py b/src/omnistack/types/audio/transcription_create_response.py deleted file mode 100644 index 965d7dc..0000000 --- a/src/omnistack/types/audio/transcription_create_response.py +++ /dev/null @@ -1,92 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import TypeAlias - -from ..._models import BaseModel - -__all__ = [ - "TranscriptionCreateResponse", - "CreateTranscriptionResponseJson", - "CreateTranscriptionResponseVerboseJson", - "CreateTranscriptionResponseVerboseJsonSegment", - "CreateTranscriptionResponseVerboseJsonWord", -] - - -class CreateTranscriptionResponseJson(BaseModel): - text: str - """The transcribed text.""" - - -class CreateTranscriptionResponseVerboseJsonSegment(BaseModel): - id: int - """Unique identifier of the segment.""" - - avg_logprob: float - """Average logprob of the segment. - - If the value is lower than -1, consider the logprobs failed. - """ - - compression_ratio: float - """Compression ratio of the segment. - - If the value is greater than 2.4, consider the compression failed. - """ - - end: float - """End time of the segment in seconds.""" - - no_speech_prob: float - """Probability of no speech in the segment. - - If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this - segment silent. - """ - - seek: int - """Seek offset of the segment.""" - - start: float - """Start time of the segment in seconds.""" - - temperature: float - """Temperature parameter used for generating the segment.""" - - text: str - """Text content of the segment.""" - - tokens: List[int] - """Array of token IDs for the text content.""" - - -class CreateTranscriptionResponseVerboseJsonWord(BaseModel): - end: float - """End time of the word in seconds.""" - - start: float - """Start time of the word in seconds.""" - - word: str - """The text content of the word.""" - - -class CreateTranscriptionResponseVerboseJson(BaseModel): - duration: float - """The duration of the input audio.""" - - language: str - """The language of the input audio.""" - - text: str - """The transcribed text.""" - - segments: Optional[List[CreateTranscriptionResponseVerboseJsonSegment]] = None - """Segments of the transcribed text and their corresponding details.""" - - words: Optional[List[CreateTranscriptionResponseVerboseJsonWord]] = None - """Extracted words and their corresponding timestamps.""" - - -TranscriptionCreateResponse: TypeAlias = Union[CreateTranscriptionResponseJson, CreateTranscriptionResponseVerboseJson] diff --git a/src/omnistack/types/audio/translation_create_params.py b/src/omnistack/types/audio/translation_create_params.py deleted file mode 100644 index e025fc4..0000000 --- a/src/omnistack/types/audio/translation_create_params.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, TypedDict - -from ..._types import FileTypes - -__all__ = ["TranslationCreateParams"] - - -class TranslationCreateParams(TypedDict, total=False): - file: Required[FileTypes] - """ - The audio file object (not file name) translate, in one of these formats: flac, - mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - """ - - model: Required[Union[str, Literal["whisper-1"]]] - """ID of the model to use. - - Only `whisper-1` (which is powered by our open source Whisper V2 model) is - currently available. - """ - - prompt: str - """An optional text to guide the model's style or continue a previous audio - segment. - - The [prompt](/docs/guides/speech-to-text/prompting) should be in English. - """ - - response_format: Literal["json", "text", "srt", "verbose_json", "vtt"] - """ - The format of the output, in one of these options: `json`, `text`, `srt`, - `verbose_json`, or `vtt`. - """ - - temperature: float - """The sampling temperature, between 0 and 1. - - Higher values like 0.8 will make the output more random, while lower values like - 0.2 will make it more focused and deterministic. If set to 0, the model will use - [log probability](https://en.wikipedia.org/wiki/Log_probability) to - automatically increase the temperature until certain thresholds are hit. - """ diff --git a/src/omnistack/types/audio/translation_create_response.py b/src/omnistack/types/audio/translation_create_response.py deleted file mode 100644 index 5918ca8..0000000 --- a/src/omnistack/types/audio/translation_create_response.py +++ /dev/null @@ -1,76 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import TypeAlias - -from ..._models import BaseModel - -__all__ = [ - "TranslationCreateResponse", - "CreateTranslationResponseJson", - "CreateTranslationResponseVerboseJson", - "CreateTranslationResponseVerboseJsonSegment", -] - - -class CreateTranslationResponseJson(BaseModel): - text: str - - -class CreateTranslationResponseVerboseJsonSegment(BaseModel): - id: int - """Unique identifier of the segment.""" - - avg_logprob: float - """Average logprob of the segment. - - If the value is lower than -1, consider the logprobs failed. - """ - - compression_ratio: float - """Compression ratio of the segment. - - If the value is greater than 2.4, consider the compression failed. - """ - - end: float - """End time of the segment in seconds.""" - - no_speech_prob: float - """Probability of no speech in the segment. - - If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this - segment silent. - """ - - seek: int - """Seek offset of the segment.""" - - start: float - """Start time of the segment in seconds.""" - - temperature: float - """Temperature parameter used for generating the segment.""" - - text: str - """Text content of the segment.""" - - tokens: List[int] - """Array of token IDs for the text content.""" - - -class CreateTranslationResponseVerboseJson(BaseModel): - duration: float - """The duration of the input audio.""" - - language: str - """The language of the output translation (always `english`).""" - - text: str - """The translated text.""" - - segments: Optional[List[CreateTranslationResponseVerboseJsonSegment]] = None - """Segments of the translated text and their corresponding details.""" - - -TranslationCreateResponse: TypeAlias = Union[CreateTranslationResponseJson, CreateTranslationResponseVerboseJson] diff --git a/src/omnistack/types/batch.py b/src/omnistack/types/batch.py deleted file mode 100644 index b2d100b..0000000 --- a/src/omnistack/types/batch.py +++ /dev/null @@ -1,108 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import builtins -from typing import List, Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["Batch", "Errors", "ErrorsData", "RequestCounts"] - - -class ErrorsData(BaseModel): - code: Optional[str] = None - """An error code identifying the error type.""" - - line: Optional[int] = None - """The line number of the input file where the error occurred, if applicable.""" - - message: Optional[str] = None - """A human-readable message providing more details about the error.""" - - param: Optional[str] = None - """The name of the parameter that caused the error, if applicable.""" - - -class Errors(BaseModel): - data: Optional[List[ErrorsData]] = None - - object: Optional[str] = None - """The object type, which is always `list`.""" - - -class RequestCounts(BaseModel): - completed: int - """Number of requests that have been completed successfully.""" - - failed: int - """Number of requests that have failed.""" - - total: int - """Total number of requests in the batch.""" - - -class Batch(BaseModel): - id: str - - completion_window: str - """The time frame within which the batch should be processed.""" - - created_at: int - """The Unix timestamp (in seconds) for when the batch was created.""" - - endpoint: str - """The OpenAI API endpoint used by the batch.""" - - input_file_id: str - """The ID of the input file for the batch.""" - - object: Literal["batch"] - """The object type, which is always `batch`.""" - - status: Literal[ - "validating", "failed", "in_progress", "finalizing", "completed", "expired", "cancelling", "cancelled" - ] - """The current status of the batch.""" - - cancelled_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the batch was cancelled.""" - - cancelling_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the batch started cancelling.""" - - completed_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the batch was completed.""" - - error_file_id: Optional[str] = None - """The ID of the file containing the outputs of requests with errors.""" - - errors: Optional[Errors] = None - - expired_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the batch expired.""" - - expires_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the batch will expire.""" - - failed_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the batch failed.""" - - finalizing_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the batch started finalizing.""" - - in_progress_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the batch started processing.""" - - metadata: Optional[builtins.object] = None - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - output_file_id: Optional[str] = None - """The ID of the file containing the outputs of successfully executed requests.""" - - request_counts: Optional[RequestCounts] = None - """The request counts for different statuses within the batch.""" diff --git a/src/omnistack/types/batch_create_params.py b/src/omnistack/types/batch_create_params.py deleted file mode 100644 index 8ef7b83..0000000 --- a/src/omnistack/types/batch_create_params.py +++ /dev/null @@ -1,38 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["BatchCreateParams"] - - -class BatchCreateParams(TypedDict, total=False): - completion_window: Required[Literal["24h"]] - """The time frame within which the batch should be processed. - - Currently only `24h` is supported. - """ - - endpoint: Required[Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"]] - """The endpoint to be used for all requests in the batch. - - Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are - supported. Note that `/v1/embeddings` batches are also restricted to a maximum - of 50,000 embedding inputs across all requests in the batch. - """ - - input_file_id: Required[str] - """The ID of an uploaded file that contains requests for the new batch. - - See [upload file](/docs/api-reference/files/create) for how to upload a file. - - Your input file must be formatted as a - [JSONL file](/docs/api-reference/batch/request-input), and must be uploaded with - the purpose `batch`. The file can contain up to 50,000 requests, and can be up - to 100 MB in size. - """ - - metadata: Optional[Dict[str, str]] - """Optional custom metadata for the batch.""" diff --git a/src/omnistack/types/batch_list_params.py b/src/omnistack/types/batch_list_params.py deleted file mode 100644 index ef5e966..0000000 --- a/src/omnistack/types/batch_list_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["BatchListParams"] - - -class BatchListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ diff --git a/src/omnistack/types/batch_list_response.py b/src/omnistack/types/batch_list_response.py deleted file mode 100644 index 87c4f9b..0000000 --- a/src/omnistack/types/batch_list_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from .batch import Batch -from .._models import BaseModel - -__all__ = ["BatchListResponse"] - - -class BatchListResponse(BaseModel): - data: List[Batch] - - has_more: bool - - object: Literal["list"] - - first_id: Optional[str] = None - - last_id: Optional[str] = None diff --git a/src/omnistack/types/embedding_create_params.py b/src/omnistack/types/embedding_create_params.py deleted file mode 100644 index ec0c885..0000000 --- a/src/omnistack/types/embedding_create_params.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["EmbeddingCreateParams"] - - -class EmbeddingCreateParams(TypedDict, total=False): - input: Required[Union[str, List[str], Iterable[int], Iterable[Iterable[int]]]] - """Input text to embed, encoded as a string or array of tokens. - - To embed multiple inputs in a single request, pass an array of strings or array - of token arrays. The input must not exceed the max input tokens for the model - (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any - array must be 2048 dimensions or less. - [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - for counting tokens. - """ - - model: Required[Union[str, Literal["text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large"]]] - """ID of the model to use. - - You can use the [List models](/docs/api-reference/models/list) API to see all of - your available models, or see our [Model overview](/docs/models/overview) for - descriptions of them. - """ - - dimensions: int - """The number of dimensions the resulting output embeddings should have. - - Only supported in `text-embedding-3` and later models. - """ - - encoding_format: Literal["float", "base64"] - """The format to return the embeddings in. - - Can be either `float` or [`base64`](https://pypi.org/project/pybase64/). - """ - - user: str - """ - A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - """ diff --git a/src/omnistack/types/embedding_create_response.py b/src/omnistack/types/embedding_create_response.py deleted file mode 100644 index e85daab..0000000 --- a/src/omnistack/types/embedding_create_response.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["EmbeddingCreateResponse", "Data", "Usage"] - - -class Data(BaseModel): - embedding: List[float] - """The embedding vector, which is a list of floats. - - The length of vector depends on the model as listed in the - [embedding guide](/docs/guides/embeddings). - """ - - index: int - """The index of the embedding in the list of embeddings.""" - - object: Literal["embedding"] - """The object type, which is always "embedding".""" - - -class Usage(BaseModel): - prompt_tokens: int - """The number of tokens used by the prompt.""" - - total_tokens: int - """The total number of tokens used by the request.""" - - -class EmbeddingCreateResponse(BaseModel): - data: List[Data] - """The list of embeddings generated by the model.""" - - model: str - """The name of the model used to generate the embedding.""" - - object: Literal["list"] - """The object type, which is always "list".""" - - usage: Usage - """The usage information for the request.""" diff --git a/src/omnistack/types/file_create_params.py b/src/omnistack/types/file_create_params.py deleted file mode 100644 index e301e88..0000000 --- a/src/omnistack/types/file_create_params.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -from .._types import FileTypes - -__all__ = ["FileCreateParams"] - - -class FileCreateParams(TypedDict, total=False): - file: Required[FileTypes] - """The File object (not file name) to be uploaded.""" - - purpose: Required[Literal["assistants", "batch", "fine-tune", "vision"]] - """The intended purpose of the uploaded file. - - Use "assistants" for [Assistants](/docs/api-reference/assistants) and - [Message](/docs/api-reference/messages) files, "vision" for Assistants image - file inputs, "batch" for [Batch API](/docs/guides/batch), and "fine-tune" for - [Fine-tuning](/docs/api-reference/fine-tuning). - """ diff --git a/src/omnistack/types/file_delete_response.py b/src/omnistack/types/file_delete_response.py deleted file mode 100644 index 26e2e05..0000000 --- a/src/omnistack/types/file_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["FileDeleteResponse"] - - -class FileDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["file"] diff --git a/src/omnistack/types/file_list_params.py b/src/omnistack/types/file_list_params.py deleted file mode 100644 index 212eca1..0000000 --- a/src/omnistack/types/file_list_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["FileListParams"] - - -class FileListParams(TypedDict, total=False): - purpose: str - """Only return files with the given purpose.""" diff --git a/src/omnistack/types/file_list_response.py b/src/omnistack/types/file_list_response.py deleted file mode 100644 index 60b1b42..0000000 --- a/src/omnistack/types/file_list_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from .._models import BaseModel -from .openai_file import OpenAIFile - -__all__ = ["FileListResponse"] - - -class FileListResponse(BaseModel): - data: List[OpenAIFile] - - object: Literal["list"] diff --git a/src/omnistack/types/files/__init__.py b/src/omnistack/types/files/__init__.py deleted file mode 100644 index 0784a6a..0000000 --- a/src/omnistack/types/files/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .content_retrieve_response import ContentRetrieveResponse as ContentRetrieveResponse diff --git a/src/omnistack/types/files/content_retrieve_response.py b/src/omnistack/types/files/content_retrieve_response.py deleted file mode 100644 index 831ef54..0000000 --- a/src/omnistack/types/files/content_retrieve_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import TypeAlias - -__all__ = ["ContentRetrieveResponse"] - -ContentRetrieveResponse: TypeAlias = str diff --git a/src/omnistack/types/fine_tuning/__init__.py b/src/omnistack/types/fine_tuning/__init__.py deleted file mode 100644 index b6967b2..0000000 --- a/src/omnistack/types/fine_tuning/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .fine_tuning_job import FineTuningJob as FineTuningJob -from .job_list_params import JobListParams as JobListParams -from .job_create_params import JobCreateParams as JobCreateParams -from .job_list_response import JobListResponse as JobListResponse diff --git a/src/omnistack/types/fine_tuning/fine_tuning_job.py b/src/omnistack/types/fine_tuning/fine_tuning_job.py deleted file mode 100644 index c22015d..0000000 --- a/src/omnistack/types/fine_tuning/fine_tuning_job.py +++ /dev/null @@ -1,157 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["FineTuningJob", "Error", "Hyperparameters", "Integration", "IntegrationWandb"] - - -class Error(BaseModel): - code: str - """A machine-readable error code.""" - - message: str - """A human-readable error message.""" - - param: Optional[str] = None - """The parameter that was invalid, usually `training_file` or `validation_file`. - - This field will be null if the failure was not parameter-specific. - """ - - -class Hyperparameters(BaseModel): - n_epochs: Union[Literal["auto"], int] - """The number of epochs to train the model for. - - An epoch refers to one full cycle through the training dataset. "auto" decides - the optimal number of epochs based on the size of the dataset. If setting the - number manually, we support any number between 1 and 50 epochs. - """ - - -class IntegrationWandb(BaseModel): - project: str - """The name of the project that the new run will be created under.""" - - entity: Optional[str] = None - """The entity to use for the run. - - This allows you to set the team or username of the WandB user that you would - like associated with the run. If not set, the default entity for the registered - WandB API key is used. - """ - - name: Optional[str] = None - """A display name to set for the run. - - If not set, we will use the Job ID as the name. - """ - - tags: Optional[List[str]] = None - """A list of tags to be attached to the newly created run. - - These tags are passed through directly to WandB. Some default tags are generated - by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". - """ - - -class Integration(BaseModel): - type: Literal["wandb"] - """The type of the integration being enabled for the fine-tuning job""" - - wandb: IntegrationWandb - """The settings for your integration with Weights and Biases. - - This payload specifies the project that metrics will be sent to. Optionally, you - can set an explicit display name for your run, add tags to your run, and set a - default entity (team, username, etc) to be associated with your run. - """ - - -class FineTuningJob(BaseModel): - id: str - """The object identifier, which can be referenced in the API endpoints.""" - - created_at: int - """The Unix timestamp (in seconds) for when the fine-tuning job was created.""" - - error: Optional[Error] = None - """ - For fine-tuning jobs that have `failed`, this will contain more information on - the cause of the failure. - """ - - fine_tuned_model: Optional[str] = None - """The name of the fine-tuned model that is being created. - - The value will be null if the fine-tuning job is still running. - """ - - finished_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the fine-tuning job was finished. - - The value will be null if the fine-tuning job is still running. - """ - - hyperparameters: Hyperparameters - """The hyperparameters used for the fine-tuning job. - - See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. - """ - - model: str - """The base model that is being fine-tuned.""" - - object: Literal["fine_tuning.job"] - """The object type, which is always "fine_tuning.job".""" - - organization_id: str - """The organization that owns the fine-tuning job.""" - - result_files: List[str] - """The compiled results file ID(s) for the fine-tuning job. - - You can retrieve the results with the - [Files API](/docs/api-reference/files/retrieve-contents). - """ - - seed: int - """The seed used for the fine-tuning job.""" - - status: Literal["validating_files", "queued", "running", "succeeded", "failed", "cancelled"] - """ - The current status of the fine-tuning job, which can be either - `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. - """ - - trained_tokens: Optional[int] = None - """The total number of billable tokens processed by this fine-tuning job. - - The value will be null if the fine-tuning job is still running. - """ - - training_file: str - """The file ID used for training. - - You can retrieve the training data with the - [Files API](/docs/api-reference/files/retrieve-contents). - """ - - validation_file: Optional[str] = None - """The file ID used for validation. - - You can retrieve the validation results with the - [Files API](/docs/api-reference/files/retrieve-contents). - """ - - estimated_finish: Optional[int] = None - """ - The Unix timestamp (in seconds) for when the fine-tuning job is estimated to - finish. The value will be null if the fine-tuning job is not running. - """ - - integrations: Optional[List[Integration]] = None - """A list of integrations to enable for this fine-tuning job.""" diff --git a/src/omnistack/types/fine_tuning/job_create_params.py b/src/omnistack/types/fine_tuning/job_create_params.py deleted file mode 100644 index dbbeddb..0000000 --- a/src/omnistack/types/fine_tuning/job_create_params.py +++ /dev/null @@ -1,132 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable, Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["JobCreateParams", "Hyperparameters", "Integration", "IntegrationWandb"] - - -class JobCreateParams(TypedDict, total=False): - model: Required[Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"]]] - """The name of the model to fine-tune. - - You can select one of the - [supported models](/docs/guides/fine-tuning/which-models-can-be-fine-tuned). - """ - - training_file: Required[str] - """The ID of an uploaded file that contains training data. - - See [upload file](/docs/api-reference/files/create) for how to upload a file. - - Your dataset must be formatted as a JSONL file. Additionally, you must upload - your file with the purpose `fine-tune`. - - The contents of the file should differ depending on if the model uses the - [chat](/docs/api-reference/fine-tuning/chat-input) or - [completions](/docs/api-reference/fine-tuning/completions-input) format. - - See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. - """ - - hyperparameters: Hyperparameters - """The hyperparameters used for the fine-tuning job.""" - - integrations: Optional[Iterable[Integration]] - """A list of integrations to enable for your fine-tuning job.""" - - seed: Optional[int] - """The seed controls the reproducibility of the job. - - Passing in the same seed and job parameters should produce the same results, but - may differ in rare cases. If a seed is not specified, one will be generated for - you. - """ - - suffix: Optional[str] - """ - A string of up to 64 characters that will be added to your fine-tuned model - name. - - For example, a `suffix` of "custom-model-name" would produce a model name like - `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. - """ - - validation_file: Optional[str] - """The ID of an uploaded file that contains validation data. - - If you provide this file, the data is used to generate validation metrics - periodically during fine-tuning. These metrics can be viewed in the fine-tuning - results file. The same data should not be present in both train and validation - files. - - Your dataset must be formatted as a JSONL file. You must upload your file with - the purpose `fine-tune`. - - See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. - """ - - -class Hyperparameters(TypedDict, total=False): - batch_size: Union[Literal["auto"], int] - """Number of examples in each batch. - - A larger batch size means that model parameters are updated less frequently, but - with lower variance. - """ - - learning_rate_multiplier: Union[Literal["auto"], float] - """Scaling factor for the learning rate. - - A smaller learning rate may be useful to avoid overfitting. - """ - - n_epochs: Union[Literal["auto"], int] - """The number of epochs to train the model for. - - An epoch refers to one full cycle through the training dataset. - """ - - -class IntegrationWandb(TypedDict, total=False): - project: Required[str] - """The name of the project that the new run will be created under.""" - - entity: Optional[str] - """The entity to use for the run. - - This allows you to set the team or username of the WandB user that you would - like associated with the run. If not set, the default entity for the registered - WandB API key is used. - """ - - name: Optional[str] - """A display name to set for the run. - - If not set, we will use the Job ID as the name. - """ - - tags: List[str] - """A list of tags to be attached to the newly created run. - - These tags are passed through directly to WandB. Some default tags are generated - by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". - """ - - -class Integration(TypedDict, total=False): - type: Required[Literal["wandb"]] - """The type of integration to enable. - - Currently, only "wandb" (Weights and Biases) is supported. - """ - - wandb: Required[IntegrationWandb] - """The settings for your integration with Weights and Biases. - - This payload specifies the project that metrics will be sent to. Optionally, you - can set an explicit display name for your run, add tags to your run, and set a - default entity (team, username, etc) to be associated with your run. - """ diff --git a/src/omnistack/types/fine_tuning/job_list_params.py b/src/omnistack/types/fine_tuning/job_list_params.py deleted file mode 100644 index 5c075ca..0000000 --- a/src/omnistack/types/fine_tuning/job_list_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["JobListParams"] - - -class JobListParams(TypedDict, total=False): - after: str - """Identifier for the last job from the previous pagination request.""" - - limit: int - """Number of fine-tuning jobs to retrieve.""" diff --git a/src/omnistack/types/fine_tuning/job_list_response.py b/src/omnistack/types/fine_tuning/job_list_response.py deleted file mode 100644 index ea6eb6a..0000000 --- a/src/omnistack/types/fine_tuning/job_list_response.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from ..._models import BaseModel -from .fine_tuning_job import FineTuningJob - -__all__ = ["JobListResponse"] - - -class JobListResponse(BaseModel): - data: List[FineTuningJob] - - has_more: bool - - object: Literal["list"] diff --git a/src/omnistack/types/fine_tuning/jobs/__init__.py b/src/omnistack/types/fine_tuning/jobs/__init__.py deleted file mode 100644 index b42de56..0000000 --- a/src/omnistack/types/fine_tuning/jobs/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .event_retrieve_params import EventRetrieveParams as EventRetrieveParams -from .checkpoint_list_params import CheckpointListParams as CheckpointListParams -from .event_retrieve_response import EventRetrieveResponse as EventRetrieveResponse -from .checkpoint_list_response import CheckpointListResponse as CheckpointListResponse diff --git a/src/omnistack/types/fine_tuning/jobs/checkpoint_list_params.py b/src/omnistack/types/fine_tuning/jobs/checkpoint_list_params.py deleted file mode 100644 index adceb3b..0000000 --- a/src/omnistack/types/fine_tuning/jobs/checkpoint_list_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["CheckpointListParams"] - - -class CheckpointListParams(TypedDict, total=False): - after: str - """Identifier for the last checkpoint ID from the previous pagination request.""" - - limit: int - """Number of checkpoints to retrieve.""" diff --git a/src/omnistack/types/fine_tuning/jobs/checkpoint_list_response.py b/src/omnistack/types/fine_tuning/jobs/checkpoint_list_response.py deleted file mode 100644 index 2b8331b..0000000 --- a/src/omnistack/types/fine_tuning/jobs/checkpoint_list_response.py +++ /dev/null @@ -1,59 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["CheckpointListResponse", "Data", "DataMetrics"] - - -class DataMetrics(BaseModel): - full_valid_loss: Optional[float] = None - - full_valid_mean_token_accuracy: Optional[float] = None - - step: Optional[float] = None - - train_loss: Optional[float] = None - - train_mean_token_accuracy: Optional[float] = None - - valid_loss: Optional[float] = None - - valid_mean_token_accuracy: Optional[float] = None - - -class Data(BaseModel): - id: str - """The checkpoint identifier, which can be referenced in the API endpoints.""" - - created_at: int - """The Unix timestamp (in seconds) for when the checkpoint was created.""" - - fine_tuned_model_checkpoint: str - """The name of the fine-tuned checkpoint model that is created.""" - - fine_tuning_job_id: str - """The name of the fine-tuning job that this checkpoint was created from.""" - - metrics: DataMetrics - """Metrics at the step number during the fine-tuning job.""" - - object: Literal["fine_tuning.job.checkpoint"] - """The object type, which is always "fine_tuning.job.checkpoint".""" - - step_number: int - """The step number that the checkpoint was created at.""" - - -class CheckpointListResponse(BaseModel): - data: List[Data] - - has_more: bool - - object: Literal["list"] - - first_id: Optional[str] = None - - last_id: Optional[str] = None diff --git a/src/omnistack/types/fine_tuning/jobs/event_retrieve_params.py b/src/omnistack/types/fine_tuning/jobs/event_retrieve_params.py deleted file mode 100644 index f0162e0..0000000 --- a/src/omnistack/types/fine_tuning/jobs/event_retrieve_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["EventRetrieveParams"] - - -class EventRetrieveParams(TypedDict, total=False): - after: str - """Identifier for the last event from the previous pagination request.""" - - limit: int - """Number of events to retrieve.""" diff --git a/src/omnistack/types/fine_tuning/jobs/event_retrieve_response.py b/src/omnistack/types/fine_tuning/jobs/event_retrieve_response.py deleted file mode 100644 index e676b7d..0000000 --- a/src/omnistack/types/fine_tuning/jobs/event_retrieve_response.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["EventRetrieveResponse", "Data"] - - -class Data(BaseModel): - id: str - - created_at: int - - level: Literal["info", "warn", "error"] - - message: str - - object: Literal["fine_tuning.job.event"] - - -class EventRetrieveResponse(BaseModel): - data: List[Data] - - object: Literal["list"] diff --git a/src/omnistack/types/image_response.py b/src/omnistack/types/image_response.py deleted file mode 100644 index 496654d..0000000 --- a/src/omnistack/types/image_response.py +++ /dev/null @@ -1,30 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .._models import BaseModel - -__all__ = ["ImageResponse", "Data"] - - -class Data(BaseModel): - b64_json: Optional[str] = None - """ - The base64-encoded JSON of the generated image, if `response_format` is - `b64_json`. - """ - - revised_prompt: Optional[str] = None - """ - The prompt that was used to generate the image, if there was any revision to the - prompt. - """ - - url: Optional[str] = None - """The URL of the generated image, if `response_format` is `url` (default).""" - - -class ImageResponse(BaseModel): - created: int - - data: List[Data] diff --git a/src/omnistack/types/images/__init__.py b/src/omnistack/types/images/__init__.py deleted file mode 100644 index 6490a1a..0000000 --- a/src/omnistack/types/images/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .edit_create_params import EditCreateParams as EditCreateParams -from .variation_create_params import VariationCreateParams as VariationCreateParams -from .generation_create_params import GenerationCreateParams as GenerationCreateParams diff --git a/src/omnistack/types/images/edit_create_params.py b/src/omnistack/types/images/edit_create_params.py deleted file mode 100644 index 2e5b469..0000000 --- a/src/omnistack/types/images/edit_create_params.py +++ /dev/null @@ -1,60 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Optional -from typing_extensions import Literal, Required, TypedDict - -from ..._types import FileTypes - -__all__ = ["EditCreateParams"] - - -class EditCreateParams(TypedDict, total=False): - image: Required[FileTypes] - """The image to edit. - - Must be a valid PNG file, less than 4MB, and square. If mask is not provided, - image must have transparency, which will be used as the mask. - """ - - prompt: Required[str] - """A text description of the desired image(s). - - The maximum length is 1000 characters. - """ - - mask: FileTypes - """An additional image whose fully transparent areas (e.g. - - where alpha is zero) indicate where `image` should be edited. Must be a valid - PNG file, less than 4MB, and have the same dimensions as `image`. - """ - - model: Union[str, Literal["dall-e-2"], None] - """The model to use for image generation. - - Only `dall-e-2` is supported at this time. - """ - - n: Optional[int] - """The number of images to generate. Must be between 1 and 10.""" - - response_format: Optional[Literal["url", "b64_json"]] - """The format in which the generated images are returned. - - Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the - image has been generated. - """ - - size: Optional[Literal["256x256", "512x512", "1024x1024"]] - """The size of the generated images. - - Must be one of `256x256`, `512x512`, or `1024x1024`. - """ - - user: str - """ - A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - """ diff --git a/src/omnistack/types/images/generation_create_params.py b/src/omnistack/types/images/generation_create_params.py deleted file mode 100644 index 8b17a8f..0000000 --- a/src/omnistack/types/images/generation_create_params.py +++ /dev/null @@ -1,62 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["GenerationCreateParams"] - - -class GenerationCreateParams(TypedDict, total=False): - prompt: Required[str] - """A text description of the desired image(s). - - The maximum length is 1000 characters for `dall-e-2` and 4000 characters for - `dall-e-3`. - """ - - model: Union[str, Literal["dall-e-2", "dall-e-3"], None] - """The model to use for image generation.""" - - n: Optional[int] - """The number of images to generate. - - Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. - """ - - quality: Literal["standard", "hd"] - """The quality of the image that will be generated. - - `hd` creates images with finer details and greater consistency across the image. - This param is only supported for `dall-e-3`. - """ - - response_format: Optional[Literal["url", "b64_json"]] - """The format in which the generated images are returned. - - Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the - image has been generated. - """ - - size: Optional[Literal["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"]] - """The size of the generated images. - - Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one - of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models. - """ - - style: Optional[Literal["vivid", "natural"]] - """The style of the generated images. - - Must be one of `vivid` or `natural`. Vivid causes the model to lean towards - generating hyper-real and dramatic images. Natural causes the model to produce - more natural, less hyper-real looking images. This param is only supported for - `dall-e-3`. - """ - - user: str - """ - A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - """ diff --git a/src/omnistack/types/images/variation_create_params.py b/src/omnistack/types/images/variation_create_params.py deleted file mode 100644 index 708e3f2..0000000 --- a/src/omnistack/types/images/variation_create_params.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Optional -from typing_extensions import Literal, Required, TypedDict - -from ..._types import FileTypes - -__all__ = ["VariationCreateParams"] - - -class VariationCreateParams(TypedDict, total=False): - image: Required[FileTypes] - """The image to use as the basis for the variation(s). - - Must be a valid PNG file, less than 4MB, and square. - """ - - model: Union[str, Literal["dall-e-2"], None] - """The model to use for image generation. - - Only `dall-e-2` is supported at this time. - """ - - n: Optional[int] - """The number of images to generate. - - Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. - """ - - response_format: Optional[Literal["url", "b64_json"]] - """The format in which the generated images are returned. - - Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the - image has been generated. - """ - - size: Optional[Literal["256x256", "512x512", "1024x1024"]] - """The size of the generated images. - - Must be one of `256x256`, `512x512`, or `1024x1024`. - """ - - user: str - """ - A unique identifier representing your end-user, which can help OpenAI to monitor - and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - """ diff --git a/src/omnistack/types/model.py b/src/omnistack/types/model.py deleted file mode 100644 index 2631ee8..0000000 --- a/src/omnistack/types/model.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["Model"] - - -class Model(BaseModel): - id: str - """The model identifier, which can be referenced in the API endpoints.""" - - created: int - """The Unix timestamp (in seconds) when the model was created.""" - - object: Literal["model"] - """The object type, which is always "model".""" - - owned_by: str - """The organization that owns the model.""" diff --git a/src/omnistack/types/model_delete_response.py b/src/omnistack/types/model_delete_response.py deleted file mode 100644 index 11a9ace..0000000 --- a/src/omnistack/types/model_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - - -from .._models import BaseModel - -__all__ = ["ModelDeleteResponse"] - - -class ModelDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: str diff --git a/src/omnistack/types/model_list_response.py b/src/omnistack/types/model_list_response.py deleted file mode 100644 index 8f83544..0000000 --- a/src/omnistack/types/model_list_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from .model import Model -from .._models import BaseModel - -__all__ = ["ModelListResponse"] - - -class ModelListResponse(BaseModel): - data: List[Model] - - object: Literal["list"] diff --git a/src/omnistack/types/moderation_create_params.py b/src/omnistack/types/moderation_create_params.py deleted file mode 100644 index 0252bdd..0000000 --- a/src/omnistack/types/moderation_create_params.py +++ /dev/null @@ -1,59 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = [ - "ModerationCreateParams", - "InputUnionMember2", - "InputUnionMember2UnionMember0", - "InputUnionMember2UnionMember0ImageURL", - "InputUnionMember2UnionMember1", -] - - -class ModerationCreateParams(TypedDict, total=False): - input: Required[Union[str, List[str], Iterable[InputUnionMember2]]] - """Input (or inputs) to classify. - - Can be a single string, an array of strings, or an array of multi-modal input - objects similar to other models. - """ - - model: Union[ - str, - Literal[ - "omni-moderation-latest", "omni-moderation-2024-09-26", "text-moderation-latest", "text-moderation-stable" - ], - ] - """The content moderation model you would like to use. - - Learn more in [the moderation guide](/docs/guides/moderation), and learn about - available models [here](/docs/models/moderation). - """ - - -class InputUnionMember2UnionMember0ImageURL(TypedDict, total=False): - url: Required[str] - """Either a URL of the image or the base64 encoded image data.""" - - -class InputUnionMember2UnionMember0(TypedDict, total=False): - image_url: Required[InputUnionMember2UnionMember0ImageURL] - """Contains either an image URL or a data URL for a base64 encoded image.""" - - type: Required[Literal["image_url"]] - """Always `image_url`.""" - - -class InputUnionMember2UnionMember1(TypedDict, total=False): - text: Required[str] - """A string of text to classify.""" - - type: Required[Literal["text"]] - """Always `text`.""" - - -InputUnionMember2: TypeAlias = Union[InputUnionMember2UnionMember0, InputUnionMember2UnionMember1] diff --git a/src/omnistack/types/moderation_create_response.py b/src/omnistack/types/moderation_create_response.py deleted file mode 100644 index e7b4762..0000000 --- a/src/omnistack/types/moderation_create_response.py +++ /dev/null @@ -1,203 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = [ - "ModerationCreateResponse", - "Result", - "ResultCategories", - "ResultCategoryAppliedInputTypes", - "ResultCategoryScores", -] - - -class ResultCategories(BaseModel): - harassment: bool - """ - Content that expresses, incites, or promotes harassing language towards any - target. - """ - - harassment_threatening: bool = FieldInfo(alias="harassment/threatening") - """ - Harassment content that also includes violence or serious harm towards any - target. - """ - - hate: bool - """ - Content that expresses, incites, or promotes hate based on race, gender, - ethnicity, religion, nationality, sexual orientation, disability status, or - caste. Hateful content aimed at non-protected groups (e.g., chess players) is - harassment. - """ - - hate_threatening: bool = FieldInfo(alias="hate/threatening") - """ - Hateful content that also includes violence or serious harm towards the targeted - group based on race, gender, ethnicity, religion, nationality, sexual - orientation, disability status, or caste. - """ - - illicit: bool - """ - Content that includes instructions or advice that facilitate the planning or - execution of wrongdoing, or that gives advice or instruction on how to commit - illicit acts. For example, "how to shoplift" would fit this category. - """ - - illicit_violent: bool = FieldInfo(alias="illicit/violent") - """ - Content that includes instructions or advice that facilitate the planning or - execution of wrongdoing that also includes violence, or that gives advice or - instruction on the procurement of any weapon. - """ - - self_harm: bool = FieldInfo(alias="self-harm") - """ - Content that promotes, encourages, or depicts acts of self-harm, such as - suicide, cutting, and eating disorders. - """ - - self_harm_instructions: bool = FieldInfo(alias="self-harm/instructions") - """ - Content that encourages performing acts of self-harm, such as suicide, cutting, - and eating disorders, or that gives instructions or advice on how to commit such - acts. - """ - - self_harm_intent: bool = FieldInfo(alias="self-harm/intent") - """ - Content where the speaker expresses that they are engaging or intend to engage - in acts of self-harm, such as suicide, cutting, and eating disorders. - """ - - sexual: bool - """ - Content meant to arouse sexual excitement, such as the description of sexual - activity, or that promotes sexual services (excluding sex education and - wellness). - """ - - sexual_minors: bool = FieldInfo(alias="sexual/minors") - """Sexual content that includes an individual who is under 18 years old.""" - - violence: bool - """Content that depicts death, violence, or physical injury.""" - - violence_graphic: bool = FieldInfo(alias="violence/graphic") - """Content that depicts death, violence, or physical injury in graphic detail.""" - - -class ResultCategoryAppliedInputTypes(BaseModel): - harassment: List[Literal["text"]] - """The applied input type(s) for the category 'harassment'.""" - - harassment_threatening: List[Literal["text"]] = FieldInfo(alias="harassment/threatening") - """The applied input type(s) for the category 'harassment/threatening'.""" - - hate: List[Literal["text"]] - """The applied input type(s) for the category 'hate'.""" - - hate_threatening: List[Literal["text"]] = FieldInfo(alias="hate/threatening") - """The applied input type(s) for the category 'hate/threatening'.""" - - illicit: List[Literal["text"]] - """The applied input type(s) for the category 'illicit'.""" - - illicit_violent: List[Literal["text"]] = FieldInfo(alias="illicit/violent") - """The applied input type(s) for the category 'illicit/violent'.""" - - self_harm: List[Literal["text", "image"]] = FieldInfo(alias="self-harm") - """The applied input type(s) for the category 'self-harm'.""" - - self_harm_instructions: List[Literal["text", "image"]] = FieldInfo(alias="self-harm/instructions") - """The applied input type(s) for the category 'self-harm/instructions'.""" - - self_harm_intent: List[Literal["text", "image"]] = FieldInfo(alias="self-harm/intent") - """The applied input type(s) for the category 'self-harm/intent'.""" - - sexual: List[Literal["text", "image"]] - """The applied input type(s) for the category 'sexual'.""" - - sexual_minors: List[Literal["text"]] = FieldInfo(alias="sexual/minors") - """The applied input type(s) for the category 'sexual/minors'.""" - - violence: List[Literal["text", "image"]] - """The applied input type(s) for the category 'violence'.""" - - violence_graphic: List[Literal["text", "image"]] = FieldInfo(alias="violence/graphic") - """The applied input type(s) for the category 'violence/graphic'.""" - - -class ResultCategoryScores(BaseModel): - harassment: float - """The score for the category 'harassment'.""" - - harassment_threatening: float = FieldInfo(alias="harassment/threatening") - """The score for the category 'harassment/threatening'.""" - - hate: float - """The score for the category 'hate'.""" - - hate_threatening: float = FieldInfo(alias="hate/threatening") - """The score for the category 'hate/threatening'.""" - - illicit: float - """The score for the category 'illicit'.""" - - illicit_violent: float = FieldInfo(alias="illicit/violent") - """The score for the category 'illicit/violent'.""" - - self_harm: float = FieldInfo(alias="self-harm") - """The score for the category 'self-harm'.""" - - self_harm_instructions: float = FieldInfo(alias="self-harm/instructions") - """The score for the category 'self-harm/instructions'.""" - - self_harm_intent: float = FieldInfo(alias="self-harm/intent") - """The score for the category 'self-harm/intent'.""" - - sexual: float - """The score for the category 'sexual'.""" - - sexual_minors: float = FieldInfo(alias="sexual/minors") - """The score for the category 'sexual/minors'.""" - - violence: float - """The score for the category 'violence'.""" - - violence_graphic: float = FieldInfo(alias="violence/graphic") - """The score for the category 'violence/graphic'.""" - - -class Result(BaseModel): - categories: ResultCategories - """A list of the categories, and whether they are flagged or not.""" - - category_applied_input_types: ResultCategoryAppliedInputTypes - """ - A list of the categories along with the input type(s) that the score applies to. - """ - - category_scores: ResultCategoryScores - """A list of the categories along with their scores as predicted by model.""" - - flagged: bool - """Whether any of the below categories are flagged.""" - - -class ModerationCreateResponse(BaseModel): - id: str - """The unique identifier for the moderation request.""" - - model: str - """The model used to generate the moderation results.""" - - results: List[Result] - """A list of moderation objects.""" diff --git a/src/omnistack/types/openai_file.py b/src/omnistack/types/openai_file.py deleted file mode 100644 index c4bbe7d..0000000 --- a/src/omnistack/types/openai_file.py +++ /dev/null @@ -1,48 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["OpenAIFile"] - - -class OpenAIFile(BaseModel): - id: str - """The file identifier, which can be referenced in the API endpoints.""" - - bytes: int - """The size of the file, in bytes.""" - - created_at: int - """The Unix timestamp (in seconds) for when the file was created.""" - - filename: str - """The name of the file.""" - - object: Literal["file"] - """The object type, which is always `file`.""" - - purpose: Literal[ - "assistants", "assistants_output", "batch", "batch_output", "fine-tune", "fine-tune-results", "vision" - ] - """The intended purpose of the file. - - Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, - `fine-tune`, `fine-tune-results` and `vision`. - """ - - status: Literal["uploaded", "processed", "error"] - """Deprecated. - - The current status of the file, which can be either `uploaded`, `processed`, or - `error`. - """ - - status_details: Optional[str] = None - """Deprecated. - - For details on why a fine-tuning training file failed validation, see the - `error` field on `fine_tuning.job`. - """ diff --git a/src/omnistack/types/organization/__init__.py b/src/omnistack/types/organization/__init__.py deleted file mode 100644 index c82e35a..0000000 --- a/src/omnistack/types/organization/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .user import User as User -from .invite import Invite as Invite -from .project import Project as Project -from .user_list_params import UserListParams as UserListParams -from .invite_list_params import InviteListParams as InviteListParams -from .user_create_params import UserCreateParams as UserCreateParams -from .user_list_response import UserListResponse as UserListResponse -from .project_list_params import ProjectListParams as ProjectListParams -from .invite_create_params import InviteCreateParams as InviteCreateParams -from .invite_list_response import InviteListResponse as InviteListResponse -from .user_delete_response import UserDeleteResponse as UserDeleteResponse -from .audit_log_list_params import AuditLogListParams as AuditLogListParams -from .project_create_params import ProjectCreateParams as ProjectCreateParams -from .project_list_response import ProjectListResponse as ProjectListResponse -from .invite_delete_response import InviteDeleteResponse as InviteDeleteResponse -from .audit_log_list_response import AuditLogListResponse as AuditLogListResponse diff --git a/src/omnistack/types/organization/audit_log_list_params.py b/src/omnistack/types/organization/audit_log_list_params.py deleted file mode 100644 index bacd4e8..0000000 --- a/src/omnistack/types/organization/audit_log_list_params.py +++ /dev/null @@ -1,108 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Literal, TypedDict - -__all__ = ["AuditLogListParams", "EffectiveAt"] - - -class AuditLogListParams(TypedDict, total=False): - actor_emails: List[str] - """Return only events performed by users with these emails.""" - - actor_ids: List[str] - """Return only events performed by these actors. - - Can be a user ID, a service account ID, or an api key tracking ID. - """ - - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - before: str - """A cursor for use in pagination. - - `before` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page - of the list. - """ - - effective_at: EffectiveAt - """Return only events whose `effective_at` (Unix seconds) is in this range.""" - - event_types: List[ - Literal[ - "api_key.created", - "api_key.updated", - "api_key.deleted", - "invite.sent", - "invite.accepted", - "invite.deleted", - "login.succeeded", - "login.failed", - "logout.succeeded", - "logout.failed", - "organization.updated", - "project.created", - "project.updated", - "project.archived", - "service_account.created", - "service_account.updated", - "service_account.deleted", - "user.added", - "user.updated", - "user.deleted", - ] - ] - """Return only events with a `type` in one of these values. - - For example, `project.created`. For all options, see the documentation for the - [audit log object](/docs/api-reference/audit-logs/object). - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - project_ids: List[str] - """Return only events for these projects.""" - - resource_ids: List[str] - """Return only events performed on these targets. - - For example, a project ID updated. - """ - - -class EffectiveAt(TypedDict, total=False): - gt: int - """ - Return only events whose `effective_at` (Unix seconds) is greater than this - value. - """ - - gte: int - """ - Return only events whose `effective_at` (Unix seconds) is greater than or equal - to this value. - """ - - lt: int - """Return only events whose `effective_at` (Unix seconds) is less than this value.""" - - lte: int - """ - Return only events whose `effective_at` (Unix seconds) is less than or equal to - this value. - """ diff --git a/src/omnistack/types/organization/audit_log_list_response.py b/src/omnistack/types/organization/audit_log_list_response.py deleted file mode 100644 index f3082e5..0000000 --- a/src/omnistack/types/organization/audit_log_list_response.py +++ /dev/null @@ -1,428 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel - -__all__ = [ - "AuditLogListResponse", - "Data", - "DataActor", - "DataActorAPIKey", - "DataActorAPIKeyServiceAccount", - "DataActorAPIKeyUser", - "DataActorSession", - "DataActorSessionUser", - "DataAPIKeyCreated", - "DataAPIKeyCreatedData", - "DataAPIKeyDeleted", - "DataAPIKeyUpdated", - "DataAPIKeyUpdatedChangesRequested", - "DataInviteAccepted", - "DataInviteDeleted", - "DataInviteSent", - "DataInviteSentData", - "DataLoginFailed", - "DataLogoutFailed", - "DataOrganizationUpdated", - "DataOrganizationUpdatedChangesRequested", - "DataOrganizationUpdatedChangesRequestedSettings", - "DataProject", - "DataProjectArchived", - "DataProjectCreated", - "DataProjectCreatedData", - "DataProjectUpdated", - "DataProjectUpdatedChangesRequested", - "DataServiceAccountCreated", - "DataServiceAccountCreatedData", - "DataServiceAccountDeleted", - "DataServiceAccountUpdated", - "DataServiceAccountUpdatedChangesRequested", - "DataUserAdded", - "DataUserAddedData", - "DataUserDeleted", - "DataUserUpdated", - "DataUserUpdatedChangesRequested", -] - - -class DataActorAPIKeyServiceAccount(BaseModel): - id: Optional[str] = None - """The service account id.""" - - -class DataActorAPIKeyUser(BaseModel): - id: Optional[str] = None - """The user id.""" - - email: Optional[str] = None - """The user email.""" - - -class DataActorAPIKey(BaseModel): - id: Optional[str] = None - """The tracking id of the API key.""" - - service_account: Optional[DataActorAPIKeyServiceAccount] = None - """The service account that performed the audit logged action.""" - - type: Optional[Literal["user", "service_account"]] = None - """The type of API key. Can be either `user` or `service_account`.""" - - user: Optional[DataActorAPIKeyUser] = None - """The user who performed the audit logged action.""" - - -class DataActorSessionUser(BaseModel): - id: Optional[str] = None - """The user id.""" - - email: Optional[str] = None - """The user email.""" - - -class DataActorSession(BaseModel): - ip_address: Optional[str] = None - """The IP address from which the action was performed.""" - - user: Optional[DataActorSessionUser] = None - """The user who performed the audit logged action.""" - - -class DataActor(BaseModel): - api_key: Optional[DataActorAPIKey] = None - """The API Key used to perform the audit logged action.""" - - session: Optional[DataActorSession] = None - """The session in which the audit logged action was performed.""" - - type: Optional[Literal["session", "api_key"]] = None - """The type of actor. Is either `session` or `api_key`.""" - - -class DataAPIKeyCreatedData(BaseModel): - scopes: Optional[List[str]] = None - """A list of scopes allowed for the API key, e.g. `["api.model.request"]`""" - - -class DataAPIKeyCreated(BaseModel): - id: Optional[str] = None - """The tracking ID of the API key.""" - - data: Optional[DataAPIKeyCreatedData] = None - """The payload used to create the API key.""" - - -class DataAPIKeyDeleted(BaseModel): - id: Optional[str] = None - """The tracking ID of the API key.""" - - -class DataAPIKeyUpdatedChangesRequested(BaseModel): - scopes: Optional[List[str]] = None - """A list of scopes allowed for the API key, e.g. `["api.model.request"]`""" - - -class DataAPIKeyUpdated(BaseModel): - id: Optional[str] = None - """The tracking ID of the API key.""" - - changes_requested: Optional[DataAPIKeyUpdatedChangesRequested] = None - """The payload used to update the API key.""" - - -class DataInviteAccepted(BaseModel): - id: Optional[str] = None - """The ID of the invite.""" - - -class DataInviteDeleted(BaseModel): - id: Optional[str] = None - """The ID of the invite.""" - - -class DataInviteSentData(BaseModel): - email: Optional[str] = None - """The email invited to the organization.""" - - role: Optional[str] = None - """The role the email was invited to be. Is either `owner` or `member`.""" - - -class DataInviteSent(BaseModel): - id: Optional[str] = None - """The ID of the invite.""" - - data: Optional[DataInviteSentData] = None - """The payload used to create the invite.""" - - -class DataLoginFailed(BaseModel): - error_code: Optional[str] = None - """The error code of the failure.""" - - error_message: Optional[str] = None - """The error message of the failure.""" - - -class DataLogoutFailed(BaseModel): - error_code: Optional[str] = None - """The error code of the failure.""" - - error_message: Optional[str] = None - """The error message of the failure.""" - - -class DataOrganizationUpdatedChangesRequestedSettings(BaseModel): - threads_ui_visibility: Optional[str] = None - """ - Visibility of the threads page which shows messages created with the Assistants - API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`. - """ - - usage_dashboard_visibility: Optional[str] = None - """ - Visibility of the usage dashboard which shows activity and costs for your - organization. One of `ANY_ROLE` or `OWNERS`. - """ - - -class DataOrganizationUpdatedChangesRequested(BaseModel): - description: Optional[str] = None - """The organization description.""" - - name: Optional[str] = None - """The organization name.""" - - settings: Optional[DataOrganizationUpdatedChangesRequestedSettings] = None - - title: Optional[str] = None - """The organization title.""" - - -class DataOrganizationUpdated(BaseModel): - id: Optional[str] = None - """The organization ID.""" - - changes_requested: Optional[DataOrganizationUpdatedChangesRequested] = None - """The payload used to update the organization settings.""" - - -class DataProject(BaseModel): - id: Optional[str] = None - """The project ID.""" - - name: Optional[str] = None - """The project title.""" - - -class DataProjectArchived(BaseModel): - id: Optional[str] = None - """The project ID.""" - - -class DataProjectCreatedData(BaseModel): - name: Optional[str] = None - """The project name.""" - - title: Optional[str] = None - """The title of the project as seen on the dashboard.""" - - -class DataProjectCreated(BaseModel): - id: Optional[str] = None - """The project ID.""" - - data: Optional[DataProjectCreatedData] = None - """The payload used to create the project.""" - - -class DataProjectUpdatedChangesRequested(BaseModel): - title: Optional[str] = None - """The title of the project as seen on the dashboard.""" - - -class DataProjectUpdated(BaseModel): - id: Optional[str] = None - """The project ID.""" - - changes_requested: Optional[DataProjectUpdatedChangesRequested] = None - """The payload used to update the project.""" - - -class DataServiceAccountCreatedData(BaseModel): - role: Optional[str] = None - """The role of the service account. Is either `owner` or `member`.""" - - -class DataServiceAccountCreated(BaseModel): - id: Optional[str] = None - """The service account ID.""" - - data: Optional[DataServiceAccountCreatedData] = None - """The payload used to create the service account.""" - - -class DataServiceAccountDeleted(BaseModel): - id: Optional[str] = None - """The service account ID.""" - - -class DataServiceAccountUpdatedChangesRequested(BaseModel): - role: Optional[str] = None - """The role of the service account. Is either `owner` or `member`.""" - - -class DataServiceAccountUpdated(BaseModel): - id: Optional[str] = None - """The service account ID.""" - - changes_requested: Optional[DataServiceAccountUpdatedChangesRequested] = None - """The payload used to updated the service account.""" - - -class DataUserAddedData(BaseModel): - role: Optional[str] = None - """The role of the user. Is either `owner` or `member`.""" - - -class DataUserAdded(BaseModel): - id: Optional[str] = None - """The user ID.""" - - data: Optional[DataUserAddedData] = None - """The payload used to add the user to the project.""" - - -class DataUserDeleted(BaseModel): - id: Optional[str] = None - """The user ID.""" - - -class DataUserUpdatedChangesRequested(BaseModel): - role: Optional[str] = None - """The role of the user. Is either `owner` or `member`.""" - - -class DataUserUpdated(BaseModel): - id: Optional[str] = None - """The project ID.""" - - changes_requested: Optional[DataUserUpdatedChangesRequested] = None - """The payload used to update the user.""" - - -class Data(BaseModel): - id: str - """The ID of this log.""" - - actor: DataActor - """The actor who performed the audit logged action.""" - - effective_at: int - """The Unix timestamp (in seconds) of the event.""" - - type: Literal[ - "api_key.created", - "api_key.updated", - "api_key.deleted", - "invite.sent", - "invite.accepted", - "invite.deleted", - "login.succeeded", - "login.failed", - "logout.succeeded", - "logout.failed", - "organization.updated", - "project.created", - "project.updated", - "project.archived", - "service_account.created", - "service_account.updated", - "service_account.deleted", - "user.added", - "user.updated", - "user.deleted", - ] - """The event type.""" - - api_key_created: Optional[DataAPIKeyCreated] = FieldInfo(alias="api_key.created", default=None) - """The details for events with this `type`.""" - - api_key_deleted: Optional[DataAPIKeyDeleted] = FieldInfo(alias="api_key.deleted", default=None) - """The details for events with this `type`.""" - - api_key_updated: Optional[DataAPIKeyUpdated] = FieldInfo(alias="api_key.updated", default=None) - """The details for events with this `type`.""" - - invite_accepted: Optional[DataInviteAccepted] = FieldInfo(alias="invite.accepted", default=None) - """The details for events with this `type`.""" - - invite_deleted: Optional[DataInviteDeleted] = FieldInfo(alias="invite.deleted", default=None) - """The details for events with this `type`.""" - - invite_sent: Optional[DataInviteSent] = FieldInfo(alias="invite.sent", default=None) - """The details for events with this `type`.""" - - login_failed: Optional[DataLoginFailed] = FieldInfo(alias="login.failed", default=None) - """The details for events with this `type`.""" - - logout_failed: Optional[DataLogoutFailed] = FieldInfo(alias="logout.failed", default=None) - """The details for events with this `type`.""" - - organization_updated: Optional[DataOrganizationUpdated] = FieldInfo(alias="organization.updated", default=None) - """The details for events with this `type`.""" - - project: Optional[DataProject] = None - """The project that the action was scoped to. - - Absent for actions not scoped to projects. - """ - - project_archived: Optional[DataProjectArchived] = FieldInfo(alias="project.archived", default=None) - """The details for events with this `type`.""" - - project_created: Optional[DataProjectCreated] = FieldInfo(alias="project.created", default=None) - """The details for events with this `type`.""" - - project_updated: Optional[DataProjectUpdated] = FieldInfo(alias="project.updated", default=None) - """The details for events with this `type`.""" - - service_account_created: Optional[DataServiceAccountCreated] = FieldInfo( - alias="service_account.created", default=None - ) - """The details for events with this `type`.""" - - service_account_deleted: Optional[DataServiceAccountDeleted] = FieldInfo( - alias="service_account.deleted", default=None - ) - """The details for events with this `type`.""" - - service_account_updated: Optional[DataServiceAccountUpdated] = FieldInfo( - alias="service_account.updated", default=None - ) - """The details for events with this `type`.""" - - user_added: Optional[DataUserAdded] = FieldInfo(alias="user.added", default=None) - """The details for events with this `type`.""" - - user_deleted: Optional[DataUserDeleted] = FieldInfo(alias="user.deleted", default=None) - """The details for events with this `type`.""" - - user_updated: Optional[DataUserUpdated] = FieldInfo(alias="user.updated", default=None) - """The details for events with this `type`.""" - - -class AuditLogListResponse(BaseModel): - data: List[Data] - - first_id: str - - has_more: bool - - last_id: str - - object: Literal["list"] diff --git a/src/omnistack/types/organization/invite.py b/src/omnistack/types/organization/invite.py deleted file mode 100644 index 0254449..0000000 --- a/src/omnistack/types/organization/invite.py +++ /dev/null @@ -1,34 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["Invite"] - - -class Invite(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints""" - - email: str - """The email address of the individual to whom the invite was sent""" - - expires_at: int - """The Unix timestamp (in seconds) of when the invite expires.""" - - invited_at: int - """The Unix timestamp (in seconds) of when the invite was sent.""" - - object: Literal["organization.invite"] - """The object type, which is always `organization.invite`""" - - role: Literal["owner", "reader"] - """`owner` or `reader`""" - - status: Literal["accepted", "expired", "pending"] - """`accepted`,`expired`, or `pending`""" - - accepted_at: Optional[int] = None - """The Unix timestamp (in seconds) of when the invite was accepted.""" diff --git a/src/omnistack/types/organization/invite_create_params.py b/src/omnistack/types/organization/invite_create_params.py deleted file mode 100644 index e7f0762..0000000 --- a/src/omnistack/types/organization/invite_create_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["InviteCreateParams"] - - -class InviteCreateParams(TypedDict, total=False): - email: Required[str] - """Send an email to this address""" - - role: Required[Literal["reader", "owner"]] - """`owner` or `reader`""" diff --git a/src/omnistack/types/organization/invite_delete_response.py b/src/omnistack/types/organization/invite_delete_response.py deleted file mode 100644 index 52bd47b..0000000 --- a/src/omnistack/types/organization/invite_delete_response.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["InviteDeleteResponse"] - - -class InviteDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["organization.invite.deleted"] - """The object type, which is always `organization.invite.deleted`""" diff --git a/src/omnistack/types/organization/invite_list_params.py b/src/omnistack/types/organization/invite_list_params.py deleted file mode 100644 index 678510d..0000000 --- a/src/omnistack/types/organization/invite_list_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["InviteListParams"] - - -class InviteListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ diff --git a/src/omnistack/types/organization/invite_list_response.py b/src/omnistack/types/organization/invite_list_response.py deleted file mode 100644 index 2b64628..0000000 --- a/src/omnistack/types/organization/invite_list_response.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from .invite import Invite -from ..._models import BaseModel - -__all__ = ["InviteListResponse"] - - -class InviteListResponse(BaseModel): - data: List[Invite] - - object: Literal["list"] - """The object type, which is always `list`""" - - first_id: Optional[str] = None - """The first `invite_id` in the retrieved `list`""" - - has_more: Optional[bool] = None - """ - The `has_more` property is used for pagination to indicate there are additional - results. - """ - - last_id: Optional[str] = None - """The last `invite_id` in the retrieved `list`""" diff --git a/src/omnistack/types/organization/project.py b/src/omnistack/types/organization/project.py deleted file mode 100644 index 731e860..0000000 --- a/src/omnistack/types/organization/project.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["Project"] - - -class Project(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints""" - - created_at: int - """The Unix timestamp (in seconds) of when the project was created.""" - - name: str - """The name of the project. This appears in reporting.""" - - object: Literal["organization.project"] - """The object type, which is always `organization.project`""" - - status: Literal["active", "archived"] - """`active` or `archived`""" - - archived_at: Optional[int] = None - """The Unix timestamp (in seconds) of when the project was archived or `null`.""" diff --git a/src/omnistack/types/organization/project_create_params.py b/src/omnistack/types/organization/project_create_params.py deleted file mode 100644 index a51d27c..0000000 --- a/src/omnistack/types/organization/project_create_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["ProjectCreateParams"] - - -class ProjectCreateParams(TypedDict, total=False): - name: Required[str] - """The updated name of the project, this name appears in reports.""" diff --git a/src/omnistack/types/organization/project_list_params.py b/src/omnistack/types/organization/project_list_params.py deleted file mode 100644 index f55fb8a..0000000 --- a/src/omnistack/types/organization/project_list_params.py +++ /dev/null @@ -1,30 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["ProjectListParams"] - - -class ProjectListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - include_archived: bool - """If `true` returns all projects including those that have been `archived`. - - Archived projects are not included by default. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ diff --git a/src/omnistack/types/organization/project_list_response.py b/src/omnistack/types/organization/project_list_response.py deleted file mode 100644 index 24a79f6..0000000 --- a/src/omnistack/types/organization/project_list_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from .project import Project -from ..._models import BaseModel - -__all__ = ["ProjectListResponse"] - - -class ProjectListResponse(BaseModel): - data: List[Project] - - first_id: str - - has_more: bool - - last_id: str - - object: Literal["list"] diff --git a/src/omnistack/types/organization/projects/__init__.py b/src/omnistack/types/organization/projects/__init__.py deleted file mode 100644 index 30f767a..0000000 --- a/src/omnistack/types/organization/projects/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .user_list_params import UserListParams as UserListParams -from .user_create_params import UserCreateParams as UserCreateParams -from .user_list_response import UserListResponse as UserListResponse -from .user_delete_response import UserDeleteResponse as UserDeleteResponse -from .service_account_list_params import ServiceAccountListParams as ServiceAccountListParams -from .service_account_create_params import ServiceAccountCreateParams as ServiceAccountCreateParams -from .service_account_list_response import ServiceAccountListResponse as ServiceAccountListResponse -from .service_account_create_response import ServiceAccountCreateResponse as ServiceAccountCreateResponse diff --git a/src/omnistack/types/organization/projects/service_account_create_params.py b/src/omnistack/types/organization/projects/service_account_create_params.py deleted file mode 100644 index 409dcba..0000000 --- a/src/omnistack/types/organization/projects/service_account_create_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["ServiceAccountCreateParams"] - - -class ServiceAccountCreateParams(TypedDict, total=False): - name: Required[str] - """The name of the service account being created.""" diff --git a/src/omnistack/types/organization/projects/service_account_create_response.py b/src/omnistack/types/organization/projects/service_account_create_response.py deleted file mode 100644 index e7757a8..0000000 --- a/src/omnistack/types/organization/projects/service_account_create_response.py +++ /dev/null @@ -1,35 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["ServiceAccountCreateResponse", "APIKey"] - - -class APIKey(BaseModel): - id: str - - created_at: int - - name: str - - object: Literal["organization.project.service_account.api_key"] - """The object type, which is always `organization.project.service_account.api_key`""" - - value: str - - -class ServiceAccountCreateResponse(BaseModel): - id: str - - api_key: APIKey - - created_at: int - - name: str - - object: Literal["organization.project.service_account"] - - role: Literal["member"] - """Service accounts can only have one role of type `member`""" diff --git a/src/omnistack/types/organization/projects/service_account_list_params.py b/src/omnistack/types/organization/projects/service_account_list_params.py deleted file mode 100644 index 7f808e2..0000000 --- a/src/omnistack/types/organization/projects/service_account_list_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["ServiceAccountListParams"] - - -class ServiceAccountListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ diff --git a/src/omnistack/types/organization/projects/service_account_list_response.py b/src/omnistack/types/organization/projects/service_account_list_response.py deleted file mode 100644 index 1776251..0000000 --- a/src/omnistack/types/organization/projects/service_account_list_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from ...._models import BaseModel -from ...shared.project_service_account import ProjectServiceAccount - -__all__ = ["ServiceAccountListResponse"] - - -class ServiceAccountListResponse(BaseModel): - data: List[ProjectServiceAccount] - - first_id: str - - has_more: bool - - last_id: str - - object: Literal["list"] diff --git a/src/omnistack/types/organization/projects/user_create_params.py b/src/omnistack/types/organization/projects/user_create_params.py deleted file mode 100644 index 9c0745a..0000000 --- a/src/omnistack/types/organization/projects/user_create_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["UserCreateParams"] - - -class UserCreateParams(TypedDict, total=False): - project_id: Required[str] - - role: Required[Literal["owner", "member"]] - """`owner` or `member`""" diff --git a/src/omnistack/types/organization/projects/user_delete_response.py b/src/omnistack/types/organization/projects/user_delete_response.py deleted file mode 100644 index 7ac68cc..0000000 --- a/src/omnistack/types/organization/projects/user_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ...._models import BaseModel - -__all__ = ["UserDeleteResponse"] - - -class UserDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["organization.project.user.deleted"] diff --git a/src/omnistack/types/organization/projects/user_list_params.py b/src/omnistack/types/organization/projects/user_list_params.py deleted file mode 100644 index d561e90..0000000 --- a/src/omnistack/types/organization/projects/user_list_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["UserListParams"] - - -class UserListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ diff --git a/src/omnistack/types/organization/projects/user_list_response.py b/src/omnistack/types/organization/projects/user_list_response.py deleted file mode 100644 index 816d0b7..0000000 --- a/src/omnistack/types/organization/projects/user_list_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel -from ...shared.project_user import ProjectUser - -__all__ = ["UserListResponse"] - - -class UserListResponse(BaseModel): - data: List[ProjectUser] - - first_id: str - - has_more: bool - - last_id: str - - object: str diff --git a/src/omnistack/types/organization/user.py b/src/omnistack/types/organization/user.py deleted file mode 100644 index ae407ac..0000000 --- a/src/omnistack/types/organization/user.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["User"] - - -class User(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints""" - - added_at: int - """The Unix timestamp (in seconds) of when the user was added.""" - - email: str - """The email address of the user""" - - name: str - """The name of the user""" - - object: Literal["organization.user"] - """The object type, which is always `organization.user`""" - - role: Literal["owner", "reader"] - """`owner` or `reader`""" diff --git a/src/omnistack/types/organization/user_create_params.py b/src/omnistack/types/organization/user_create_params.py deleted file mode 100644 index dab3d89..0000000 --- a/src/omnistack/types/organization/user_create_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["UserCreateParams"] - - -class UserCreateParams(TypedDict, total=False): - role: Required[Literal["owner", "reader"]] - """`owner` or `reader`""" diff --git a/src/omnistack/types/organization/user_delete_response.py b/src/omnistack/types/organization/user_delete_response.py deleted file mode 100644 index 5baab3b..0000000 --- a/src/omnistack/types/organization/user_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["UserDeleteResponse"] - - -class UserDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["organization.user.deleted"] diff --git a/src/omnistack/types/organization/user_list_params.py b/src/omnistack/types/organization/user_list_params.py deleted file mode 100644 index d561e90..0000000 --- a/src/omnistack/types/organization/user_list_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["UserListParams"] - - -class UserListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ diff --git a/src/omnistack/types/organization/user_list_response.py b/src/omnistack/types/organization/user_list_response.py deleted file mode 100644 index 61f927f..0000000 --- a/src/omnistack/types/organization/user_list_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from .user import User -from ..._models import BaseModel - -__all__ = ["UserListResponse"] - - -class UserListResponse(BaseModel): - data: List[User] - - first_id: str - - has_more: bool - - last_id: str - - object: Literal["list"] diff --git a/src/omnistack/types/projects/__init__.py b/src/omnistack/types/projects/__init__.py deleted file mode 100644 index f7f711a..0000000 --- a/src/omnistack/types/projects/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .api_key_list_params import APIKeyListParams as APIKeyListParams -from .api_key_list_response import APIKeyListResponse as APIKeyListResponse -from .api_key_delete_response import APIKeyDeleteResponse as APIKeyDeleteResponse -from .service_account_delete_response import ServiceAccountDeleteResponse as ServiceAccountDeleteResponse diff --git a/src/omnistack/types/projects/api_key_delete_response.py b/src/omnistack/types/projects/api_key_delete_response.py deleted file mode 100644 index f83d199..0000000 --- a/src/omnistack/types/projects/api_key_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["APIKeyDeleteResponse"] - - -class APIKeyDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["organization.project.api_key.deleted"] diff --git a/src/omnistack/types/projects/api_key_list_params.py b/src/omnistack/types/projects/api_key_list_params.py deleted file mode 100644 index 422a285..0000000 --- a/src/omnistack/types/projects/api_key_list_params.py +++ /dev/null @@ -1,24 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["APIKeyListParams"] - - -class APIKeyListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ diff --git a/src/omnistack/types/projects/api_key_list_response.py b/src/omnistack/types/projects/api_key_list_response.py deleted file mode 100644 index 1c34968..0000000 --- a/src/omnistack/types/projects/api_key_list_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import Literal - -from ..._models import BaseModel -from ..shared.project_api_key import ProjectAPIKey - -__all__ = ["APIKeyListResponse"] - - -class APIKeyListResponse(BaseModel): - data: List[ProjectAPIKey] - - first_id: str - - has_more: bool - - last_id: str - - object: Literal["list"] diff --git a/src/omnistack/types/projects/service_account_delete_response.py b/src/omnistack/types/projects/service_account_delete_response.py deleted file mode 100644 index ddc6321..0000000 --- a/src/omnistack/types/projects/service_account_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["ServiceAccountDeleteResponse"] - - -class ServiceAccountDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["organization.project.service_account.deleted"] diff --git a/src/omnistack/types/thread_create_params.py b/src/omnistack/types/thread_create_params.py deleted file mode 100644 index bc19281..0000000 --- a/src/omnistack/types/thread_create_params.py +++ /dev/null @@ -1,326 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = [ - "ThreadCreateParams", - "Message", - "MessageContentArrayOfContentPart", - "MessageContentArrayOfContentPartMessageContentImageFileObject", - "MessageContentArrayOfContentPartMessageContentImageFileObjectImageFile", - "MessageContentArrayOfContentPartMessageContentImageURLObject", - "MessageContentArrayOfContentPartMessageContentImageURLObjectImageURL", - "MessageContentArrayOfContentPartMessageRequestContentTextObject", - "MessageAttachment", - "MessageAttachmentTool", - "MessageAttachmentToolAssistantToolsCode", - "MessageAttachmentToolAssistantToolsFileSearchTypeOnly", - "ToolResources", - "ToolResourcesCodeInterpreter", - "ToolResourcesFileSearch", - "ToolResourcesFileSearchUnionMember0", - "ToolResourcesFileSearchUnionMember0VectorStore", - "ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategy", - "ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategyAutoChunkingStrategy", - "ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategyStaticChunkingStrategy", - "ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategyStaticChunkingStrategyStatic", - "ToolResourcesFileSearchUnionMember1", - "ToolResourcesFileSearchUnionMember1VectorStore", - "ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategy", - "ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategyAutoChunkingStrategy", - "ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategyStaticChunkingStrategy", - "ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategyStaticChunkingStrategyStatic", -] - - -class ThreadCreateParams(TypedDict, total=False): - messages: Iterable[Message] - """A list of [messages](/docs/api-reference/messages) to start the thread with.""" - - metadata: Optional[object] - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - tool_resources: Optional[ToolResources] - """ - A set of resources that are made available to the assistant's tools in this - thread. The resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the `file_search` - tool requires a list of vector store IDs. - """ - - -class MessageContentArrayOfContentPartMessageContentImageFileObjectImageFile(TypedDict, total=False): - file_id: Required[str] - """The [File](/docs/api-reference/files) ID of the image in the message content. - - Set `purpose="vision"` when uploading the File if you need to later display the - file content. - """ - - detail: Literal["auto", "low", "high"] - """Specifies the detail level of the image if specified by the user. - - `low` uses fewer tokens, you can opt in to high resolution using `high`. - """ - - -class MessageContentArrayOfContentPartMessageContentImageFileObject(TypedDict, total=False): - image_file: Required[MessageContentArrayOfContentPartMessageContentImageFileObjectImageFile] - - type: Required[Literal["image_file"]] - """Always `image_file`.""" - - -class MessageContentArrayOfContentPartMessageContentImageURLObjectImageURL(TypedDict, total=False): - url: Required[str] - """ - The external URL of the image, must be a supported image types: jpeg, jpg, png, - gif, webp. - """ - - detail: Literal["auto", "low", "high"] - """Specifies the detail level of the image. - - `low` uses fewer tokens, you can opt in to high resolution using `high`. Default - value is `auto` - """ - - -class MessageContentArrayOfContentPartMessageContentImageURLObject(TypedDict, total=False): - image_url: Required[MessageContentArrayOfContentPartMessageContentImageURLObjectImageURL] - - type: Required[Literal["image_url"]] - """The type of the content part.""" - - -class MessageContentArrayOfContentPartMessageRequestContentTextObject(TypedDict, total=False): - text: Required[str] - """Text content to be sent to the model""" - - type: Required[Literal["text"]] - """Always `text`.""" - - -MessageContentArrayOfContentPart: TypeAlias = Union[ - MessageContentArrayOfContentPartMessageContentImageFileObject, - MessageContentArrayOfContentPartMessageContentImageURLObject, - MessageContentArrayOfContentPartMessageRequestContentTextObject, -] - - -class MessageAttachmentToolAssistantToolsCode(TypedDict, total=False): - type: Required[Literal["code_interpreter"]] - """The type of tool being defined: `code_interpreter`""" - - -class MessageAttachmentToolAssistantToolsFileSearchTypeOnly(TypedDict, total=False): - type: Required[Literal["file_search"]] - """The type of tool being defined: `file_search`""" - - -MessageAttachmentTool: TypeAlias = Union[ - MessageAttachmentToolAssistantToolsCode, MessageAttachmentToolAssistantToolsFileSearchTypeOnly -] - - -class MessageAttachment(TypedDict, total=False): - file_id: str - """The ID of the file to attach to the message.""" - - tools: Iterable[MessageAttachmentTool] - """The tools to add this file to.""" - - -class Message(TypedDict, total=False): - content: Required[Union[str, Iterable[MessageContentArrayOfContentPart]]] - """The text contents of the message.""" - - role: Required[Literal["user", "assistant"]] - """The role of the entity that is creating the message. Allowed values include: - - - `user`: Indicates the message is sent by an actual user and should be used in - most cases to represent user-generated messages. - - `assistant`: Indicates the message is generated by the assistant. Use this - value to insert messages from the assistant into the conversation. - """ - - attachments: Optional[Iterable[MessageAttachment]] - """A list of files attached to the message, and the tools they should be added to.""" - - metadata: Optional[object] - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - -class ToolResourcesCodeInterpreter(TypedDict, total=False): - file_ids: List[str] - """ - A list of [file](/docs/api-reference/files) IDs made available to the - `code_interpreter` tool. There can be a maximum of 20 files associated with the - tool. - """ - - -class ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategyAutoChunkingStrategy(TypedDict, total=False): - type: Required[Literal["auto"]] - """Always `auto`.""" - - -class ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategyStaticChunkingStrategyStatic( - TypedDict, total=False -): - chunk_overlap_tokens: Required[int] - """The number of tokens that overlap between chunks. The default value is `400`. - - Note that the overlap must not exceed half of `max_chunk_size_tokens`. - """ - - max_chunk_size_tokens: Required[int] - """The maximum number of tokens in each chunk. - - The default value is `800`. The minimum value is `100` and the maximum value is - `4096`. - """ - - -class ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategyStaticChunkingStrategy(TypedDict, total=False): - static: Required[ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategyStaticChunkingStrategyStatic] - - type: Required[Literal["static"]] - """Always `static`.""" - - -ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategy: TypeAlias = Union[ - ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategyAutoChunkingStrategy, - ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategyStaticChunkingStrategy, -] - - -class ToolResourcesFileSearchUnionMember0VectorStore(TypedDict, total=False): - chunking_strategy: ToolResourcesFileSearchUnionMember0VectorStoreChunkingStrategy - """The chunking strategy used to chunk the file(s). - - If not set, will use the `auto` strategy. - """ - - file_ids: List[str] - """A list of [file](/docs/api-reference/files) IDs to add to the vector store. - - There can be a maximum of 10000 files in a vector store. - """ - - metadata: object - """Set of 16 key-value pairs that can be attached to a vector store. - - This can be useful for storing additional information about the vector store in - a structured format. Keys can be a maximum of 64 characters long and values can - be a maximum of 512 characters long. - """ - - -class ToolResourcesFileSearchUnionMember0(TypedDict, total=False): - vector_store_ids: Required[List[str]] - """ - The [vector store](/docs/api-reference/vector-stores/object) attached to this - thread. There can be a maximum of 1 vector store attached to the thread. - """ - - vector_stores: Iterable[ToolResourcesFileSearchUnionMember0VectorStore] - """ - A helper to create a [vector store](/docs/api-reference/vector-stores/object) - with file_ids and attach it to this thread. There can be a maximum of 1 vector - store attached to the thread. - """ - - -class ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategyAutoChunkingStrategy(TypedDict, total=False): - type: Required[Literal["auto"]] - """Always `auto`.""" - - -class ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategyStaticChunkingStrategyStatic( - TypedDict, total=False -): - chunk_overlap_tokens: Required[int] - """The number of tokens that overlap between chunks. The default value is `400`. - - Note that the overlap must not exceed half of `max_chunk_size_tokens`. - """ - - max_chunk_size_tokens: Required[int] - """The maximum number of tokens in each chunk. - - The default value is `800`. The minimum value is `100` and the maximum value is - `4096`. - """ - - -class ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategyStaticChunkingStrategy(TypedDict, total=False): - static: Required[ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategyStaticChunkingStrategyStatic] - - type: Required[Literal["static"]] - """Always `static`.""" - - -ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategy: TypeAlias = Union[ - ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategyAutoChunkingStrategy, - ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategyStaticChunkingStrategy, -] - - -class ToolResourcesFileSearchUnionMember1VectorStore(TypedDict, total=False): - chunking_strategy: ToolResourcesFileSearchUnionMember1VectorStoreChunkingStrategy - """The chunking strategy used to chunk the file(s). - - If not set, will use the `auto` strategy. - """ - - file_ids: List[str] - """A list of [file](/docs/api-reference/files) IDs to add to the vector store. - - There can be a maximum of 10000 files in a vector store. - """ - - metadata: object - """Set of 16 key-value pairs that can be attached to a vector store. - - This can be useful for storing additional information about the vector store in - a structured format. Keys can be a maximum of 64 characters long and values can - be a maximum of 512 characters long. - """ - - -class ToolResourcesFileSearchUnionMember1(TypedDict, total=False): - vector_stores: Required[Iterable[ToolResourcesFileSearchUnionMember1VectorStore]] - """ - A helper to create a [vector store](/docs/api-reference/vector-stores/object) - with file_ids and attach it to this thread. There can be a maximum of 1 vector - store attached to the thread. - """ - - vector_store_ids: List[str] - """ - The [vector store](/docs/api-reference/vector-stores/object) attached to this - thread. There can be a maximum of 1 vector store attached to the thread. - """ - - -ToolResourcesFileSearch: TypeAlias = Union[ToolResourcesFileSearchUnionMember0, ToolResourcesFileSearchUnionMember1] - - -class ToolResources(TypedDict, total=False): - code_interpreter: ToolResourcesCodeInterpreter - - file_search: ToolResourcesFileSearch diff --git a/src/omnistack/types/thread_delete_response.py b/src/omnistack/types/thread_delete_response.py deleted file mode 100644 index 74f09d8..0000000 --- a/src/omnistack/types/thread_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["ThreadDeleteResponse"] - - -class ThreadDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["thread.deleted"] diff --git a/src/omnistack/types/thread_update_params.py b/src/omnistack/types/thread_update_params.py deleted file mode 100644 index 418ccb7..0000000 --- a/src/omnistack/types/thread_update_params.py +++ /dev/null @@ -1,49 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Optional -from typing_extensions import TypedDict - -__all__ = ["ThreadUpdateParams", "ToolResources", "ToolResourcesCodeInterpreter", "ToolResourcesFileSearch"] - - -class ThreadUpdateParams(TypedDict, total=False): - metadata: Optional[object] - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - tool_resources: Optional[ToolResources] - """ - A set of resources that are made available to the assistant's tools in this - thread. The resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the `file_search` - tool requires a list of vector store IDs. - """ - - -class ToolResourcesCodeInterpreter(TypedDict, total=False): - file_ids: List[str] - """ - A list of [file](/docs/api-reference/files) IDs made available to the - `code_interpreter` tool. There can be a maximum of 20 files associated with the - tool. - """ - - -class ToolResourcesFileSearch(TypedDict, total=False): - vector_store_ids: List[str] - """ - The [vector store](/docs/api-reference/vector-stores/object) attached to this - thread. There can be a maximum of 1 vector store attached to the thread. - """ - - -class ToolResources(TypedDict, total=False): - code_interpreter: ToolResourcesCodeInterpreter - - file_search: ToolResourcesFileSearch diff --git a/src/omnistack/types/threads/__init__.py b/src/omnistack/types/threads/__init__.py deleted file mode 100644 index 5314f36..0000000 --- a/src/omnistack/types/threads/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .run_list_params import RunListParams as RunListParams -from .run_create_params import RunCreateParams as RunCreateParams -from .run_list_response import RunListResponse as RunListResponse -from .message_list_params import MessageListParams as MessageListParams -from .message_create_params import MessageCreateParams as MessageCreateParams -from .message_list_response import MessageListResponse as MessageListResponse -from .message_delete_response import MessageDeleteResponse as MessageDeleteResponse -from .run_submit_tool_outputs_params import RunSubmitToolOutputsParams as RunSubmitToolOutputsParams diff --git a/src/omnistack/types/threads/message_create_params.py b/src/omnistack/types/threads/message_create_params.py deleted file mode 100644 index fc98088..0000000 --- a/src/omnistack/types/threads/message_create_params.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Required, TypedDict - -__all__ = ["MessageCreateParams"] - - -class MessageCreateParams(TypedDict, total=False): - thread_id: Required[str] - - metadata: Optional[object] - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ diff --git a/src/omnistack/types/threads/message_delete_response.py b/src/omnistack/types/threads/message_delete_response.py deleted file mode 100644 index c86408d..0000000 --- a/src/omnistack/types/threads/message_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["MessageDeleteResponse"] - - -class MessageDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["thread.message.deleted"] diff --git a/src/omnistack/types/threads/message_list_params.py b/src/omnistack/types/threads/message_list_params.py deleted file mode 100644 index 18c2442..0000000 --- a/src/omnistack/types/threads/message_list_params.py +++ /dev/null @@ -1,42 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["MessageListParams"] - - -class MessageListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - before: str - """A cursor for use in pagination. - - `before` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page - of the list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: Literal["asc", "desc"] - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ - - run_id: str - """Filter messages by the run ID that generated them.""" diff --git a/src/omnistack/types/threads/message_list_response.py b/src/omnistack/types/threads/message_list_response.py deleted file mode 100644 index 4ebfc38..0000000 --- a/src/omnistack/types/threads/message_list_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from ..assistants.message_object import MessageObject - -__all__ = ["MessageListResponse"] - - -class MessageListResponse(BaseModel): - data: List[MessageObject] - - first_id: str - - has_more: bool - - last_id: str - - object: str diff --git a/src/omnistack/types/threads/run_create_params.py b/src/omnistack/types/threads/run_create_params.py deleted file mode 100644 index e59e2d9..0000000 --- a/src/omnistack/types/threads/run_create_params.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Required, TypedDict - -__all__ = ["RunCreateParams"] - - -class RunCreateParams(TypedDict, total=False): - thread_id: Required[str] - - metadata: Optional[object] - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ diff --git a/src/omnistack/types/threads/run_list_params.py b/src/omnistack/types/threads/run_list_params.py deleted file mode 100644 index 1e32bca..0000000 --- a/src/omnistack/types/threads/run_list_params.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["RunListParams"] - - -class RunListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - before: str - """A cursor for use in pagination. - - `before` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page - of the list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: Literal["asc", "desc"] - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ diff --git a/src/omnistack/types/threads/run_list_response.py b/src/omnistack/types/threads/run_list_response.py deleted file mode 100644 index 092f0e5..0000000 --- a/src/omnistack/types/threads/run_list_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from ..assistants.run_object import RunObject - -__all__ = ["RunListResponse"] - - -class RunListResponse(BaseModel): - data: List[RunObject] - - first_id: str - - has_more: bool - - last_id: str - - object: str diff --git a/src/omnistack/types/threads/run_submit_tool_outputs_params.py b/src/omnistack/types/threads/run_submit_tool_outputs_params.py deleted file mode 100644 index 77ab84b..0000000 --- a/src/omnistack/types/threads/run_submit_tool_outputs_params.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Required, TypedDict - -__all__ = ["RunSubmitToolOutputsParams", "ToolOutput"] - - -class RunSubmitToolOutputsParams(TypedDict, total=False): - thread_id: Required[str] - - tool_outputs: Required[Iterable[ToolOutput]] - """A list of tools for which the outputs are being submitted.""" - - stream: Optional[bool] - """ - If `true`, returns a stream of events that happen during the Run as server-sent - events, terminating when the Run enters a terminal state with a `data: [DONE]` - message. - """ - - -class ToolOutput(TypedDict, total=False): - output: str - """The output of the tool call to be submitted to continue the run.""" - - tool_call_id: str - """ - The ID of the tool call in the `required_action` object within the run object - the output is being submitted for. - """ diff --git a/src/omnistack/types/threads/runs/__init__.py b/src/omnistack/types/threads/runs/__init__.py deleted file mode 100644 index 3cab1f9..0000000 --- a/src/omnistack/types/threads/runs/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .run_step_object import RunStepObject as RunStepObject -from .step_list_params import StepListParams as StepListParams -from .step_list_response import StepListResponse as StepListResponse -from .step_retrieve_params import StepRetrieveParams as StepRetrieveParams diff --git a/src/omnistack/types/threads/runs/run_step_object.py b/src/omnistack/types/threads/runs/run_step_object.py deleted file mode 100644 index 5a9a9d7..0000000 --- a/src/omnistack/types/threads/runs/run_step_object.py +++ /dev/null @@ -1,317 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from ...._models import BaseModel - -__all__ = [ - "RunStepObject", - "LastError", - "StepDetails", - "StepDetailsRunStepDetailsMessageCreationObject", - "StepDetailsRunStepDetailsMessageCreationObjectMessageCreation", - "StepDetailsRunStepDetailsToolCallsObject", - "StepDetailsRunStepDetailsToolCallsObjectToolCall", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObject", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreter", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutput", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputRunStepDetailsToolCallsCodeOutputLogsObject", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputRunStepDetailsToolCallsCodeOutputImageObject", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputRunStepDetailsToolCallsCodeOutputImageObjectImage", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObject", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearch", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearchRankingOptions", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearchResult", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearchResultContent", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFunctionObject", - "StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFunctionObjectFunction", - "Usage", -] - - -class LastError(BaseModel): - code: Literal["server_error", "rate_limit_exceeded"] - """One of `server_error` or `rate_limit_exceeded`.""" - - message: str - """A human-readable description of the error.""" - - -class StepDetailsRunStepDetailsMessageCreationObjectMessageCreation(BaseModel): - message_id: str - """The ID of the message that was created by this run step.""" - - -class StepDetailsRunStepDetailsMessageCreationObject(BaseModel): - message_creation: StepDetailsRunStepDetailsMessageCreationObjectMessageCreation - - type: Literal["message_creation"] - """Always `message_creation`.""" - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputRunStepDetailsToolCallsCodeOutputLogsObject( - BaseModel -): - logs: str - """The text output from the Code Interpreter tool call.""" - - type: Literal["logs"] - """Always `logs`.""" - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputRunStepDetailsToolCallsCodeOutputImageObjectImage( - BaseModel -): - file_id: str - """The [file](/docs/api-reference/files) ID of the image.""" - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputRunStepDetailsToolCallsCodeOutputImageObject( - BaseModel -): - image: StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputRunStepDetailsToolCallsCodeOutputImageObjectImage - - type: Literal["image"] - """Always `image`.""" - - -StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutput: TypeAlias = Union[ - StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputRunStepDetailsToolCallsCodeOutputLogsObject, - StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutputRunStepDetailsToolCallsCodeOutputImageObject, -] - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreter(BaseModel): - input: str - """The input to the Code Interpreter tool call.""" - - outputs: List[ - StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreterOutput - ] - """The outputs from the Code Interpreter tool call. - - Code Interpreter can output one or more items, including text (`logs`) or images - (`image`). Each of these are represented by a different object type. - """ - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObject(BaseModel): - id: str - """The ID of the tool call.""" - - code_interpreter: StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObjectCodeInterpreter - """The Code Interpreter tool call definition.""" - - type: Literal["code_interpreter"] - """The type of tool call. - - This is always going to be `code_interpreter` for this type of tool call. - """ - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearchRankingOptions( - BaseModel -): - ranker: Literal["default_2024_08_21"] - """The ranker used for the file search.""" - - score_threshold: float - """The score threshold for the file search. - - All values must be a floating point number between 0 and 1. - """ - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearchResultContent( - BaseModel -): - text: Optional[str] = None - """The text content of the file.""" - - type: Optional[Literal["text"]] = None - """The type of the content.""" - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearchResult( - BaseModel -): - file_id: str - """The ID of the file that result was found in.""" - - file_name: str - """The name of the file that result was found in.""" - - score: float - """The score of the result. - - All values must be a floating point number between 0 and 1. - """ - - content: Optional[ - List[ - StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearchResultContent - ] - ] = None - """The content of the result that was found. - - The content is only included if requested via the include query parameter. - """ - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearch(BaseModel): - ranking_options: Optional[ - StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearchRankingOptions - ] = None - """The ranking options for the file search.""" - - results: Optional[ - List[StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearchResult] - ] = None - """The results of the file search.""" - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObject(BaseModel): - id: str - """The ID of the tool call object.""" - - file_search: StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObjectFileSearch - """For now, this is always going to be an empty object.""" - - type: Literal["file_search"] - """The type of tool call. - - This is always going to be `file_search` for this type of tool call. - """ - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFunctionObjectFunction(BaseModel): - arguments: str - """The arguments passed to the function.""" - - name: str - """The name of the function.""" - - output: Optional[str] = None - """The output of the function. - - This will be `null` if the outputs have not been - [submitted](/docs/api-reference/runs/submitToolOutputs) yet. - """ - - -class StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFunctionObject(BaseModel): - id: str - """The ID of the tool call object.""" - - function: StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFunctionObjectFunction - """The definition of the function that was called.""" - - type: Literal["function"] - """The type of tool call. - - This is always going to be `function` for this type of tool call. - """ - - -StepDetailsRunStepDetailsToolCallsObjectToolCall: TypeAlias = Union[ - StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsCodeObject, - StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFileSearchObject, - StepDetailsRunStepDetailsToolCallsObjectToolCallRunStepDetailsToolCallsFunctionObject, -] - - -class StepDetailsRunStepDetailsToolCallsObject(BaseModel): - tool_calls: List[StepDetailsRunStepDetailsToolCallsObjectToolCall] - """An array of tool calls the run step was involved in. - - These can be associated with one of three types of tools: `code_interpreter`, - `file_search`, or `function`. - """ - - type: Literal["tool_calls"] - """Always `tool_calls`.""" - - -StepDetails: TypeAlias = Union[StepDetailsRunStepDetailsMessageCreationObject, StepDetailsRunStepDetailsToolCallsObject] - - -class Usage(BaseModel): - completion_tokens: int - """Number of completion tokens used over the course of the run step.""" - - prompt_tokens: int - """Number of prompt tokens used over the course of the run step.""" - - total_tokens: int - """Total number of tokens used (prompt + completion).""" - - -class RunStepObject(BaseModel): - id: str - """The identifier of the run step, which can be referenced in API endpoints.""" - - assistant_id: str - """ - The ID of the [assistant](/docs/api-reference/assistants) associated with the - run step. - """ - - cancelled_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the run step was cancelled.""" - - completed_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the run step completed.""" - - created_at: int - """The Unix timestamp (in seconds) for when the run step was created.""" - - expired_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the run step expired. - - A step is considered expired if the parent run is expired. - """ - - failed_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the run step failed.""" - - last_error: Optional[LastError] = None - """The last error associated with this run step. - - Will be `null` if there are no errors. - """ - - metadata: Optional[object] = None - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - object: Literal["thread.run.step"] - """The object type, which is always `thread.run.step`.""" - - run_id: str - """The ID of the [run](/docs/api-reference/runs) that this run step is a part of.""" - - status: Literal["in_progress", "cancelled", "failed", "completed", "expired"] - """ - The status of the run step, which can be either `in_progress`, `cancelled`, - `failed`, `completed`, or `expired`. - """ - - step_details: StepDetails - """The details of the run step.""" - - thread_id: str - """The ID of the [thread](/docs/api-reference/threads) that was run.""" - - type: Literal["message_creation", "tool_calls"] - """The type of run step, which can be either `message_creation` or `tool_calls`.""" - - usage: Optional[Usage] = None - """Usage statistics related to the run step. - - This value will be `null` while the run step's status is `in_progress`. - """ diff --git a/src/omnistack/types/threads/runs/step_list_params.py b/src/omnistack/types/threads/runs/step_list_params.py deleted file mode 100644 index b921d1f..0000000 --- a/src/omnistack/types/threads/runs/step_list_params.py +++ /dev/null @@ -1,54 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["StepListParams"] - - -class StepListParams(TypedDict, total=False): - thread_id: Required[str] - - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - before: str - """A cursor for use in pagination. - - `before` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page - of the list. - """ - - include: List[Literal["step_details.tool_calls[*].file_search.results[*].content"]] - """A list of additional fields to include in the response. - - Currently the only supported value is - `step_details.tool_calls[*].file_search.results[*].content` to fetch the file - search result content. - - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: Literal["asc", "desc"] - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ diff --git a/src/omnistack/types/threads/runs/step_list_response.py b/src/omnistack/types/threads/runs/step_list_response.py deleted file mode 100644 index 93ccb4c..0000000 --- a/src/omnistack/types/threads/runs/step_list_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel -from .run_step_object import RunStepObject - -__all__ = ["StepListResponse"] - - -class StepListResponse(BaseModel): - data: List[RunStepObject] - - first_id: str - - has_more: bool - - last_id: str - - object: str diff --git a/src/omnistack/types/threads/runs/step_retrieve_params.py b/src/omnistack/types/threads/runs/step_retrieve_params.py deleted file mode 100644 index 86299d5..0000000 --- a/src/omnistack/types/threads/runs/step_retrieve_params.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["StepRetrieveParams"] - - -class StepRetrieveParams(TypedDict, total=False): - thread_id: Required[str] - - run_id: Required[str] - - include: List[Literal["step_details.tool_calls[*].file_search.results[*].content"]] - """A list of additional fields to include in the response. - - Currently the only supported value is - `step_details.tool_calls[*].file_search.results[*].content` to fetch the file - search result content. - - See the - [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) - for more information. - """ diff --git a/src/omnistack/types/upload.py b/src/omnistack/types/upload.py deleted file mode 100644 index a08555b..0000000 --- a/src/omnistack/types/upload.py +++ /dev/null @@ -1,42 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel -from .openai_file import OpenAIFile - -__all__ = ["Upload"] - - -class Upload(BaseModel): - id: str - """The Upload unique identifier, which can be referenced in API endpoints.""" - - bytes: int - """The intended number of bytes to be uploaded.""" - - created_at: int - """The Unix timestamp (in seconds) for when the Upload was created.""" - - expires_at: int - """The Unix timestamp (in seconds) for when the Upload was created.""" - - filename: str - """The name of the file to be uploaded.""" - - purpose: str - """The intended purpose of the file. - - [Please refer here](/docs/api-reference/files/object#files/object-purpose) for - acceptable values. - """ - - status: Literal["pending", "completed", "cancelled", "expired"] - """The status of the Upload.""" - - file: Optional[OpenAIFile] = None - """The ready File object after the Upload is completed.""" - - object: Optional[Literal["upload"]] = None - """The object type, which is always "upload".""" diff --git a/src/omnistack/types/upload_complete_params.py b/src/omnistack/types/upload_complete_params.py deleted file mode 100644 index cce568d..0000000 --- a/src/omnistack/types/upload_complete_params.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List -from typing_extensions import Required, TypedDict - -__all__ = ["UploadCompleteParams"] - - -class UploadCompleteParams(TypedDict, total=False): - part_ids: Required[List[str]] - """The ordered list of Part IDs.""" - - md5: str - """ - The optional md5 checksum for the file contents to verify if the bytes uploaded - matches what you expect. - """ diff --git a/src/omnistack/types/upload_create_params.py b/src/omnistack/types/upload_create_params.py deleted file mode 100644 index eab9a51..0000000 --- a/src/omnistack/types/upload_create_params.py +++ /dev/null @@ -1,29 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["UploadCreateParams"] - - -class UploadCreateParams(TypedDict, total=False): - bytes: Required[int] - """The number of bytes in the file you are uploading.""" - - filename: Required[str] - """The name of the file to upload.""" - - mime_type: Required[str] - """The MIME type of the file. - - This must fall within the supported MIME types for your file purpose. See the - supported MIME types for assistants and vision. - """ - - purpose: Required[Literal["assistants", "batch", "fine-tune", "vision"]] - """The intended purpose of the uploaded file. - - See the - [documentation on File purposes](/docs/api-reference/files/create#files-create-purpose). - """ diff --git a/src/omnistack/types/upload_part.py b/src/omnistack/types/upload_part.py deleted file mode 100644 index 56736e8..0000000 --- a/src/omnistack/types/upload_part.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["UploadPart"] - - -class UploadPart(BaseModel): - id: str - """The upload Part unique identifier, which can be referenced in API endpoints.""" - - created_at: int - """The Unix timestamp (in seconds) for when the Part was created.""" - - object: Literal["upload.part"] - """The object type, which is always `upload.part`.""" - - upload_id: str - """The ID of the Upload object that this Part was added to.""" diff --git a/src/omnistack/types/uploads/__init__.py b/src/omnistack/types/uploads/__init__.py deleted file mode 100644 index 17a4c21..0000000 --- a/src/omnistack/types/uploads/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .part_create_params import PartCreateParams as PartCreateParams diff --git a/src/omnistack/types/uploads/part_create_params.py b/src/omnistack/types/uploads/part_create_params.py deleted file mode 100644 index 9851ca4..0000000 --- a/src/omnistack/types/uploads/part_create_params.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from ..._types import FileTypes - -__all__ = ["PartCreateParams"] - - -class PartCreateParams(TypedDict, total=False): - data: Required[FileTypes] - """The chunk of bytes for this Part.""" diff --git a/src/omnistack/types/vector_store_create_params.py b/src/omnistack/types/vector_store_create_params.py deleted file mode 100644 index a6e199e..0000000 --- a/src/omnistack/types/vector_store_create_params.py +++ /dev/null @@ -1,88 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = [ - "VectorStoreCreateParams", - "ChunkingStrategy", - "ChunkingStrategyAutoChunkingStrategyRequestParam", - "ChunkingStrategyStaticChunkingStrategyRequestParam", - "ChunkingStrategyStaticChunkingStrategyRequestParamStatic", - "ExpiresAfter", -] - - -class VectorStoreCreateParams(TypedDict, total=False): - chunking_strategy: ChunkingStrategy - """The chunking strategy used to chunk the file(s). - - If not set, will use the `auto` strategy. Only applicable if `file_ids` is - non-empty. - """ - - expires_after: ExpiresAfter - """The expiration policy for a vector store.""" - - file_ids: List[str] - """A list of [File](/docs/api-reference/files) IDs that the vector store should - use. - - Useful for tools like `file_search` that can access files. - """ - - metadata: Optional[object] - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - name: str - """The name of the vector store.""" - - -class ChunkingStrategyAutoChunkingStrategyRequestParam(TypedDict, total=False): - type: Required[Literal["auto"]] - """Always `auto`.""" - - -class ChunkingStrategyStaticChunkingStrategyRequestParamStatic(TypedDict, total=False): - chunk_overlap_tokens: Required[int] - """The number of tokens that overlap between chunks. The default value is `400`. - - Note that the overlap must not exceed half of `max_chunk_size_tokens`. - """ - - max_chunk_size_tokens: Required[int] - """The maximum number of tokens in each chunk. - - The default value is `800`. The minimum value is `100` and the maximum value is - `4096`. - """ - - -class ChunkingStrategyStaticChunkingStrategyRequestParam(TypedDict, total=False): - static: Required[ChunkingStrategyStaticChunkingStrategyRequestParamStatic] - - type: Required[Literal["static"]] - """Always `static`.""" - - -ChunkingStrategy: TypeAlias = Union[ - ChunkingStrategyAutoChunkingStrategyRequestParam, ChunkingStrategyStaticChunkingStrategyRequestParam -] - - -class ExpiresAfter(TypedDict, total=False): - anchor: Required[Literal["last_active_at"]] - """Anchor timestamp after which the expiration policy applies. - - Supported anchors: `last_active_at`. - """ - - days: Required[int] - """The number of days after the anchor time that the vector store will expire.""" diff --git a/src/omnistack/types/vector_store_delete_response.py b/src/omnistack/types/vector_store_delete_response.py deleted file mode 100644 index 17d3ee2..0000000 --- a/src/omnistack/types/vector_store_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["VectorStoreDeleteResponse"] - - -class VectorStoreDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["vector_store.deleted"] diff --git a/src/omnistack/types/vector_store_list_params.py b/src/omnistack/types/vector_store_list_params.py deleted file mode 100644 index f39f672..0000000 --- a/src/omnistack/types/vector_store_list_params.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["VectorStoreListParams"] - - -class VectorStoreListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - before: str - """A cursor for use in pagination. - - `before` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page - of the list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: Literal["asc", "desc"] - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ diff --git a/src/omnistack/types/vector_store_list_response.py b/src/omnistack/types/vector_store_list_response.py deleted file mode 100644 index 2dc455e..0000000 --- a/src/omnistack/types/vector_store_list_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .._models import BaseModel -from .vector_store_object import VectorStoreObject - -__all__ = ["VectorStoreListResponse"] - - -class VectorStoreListResponse(BaseModel): - data: List[VectorStoreObject] - - first_id: str - - has_more: bool - - last_id: str - - object: str diff --git a/src/omnistack/types/vector_store_object.py b/src/omnistack/types/vector_store_object.py deleted file mode 100644 index 7c3a30a..0000000 --- a/src/omnistack/types/vector_store_object.py +++ /dev/null @@ -1,79 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["VectorStoreObject", "FileCounts", "ExpiresAfter"] - - -class FileCounts(BaseModel): - cancelled: int - """The number of files that were cancelled.""" - - completed: int - """The number of files that have been successfully processed.""" - - failed: int - """The number of files that have failed to process.""" - - in_progress: int - """The number of files that are currently being processed.""" - - total: int - """The total number of files.""" - - -class ExpiresAfter(BaseModel): - anchor: Literal["last_active_at"] - """Anchor timestamp after which the expiration policy applies. - - Supported anchors: `last_active_at`. - """ - - days: int - """The number of days after the anchor time that the vector store will expire.""" - - -class VectorStoreObject(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints.""" - - created_at: int - """The Unix timestamp (in seconds) for when the vector store was created.""" - - file_counts: FileCounts - - last_active_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the vector store was last active.""" - - metadata: Optional[object] = None - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - name: str - """The name of the vector store.""" - - object: Literal["vector_store"] - """The object type, which is always `vector_store`.""" - - status: Literal["expired", "in_progress", "completed"] - """ - The status of the vector store, which can be either `expired`, `in_progress`, or - `completed`. A status of `completed` indicates that the vector store is ready - for use. - """ - - usage_bytes: int - """The total number of bytes used by the files in the vector store.""" - - expires_after: Optional[ExpiresAfter] = None - """The expiration policy for a vector store.""" - - expires_at: Optional[int] = None - """The Unix timestamp (in seconds) for when the vector store will expire.""" diff --git a/src/omnistack/types/vector_store_update_params.py b/src/omnistack/types/vector_store_update_params.py deleted file mode 100644 index ff6c068..0000000 --- a/src/omnistack/types/vector_store_update_params.py +++ /dev/null @@ -1,35 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["VectorStoreUpdateParams", "ExpiresAfter"] - - -class VectorStoreUpdateParams(TypedDict, total=False): - expires_after: Optional[ExpiresAfter] - """The expiration policy for a vector store.""" - - metadata: Optional[object] - """Set of 16 key-value pairs that can be attached to an object. - - This can be useful for storing additional information about the object in a - structured format. Keys can be a maximum of 64 characters long and values can be - a maximum of 512 characters long. - """ - - name: Optional[str] - """The name of the vector store.""" - - -class ExpiresAfter(TypedDict, total=False): - anchor: Required[Literal["last_active_at"]] - """Anchor timestamp after which the expiration policy applies. - - Supported anchors: `last_active_at`. - """ - - days: Required[int] - """The number of days after the anchor time that the vector store will expire.""" diff --git a/src/omnistack/types/vector_stores/__init__.py b/src/omnistack/types/vector_stores/__init__.py deleted file mode 100644 index f8ff760..0000000 --- a/src/omnistack/types/vector_stores/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .file_list_params import FileListParams as FileListParams -from .file_create_params import FileCreateParams as FileCreateParams -from .file_list_response import FileListResponse as FileListResponse -from .file_delete_response import FileDeleteResponse as FileDeleteResponse -from .file_batch_create_params import FileBatchCreateParams as FileBatchCreateParams -from .vector_store_file_object import VectorStoreFileObject as VectorStoreFileObject -from .vector_store_file_batch_object import VectorStoreFileBatchObject as VectorStoreFileBatchObject diff --git a/src/omnistack/types/vector_stores/file_batch_create_params.py b/src/omnistack/types/vector_stores/file_batch_create_params.py deleted file mode 100644 index e7fb90b..0000000 --- a/src/omnistack/types/vector_stores/file_batch_create_params.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = [ - "FileBatchCreateParams", - "ChunkingStrategy", - "ChunkingStrategyAutoChunkingStrategyRequestParam", - "ChunkingStrategyStaticChunkingStrategyRequestParam", - "ChunkingStrategyStaticChunkingStrategyRequestParamStatic", -] - - -class FileBatchCreateParams(TypedDict, total=False): - file_ids: Required[List[str]] - """A list of [File](/docs/api-reference/files) IDs that the vector store should - use. - - Useful for tools like `file_search` that can access files. - """ - - chunking_strategy: ChunkingStrategy - """The chunking strategy used to chunk the file(s). - - If not set, will use the `auto` strategy. - """ - - -class ChunkingStrategyAutoChunkingStrategyRequestParam(TypedDict, total=False): - type: Required[Literal["auto"]] - """Always `auto`.""" - - -class ChunkingStrategyStaticChunkingStrategyRequestParamStatic(TypedDict, total=False): - chunk_overlap_tokens: Required[int] - """The number of tokens that overlap between chunks. The default value is `400`. - - Note that the overlap must not exceed half of `max_chunk_size_tokens`. - """ - - max_chunk_size_tokens: Required[int] - """The maximum number of tokens in each chunk. - - The default value is `800`. The minimum value is `100` and the maximum value is - `4096`. - """ - - -class ChunkingStrategyStaticChunkingStrategyRequestParam(TypedDict, total=False): - static: Required[ChunkingStrategyStaticChunkingStrategyRequestParamStatic] - - type: Required[Literal["static"]] - """Always `static`.""" - - -ChunkingStrategy: TypeAlias = Union[ - ChunkingStrategyAutoChunkingStrategyRequestParam, ChunkingStrategyStaticChunkingStrategyRequestParam -] diff --git a/src/omnistack/types/vector_stores/file_batches/__init__.py b/src/omnistack/types/vector_stores/file_batches/__init__.py deleted file mode 100644 index 84e021e..0000000 --- a/src/omnistack/types/vector_stores/file_batches/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .file_list_params import FileListParams as FileListParams -from .file_list_response import FileListResponse as FileListResponse diff --git a/src/omnistack/types/vector_stores/file_batches/file_list_params.py b/src/omnistack/types/vector_stores/file_batches/file_list_params.py deleted file mode 100644 index a648d50..0000000 --- a/src/omnistack/types/vector_stores/file_batches/file_list_params.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["FileListParams"] - - -class FileListParams(TypedDict, total=False): - vector_store_id: Required[str] - - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - before: str - """A cursor for use in pagination. - - `before` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page - of the list. - """ - - filter: Literal["in_progress", "completed", "failed", "cancelled"] - """Filter by file status. - - One of `in_progress`, `completed`, `failed`, `cancelled`. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: Literal["asc", "desc"] - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ diff --git a/src/omnistack/types/vector_stores/file_batches/file_list_response.py b/src/omnistack/types/vector_stores/file_batches/file_list_response.py deleted file mode 100644 index fe72a11..0000000 --- a/src/omnistack/types/vector_stores/file_batches/file_list_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ...._models import BaseModel -from ..vector_store_file_object import VectorStoreFileObject - -__all__ = ["FileListResponse"] - - -class FileListResponse(BaseModel): - data: List[VectorStoreFileObject] - - first_id: str - - has_more: bool - - last_id: str - - object: str diff --git a/src/omnistack/types/vector_stores/file_create_params.py b/src/omnistack/types/vector_stores/file_create_params.py deleted file mode 100644 index 239f38b..0000000 --- a/src/omnistack/types/vector_stores/file_create_params.py +++ /dev/null @@ -1,60 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = [ - "FileCreateParams", - "ChunkingStrategy", - "ChunkingStrategyAutoChunkingStrategyRequestParam", - "ChunkingStrategyStaticChunkingStrategyRequestParam", - "ChunkingStrategyStaticChunkingStrategyRequestParamStatic", -] - - -class FileCreateParams(TypedDict, total=False): - file_id: Required[str] - """A [File](/docs/api-reference/files) ID that the vector store should use. - - Useful for tools like `file_search` that can access files. - """ - - chunking_strategy: ChunkingStrategy - """The chunking strategy used to chunk the file(s). - - If not set, will use the `auto` strategy. - """ - - -class ChunkingStrategyAutoChunkingStrategyRequestParam(TypedDict, total=False): - type: Required[Literal["auto"]] - """Always `auto`.""" - - -class ChunkingStrategyStaticChunkingStrategyRequestParamStatic(TypedDict, total=False): - chunk_overlap_tokens: Required[int] - """The number of tokens that overlap between chunks. The default value is `400`. - - Note that the overlap must not exceed half of `max_chunk_size_tokens`. - """ - - max_chunk_size_tokens: Required[int] - """The maximum number of tokens in each chunk. - - The default value is `800`. The minimum value is `100` and the maximum value is - `4096`. - """ - - -class ChunkingStrategyStaticChunkingStrategyRequestParam(TypedDict, total=False): - static: Required[ChunkingStrategyStaticChunkingStrategyRequestParamStatic] - - type: Required[Literal["static"]] - """Always `static`.""" - - -ChunkingStrategy: TypeAlias = Union[ - ChunkingStrategyAutoChunkingStrategyRequestParam, ChunkingStrategyStaticChunkingStrategyRequestParam -] diff --git a/src/omnistack/types/vector_stores/file_delete_response.py b/src/omnistack/types/vector_stores/file_delete_response.py deleted file mode 100644 index 24fbe57..0000000 --- a/src/omnistack/types/vector_stores/file_delete_response.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["FileDeleteResponse"] - - -class FileDeleteResponse(BaseModel): - id: str - - deleted: bool - - object: Literal["vector_store.file.deleted"] diff --git a/src/omnistack/types/vector_stores/file_list_params.py b/src/omnistack/types/vector_stores/file_list_params.py deleted file mode 100644 index 23dd7f0..0000000 --- a/src/omnistack/types/vector_stores/file_list_params.py +++ /dev/null @@ -1,45 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, TypedDict - -__all__ = ["FileListParams"] - - -class FileListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. - - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ - - before: str - """A cursor for use in pagination. - - `before` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include before=obj_foo in order to fetch the previous page - of the list. - """ - - filter: Literal["in_progress", "completed", "failed", "cancelled"] - """Filter by file status. - - One of `in_progress`, `completed`, `failed`, `cancelled`. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: Literal["asc", "desc"] - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ diff --git a/src/omnistack/types/vector_stores/file_list_response.py b/src/omnistack/types/vector_stores/file_list_response.py deleted file mode 100644 index 6cea411..0000000 --- a/src/omnistack/types/vector_stores/file_list_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel -from .vector_store_file_object import VectorStoreFileObject - -__all__ = ["FileListResponse"] - - -class FileListResponse(BaseModel): - data: List[VectorStoreFileObject] - - first_id: str - - has_more: bool - - last_id: str - - object: str diff --git a/src/omnistack/types/vector_stores/vector_store_file_batch_object.py b/src/omnistack/types/vector_stores/vector_store_file_batch_object.py deleted file mode 100644 index 3d5aa1b..0000000 --- a/src/omnistack/types/vector_stores/vector_store_file_batch_object.py +++ /dev/null @@ -1,52 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["VectorStoreFileBatchObject", "FileCounts"] - - -class FileCounts(BaseModel): - cancelled: int - """The number of files that where cancelled.""" - - completed: int - """The number of files that have been processed.""" - - failed: int - """The number of files that have failed to process.""" - - in_progress: int - """The number of files that are currently being processed.""" - - total: int - """The total number of files.""" - - -class VectorStoreFileBatchObject(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints.""" - - created_at: int - """ - The Unix timestamp (in seconds) for when the vector store files batch was - created. - """ - - file_counts: FileCounts - - object: Literal["vector_store.files_batch"] - """The object type, which is always `vector_store.file_batch`.""" - - status: Literal["in_progress", "completed", "cancelled", "failed"] - """ - The status of the vector store files batch, which can be either `in_progress`, - `completed`, `cancelled` or `failed`. - """ - - vector_store_id: str - """ - The ID of the [vector store](/docs/api-reference/vector-stores/object) that the - [File](/docs/api-reference/files) is attached to. - """ diff --git a/src/omnistack/types/vector_stores/vector_store_file_object.py b/src/omnistack/types/vector_stores/vector_store_file_object.py deleted file mode 100644 index 3f943b9..0000000 --- a/src/omnistack/types/vector_stores/vector_store_file_object.py +++ /dev/null @@ -1,94 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal, TypeAlias - -from ..._models import BaseModel - -__all__ = [ - "VectorStoreFileObject", - "LastError", - "ChunkingStrategy", - "ChunkingStrategyStaticChunkingStrategyResponseParam", - "ChunkingStrategyStaticChunkingStrategyResponseParamStatic", - "ChunkingStrategyOtherChunkingStrategyResponseParam", -] - - -class LastError(BaseModel): - code: Literal["server_error", "unsupported_file", "invalid_file"] - """One of `server_error` or `rate_limit_exceeded`.""" - - message: str - """A human-readable description of the error.""" - - -class ChunkingStrategyStaticChunkingStrategyResponseParamStatic(BaseModel): - chunk_overlap_tokens: int - """The number of tokens that overlap between chunks. The default value is `400`. - - Note that the overlap must not exceed half of `max_chunk_size_tokens`. - """ - - max_chunk_size_tokens: int - """The maximum number of tokens in each chunk. - - The default value is `800`. The minimum value is `100` and the maximum value is - `4096`. - """ - - -class ChunkingStrategyStaticChunkingStrategyResponseParam(BaseModel): - static: ChunkingStrategyStaticChunkingStrategyResponseParamStatic - - type: Literal["static"] - """Always `static`.""" - - -class ChunkingStrategyOtherChunkingStrategyResponseParam(BaseModel): - type: Literal["other"] - """Always `other`.""" - - -ChunkingStrategy: TypeAlias = Union[ - ChunkingStrategyStaticChunkingStrategyResponseParam, ChunkingStrategyOtherChunkingStrategyResponseParam -] - - -class VectorStoreFileObject(BaseModel): - id: str - """The identifier, which can be referenced in API endpoints.""" - - created_at: int - """The Unix timestamp (in seconds) for when the vector store file was created.""" - - last_error: Optional[LastError] = None - """The last error associated with this vector store file. - - Will be `null` if there are no errors. - """ - - object: Literal["vector_store.file"] - """The object type, which is always `vector_store.file`.""" - - status: Literal["in_progress", "completed", "cancelled", "failed"] - """ - The status of the vector store file, which can be either `in_progress`, - `completed`, `cancelled`, or `failed`. The status `completed` indicates that the - vector store file is ready for use. - """ - - usage_bytes: int - """The total vector store usage in bytes. - - Note that this may be different from the original file size. - """ - - vector_store_id: str - """ - The ID of the [vector store](/docs/api-reference/vector-stores/object) that the - [File](/docs/api-reference/files) is attached to. - """ - - chunking_strategy: Optional[ChunkingStrategy] = None - """The strategy used to chunk the file.""" diff --git a/tests/api_resources/assistants/__init__.py b/tests/api_resources/assistants/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/assistants/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/audio/__init__.py b/tests/api_resources/audio/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/audio/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/audio/test_speech.py b/tests/api_resources/audio/test_speech.py deleted file mode 100644 index d7be228..0000000 --- a/tests/api_resources/audio/test_speech.py +++ /dev/null @@ -1,156 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import httpx -import pytest -from respx import MockRouter - -from omnistack import Omnistack, AsyncOmnistack -from omnistack._response import ( - BinaryAPIResponse, - AsyncBinaryAPIResponse, - StreamedBinaryAPIResponse, - AsyncStreamedBinaryAPIResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSpeech: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_method_create(self, client: Omnistack, respx_mock: MockRouter) -> None: - respx_mock.post("/audio/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - speech = client.audio.speech.create( - input="input", - model="string", - voice="alloy", - ) - assert speech.is_closed - assert speech.json() == {"foo": "bar"} - assert cast(Any, speech.is_closed) is True - assert isinstance(speech, BinaryAPIResponse) - - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_method_create_with_all_params(self, client: Omnistack, respx_mock: MockRouter) -> None: - respx_mock.post("/audio/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - speech = client.audio.speech.create( - input="input", - model="string", - voice="alloy", - response_format="mp3", - speed=0.25, - ) - assert speech.is_closed - assert speech.json() == {"foo": "bar"} - assert cast(Any, speech.is_closed) is True - assert isinstance(speech, BinaryAPIResponse) - - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_raw_response_create(self, client: Omnistack, respx_mock: MockRouter) -> None: - respx_mock.post("/audio/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - speech = client.audio.speech.with_raw_response.create( - input="input", - model="string", - voice="alloy", - ) - - assert speech.is_closed is True - assert speech.http_request.headers.get("X-Stainless-Lang") == "python" - assert speech.json() == {"foo": "bar"} - assert isinstance(speech, BinaryAPIResponse) - - @parametrize - @pytest.mark.respx(base_url=base_url) - def test_streaming_response_create(self, client: Omnistack, respx_mock: MockRouter) -> None: - respx_mock.post("/audio/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - with client.audio.speech.with_streaming_response.create( - input="input", - model="string", - voice="alloy", - ) as speech: - assert not speech.is_closed - assert speech.http_request.headers.get("X-Stainless-Lang") == "python" - - assert speech.json() == {"foo": "bar"} - assert cast(Any, speech.is_closed) is True - assert isinstance(speech, StreamedBinaryAPIResponse) - - assert cast(Any, speech.is_closed) is True - - -class TestAsyncSpeech: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_method_create(self, async_client: AsyncOmnistack, respx_mock: MockRouter) -> None: - respx_mock.post("/audio/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - speech = await async_client.audio.speech.create( - input="input", - model="string", - voice="alloy", - ) - assert speech.is_closed - assert await speech.json() == {"foo": "bar"} - assert cast(Any, speech.is_closed) is True - assert isinstance(speech, AsyncBinaryAPIResponse) - - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack, respx_mock: MockRouter) -> None: - respx_mock.post("/audio/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - speech = await async_client.audio.speech.create( - input="input", - model="string", - voice="alloy", - response_format="mp3", - speed=0.25, - ) - assert speech.is_closed - assert await speech.json() == {"foo": "bar"} - assert cast(Any, speech.is_closed) is True - assert isinstance(speech, AsyncBinaryAPIResponse) - - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_raw_response_create(self, async_client: AsyncOmnistack, respx_mock: MockRouter) -> None: - respx_mock.post("/audio/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - speech = await async_client.audio.speech.with_raw_response.create( - input="input", - model="string", - voice="alloy", - ) - - assert speech.is_closed is True - assert speech.http_request.headers.get("X-Stainless-Lang") == "python" - assert await speech.json() == {"foo": "bar"} - assert isinstance(speech, AsyncBinaryAPIResponse) - - @parametrize - @pytest.mark.respx(base_url=base_url) - async def test_streaming_response_create(self, async_client: AsyncOmnistack, respx_mock: MockRouter) -> None: - respx_mock.post("/audio/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - async with async_client.audio.speech.with_streaming_response.create( - input="input", - model="string", - voice="alloy", - ) as speech: - assert not speech.is_closed - assert speech.http_request.headers.get("X-Stainless-Lang") == "python" - - assert await speech.json() == {"foo": "bar"} - assert cast(Any, speech.is_closed) is True - assert isinstance(speech, AsyncStreamedBinaryAPIResponse) - - assert cast(Any, speech.is_closed) is True diff --git a/tests/api_resources/audio/test_transcriptions.py b/tests/api_resources/audio/test_transcriptions.py deleted file mode 100644 index 4582248..0000000 --- a/tests/api_resources/audio/test_transcriptions.py +++ /dev/null @@ -1,116 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.audio import TranscriptionCreateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTranscriptions: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - transcription = client.audio.transcriptions.create( - file=b"raw file contents", - model="whisper-1", - ) - assert_matches_type(TranscriptionCreateResponse, transcription, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - transcription = client.audio.transcriptions.create( - file=b"raw file contents", - model="whisper-1", - language="language", - prompt="prompt", - response_format="json", - temperature=0, - timestamp_granularities=["word", "segment"], - ) - assert_matches_type(TranscriptionCreateResponse, transcription, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.audio.transcriptions.with_raw_response.create( - file=b"raw file contents", - model="whisper-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - transcription = response.parse() - assert_matches_type(TranscriptionCreateResponse, transcription, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.audio.transcriptions.with_streaming_response.create( - file=b"raw file contents", - model="whisper-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - transcription = response.parse() - assert_matches_type(TranscriptionCreateResponse, transcription, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncTranscriptions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - transcription = await async_client.audio.transcriptions.create( - file=b"raw file contents", - model="whisper-1", - ) - assert_matches_type(TranscriptionCreateResponse, transcription, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - transcription = await async_client.audio.transcriptions.create( - file=b"raw file contents", - model="whisper-1", - language="language", - prompt="prompt", - response_format="json", - temperature=0, - timestamp_granularities=["word", "segment"], - ) - assert_matches_type(TranscriptionCreateResponse, transcription, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.audio.transcriptions.with_raw_response.create( - file=b"raw file contents", - model="whisper-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - transcription = await response.parse() - assert_matches_type(TranscriptionCreateResponse, transcription, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.audio.transcriptions.with_streaming_response.create( - file=b"raw file contents", - model="whisper-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - transcription = await response.parse() - assert_matches_type(TranscriptionCreateResponse, transcription, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/audio/test_translations.py b/tests/api_resources/audio/test_translations.py deleted file mode 100644 index de42776..0000000 --- a/tests/api_resources/audio/test_translations.py +++ /dev/null @@ -1,112 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.audio import TranslationCreateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTranslations: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - translation = client.audio.translations.create( - file=b"raw file contents", - model="whisper-1", - ) - assert_matches_type(TranslationCreateResponse, translation, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - translation = client.audio.translations.create( - file=b"raw file contents", - model="whisper-1", - prompt="prompt", - response_format="json", - temperature=0, - ) - assert_matches_type(TranslationCreateResponse, translation, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.audio.translations.with_raw_response.create( - file=b"raw file contents", - model="whisper-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - translation = response.parse() - assert_matches_type(TranslationCreateResponse, translation, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.audio.translations.with_streaming_response.create( - file=b"raw file contents", - model="whisper-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - translation = response.parse() - assert_matches_type(TranslationCreateResponse, translation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncTranslations: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - translation = await async_client.audio.translations.create( - file=b"raw file contents", - model="whisper-1", - ) - assert_matches_type(TranslationCreateResponse, translation, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - translation = await async_client.audio.translations.create( - file=b"raw file contents", - model="whisper-1", - prompt="prompt", - response_format="json", - temperature=0, - ) - assert_matches_type(TranslationCreateResponse, translation, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.audio.translations.with_raw_response.create( - file=b"raw file contents", - model="whisper-1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - translation = await response.parse() - assert_matches_type(TranslationCreateResponse, translation, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.audio.translations.with_streaming_response.create( - file=b"raw file contents", - model="whisper-1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - translation = await response.parse() - assert_matches_type(TranslationCreateResponse, translation, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/files/__init__.py b/tests/api_resources/files/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/files/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/files/test_content.py b/tests/api_resources/files/test_content.py deleted file mode 100644 index d4080b7..0000000 --- a/tests/api_resources/files/test_content.py +++ /dev/null @@ -1,97 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestContent: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - content = client.files.content.retrieve( - "file_id", - ) - assert_matches_type(str, content, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.files.content.with_raw_response.retrieve( - "file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = response.parse() - assert_matches_type(str, content, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.files.content.with_streaming_response.retrieve( - "file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - content = response.parse() - assert_matches_type(str, content, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - client.files.content.with_raw_response.retrieve( - "", - ) - - -class TestAsyncContent: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - content = await async_client.files.content.retrieve( - "file_id", - ) - assert_matches_type(str, content, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.files.content.with_raw_response.retrieve( - "file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = await response.parse() - assert_matches_type(str, content, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.files.content.with_streaming_response.retrieve( - "file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - content = await response.parse() - assert_matches_type(str, content, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - await async_client.files.content.with_raw_response.retrieve( - "", - ) diff --git a/tests/api_resources/fine_tuning/__init__.py b/tests/api_resources/fine_tuning/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/fine_tuning/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/fine_tuning/jobs/__init__.py b/tests/api_resources/fine_tuning/jobs/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/fine_tuning/jobs/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/fine_tuning/jobs/test_checkpoints.py b/tests/api_resources/fine_tuning/jobs/test_checkpoints.py deleted file mode 100644 index fd08a4c..0000000 --- a/tests/api_resources/fine_tuning/jobs/test_checkpoints.py +++ /dev/null @@ -1,116 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.fine_tuning.jobs import CheckpointListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCheckpoints: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - checkpoint = client.fine_tuning.jobs.checkpoints.list( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - assert_matches_type(CheckpointListResponse, checkpoint, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - checkpoint = client.fine_tuning.jobs.checkpoints.list( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - after="after", - limit=0, - ) - assert_matches_type(CheckpointListResponse, checkpoint, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.fine_tuning.jobs.checkpoints.with_raw_response.list( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - checkpoint = response.parse() - assert_matches_type(CheckpointListResponse, checkpoint, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.fine_tuning.jobs.checkpoints.with_streaming_response.list( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - checkpoint = response.parse() - assert_matches_type(CheckpointListResponse, checkpoint, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"): - client.fine_tuning.jobs.checkpoints.with_raw_response.list( - fine_tuning_job_id="", - ) - - -class TestAsyncCheckpoints: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - checkpoint = await async_client.fine_tuning.jobs.checkpoints.list( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - assert_matches_type(CheckpointListResponse, checkpoint, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - checkpoint = await async_client.fine_tuning.jobs.checkpoints.list( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - after="after", - limit=0, - ) - assert_matches_type(CheckpointListResponse, checkpoint, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.fine_tuning.jobs.checkpoints.with_raw_response.list( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - checkpoint = await response.parse() - assert_matches_type(CheckpointListResponse, checkpoint, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.fine_tuning.jobs.checkpoints.with_streaming_response.list( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - checkpoint = await response.parse() - assert_matches_type(CheckpointListResponse, checkpoint, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"): - await async_client.fine_tuning.jobs.checkpoints.with_raw_response.list( - fine_tuning_job_id="", - ) diff --git a/tests/api_resources/fine_tuning/jobs/test_events.py b/tests/api_resources/fine_tuning/jobs/test_events.py deleted file mode 100644 index fbba30b..0000000 --- a/tests/api_resources/fine_tuning/jobs/test_events.py +++ /dev/null @@ -1,116 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.fine_tuning.jobs import EventRetrieveResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEvents: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - event = client.fine_tuning.jobs.events.retrieve( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - def test_method_retrieve_with_all_params(self, client: Omnistack) -> None: - event = client.fine_tuning.jobs.events.retrieve( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - after="after", - limit=0, - ) - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.fine_tuning.jobs.events.with_raw_response.retrieve( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.fine_tuning.jobs.events.with_streaming_response.retrieve( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = response.parse() - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"): - client.fine_tuning.jobs.events.with_raw_response.retrieve( - fine_tuning_job_id="", - ) - - -class TestAsyncEvents: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - event = await async_client.fine_tuning.jobs.events.retrieve( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOmnistack) -> None: - event = await async_client.fine_tuning.jobs.events.retrieve( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - after="after", - limit=0, - ) - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.fine_tuning.jobs.events.with_raw_response.retrieve( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = await response.parse() - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.fine_tuning.jobs.events.with_streaming_response.retrieve( - fine_tuning_job_id="ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - event = await response.parse() - assert_matches_type(EventRetrieveResponse, event, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"): - await async_client.fine_tuning.jobs.events.with_raw_response.retrieve( - fine_tuning_job_id="", - ) diff --git a/tests/api_resources/fine_tuning/test_jobs.py b/tests/api_resources/fine_tuning/test_jobs.py deleted file mode 100644 index 565d24d..0000000 --- a/tests/api_resources/fine_tuning/test_jobs.py +++ /dev/null @@ -1,398 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.fine_tuning import FineTuningJob, JobListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestJobs: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - job = client.fine_tuning.jobs.create( - model="gpt-4o-mini", - training_file="file-abc123", - ) - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - job = client.fine_tuning.jobs.create( - model="gpt-4o-mini", - training_file="file-abc123", - hyperparameters={ - "batch_size": "auto", - "learning_rate_multiplier": "auto", - "n_epochs": "auto", - }, - integrations=[ - { - "type": "wandb", - "wandb": { - "project": "my-wandb-project", - "entity": "entity", - "name": "name", - "tags": ["custom-tag", "custom-tag", "custom-tag"], - }, - }, - { - "type": "wandb", - "wandb": { - "project": "my-wandb-project", - "entity": "entity", - "name": "name", - "tags": ["custom-tag", "custom-tag", "custom-tag"], - }, - }, - { - "type": "wandb", - "wandb": { - "project": "my-wandb-project", - "entity": "entity", - "name": "name", - "tags": ["custom-tag", "custom-tag", "custom-tag"], - }, - }, - ], - seed=42, - suffix="x", - validation_file="file-abc123", - ) - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.fine_tuning.jobs.with_raw_response.create( - model="gpt-4o-mini", - training_file="file-abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.fine_tuning.jobs.with_streaming_response.create( - model="gpt-4o-mini", - training_file="file-abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - job = client.fine_tuning.jobs.retrieve( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.fine_tuning.jobs.with_raw_response.retrieve( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.fine_tuning.jobs.with_streaming_response.retrieve( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"): - client.fine_tuning.jobs.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - job = client.fine_tuning.jobs.list() - assert_matches_type(JobListResponse, job, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - job = client.fine_tuning.jobs.list( - after="after", - limit=0, - ) - assert_matches_type(JobListResponse, job, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.fine_tuning.jobs.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.fine_tuning.jobs.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_cancel(self, client: Omnistack) -> None: - job = client.fine_tuning.jobs.cancel( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - def test_raw_response_cancel(self, client: Omnistack) -> None: - response = client.fine_tuning.jobs.with_raw_response.cancel( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - def test_streaming_response_cancel(self, client: Omnistack) -> None: - with client.fine_tuning.jobs.with_streaming_response.cancel( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_cancel(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"): - client.fine_tuning.jobs.with_raw_response.cancel( - "", - ) - - -class TestAsyncJobs: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - job = await async_client.fine_tuning.jobs.create( - model="gpt-4o-mini", - training_file="file-abc123", - ) - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - job = await async_client.fine_tuning.jobs.create( - model="gpt-4o-mini", - training_file="file-abc123", - hyperparameters={ - "batch_size": "auto", - "learning_rate_multiplier": "auto", - "n_epochs": "auto", - }, - integrations=[ - { - "type": "wandb", - "wandb": { - "project": "my-wandb-project", - "entity": "entity", - "name": "name", - "tags": ["custom-tag", "custom-tag", "custom-tag"], - }, - }, - { - "type": "wandb", - "wandb": { - "project": "my-wandb-project", - "entity": "entity", - "name": "name", - "tags": ["custom-tag", "custom-tag", "custom-tag"], - }, - }, - { - "type": "wandb", - "wandb": { - "project": "my-wandb-project", - "entity": "entity", - "name": "name", - "tags": ["custom-tag", "custom-tag", "custom-tag"], - }, - }, - ], - seed=42, - suffix="x", - validation_file="file-abc123", - ) - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.fine_tuning.jobs.with_raw_response.create( - model="gpt-4o-mini", - training_file="file-abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = await response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.fine_tuning.jobs.with_streaming_response.create( - model="gpt-4o-mini", - training_file="file-abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = await response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - job = await async_client.fine_tuning.jobs.retrieve( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.fine_tuning.jobs.with_raw_response.retrieve( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = await response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.fine_tuning.jobs.with_streaming_response.retrieve( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = await response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"): - await async_client.fine_tuning.jobs.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - job = await async_client.fine_tuning.jobs.list() - assert_matches_type(JobListResponse, job, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - job = await async_client.fine_tuning.jobs.list( - after="after", - limit=0, - ) - assert_matches_type(JobListResponse, job, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.fine_tuning.jobs.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = await response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.fine_tuning.jobs.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = await response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_cancel(self, async_client: AsyncOmnistack) -> None: - job = await async_client.fine_tuning.jobs.cancel( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - async def test_raw_response_cancel(self, async_client: AsyncOmnistack) -> None: - response = await async_client.fine_tuning.jobs.with_raw_response.cancel( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = await response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - @parametrize - async def test_streaming_response_cancel(self, async_client: AsyncOmnistack) -> None: - async with async_client.fine_tuning.jobs.with_streaming_response.cancel( - "ft-AF1WoRqd3aJAHsqc9NY7iL8F", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = await response.parse() - assert_matches_type(FineTuningJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_cancel(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `fine_tuning_job_id` but received ''"): - await async_client.fine_tuning.jobs.with_raw_response.cancel( - "", - ) diff --git a/tests/api_resources/images/__init__.py b/tests/api_resources/images/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/images/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/images/test_edits.py b/tests/api_resources/images/test_edits.py deleted file mode 100644 index 686b1d0..0000000 --- a/tests/api_resources/images/test_edits.py +++ /dev/null @@ -1,118 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import ImageResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEdits: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - edit = client.images.edits.create( - image=b"raw file contents", - prompt="A cute baby sea otter wearing a beret", - ) - assert_matches_type(ImageResponse, edit, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - edit = client.images.edits.create( - image=b"raw file contents", - prompt="A cute baby sea otter wearing a beret", - mask=b"raw file contents", - model="dall-e-2", - n=1, - response_format="url", - size="256x256", - user="user-1234", - ) - assert_matches_type(ImageResponse, edit, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.images.edits.with_raw_response.create( - image=b"raw file contents", - prompt="A cute baby sea otter wearing a beret", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - edit = response.parse() - assert_matches_type(ImageResponse, edit, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.images.edits.with_streaming_response.create( - image=b"raw file contents", - prompt="A cute baby sea otter wearing a beret", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - edit = response.parse() - assert_matches_type(ImageResponse, edit, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncEdits: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - edit = await async_client.images.edits.create( - image=b"raw file contents", - prompt="A cute baby sea otter wearing a beret", - ) - assert_matches_type(ImageResponse, edit, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - edit = await async_client.images.edits.create( - image=b"raw file contents", - prompt="A cute baby sea otter wearing a beret", - mask=b"raw file contents", - model="dall-e-2", - n=1, - response_format="url", - size="256x256", - user="user-1234", - ) - assert_matches_type(ImageResponse, edit, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.images.edits.with_raw_response.create( - image=b"raw file contents", - prompt="A cute baby sea otter wearing a beret", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - edit = await response.parse() - assert_matches_type(ImageResponse, edit, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.images.edits.with_streaming_response.create( - image=b"raw file contents", - prompt="A cute baby sea otter wearing a beret", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - edit = await response.parse() - assert_matches_type(ImageResponse, edit, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/images/test_generations.py b/tests/api_resources/images/test_generations.py deleted file mode 100644 index b14a656..0000000 --- a/tests/api_resources/images/test_generations.py +++ /dev/null @@ -1,112 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import ImageResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestGenerations: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - generation = client.images.generations.create( - prompt="A cute baby sea otter", - ) - assert_matches_type(ImageResponse, generation, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - generation = client.images.generations.create( - prompt="A cute baby sea otter", - model="dall-e-3", - n=1, - quality="standard", - response_format="url", - size="256x256", - style="vivid", - user="user-1234", - ) - assert_matches_type(ImageResponse, generation, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.images.generations.with_raw_response.create( - prompt="A cute baby sea otter", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - generation = response.parse() - assert_matches_type(ImageResponse, generation, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.images.generations.with_streaming_response.create( - prompt="A cute baby sea otter", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - generation = response.parse() - assert_matches_type(ImageResponse, generation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncGenerations: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - generation = await async_client.images.generations.create( - prompt="A cute baby sea otter", - ) - assert_matches_type(ImageResponse, generation, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - generation = await async_client.images.generations.create( - prompt="A cute baby sea otter", - model="dall-e-3", - n=1, - quality="standard", - response_format="url", - size="256x256", - style="vivid", - user="user-1234", - ) - assert_matches_type(ImageResponse, generation, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.images.generations.with_raw_response.create( - prompt="A cute baby sea otter", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - generation = await response.parse() - assert_matches_type(ImageResponse, generation, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.images.generations.with_streaming_response.create( - prompt="A cute baby sea otter", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - generation = await response.parse() - assert_matches_type(ImageResponse, generation, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/images/test_variations.py b/tests/api_resources/images/test_variations.py deleted file mode 100644 index 3203fb4..0000000 --- a/tests/api_resources/images/test_variations.py +++ /dev/null @@ -1,108 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import ImageResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestVariations: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - variation = client.images.variations.create( - image=b"raw file contents", - ) - assert_matches_type(ImageResponse, variation, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - variation = client.images.variations.create( - image=b"raw file contents", - model="dall-e-2", - n=1, - response_format="url", - size="256x256", - user="user-1234", - ) - assert_matches_type(ImageResponse, variation, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.images.variations.with_raw_response.create( - image=b"raw file contents", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - variation = response.parse() - assert_matches_type(ImageResponse, variation, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.images.variations.with_streaming_response.create( - image=b"raw file contents", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - variation = response.parse() - assert_matches_type(ImageResponse, variation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncVariations: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - variation = await async_client.images.variations.create( - image=b"raw file contents", - ) - assert_matches_type(ImageResponse, variation, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - variation = await async_client.images.variations.create( - image=b"raw file contents", - model="dall-e-2", - n=1, - response_format="url", - size="256x256", - user="user-1234", - ) - assert_matches_type(ImageResponse, variation, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.images.variations.with_raw_response.create( - image=b"raw file contents", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - variation = await response.parse() - assert_matches_type(ImageResponse, variation, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.images.variations.with_streaming_response.create( - image=b"raw file contents", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - variation = await response.parse() - assert_matches_type(ImageResponse, variation, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/organization/__init__.py b/tests/api_resources/organization/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/organization/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/organization/projects/__init__.py b/tests/api_resources/organization/projects/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/organization/projects/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/organization/projects/test_service_accounts.py b/tests/api_resources/organization/projects/test_service_accounts.py deleted file mode 100644 index c1f8ebf..0000000 --- a/tests/api_resources/organization/projects/test_service_accounts.py +++ /dev/null @@ -1,300 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.shared import ProjectServiceAccount -from omnistack.types.organization.projects import ( - ServiceAccountListResponse, - ServiceAccountCreateResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestServiceAccounts: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - service_account = client.organization.projects.service_accounts.create( - project_id="project_id", - name="name", - ) - assert_matches_type(ServiceAccountCreateResponse, service_account, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.organization.projects.service_accounts.with_raw_response.create( - project_id="project_id", - name="name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_account = response.parse() - assert_matches_type(ServiceAccountCreateResponse, service_account, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.organization.projects.service_accounts.with_streaming_response.create( - project_id="project_id", - name="name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_account = response.parse() - assert_matches_type(ServiceAccountCreateResponse, service_account, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.service_accounts.with_raw_response.create( - project_id="", - name="name", - ) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - service_account = client.organization.projects.service_accounts.retrieve( - service_account_id="service_account_id", - project_id="project_id", - ) - assert_matches_type(ProjectServiceAccount, service_account, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.organization.projects.service_accounts.with_raw_response.retrieve( - service_account_id="service_account_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_account = response.parse() - assert_matches_type(ProjectServiceAccount, service_account, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.organization.projects.service_accounts.with_streaming_response.retrieve( - service_account_id="service_account_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_account = response.parse() - assert_matches_type(ProjectServiceAccount, service_account, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.service_accounts.with_raw_response.retrieve( - service_account_id="service_account_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_account_id` but received ''"): - client.organization.projects.service_accounts.with_raw_response.retrieve( - service_account_id="", - project_id="project_id", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - service_account = client.organization.projects.service_accounts.list( - project_id="project_id", - ) - assert_matches_type(ServiceAccountListResponse, service_account, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - service_account = client.organization.projects.service_accounts.list( - project_id="project_id", - after="after", - limit=0, - ) - assert_matches_type(ServiceAccountListResponse, service_account, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.organization.projects.service_accounts.with_raw_response.list( - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_account = response.parse() - assert_matches_type(ServiceAccountListResponse, service_account, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.organization.projects.service_accounts.with_streaming_response.list( - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_account = response.parse() - assert_matches_type(ServiceAccountListResponse, service_account, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.service_accounts.with_raw_response.list( - project_id="", - ) - - -class TestAsyncServiceAccounts: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - service_account = await async_client.organization.projects.service_accounts.create( - project_id="project_id", - name="name", - ) - assert_matches_type(ServiceAccountCreateResponse, service_account, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.service_accounts.with_raw_response.create( - project_id="project_id", - name="name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_account = await response.parse() - assert_matches_type(ServiceAccountCreateResponse, service_account, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.service_accounts.with_streaming_response.create( - project_id="project_id", - name="name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_account = await response.parse() - assert_matches_type(ServiceAccountCreateResponse, service_account, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.service_accounts.with_raw_response.create( - project_id="", - name="name", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - service_account = await async_client.organization.projects.service_accounts.retrieve( - service_account_id="service_account_id", - project_id="project_id", - ) - assert_matches_type(ProjectServiceAccount, service_account, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.service_accounts.with_raw_response.retrieve( - service_account_id="service_account_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_account = await response.parse() - assert_matches_type(ProjectServiceAccount, service_account, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.service_accounts.with_streaming_response.retrieve( - service_account_id="service_account_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_account = await response.parse() - assert_matches_type(ProjectServiceAccount, service_account, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.service_accounts.with_raw_response.retrieve( - service_account_id="service_account_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_account_id` but received ''"): - await async_client.organization.projects.service_accounts.with_raw_response.retrieve( - service_account_id="", - project_id="project_id", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - service_account = await async_client.organization.projects.service_accounts.list( - project_id="project_id", - ) - assert_matches_type(ServiceAccountListResponse, service_account, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - service_account = await async_client.organization.projects.service_accounts.list( - project_id="project_id", - after="after", - limit=0, - ) - assert_matches_type(ServiceAccountListResponse, service_account, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.service_accounts.with_raw_response.list( - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_account = await response.parse() - assert_matches_type(ServiceAccountListResponse, service_account, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.service_accounts.with_streaming_response.list( - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_account = await response.parse() - assert_matches_type(ServiceAccountListResponse, service_account, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.service_accounts.with_raw_response.list( - project_id="", - ) diff --git a/tests/api_resources/organization/projects/test_users.py b/tests/api_resources/organization/projects/test_users.py deleted file mode 100644 index 9498e06..0000000 --- a/tests/api_resources/organization/projects/test_users.py +++ /dev/null @@ -1,418 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.shared import ProjectUser -from omnistack.types.organization.projects import ( - UserListResponse, - UserDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestUsers: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - user = client.organization.projects.users.create( - user_id="user_id", - project_id="project_id", - role="owner", - ) - assert_matches_type(ProjectUser, user, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.organization.projects.users.with_raw_response.create( - user_id="user_id", - project_id="project_id", - role="owner", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(ProjectUser, user, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.organization.projects.users.with_streaming_response.create( - user_id="user_id", - project_id="project_id", - role="owner", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(ProjectUser, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.users.with_raw_response.create( - user_id="user_id", - project_id="", - role="owner", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.organization.projects.users.with_raw_response.create( - user_id="", - project_id="project_id", - role="owner", - ) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - user = client.organization.projects.users.retrieve( - user_id="user_id", - project_id="project_id", - ) - assert_matches_type(ProjectUser, user, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.organization.projects.users.with_raw_response.retrieve( - user_id="user_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(ProjectUser, user, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.organization.projects.users.with_streaming_response.retrieve( - user_id="user_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(ProjectUser, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.users.with_raw_response.retrieve( - user_id="user_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.organization.projects.users.with_raw_response.retrieve( - user_id="", - project_id="project_id", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - user = client.organization.projects.users.list( - project_id="project_id", - ) - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - user = client.organization.projects.users.list( - project_id="project_id", - after="after", - limit=0, - ) - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.organization.projects.users.with_raw_response.list( - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.organization.projects.users.with_streaming_response.list( - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(UserListResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.users.with_raw_response.list( - project_id="", - ) - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - user = client.organization.projects.users.delete( - user_id="user_id", - project_id="project_id", - ) - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.organization.projects.users.with_raw_response.delete( - user_id="user_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.organization.projects.users.with_streaming_response.delete( - user_id="user_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.users.with_raw_response.delete( - user_id="user_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.organization.projects.users.with_raw_response.delete( - user_id="", - project_id="project_id", - ) - - -class TestAsyncUsers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.projects.users.create( - user_id="user_id", - project_id="project_id", - role="owner", - ) - assert_matches_type(ProjectUser, user, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.users.with_raw_response.create( - user_id="user_id", - project_id="project_id", - role="owner", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(ProjectUser, user, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.users.with_streaming_response.create( - user_id="user_id", - project_id="project_id", - role="owner", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(ProjectUser, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.users.with_raw_response.create( - user_id="user_id", - project_id="", - role="owner", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.organization.projects.users.with_raw_response.create( - user_id="", - project_id="project_id", - role="owner", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.projects.users.retrieve( - user_id="user_id", - project_id="project_id", - ) - assert_matches_type(ProjectUser, user, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.users.with_raw_response.retrieve( - user_id="user_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(ProjectUser, user, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.users.with_streaming_response.retrieve( - user_id="user_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(ProjectUser, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.users.with_raw_response.retrieve( - user_id="user_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.organization.projects.users.with_raw_response.retrieve( - user_id="", - project_id="project_id", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.projects.users.list( - project_id="project_id", - ) - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.projects.users.list( - project_id="project_id", - after="after", - limit=0, - ) - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.users.with_raw_response.list( - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.users.with_streaming_response.list( - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(UserListResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.users.with_raw_response.list( - project_id="", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.projects.users.delete( - user_id="user_id", - project_id="project_id", - ) - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.users.with_raw_response.delete( - user_id="user_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.users.with_streaming_response.delete( - user_id="user_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.users.with_raw_response.delete( - user_id="user_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.organization.projects.users.with_raw_response.delete( - user_id="", - project_id="project_id", - ) diff --git a/tests/api_resources/organization/test_audit_logs.py b/tests/api_resources/organization/test_audit_logs.py deleted file mode 100644 index cd27b67..0000000 --- a/tests/api_resources/organization/test_audit_logs.py +++ /dev/null @@ -1,112 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.organization import AuditLogListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAuditLogs: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - audit_log = client.organization.audit_logs.list() - assert_matches_type(AuditLogListResponse, audit_log, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - audit_log = client.organization.audit_logs.list( - actor_emails=["string", "string", "string"], - actor_ids=["string", "string", "string"], - after="after", - before="before", - effective_at={ - "gt": 0, - "gte": 0, - "lt": 0, - "lte": 0, - }, - event_types=["api_key.created", "api_key.updated", "api_key.deleted"], - limit=0, - project_ids=["string", "string", "string"], - resource_ids=["string", "string", "string"], - ) - assert_matches_type(AuditLogListResponse, audit_log, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.organization.audit_logs.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - audit_log = response.parse() - assert_matches_type(AuditLogListResponse, audit_log, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.organization.audit_logs.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - audit_log = response.parse() - assert_matches_type(AuditLogListResponse, audit_log, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncAuditLogs: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - audit_log = await async_client.organization.audit_logs.list() - assert_matches_type(AuditLogListResponse, audit_log, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - audit_log = await async_client.organization.audit_logs.list( - actor_emails=["string", "string", "string"], - actor_ids=["string", "string", "string"], - after="after", - before="before", - effective_at={ - "gt": 0, - "gte": 0, - "lt": 0, - "lte": 0, - }, - event_types=["api_key.created", "api_key.updated", "api_key.deleted"], - limit=0, - project_ids=["string", "string", "string"], - resource_ids=["string", "string", "string"], - ) - assert_matches_type(AuditLogListResponse, audit_log, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.audit_logs.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - audit_log = await response.parse() - assert_matches_type(AuditLogListResponse, audit_log, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.audit_logs.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - audit_log = await response.parse() - assert_matches_type(AuditLogListResponse, audit_log, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/organization/test_invites.py b/tests/api_resources/organization/test_invites.py deleted file mode 100644 index 89e14f2..0000000 --- a/tests/api_resources/organization/test_invites.py +++ /dev/null @@ -1,312 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.organization import ( - Invite, - InviteListResponse, - InviteDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestInvites: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - invite = client.organization.invites.create( - email="email", - role="reader", - ) - assert_matches_type(Invite, invite, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.organization.invites.with_raw_response.create( - email="email", - role="reader", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invite = response.parse() - assert_matches_type(Invite, invite, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.organization.invites.with_streaming_response.create( - email="email", - role="reader", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invite = response.parse() - assert_matches_type(Invite, invite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - invite = client.organization.invites.retrieve( - "invite_id", - ) - assert_matches_type(Invite, invite, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.organization.invites.with_raw_response.retrieve( - "invite_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invite = response.parse() - assert_matches_type(Invite, invite, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.organization.invites.with_streaming_response.retrieve( - "invite_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invite = response.parse() - assert_matches_type(Invite, invite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `invite_id` but received ''"): - client.organization.invites.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - invite = client.organization.invites.list() - assert_matches_type(InviteListResponse, invite, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - invite = client.organization.invites.list( - after="after", - limit=0, - ) - assert_matches_type(InviteListResponse, invite, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.organization.invites.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invite = response.parse() - assert_matches_type(InviteListResponse, invite, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.organization.invites.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invite = response.parse() - assert_matches_type(InviteListResponse, invite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - invite = client.organization.invites.delete( - "invite_id", - ) - assert_matches_type(InviteDeleteResponse, invite, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.organization.invites.with_raw_response.delete( - "invite_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invite = response.parse() - assert_matches_type(InviteDeleteResponse, invite, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.organization.invites.with_streaming_response.delete( - "invite_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invite = response.parse() - assert_matches_type(InviteDeleteResponse, invite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `invite_id` but received ''"): - client.organization.invites.with_raw_response.delete( - "", - ) - - -class TestAsyncInvites: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - invite = await async_client.organization.invites.create( - email="email", - role="reader", - ) - assert_matches_type(Invite, invite, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.invites.with_raw_response.create( - email="email", - role="reader", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invite = await response.parse() - assert_matches_type(Invite, invite, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.invites.with_streaming_response.create( - email="email", - role="reader", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invite = await response.parse() - assert_matches_type(Invite, invite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - invite = await async_client.organization.invites.retrieve( - "invite_id", - ) - assert_matches_type(Invite, invite, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.invites.with_raw_response.retrieve( - "invite_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invite = await response.parse() - assert_matches_type(Invite, invite, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.invites.with_streaming_response.retrieve( - "invite_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invite = await response.parse() - assert_matches_type(Invite, invite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `invite_id` but received ''"): - await async_client.organization.invites.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - invite = await async_client.organization.invites.list() - assert_matches_type(InviteListResponse, invite, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - invite = await async_client.organization.invites.list( - after="after", - limit=0, - ) - assert_matches_type(InviteListResponse, invite, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.invites.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invite = await response.parse() - assert_matches_type(InviteListResponse, invite, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.invites.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invite = await response.parse() - assert_matches_type(InviteListResponse, invite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - invite = await async_client.organization.invites.delete( - "invite_id", - ) - assert_matches_type(InviteDeleteResponse, invite, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.invites.with_raw_response.delete( - "invite_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invite = await response.parse() - assert_matches_type(InviteDeleteResponse, invite, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.invites.with_streaming_response.delete( - "invite_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invite = await response.parse() - assert_matches_type(InviteDeleteResponse, invite, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `invite_id` but received ''"): - await async_client.organization.invites.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/organization/test_projects.py b/tests/api_resources/organization/test_projects.py deleted file mode 100644 index 5000857..0000000 --- a/tests/api_resources/organization/test_projects.py +++ /dev/null @@ -1,326 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.organization import Project, ProjectListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestProjects: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - project = client.organization.projects.create( - project_id="project_id", - name="name", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.organization.projects.with_raw_response.create( - project_id="project_id", - name="name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.organization.projects.with_streaming_response.create( - project_id="project_id", - name="name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.with_raw_response.create( - project_id="", - name="name", - ) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - project = client.organization.projects.retrieve( - "project_id", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.organization.projects.with_raw_response.retrieve( - "project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.organization.projects.with_streaming_response.retrieve( - "project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - project = client.organization.projects.list() - assert_matches_type(ProjectListResponse, project, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - project = client.organization.projects.list( - after="after", - include_archived=True, - limit=0, - ) - assert_matches_type(ProjectListResponse, project, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.organization.projects.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.organization.projects.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_archive(self, client: Omnistack) -> None: - project = client.organization.projects.archive( - "project_id", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_raw_response_archive(self, client: Omnistack) -> None: - response = client.organization.projects.with_raw_response.archive( - "project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - def test_streaming_response_archive(self, client: Omnistack) -> None: - with client.organization.projects.with_streaming_response.archive( - "project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(Project, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_archive(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.organization.projects.with_raw_response.archive( - "", - ) - - -class TestAsyncProjects: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - project = await async_client.organization.projects.create( - project_id="project_id", - name="name", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.with_raw_response.create( - project_id="project_id", - name="name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.with_streaming_response.create( - project_id="project_id", - name="name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.with_raw_response.create( - project_id="", - name="name", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - project = await async_client.organization.projects.retrieve( - "project_id", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.with_raw_response.retrieve( - "project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.with_streaming_response.retrieve( - "project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - project = await async_client.organization.projects.list() - assert_matches_type(ProjectListResponse, project, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - project = await async_client.organization.projects.list( - after="after", - include_archived=True, - limit=0, - ) - assert_matches_type(ProjectListResponse, project, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_archive(self, async_client: AsyncOmnistack) -> None: - project = await async_client.organization.projects.archive( - "project_id", - ) - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_raw_response_archive(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.projects.with_raw_response.archive( - "project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) - - @parametrize - async def test_streaming_response_archive(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.projects.with_streaming_response.archive( - "project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(Project, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_archive(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.organization.projects.with_raw_response.archive( - "", - ) diff --git a/tests/api_resources/organization/test_users.py b/tests/api_resources/organization/test_users.py deleted file mode 100644 index 2090af2..0000000 --- a/tests/api_resources/organization/test_users.py +++ /dev/null @@ -1,328 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.organization import ( - User, - UserListResponse, - UserDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestUsers: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - user = client.organization.users.create( - user_id="user_id", - role="owner", - ) - assert_matches_type(User, user, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.organization.users.with_raw_response.create( - user_id="user_id", - role="owner", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(User, user, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.organization.users.with_streaming_response.create( - user_id="user_id", - role="owner", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(User, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.organization.users.with_raw_response.create( - user_id="", - role="owner", - ) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - user = client.organization.users.retrieve( - "user_id", - ) - assert_matches_type(User, user, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.organization.users.with_raw_response.retrieve( - "user_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(User, user, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.organization.users.with_streaming_response.retrieve( - "user_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(User, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.organization.users.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - user = client.organization.users.list() - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - user = client.organization.users.list( - after="after", - limit=0, - ) - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.organization.users.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.organization.users.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(UserListResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - user = client.organization.users.delete( - "user_id", - ) - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.organization.users.with_raw_response.delete( - "user_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = response.parse() - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.organization.users.with_streaming_response.delete( - "user_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = response.parse() - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - client.organization.users.with_raw_response.delete( - "", - ) - - -class TestAsyncUsers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.users.create( - user_id="user_id", - role="owner", - ) - assert_matches_type(User, user, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.users.with_raw_response.create( - user_id="user_id", - role="owner", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(User, user, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.users.with_streaming_response.create( - user_id="user_id", - role="owner", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(User, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.organization.users.with_raw_response.create( - user_id="", - role="owner", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.users.retrieve( - "user_id", - ) - assert_matches_type(User, user, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.users.with_raw_response.retrieve( - "user_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(User, user, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.users.with_streaming_response.retrieve( - "user_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(User, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.organization.users.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.users.list() - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.users.list( - after="after", - limit=0, - ) - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.users.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(UserListResponse, user, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.users.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(UserListResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - user = await async_client.organization.users.delete( - "user_id", - ) - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.organization.users.with_raw_response.delete( - "user_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - user = await response.parse() - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.organization.users.with_streaming_response.delete( - "user_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - user = await response.parse() - assert_matches_type(UserDeleteResponse, user, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `user_id` but received ''"): - await async_client.organization.users.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/projects/__init__.py b/tests/api_resources/projects/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/projects/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/projects/test_api_keys.py b/tests/api_resources/projects/test_api_keys.py deleted file mode 100644 index 1fbdd43..0000000 --- a/tests/api_resources/projects/test_api_keys.py +++ /dev/null @@ -1,309 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.shared import ProjectAPIKey -from omnistack.types.projects import APIKeyListResponse, APIKeyDeleteResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAPIKeys: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - api_key = client.projects.api_keys.retrieve( - key_id="key_id", - project_id="project_id", - ) - assert_matches_type(ProjectAPIKey, api_key, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.projects.api_keys.with_raw_response.retrieve( - key_id="key_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_key = response.parse() - assert_matches_type(ProjectAPIKey, api_key, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.projects.api_keys.with_streaming_response.retrieve( - key_id="key_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_key = response.parse() - assert_matches_type(ProjectAPIKey, api_key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.api_keys.with_raw_response.retrieve( - key_id="key_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): - client.projects.api_keys.with_raw_response.retrieve( - key_id="", - project_id="project_id", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - api_key = client.projects.api_keys.list( - project_id="project_id", - ) - assert_matches_type(APIKeyListResponse, api_key, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - api_key = client.projects.api_keys.list( - project_id="project_id", - after="after", - limit=0, - ) - assert_matches_type(APIKeyListResponse, api_key, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.projects.api_keys.with_raw_response.list( - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_key = response.parse() - assert_matches_type(APIKeyListResponse, api_key, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.projects.api_keys.with_streaming_response.list( - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_key = response.parse() - assert_matches_type(APIKeyListResponse, api_key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.api_keys.with_raw_response.list( - project_id="", - ) - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - api_key = client.projects.api_keys.delete( - key_id="key_id", - project_id="project_id", - ) - assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.projects.api_keys.with_raw_response.delete( - key_id="key_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_key = response.parse() - assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.projects.api_keys.with_streaming_response.delete( - key_id="key_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_key = response.parse() - assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.api_keys.with_raw_response.delete( - key_id="key_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): - client.projects.api_keys.with_raw_response.delete( - key_id="", - project_id="project_id", - ) - - -class TestAsyncAPIKeys: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - api_key = await async_client.projects.api_keys.retrieve( - key_id="key_id", - project_id="project_id", - ) - assert_matches_type(ProjectAPIKey, api_key, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.projects.api_keys.with_raw_response.retrieve( - key_id="key_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_key = await response.parse() - assert_matches_type(ProjectAPIKey, api_key, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.projects.api_keys.with_streaming_response.retrieve( - key_id="key_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_key = await response.parse() - assert_matches_type(ProjectAPIKey, api_key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.api_keys.with_raw_response.retrieve( - key_id="key_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): - await async_client.projects.api_keys.with_raw_response.retrieve( - key_id="", - project_id="project_id", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - api_key = await async_client.projects.api_keys.list( - project_id="project_id", - ) - assert_matches_type(APIKeyListResponse, api_key, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - api_key = await async_client.projects.api_keys.list( - project_id="project_id", - after="after", - limit=0, - ) - assert_matches_type(APIKeyListResponse, api_key, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.projects.api_keys.with_raw_response.list( - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_key = await response.parse() - assert_matches_type(APIKeyListResponse, api_key, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.projects.api_keys.with_streaming_response.list( - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_key = await response.parse() - assert_matches_type(APIKeyListResponse, api_key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.api_keys.with_raw_response.list( - project_id="", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - api_key = await async_client.projects.api_keys.delete( - key_id="key_id", - project_id="project_id", - ) - assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.projects.api_keys.with_raw_response.delete( - key_id="key_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - api_key = await response.parse() - assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.projects.api_keys.with_streaming_response.delete( - key_id="key_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - api_key = await response.parse() - assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.api_keys.with_raw_response.delete( - key_id="key_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `key_id` but received ''"): - await async_client.projects.api_keys.with_raw_response.delete( - key_id="", - project_id="project_id", - ) diff --git a/tests/api_resources/projects/test_service_accounts.py b/tests/api_resources/projects/test_service_accounts.py deleted file mode 100644 index eadd220..0000000 --- a/tests/api_resources/projects/test_service_accounts.py +++ /dev/null @@ -1,118 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.projects import ServiceAccountDeleteResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestServiceAccounts: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - service_account = client.projects.service_accounts.delete( - service_account_id="service_account_id", - project_id="project_id", - ) - assert_matches_type(ServiceAccountDeleteResponse, service_account, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.projects.service_accounts.with_raw_response.delete( - service_account_id="service_account_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_account = response.parse() - assert_matches_type(ServiceAccountDeleteResponse, service_account, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.projects.service_accounts.with_streaming_response.delete( - service_account_id="service_account_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_account = response.parse() - assert_matches_type(ServiceAccountDeleteResponse, service_account, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - client.projects.service_accounts.with_raw_response.delete( - service_account_id="service_account_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_account_id` but received ''"): - client.projects.service_accounts.with_raw_response.delete( - service_account_id="", - project_id="project_id", - ) - - -class TestAsyncServiceAccounts: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - service_account = await async_client.projects.service_accounts.delete( - service_account_id="service_account_id", - project_id="project_id", - ) - assert_matches_type(ServiceAccountDeleteResponse, service_account, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.projects.service_accounts.with_raw_response.delete( - service_account_id="service_account_id", - project_id="project_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - service_account = await response.parse() - assert_matches_type(ServiceAccountDeleteResponse, service_account, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.projects.service_accounts.with_streaming_response.delete( - service_account_id="service_account_id", - project_id="project_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - service_account = await response.parse() - assert_matches_type(ServiceAccountDeleteResponse, service_account, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"): - await async_client.projects.service_accounts.with_raw_response.delete( - service_account_id="service_account_id", - project_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `service_account_id` but received ''"): - await async_client.projects.service_accounts.with_raw_response.delete( - service_account_id="", - project_id="project_id", - ) diff --git a/tests/api_resources/test_assistants.py b/tests/api_resources/test_assistants.py deleted file mode 100644 index f5bc788..0000000 --- a/tests/api_resources/test_assistants.py +++ /dev/null @@ -1,364 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import ( - AssistantObject, - AssistantListResponse, - AssistantDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAssistants: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - assistant = client.assistants.create( - assistant_id="assistant_id", - ) - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - assistant = client.assistants.create( - assistant_id="assistant_id", - description="description", - instructions="instructions", - metadata={}, - model="model", - name="name", - response_format="auto", - temperature=1, - tool_resources={ - "code_interpreter": {"file_ids": ["string", "string", "string"]}, - "file_search": {"vector_store_ids": ["string"]}, - }, - tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], - top_p=1, - ) - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.assistants.with_raw_response.create( - assistant_id="assistant_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assistant = response.parse() - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.assistants.with_streaming_response.create( - assistant_id="assistant_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - assistant = response.parse() - assert_matches_type(AssistantObject, assistant, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): - client.assistants.with_raw_response.create( - assistant_id="", - ) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - assistant = client.assistants.retrieve( - "assistant_id", - ) - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.assistants.with_raw_response.retrieve( - "assistant_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assistant = response.parse() - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.assistants.with_streaming_response.retrieve( - "assistant_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - assistant = response.parse() - assert_matches_type(AssistantObject, assistant, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): - client.assistants.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - assistant = client.assistants.list() - assert_matches_type(AssistantListResponse, assistant, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - assistant = client.assistants.list( - after="after", - before="before", - limit=0, - order="asc", - ) - assert_matches_type(AssistantListResponse, assistant, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.assistants.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assistant = response.parse() - assert_matches_type(AssistantListResponse, assistant, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.assistants.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - assistant = response.parse() - assert_matches_type(AssistantListResponse, assistant, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - assistant = client.assistants.delete( - "assistant_id", - ) - assert_matches_type(AssistantDeleteResponse, assistant, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.assistants.with_raw_response.delete( - "assistant_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assistant = response.parse() - assert_matches_type(AssistantDeleteResponse, assistant, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.assistants.with_streaming_response.delete( - "assistant_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - assistant = response.parse() - assert_matches_type(AssistantDeleteResponse, assistant, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): - client.assistants.with_raw_response.delete( - "", - ) - - -class TestAsyncAssistants: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - assistant = await async_client.assistants.create( - assistant_id="assistant_id", - ) - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - assistant = await async_client.assistants.create( - assistant_id="assistant_id", - description="description", - instructions="instructions", - metadata={}, - model="model", - name="name", - response_format="auto", - temperature=1, - tool_resources={ - "code_interpreter": {"file_ids": ["string", "string", "string"]}, - "file_search": {"vector_store_ids": ["string"]}, - }, - tools=[{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}], - top_p=1, - ) - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.assistants.with_raw_response.create( - assistant_id="assistant_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assistant = await response.parse() - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.assistants.with_streaming_response.create( - assistant_id="assistant_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - assistant = await response.parse() - assert_matches_type(AssistantObject, assistant, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): - await async_client.assistants.with_raw_response.create( - assistant_id="", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - assistant = await async_client.assistants.retrieve( - "assistant_id", - ) - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.assistants.with_raw_response.retrieve( - "assistant_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assistant = await response.parse() - assert_matches_type(AssistantObject, assistant, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.assistants.with_streaming_response.retrieve( - "assistant_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - assistant = await response.parse() - assert_matches_type(AssistantObject, assistant, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): - await async_client.assistants.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - assistant = await async_client.assistants.list() - assert_matches_type(AssistantListResponse, assistant, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - assistant = await async_client.assistants.list( - after="after", - before="before", - limit=0, - order="asc", - ) - assert_matches_type(AssistantListResponse, assistant, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.assistants.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assistant = await response.parse() - assert_matches_type(AssistantListResponse, assistant, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.assistants.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - assistant = await response.parse() - assert_matches_type(AssistantListResponse, assistant, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - assistant = await async_client.assistants.delete( - "assistant_id", - ) - assert_matches_type(AssistantDeleteResponse, assistant, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.assistants.with_raw_response.delete( - "assistant_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - assistant = await response.parse() - assert_matches_type(AssistantDeleteResponse, assistant, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.assistants.with_streaming_response.delete( - "assistant_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - assistant = await response.parse() - assert_matches_type(AssistantDeleteResponse, assistant, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `assistant_id` but received ''"): - await async_client.assistants.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/test_batches.py b/tests/api_resources/test_batches.py deleted file mode 100644 index 76e12cf..0000000 --- a/tests/api_resources/test_batches.py +++ /dev/null @@ -1,334 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import Batch, BatchListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBatches: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - batch = client.batches.create( - completion_window="24h", - endpoint="/v1/chat/completions", - input_file_id="input_file_id", - ) - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - batch = client.batches.create( - completion_window="24h", - endpoint="/v1/chat/completions", - input_file_id="input_file_id", - metadata={"foo": "string"}, - ) - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.batches.with_raw_response.create( - completion_window="24h", - endpoint="/v1/chat/completions", - input_file_id="input_file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - batch = response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.batches.with_streaming_response.create( - completion_window="24h", - endpoint="/v1/chat/completions", - input_file_id="input_file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - batch = response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - batch = client.batches.retrieve( - "batch_id", - ) - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.batches.with_raw_response.retrieve( - "batch_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - batch = response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.batches.with_streaming_response.retrieve( - "batch_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - batch = response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - client.batches.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - batch = client.batches.list() - assert_matches_type(BatchListResponse, batch, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - batch = client.batches.list( - after="after", - limit=0, - ) - assert_matches_type(BatchListResponse, batch, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.batches.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - batch = response.parse() - assert_matches_type(BatchListResponse, batch, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.batches.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - batch = response.parse() - assert_matches_type(BatchListResponse, batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_cancel(self, client: Omnistack) -> None: - batch = client.batches.cancel( - "batch_id", - ) - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - def test_raw_response_cancel(self, client: Omnistack) -> None: - response = client.batches.with_raw_response.cancel( - "batch_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - batch = response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - def test_streaming_response_cancel(self, client: Omnistack) -> None: - with client.batches.with_streaming_response.cancel( - "batch_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - batch = response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_cancel(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - client.batches.with_raw_response.cancel( - "", - ) - - -class TestAsyncBatches: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - batch = await async_client.batches.create( - completion_window="24h", - endpoint="/v1/chat/completions", - input_file_id="input_file_id", - ) - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - batch = await async_client.batches.create( - completion_window="24h", - endpoint="/v1/chat/completions", - input_file_id="input_file_id", - metadata={"foo": "string"}, - ) - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.batches.with_raw_response.create( - completion_window="24h", - endpoint="/v1/chat/completions", - input_file_id="input_file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - batch = await response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.batches.with_streaming_response.create( - completion_window="24h", - endpoint="/v1/chat/completions", - input_file_id="input_file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - batch = await response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - batch = await async_client.batches.retrieve( - "batch_id", - ) - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.batches.with_raw_response.retrieve( - "batch_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - batch = await response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.batches.with_streaming_response.retrieve( - "batch_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - batch = await response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - await async_client.batches.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - batch = await async_client.batches.list() - assert_matches_type(BatchListResponse, batch, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - batch = await async_client.batches.list( - after="after", - limit=0, - ) - assert_matches_type(BatchListResponse, batch, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.batches.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - batch = await response.parse() - assert_matches_type(BatchListResponse, batch, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.batches.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - batch = await response.parse() - assert_matches_type(BatchListResponse, batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_cancel(self, async_client: AsyncOmnistack) -> None: - batch = await async_client.batches.cancel( - "batch_id", - ) - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - async def test_raw_response_cancel(self, async_client: AsyncOmnistack) -> None: - response = await async_client.batches.with_raw_response.cancel( - "batch_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - batch = await response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - @parametrize - async def test_streaming_response_cancel(self, async_client: AsyncOmnistack) -> None: - async with async_client.batches.with_streaming_response.cancel( - "batch_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - batch = await response.parse() - assert_matches_type(Batch, batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_cancel(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - await async_client.batches.with_raw_response.cancel( - "", - ) diff --git a/tests/api_resources/test_embeddings.py b/tests/api_resources/test_embeddings.py deleted file mode 100644 index 18ecaa3..0000000 --- a/tests/api_resources/test_embeddings.py +++ /dev/null @@ -1,112 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import EmbeddingCreateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEmbeddings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - embedding = client.embeddings.create( - input="The quick brown fox jumped over the lazy dog", - model="text-embedding-3-small", - ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - embedding = client.embeddings.create( - input="The quick brown fox jumped over the lazy dog", - model="text-embedding-3-small", - dimensions=1, - encoding_format="float", - user="user-1234", - ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.embeddings.with_raw_response.create( - input="The quick brown fox jumped over the lazy dog", - model="text-embedding-3-small", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - embedding = response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.embeddings.with_streaming_response.create( - input="The quick brown fox jumped over the lazy dog", - model="text-embedding-3-small", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - embedding = response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncEmbeddings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - embedding = await async_client.embeddings.create( - input="The quick brown fox jumped over the lazy dog", - model="text-embedding-3-small", - ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - embedding = await async_client.embeddings.create( - input="The quick brown fox jumped over the lazy dog", - model="text-embedding-3-small", - dimensions=1, - encoding_format="float", - user="user-1234", - ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.embeddings.with_raw_response.create( - input="The quick brown fox jumped over the lazy dog", - model="text-embedding-3-small", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - embedding = await response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.embeddings.with_streaming_response.create( - input="The quick brown fox jumped over the lazy dog", - model="text-embedding-3-small", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - embedding = await response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_files.py b/tests/api_resources/test_files.py deleted file mode 100644 index edaf914..0000000 --- a/tests/api_resources/test_files.py +++ /dev/null @@ -1,306 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import OpenAIFile, FileListResponse, FileDeleteResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFiles: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - file = client.files.create( - file=b"raw file contents", - purpose="assistants", - ) - assert_matches_type(OpenAIFile, file, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.files.with_raw_response.create( - file=b"raw file contents", - purpose="assistants", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(OpenAIFile, file, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.files.with_streaming_response.create( - file=b"raw file contents", - purpose="assistants", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(OpenAIFile, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - file = client.files.retrieve( - "file_id", - ) - assert_matches_type(OpenAIFile, file, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.files.with_raw_response.retrieve( - "file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(OpenAIFile, file, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.files.with_streaming_response.retrieve( - "file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(OpenAIFile, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - client.files.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - file = client.files.list() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - file = client.files.list( - purpose="purpose", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.files.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.files.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - file = client.files.delete( - "file_id", - ) - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.files.with_raw_response.delete( - "file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.files.with_streaming_response.delete( - "file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - client.files.with_raw_response.delete( - "", - ) - - -class TestAsyncFiles: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - file = await async_client.files.create( - file=b"raw file contents", - purpose="assistants", - ) - assert_matches_type(OpenAIFile, file, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.files.with_raw_response.create( - file=b"raw file contents", - purpose="assistants", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(OpenAIFile, file, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.files.with_streaming_response.create( - file=b"raw file contents", - purpose="assistants", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(OpenAIFile, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - file = await async_client.files.retrieve( - "file_id", - ) - assert_matches_type(OpenAIFile, file, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.files.with_raw_response.retrieve( - "file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(OpenAIFile, file, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.files.with_streaming_response.retrieve( - "file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(OpenAIFile, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - await async_client.files.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - file = await async_client.files.list() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - file = await async_client.files.list( - purpose="purpose", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.files.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.files.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - file = await async_client.files.delete( - "file_id", - ) - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.files.with_raw_response.delete( - "file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.files.with_streaming_response.delete( - "file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - await async_client.files.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/test_models.py b/tests/api_resources/test_models.py deleted file mode 100644 index 3f43701..0000000 --- a/tests/api_resources/test_models.py +++ /dev/null @@ -1,224 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import Model, ModelListResponse, ModelDeleteResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestModels: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - model = client.models.retrieve( - "gpt-4o-mini", - ) - assert_matches_type(Model, model, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.models.with_raw_response.retrieve( - "gpt-4o-mini", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = response.parse() - assert_matches_type(Model, model, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.models.with_streaming_response.retrieve( - "gpt-4o-mini", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = response.parse() - assert_matches_type(Model, model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model` but received ''"): - client.models.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - model = client.models.list() - assert_matches_type(ModelListResponse, model, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.models.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = response.parse() - assert_matches_type(ModelListResponse, model, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.models.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = response.parse() - assert_matches_type(ModelListResponse, model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - model = client.models.delete( - "ft:gpt-4o-mini:acemeco:suffix:abc123", - ) - assert_matches_type(ModelDeleteResponse, model, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.models.with_raw_response.delete( - "ft:gpt-4o-mini:acemeco:suffix:abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = response.parse() - assert_matches_type(ModelDeleteResponse, model, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.models.with_streaming_response.delete( - "ft:gpt-4o-mini:acemeco:suffix:abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = response.parse() - assert_matches_type(ModelDeleteResponse, model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model` but received ''"): - client.models.with_raw_response.delete( - "", - ) - - -class TestAsyncModels: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - model = await async_client.models.retrieve( - "gpt-4o-mini", - ) - assert_matches_type(Model, model, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.models.with_raw_response.retrieve( - "gpt-4o-mini", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = await response.parse() - assert_matches_type(Model, model, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.models.with_streaming_response.retrieve( - "gpt-4o-mini", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = await response.parse() - assert_matches_type(Model, model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model` but received ''"): - await async_client.models.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - model = await async_client.models.list() - assert_matches_type(ModelListResponse, model, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.models.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = await response.parse() - assert_matches_type(ModelListResponse, model, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.models.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = await response.parse() - assert_matches_type(ModelListResponse, model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - model = await async_client.models.delete( - "ft:gpt-4o-mini:acemeco:suffix:abc123", - ) - assert_matches_type(ModelDeleteResponse, model, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.models.with_raw_response.delete( - "ft:gpt-4o-mini:acemeco:suffix:abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - model = await response.parse() - assert_matches_type(ModelDeleteResponse, model, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.models.with_streaming_response.delete( - "ft:gpt-4o-mini:acemeco:suffix:abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - model = await response.parse() - assert_matches_type(ModelDeleteResponse, model, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `model` but received ''"): - await async_client.models.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/test_moderations.py b/tests/api_resources/test_moderations.py deleted file mode 100644 index 0f08ab4..0000000 --- a/tests/api_resources/test_moderations.py +++ /dev/null @@ -1,100 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import ModerationCreateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestModerations: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - moderation = client.moderations.create( - input="I want to kill them.", - ) - assert_matches_type(ModerationCreateResponse, moderation, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - moderation = client.moderations.create( - input="I want to kill them.", - model="omni-moderation-2024-09-26", - ) - assert_matches_type(ModerationCreateResponse, moderation, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.moderations.with_raw_response.create( - input="I want to kill them.", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - moderation = response.parse() - assert_matches_type(ModerationCreateResponse, moderation, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.moderations.with_streaming_response.create( - input="I want to kill them.", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - moderation = response.parse() - assert_matches_type(ModerationCreateResponse, moderation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncModerations: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - moderation = await async_client.moderations.create( - input="I want to kill them.", - ) - assert_matches_type(ModerationCreateResponse, moderation, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - moderation = await async_client.moderations.create( - input="I want to kill them.", - model="omni-moderation-2024-09-26", - ) - assert_matches_type(ModerationCreateResponse, moderation, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.moderations.with_raw_response.create( - input="I want to kill them.", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - moderation = await response.parse() - assert_matches_type(ModerationCreateResponse, moderation, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.moderations.with_streaming_response.create( - input="I want to kill them.", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - moderation = await response.parse() - assert_matches_type(ModerationCreateResponse, moderation, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_threads.py b/tests/api_resources/test_threads.py deleted file mode 100644 index f4c77a9..0000000 --- a/tests/api_resources/test_threads.py +++ /dev/null @@ -1,555 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import ThreadDeleteResponse -from omnistack.types.assistants import ThreadObject - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestThreads: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - thread = client.threads.create() - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - thread = client.threads.create( - messages=[ - { - "content": "string", - "role": "user", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - ], - "metadata": {}, - }, - { - "content": "string", - "role": "user", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - ], - "metadata": {}, - }, - { - "content": "string", - "role": "user", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - ], - "metadata": {}, - }, - ], - metadata={}, - tool_resources={ - "code_interpreter": {"file_ids": ["string", "string", "string"]}, - "file_search": { - "vector_store_ids": ["string"], - "vector_stores": [ - { - "chunking_strategy": {"type": "auto"}, - "file_ids": ["string", "string", "string"], - "metadata": {}, - } - ], - }, - }, - ) - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.threads.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - thread = response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.threads.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - thread = response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - thread = client.threads.retrieve( - "thread_id", - ) - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.threads.with_raw_response.retrieve( - "thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - thread = response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.threads.with_streaming_response.retrieve( - "thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - thread = response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_update(self, client: Omnistack) -> None: - thread = client.threads.update( - thread_id="thread_id", - ) - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Omnistack) -> None: - thread = client.threads.update( - thread_id="thread_id", - metadata={}, - tool_resources={ - "code_interpreter": {"file_ids": ["string", "string", "string"]}, - "file_search": {"vector_store_ids": ["string"]}, - }, - ) - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Omnistack) -> None: - response = client.threads.with_raw_response.update( - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - thread = response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Omnistack) -> None: - with client.threads.with_streaming_response.update( - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - thread = response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.with_raw_response.update( - thread_id="", - ) - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - thread = client.threads.delete( - "thread_id", - ) - assert_matches_type(ThreadDeleteResponse, thread, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.threads.with_raw_response.delete( - "thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - thread = response.parse() - assert_matches_type(ThreadDeleteResponse, thread, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.threads.with_streaming_response.delete( - "thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - thread = response.parse() - assert_matches_type(ThreadDeleteResponse, thread, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.with_raw_response.delete( - "", - ) - - -class TestAsyncThreads: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - thread = await async_client.threads.create() - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - thread = await async_client.threads.create( - messages=[ - { - "content": "string", - "role": "user", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - ], - "metadata": {}, - }, - { - "content": "string", - "role": "user", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - ], - "metadata": {}, - }, - { - "content": "string", - "role": "user", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - { - "file_id": "file_id", - "tools": [ - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - {"type": "code_interpreter"}, - ], - }, - ], - "metadata": {}, - }, - ], - metadata={}, - tool_resources={ - "code_interpreter": {"file_ids": ["string", "string", "string"]}, - "file_search": { - "vector_store_ids": ["string"], - "vector_stores": [ - { - "chunking_strategy": {"type": "auto"}, - "file_ids": ["string", "string", "string"], - "metadata": {}, - } - ], - }, - }, - ) - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - thread = await response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - thread = await response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - thread = await async_client.threads.retrieve( - "thread_id", - ) - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.with_raw_response.retrieve( - "thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - thread = await response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.with_streaming_response.retrieve( - "thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - thread = await response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_update(self, async_client: AsyncOmnistack) -> None: - thread = await async_client.threads.update( - thread_id="thread_id", - ) - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncOmnistack) -> None: - thread = await async_client.threads.update( - thread_id="thread_id", - metadata={}, - tool_resources={ - "code_interpreter": {"file_ids": ["string", "string", "string"]}, - "file_search": {"vector_store_ids": ["string"]}, - }, - ) - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.with_raw_response.update( - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - thread = await response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.with_streaming_response.update( - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - thread = await response.parse() - assert_matches_type(ThreadObject, thread, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.with_raw_response.update( - thread_id="", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - thread = await async_client.threads.delete( - "thread_id", - ) - assert_matches_type(ThreadDeleteResponse, thread, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.with_raw_response.delete( - "thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - thread = await response.parse() - assert_matches_type(ThreadDeleteResponse, thread, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.with_streaming_response.delete( - "thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - thread = await response.parse() - assert_matches_type(ThreadDeleteResponse, thread, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/test_uploads.py b/tests/api_resources/test_uploads.py deleted file mode 100644 index 4bb9c6a..0000000 --- a/tests/api_resources/test_uploads.py +++ /dev/null @@ -1,280 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import Upload - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestUploads: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - upload = client.uploads.create( - bytes=0, - filename="filename", - mime_type="mime_type", - purpose="assistants", - ) - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.uploads.with_raw_response.create( - bytes=0, - filename="filename", - mime_type="mime_type", - purpose="assistants", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - upload = response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.uploads.with_streaming_response.create( - bytes=0, - filename="filename", - mime_type="mime_type", - purpose="assistants", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - upload = response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_cancel(self, client: Omnistack) -> None: - upload = client.uploads.cancel( - "upload_abc123", - ) - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - def test_raw_response_cancel(self, client: Omnistack) -> None: - response = client.uploads.with_raw_response.cancel( - "upload_abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - upload = response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - def test_streaming_response_cancel(self, client: Omnistack) -> None: - with client.uploads.with_streaming_response.cancel( - "upload_abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - upload = response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_cancel(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `upload_id` but received ''"): - client.uploads.with_raw_response.cancel( - "", - ) - - @parametrize - def test_method_complete(self, client: Omnistack) -> None: - upload = client.uploads.complete( - upload_id="upload_abc123", - part_ids=["string", "string", "string"], - ) - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - def test_method_complete_with_all_params(self, client: Omnistack) -> None: - upload = client.uploads.complete( - upload_id="upload_abc123", - part_ids=["string", "string", "string"], - md5="md5", - ) - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - def test_raw_response_complete(self, client: Omnistack) -> None: - response = client.uploads.with_raw_response.complete( - upload_id="upload_abc123", - part_ids=["string", "string", "string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - upload = response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - def test_streaming_response_complete(self, client: Omnistack) -> None: - with client.uploads.with_streaming_response.complete( - upload_id="upload_abc123", - part_ids=["string", "string", "string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - upload = response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_complete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `upload_id` but received ''"): - client.uploads.with_raw_response.complete( - upload_id="", - part_ids=["string", "string", "string"], - ) - - -class TestAsyncUploads: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - upload = await async_client.uploads.create( - bytes=0, - filename="filename", - mime_type="mime_type", - purpose="assistants", - ) - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.uploads.with_raw_response.create( - bytes=0, - filename="filename", - mime_type="mime_type", - purpose="assistants", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - upload = await response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.uploads.with_streaming_response.create( - bytes=0, - filename="filename", - mime_type="mime_type", - purpose="assistants", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - upload = await response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_cancel(self, async_client: AsyncOmnistack) -> None: - upload = await async_client.uploads.cancel( - "upload_abc123", - ) - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - async def test_raw_response_cancel(self, async_client: AsyncOmnistack) -> None: - response = await async_client.uploads.with_raw_response.cancel( - "upload_abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - upload = await response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - async def test_streaming_response_cancel(self, async_client: AsyncOmnistack) -> None: - async with async_client.uploads.with_streaming_response.cancel( - "upload_abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - upload = await response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_cancel(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `upload_id` but received ''"): - await async_client.uploads.with_raw_response.cancel( - "", - ) - - @parametrize - async def test_method_complete(self, async_client: AsyncOmnistack) -> None: - upload = await async_client.uploads.complete( - upload_id="upload_abc123", - part_ids=["string", "string", "string"], - ) - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - async def test_method_complete_with_all_params(self, async_client: AsyncOmnistack) -> None: - upload = await async_client.uploads.complete( - upload_id="upload_abc123", - part_ids=["string", "string", "string"], - md5="md5", - ) - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - async def test_raw_response_complete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.uploads.with_raw_response.complete( - upload_id="upload_abc123", - part_ids=["string", "string", "string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - upload = await response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - @parametrize - async def test_streaming_response_complete(self, async_client: AsyncOmnistack) -> None: - async with async_client.uploads.with_streaming_response.complete( - upload_id="upload_abc123", - part_ids=["string", "string", "string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - upload = await response.parse() - assert_matches_type(Upload, upload, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_complete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `upload_id` but received ''"): - await async_client.uploads.with_raw_response.complete( - upload_id="", - part_ids=["string", "string", "string"], - ) diff --git a/tests/api_resources/test_vector_stores.py b/tests/api_resources/test_vector_stores.py deleted file mode 100644 index abad966..0000000 --- a/tests/api_resources/test_vector_stores.py +++ /dev/null @@ -1,428 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import ( - VectorStoreObject, - VectorStoreListResponse, - VectorStoreDeleteResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestVectorStores: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - vector_store = client.vector_stores.create() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - vector_store = client.vector_stores.create( - chunking_strategy={"type": "auto"}, - expires_after={ - "anchor": "last_active_at", - "days": 1, - }, - file_ids=["string", "string", "string"], - metadata={}, - name="name", - ) - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.vector_stores.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.vector_stores.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - vector_store = client.vector_stores.retrieve( - "vector_store_id", - ) - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.vector_stores.with_raw_response.retrieve( - "vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.vector_stores.with_streaming_response.retrieve( - "vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_update(self, client: Omnistack) -> None: - vector_store = client.vector_stores.update( - vector_store_id="vector_store_id", - ) - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Omnistack) -> None: - vector_store = client.vector_stores.update( - vector_store_id="vector_store_id", - expires_after={ - "anchor": "last_active_at", - "days": 1, - }, - metadata={}, - name="name", - ) - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Omnistack) -> None: - response = client.vector_stores.with_raw_response.update( - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Omnistack) -> None: - with client.vector_stores.with_streaming_response.update( - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.with_raw_response.update( - vector_store_id="", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - vector_store = client.vector_stores.list() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - vector_store = client.vector_stores.list( - after="after", - before="before", - limit=0, - order="asc", - ) - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.vector_stores.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.vector_stores.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - vector_store = client.vector_stores.delete( - "vector_store_id", - ) - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.vector_stores.with_raw_response.delete( - "vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.vector_stores.with_streaming_response.delete( - "vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.with_raw_response.delete( - "", - ) - - -class TestAsyncVectorStores: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - vector_store = await async_client.vector_stores.create() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - vector_store = await async_client.vector_stores.create( - chunking_strategy={"type": "auto"}, - expires_after={ - "anchor": "last_active_at", - "days": 1, - }, - file_ids=["string", "string", "string"], - metadata={}, - name="name", - ) - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - vector_store = await async_client.vector_stores.retrieve( - "vector_store_id", - ) - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.with_raw_response.retrieve( - "vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.with_streaming_response.retrieve( - "vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_update(self, async_client: AsyncOmnistack) -> None: - vector_store = await async_client.vector_stores.update( - vector_store_id="vector_store_id", - ) - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncOmnistack) -> None: - vector_store = await async_client.vector_stores.update( - vector_store_id="vector_store_id", - expires_after={ - "anchor": "last_active_at", - "days": 1, - }, - metadata={}, - name="name", - ) - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.with_raw_response.update( - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.with_streaming_response.update( - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStoreObject, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.with_raw_response.update( - vector_store_id="", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - vector_store = await async_client.vector_stores.list() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - vector_store = await async_client.vector_stores.list( - after="after", - before="before", - limit=0, - order="asc", - ) - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStoreListResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - vector_store = await async_client.vector_stores.delete( - "vector_store_id", - ) - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.with_raw_response.delete( - "vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.with_streaming_response.delete( - "vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/threads/__init__.py b/tests/api_resources/threads/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/threads/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/threads/runs/__init__.py b/tests/api_resources/threads/runs/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/threads/runs/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/threads/runs/test_steps.py b/tests/api_resources/threads/runs/test_steps.py deleted file mode 100644 index b09fd61..0000000 --- a/tests/api_resources/threads/runs/test_steps.py +++ /dev/null @@ -1,284 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.threads.runs import RunStepObject, StepListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSteps: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - step = client.threads.runs.steps.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="run_id", - ) - assert_matches_type(RunStepObject, step, path=["response"]) - - @parametrize - def test_method_retrieve_with_all_params(self, client: Omnistack) -> None: - step = client.threads.runs.steps.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="run_id", - include=["step_details.tool_calls[*].file_search.results[*].content"], - ) - assert_matches_type(RunStepObject, step, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.threads.runs.steps.with_raw_response.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="run_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - step = response.parse() - assert_matches_type(RunStepObject, step, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.threads.runs.steps.with_streaming_response.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="run_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - step = response.parse() - assert_matches_type(RunStepObject, step, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.runs.steps.with_raw_response.retrieve( - step_id="step_id", - thread_id="", - run_id="run_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.threads.runs.steps.with_raw_response.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - client.threads.runs.steps.with_raw_response.retrieve( - step_id="", - thread_id="thread_id", - run_id="run_id", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - step = client.threads.runs.steps.list( - run_id="run_id", - thread_id="thread_id", - ) - assert_matches_type(StepListResponse, step, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - step = client.threads.runs.steps.list( - run_id="run_id", - thread_id="thread_id", - after="after", - before="before", - include=["step_details.tool_calls[*].file_search.results[*].content"], - limit=0, - order="asc", - ) - assert_matches_type(StepListResponse, step, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.threads.runs.steps.with_raw_response.list( - run_id="run_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - step = response.parse() - assert_matches_type(StepListResponse, step, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.threads.runs.steps.with_streaming_response.list( - run_id="run_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - step = response.parse() - assert_matches_type(StepListResponse, step, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.runs.steps.with_raw_response.list( - run_id="run_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.threads.runs.steps.with_raw_response.list( - run_id="", - thread_id="thread_id", - ) - - -class TestAsyncSteps: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - step = await async_client.threads.runs.steps.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="run_id", - ) - assert_matches_type(RunStepObject, step, path=["response"]) - - @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOmnistack) -> None: - step = await async_client.threads.runs.steps.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="run_id", - include=["step_details.tool_calls[*].file_search.results[*].content"], - ) - assert_matches_type(RunStepObject, step, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.runs.steps.with_raw_response.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="run_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - step = await response.parse() - assert_matches_type(RunStepObject, step, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.runs.steps.with_streaming_response.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="run_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - step = await response.parse() - assert_matches_type(RunStepObject, step, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.runs.steps.with_raw_response.retrieve( - step_id="step_id", - thread_id="", - run_id="run_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.threads.runs.steps.with_raw_response.retrieve( - step_id="step_id", - thread_id="thread_id", - run_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - await async_client.threads.runs.steps.with_raw_response.retrieve( - step_id="", - thread_id="thread_id", - run_id="run_id", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - step = await async_client.threads.runs.steps.list( - run_id="run_id", - thread_id="thread_id", - ) - assert_matches_type(StepListResponse, step, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - step = await async_client.threads.runs.steps.list( - run_id="run_id", - thread_id="thread_id", - after="after", - before="before", - include=["step_details.tool_calls[*].file_search.results[*].content"], - limit=0, - order="asc", - ) - assert_matches_type(StepListResponse, step, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.runs.steps.with_raw_response.list( - run_id="run_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - step = await response.parse() - assert_matches_type(StepListResponse, step, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.runs.steps.with_streaming_response.list( - run_id="run_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - step = await response.parse() - assert_matches_type(StepListResponse, step, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.runs.steps.with_raw_response.list( - run_id="run_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.threads.runs.steps.with_raw_response.list( - run_id="", - thread_id="thread_id", - ) diff --git a/tests/api_resources/threads/test_messages.py b/tests/api_resources/threads/test_messages.py deleted file mode 100644 index c369f2c..0000000 --- a/tests/api_resources/threads/test_messages.py +++ /dev/null @@ -1,432 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.threads import ( - MessageListResponse, - MessageDeleteResponse, -) -from omnistack.types.assistants import MessageObject - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestMessages: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - message = client.threads.messages.create( - message_id="message_id", - thread_id="thread_id", - ) - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - message = client.threads.messages.create( - message_id="message_id", - thread_id="thread_id", - metadata={}, - ) - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.threads.messages.with_raw_response.create( - message_id="message_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - message = response.parse() - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.threads.messages.with_streaming_response.create( - message_id="message_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - message = response.parse() - assert_matches_type(MessageObject, message, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.messages.with_raw_response.create( - message_id="message_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): - client.threads.messages.with_raw_response.create( - message_id="", - thread_id="thread_id", - ) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - message = client.threads.messages.retrieve( - message_id="message_id", - thread_id="thread_id", - ) - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.threads.messages.with_raw_response.retrieve( - message_id="message_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - message = response.parse() - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.threads.messages.with_streaming_response.retrieve( - message_id="message_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - message = response.parse() - assert_matches_type(MessageObject, message, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.messages.with_raw_response.retrieve( - message_id="message_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): - client.threads.messages.with_raw_response.retrieve( - message_id="", - thread_id="thread_id", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - message = client.threads.messages.list( - thread_id="thread_id", - ) - assert_matches_type(MessageListResponse, message, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - message = client.threads.messages.list( - thread_id="thread_id", - after="after", - before="before", - limit=0, - order="asc", - run_id="run_id", - ) - assert_matches_type(MessageListResponse, message, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.threads.messages.with_raw_response.list( - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - message = response.parse() - assert_matches_type(MessageListResponse, message, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.threads.messages.with_streaming_response.list( - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - message = response.parse() - assert_matches_type(MessageListResponse, message, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.messages.with_raw_response.list( - thread_id="", - ) - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - message = client.threads.messages.delete( - message_id="message_id", - thread_id="thread_id", - ) - assert_matches_type(MessageDeleteResponse, message, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.threads.messages.with_raw_response.delete( - message_id="message_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - message = response.parse() - assert_matches_type(MessageDeleteResponse, message, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.threads.messages.with_streaming_response.delete( - message_id="message_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - message = response.parse() - assert_matches_type(MessageDeleteResponse, message, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.messages.with_raw_response.delete( - message_id="message_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): - client.threads.messages.with_raw_response.delete( - message_id="", - thread_id="thread_id", - ) - - -class TestAsyncMessages: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - message = await async_client.threads.messages.create( - message_id="message_id", - thread_id="thread_id", - ) - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - message = await async_client.threads.messages.create( - message_id="message_id", - thread_id="thread_id", - metadata={}, - ) - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.messages.with_raw_response.create( - message_id="message_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - message = await response.parse() - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.messages.with_streaming_response.create( - message_id="message_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - message = await response.parse() - assert_matches_type(MessageObject, message, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.messages.with_raw_response.create( - message_id="message_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): - await async_client.threads.messages.with_raw_response.create( - message_id="", - thread_id="thread_id", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - message = await async_client.threads.messages.retrieve( - message_id="message_id", - thread_id="thread_id", - ) - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.messages.with_raw_response.retrieve( - message_id="message_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - message = await response.parse() - assert_matches_type(MessageObject, message, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.messages.with_streaming_response.retrieve( - message_id="message_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - message = await response.parse() - assert_matches_type(MessageObject, message, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.messages.with_raw_response.retrieve( - message_id="message_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): - await async_client.threads.messages.with_raw_response.retrieve( - message_id="", - thread_id="thread_id", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - message = await async_client.threads.messages.list( - thread_id="thread_id", - ) - assert_matches_type(MessageListResponse, message, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - message = await async_client.threads.messages.list( - thread_id="thread_id", - after="after", - before="before", - limit=0, - order="asc", - run_id="run_id", - ) - assert_matches_type(MessageListResponse, message, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.messages.with_raw_response.list( - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - message = await response.parse() - assert_matches_type(MessageListResponse, message, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.messages.with_streaming_response.list( - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - message = await response.parse() - assert_matches_type(MessageListResponse, message, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.messages.with_raw_response.list( - thread_id="", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - message = await async_client.threads.messages.delete( - message_id="message_id", - thread_id="thread_id", - ) - assert_matches_type(MessageDeleteResponse, message, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.messages.with_raw_response.delete( - message_id="message_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - message = await response.parse() - assert_matches_type(MessageDeleteResponse, message, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.messages.with_streaming_response.delete( - message_id="message_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - message = await response.parse() - assert_matches_type(MessageDeleteResponse, message, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.messages.with_raw_response.delete( - message_id="message_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): - await async_client.threads.messages.with_raw_response.delete( - message_id="", - thread_id="thread_id", - ) diff --git a/tests/api_resources/threads/test_runs.py b/tests/api_resources/threads/test_runs.py deleted file mode 100644 index 2cd78c3..0000000 --- a/tests/api_resources/threads/test_runs.py +++ /dev/null @@ -1,579 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.threads import RunListResponse -from omnistack.types.assistants import RunObject - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestRuns: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - run = client.threads.runs.create( - run_id="run_id", - thread_id="thread_id", - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - run = client.threads.runs.create( - run_id="run_id", - thread_id="thread_id", - metadata={}, - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.threads.runs.with_raw_response.create( - run_id="run_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.threads.runs.with_streaming_response.create( - run_id="run_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.runs.with_raw_response.create( - run_id="run_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.threads.runs.with_raw_response.create( - run_id="", - thread_id="thread_id", - ) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - run = client.threads.runs.retrieve( - run_id="run_id", - thread_id="thread_id", - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.threads.runs.with_raw_response.retrieve( - run_id="run_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.threads.runs.with_streaming_response.retrieve( - run_id="run_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.runs.with_raw_response.retrieve( - run_id="run_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.threads.runs.with_raw_response.retrieve( - run_id="", - thread_id="thread_id", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - run = client.threads.runs.list( - thread_id="thread_id", - ) - assert_matches_type(RunListResponse, run, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - run = client.threads.runs.list( - thread_id="thread_id", - after="after", - before="before", - limit=0, - order="asc", - ) - assert_matches_type(RunListResponse, run, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.threads.runs.with_raw_response.list( - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(RunListResponse, run, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.threads.runs.with_streaming_response.list( - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = response.parse() - assert_matches_type(RunListResponse, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.runs.with_raw_response.list( - thread_id="", - ) - - @parametrize - def test_method_cancel(self, client: Omnistack) -> None: - run = client.threads.runs.cancel( - run_id="run_id", - thread_id="thread_id", - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_raw_response_cancel(self, client: Omnistack) -> None: - response = client.threads.runs.with_raw_response.cancel( - run_id="run_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_streaming_response_cancel(self, client: Omnistack) -> None: - with client.threads.runs.with_streaming_response.cancel( - run_id="run_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_cancel(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.runs.with_raw_response.cancel( - run_id="run_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.threads.runs.with_raw_response.cancel( - run_id="", - thread_id="thread_id", - ) - - @parametrize - def test_method_submit_tool_outputs(self, client: Omnistack) -> None: - run = client.threads.runs.submit_tool_outputs( - run_id="run_id", - thread_id="thread_id", - tool_outputs=[{}, {}, {}], - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_method_submit_tool_outputs_with_all_params(self, client: Omnistack) -> None: - run = client.threads.runs.submit_tool_outputs( - run_id="run_id", - thread_id="thread_id", - tool_outputs=[ - { - "output": "output", - "tool_call_id": "tool_call_id", - }, - { - "output": "output", - "tool_call_id": "tool_call_id", - }, - { - "output": "output", - "tool_call_id": "tool_call_id", - }, - ], - stream=True, - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_raw_response_submit_tool_outputs(self, client: Omnistack) -> None: - response = client.threads.runs.with_raw_response.submit_tool_outputs( - run_id="run_id", - thread_id="thread_id", - tool_outputs=[{}, {}, {}], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - def test_streaming_response_submit_tool_outputs(self, client: Omnistack) -> None: - with client.threads.runs.with_streaming_response.submit_tool_outputs( - run_id="run_id", - thread_id="thread_id", - tool_outputs=[{}, {}, {}], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_submit_tool_outputs(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - client.threads.runs.with_raw_response.submit_tool_outputs( - run_id="run_id", - thread_id="", - tool_outputs=[{}, {}, {}], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.threads.runs.with_raw_response.submit_tool_outputs( - run_id="", - thread_id="thread_id", - tool_outputs=[{}, {}, {}], - ) - - -class TestAsyncRuns: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - run = await async_client.threads.runs.create( - run_id="run_id", - thread_id="thread_id", - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - run = await async_client.threads.runs.create( - run_id="run_id", - thread_id="thread_id", - metadata={}, - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.runs.with_raw_response.create( - run_id="run_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.runs.with_streaming_response.create( - run_id="run_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = await response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.runs.with_raw_response.create( - run_id="run_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.threads.runs.with_raw_response.create( - run_id="", - thread_id="thread_id", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - run = await async_client.threads.runs.retrieve( - run_id="run_id", - thread_id="thread_id", - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.runs.with_raw_response.retrieve( - run_id="run_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.runs.with_streaming_response.retrieve( - run_id="run_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = await response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.runs.with_raw_response.retrieve( - run_id="run_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.threads.runs.with_raw_response.retrieve( - run_id="", - thread_id="thread_id", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - run = await async_client.threads.runs.list( - thread_id="thread_id", - ) - assert_matches_type(RunListResponse, run, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - run = await async_client.threads.runs.list( - thread_id="thread_id", - after="after", - before="before", - limit=0, - order="asc", - ) - assert_matches_type(RunListResponse, run, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.runs.with_raw_response.list( - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(RunListResponse, run, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.runs.with_streaming_response.list( - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = await response.parse() - assert_matches_type(RunListResponse, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.runs.with_raw_response.list( - thread_id="", - ) - - @parametrize - async def test_method_cancel(self, async_client: AsyncOmnistack) -> None: - run = await async_client.threads.runs.cancel( - run_id="run_id", - thread_id="thread_id", - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_raw_response_cancel(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.runs.with_raw_response.cancel( - run_id="run_id", - thread_id="thread_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_streaming_response_cancel(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.runs.with_streaming_response.cancel( - run_id="run_id", - thread_id="thread_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = await response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_cancel(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.runs.with_raw_response.cancel( - run_id="run_id", - thread_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.threads.runs.with_raw_response.cancel( - run_id="", - thread_id="thread_id", - ) - - @parametrize - async def test_method_submit_tool_outputs(self, async_client: AsyncOmnistack) -> None: - run = await async_client.threads.runs.submit_tool_outputs( - run_id="run_id", - thread_id="thread_id", - tool_outputs=[{}, {}, {}], - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_method_submit_tool_outputs_with_all_params(self, async_client: AsyncOmnistack) -> None: - run = await async_client.threads.runs.submit_tool_outputs( - run_id="run_id", - thread_id="thread_id", - tool_outputs=[ - { - "output": "output", - "tool_call_id": "tool_call_id", - }, - { - "output": "output", - "tool_call_id": "tool_call_id", - }, - { - "output": "output", - "tool_call_id": "tool_call_id", - }, - ], - stream=True, - ) - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_raw_response_submit_tool_outputs(self, async_client: AsyncOmnistack) -> None: - response = await async_client.threads.runs.with_raw_response.submit_tool_outputs( - run_id="run_id", - thread_id="thread_id", - tool_outputs=[{}, {}, {}], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - @parametrize - async def test_streaming_response_submit_tool_outputs(self, async_client: AsyncOmnistack) -> None: - async with async_client.threads.runs.with_streaming_response.submit_tool_outputs( - run_id="run_id", - thread_id="thread_id", - tool_outputs=[{}, {}, {}], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - run = await response.parse() - assert_matches_type(RunObject, run, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_submit_tool_outputs(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `thread_id` but received ''"): - await async_client.threads.runs.with_raw_response.submit_tool_outputs( - run_id="run_id", - thread_id="", - tool_outputs=[{}, {}, {}], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.threads.runs.with_raw_response.submit_tool_outputs( - run_id="", - thread_id="thread_id", - tool_outputs=[{}, {}, {}], - ) diff --git a/tests/api_resources/uploads/__init__.py b/tests/api_resources/uploads/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/uploads/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/uploads/test_parts.py b/tests/api_resources/uploads/test_parts.py deleted file mode 100644 index f1b150f..0000000 --- a/tests/api_resources/uploads/test_parts.py +++ /dev/null @@ -1,106 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types import UploadPart - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestParts: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - part = client.uploads.parts.create( - upload_id="upload_abc123", - data=b"raw file contents", - ) - assert_matches_type(UploadPart, part, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.uploads.parts.with_raw_response.create( - upload_id="upload_abc123", - data=b"raw file contents", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - part = response.parse() - assert_matches_type(UploadPart, part, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.uploads.parts.with_streaming_response.create( - upload_id="upload_abc123", - data=b"raw file contents", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - part = response.parse() - assert_matches_type(UploadPart, part, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `upload_id` but received ''"): - client.uploads.parts.with_raw_response.create( - upload_id="", - data=b"raw file contents", - ) - - -class TestAsyncParts: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - part = await async_client.uploads.parts.create( - upload_id="upload_abc123", - data=b"raw file contents", - ) - assert_matches_type(UploadPart, part, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.uploads.parts.with_raw_response.create( - upload_id="upload_abc123", - data=b"raw file contents", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - part = await response.parse() - assert_matches_type(UploadPart, part, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.uploads.parts.with_streaming_response.create( - upload_id="upload_abc123", - data=b"raw file contents", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - part = await response.parse() - assert_matches_type(UploadPart, part, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `upload_id` but received ''"): - await async_client.uploads.parts.with_raw_response.create( - upload_id="", - data=b"raw file contents", - ) diff --git a/tests/api_resources/vector_stores/__init__.py b/tests/api_resources/vector_stores/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/vector_stores/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/vector_stores/file_batches/__init__.py b/tests/api_resources/vector_stores/file_batches/__init__.py deleted file mode 100644 index fd8019a..0000000 --- a/tests/api_resources/vector_stores/file_batches/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/vector_stores/file_batches/test_files.py b/tests/api_resources/vector_stores/file_batches/test_files.py deleted file mode 100644 index 155c9fc..0000000 --- a/tests/api_resources/vector_stores/file_batches/test_files.py +++ /dev/null @@ -1,144 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.vector_stores.file_batches import FileListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFiles: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - file = client.vector_stores.file_batches.files.list( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - file = client.vector_stores.file_batches.files.list( - batch_id="batch_id", - vector_store_id="vector_store_id", - after="after", - before="before", - filter="in_progress", - limit=0, - order="asc", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.vector_stores.file_batches.files.with_raw_response.list( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.vector_stores.file_batches.files.with_streaming_response.list( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.file_batches.files.with_raw_response.list( - batch_id="batch_id", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - client.vector_stores.file_batches.files.with_raw_response.list( - batch_id="", - vector_store_id="vector_store_id", - ) - - -class TestAsyncFiles: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - file = await async_client.vector_stores.file_batches.files.list( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - file = await async_client.vector_stores.file_batches.files.list( - batch_id="batch_id", - vector_store_id="vector_store_id", - after="after", - before="before", - filter="in_progress", - limit=0, - order="asc", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.file_batches.files.with_raw_response.list( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.file_batches.files.with_streaming_response.list( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.file_batches.files.with_raw_response.list( - batch_id="batch_id", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - await async_client.vector_stores.file_batches.files.with_raw_response.list( - batch_id="", - vector_store_id="vector_store_id", - ) diff --git a/tests/api_resources/vector_stores/test_file_batches.py b/tests/api_resources/vector_stores/test_file_batches.py deleted file mode 100644 index c37caa1..0000000 --- a/tests/api_resources/vector_stores/test_file_batches.py +++ /dev/null @@ -1,316 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.vector_stores import VectorStoreFileBatchObject - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFileBatches: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - file_batch = client.vector_stores.file_batches.create( - vector_store_id="vs_abc123", - file_ids=["string"], - ) - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - file_batch = client.vector_stores.file_batches.create( - vector_store_id="vs_abc123", - file_ids=["string"], - chunking_strategy={"type": "auto"}, - ) - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.vector_stores.file_batches.with_raw_response.create( - vector_store_id="vs_abc123", - file_ids=["string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_batch = response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.vector_stores.file_batches.with_streaming_response.create( - vector_store_id="vs_abc123", - file_ids=["string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file_batch = response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.file_batches.with_raw_response.create( - vector_store_id="", - file_ids=["string"], - ) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - file_batch = client.vector_stores.file_batches.retrieve( - batch_id="vsfb_abc123", - vector_store_id="vs_abc123", - ) - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.vector_stores.file_batches.with_raw_response.retrieve( - batch_id="vsfb_abc123", - vector_store_id="vs_abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_batch = response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.vector_stores.file_batches.with_streaming_response.retrieve( - batch_id="vsfb_abc123", - vector_store_id="vs_abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file_batch = response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.file_batches.with_raw_response.retrieve( - batch_id="vsfb_abc123", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - client.vector_stores.file_batches.with_raw_response.retrieve( - batch_id="", - vector_store_id="vs_abc123", - ) - - @parametrize - def test_method_cancel(self, client: Omnistack) -> None: - file_batch = client.vector_stores.file_batches.cancel( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - def test_raw_response_cancel(self, client: Omnistack) -> None: - response = client.vector_stores.file_batches.with_raw_response.cancel( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_batch = response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - def test_streaming_response_cancel(self, client: Omnistack) -> None: - with client.vector_stores.file_batches.with_streaming_response.cancel( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file_batch = response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_cancel(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.file_batches.with_raw_response.cancel( - batch_id="batch_id", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - client.vector_stores.file_batches.with_raw_response.cancel( - batch_id="", - vector_store_id="vector_store_id", - ) - - -class TestAsyncFileBatches: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - file_batch = await async_client.vector_stores.file_batches.create( - vector_store_id="vs_abc123", - file_ids=["string"], - ) - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - file_batch = await async_client.vector_stores.file_batches.create( - vector_store_id="vs_abc123", - file_ids=["string"], - chunking_strategy={"type": "auto"}, - ) - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.file_batches.with_raw_response.create( - vector_store_id="vs_abc123", - file_ids=["string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_batch = await response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.file_batches.with_streaming_response.create( - vector_store_id="vs_abc123", - file_ids=["string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file_batch = await response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.file_batches.with_raw_response.create( - vector_store_id="", - file_ids=["string"], - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - file_batch = await async_client.vector_stores.file_batches.retrieve( - batch_id="vsfb_abc123", - vector_store_id="vs_abc123", - ) - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.file_batches.with_raw_response.retrieve( - batch_id="vsfb_abc123", - vector_store_id="vs_abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_batch = await response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.file_batches.with_streaming_response.retrieve( - batch_id="vsfb_abc123", - vector_store_id="vs_abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file_batch = await response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.file_batches.with_raw_response.retrieve( - batch_id="vsfb_abc123", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - await async_client.vector_stores.file_batches.with_raw_response.retrieve( - batch_id="", - vector_store_id="vs_abc123", - ) - - @parametrize - async def test_method_cancel(self, async_client: AsyncOmnistack) -> None: - file_batch = await async_client.vector_stores.file_batches.cancel( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - async def test_raw_response_cancel(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.file_batches.with_raw_response.cancel( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file_batch = await response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - @parametrize - async def test_streaming_response_cancel(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.file_batches.with_streaming_response.cancel( - batch_id="batch_id", - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file_batch = await response.parse() - assert_matches_type(VectorStoreFileBatchObject, file_batch, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_cancel(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.file_batches.with_raw_response.cancel( - batch_id="batch_id", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): - await async_client.vector_stores.file_batches.with_raw_response.cancel( - batch_id="", - vector_store_id="vector_store_id", - ) diff --git a/tests/api_resources/vector_stores/test_files.py b/tests/api_resources/vector_stores/test_files.py deleted file mode 100644 index f730e76..0000000 --- a/tests/api_resources/vector_stores/test_files.py +++ /dev/null @@ -1,420 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from omnistack import Omnistack, AsyncOmnistack -from tests.utils import assert_matches_type -from omnistack.types.vector_stores import ( - FileListResponse, - FileDeleteResponse, - VectorStoreFileObject, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFiles: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Omnistack) -> None: - file = client.vector_stores.files.create( - vector_store_id="vs_abc123", - file_id="file_id", - ) - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Omnistack) -> None: - file = client.vector_stores.files.create( - vector_store_id="vs_abc123", - file_id="file_id", - chunking_strategy={"type": "auto"}, - ) - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Omnistack) -> None: - response = client.vector_stores.files.with_raw_response.create( - vector_store_id="vs_abc123", - file_id="file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Omnistack) -> None: - with client.vector_stores.files.with_streaming_response.create( - vector_store_id="vs_abc123", - file_id="file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.files.with_raw_response.create( - vector_store_id="", - file_id="file_id", - ) - - @parametrize - def test_method_retrieve(self, client: Omnistack) -> None: - file = client.vector_stores.files.retrieve( - file_id="file-abc123", - vector_store_id="vs_abc123", - ) - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Omnistack) -> None: - response = client.vector_stores.files.with_raw_response.retrieve( - file_id="file-abc123", - vector_store_id="vs_abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Omnistack) -> None: - with client.vector_stores.files.with_streaming_response.retrieve( - file_id="file-abc123", - vector_store_id="vs_abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.files.with_raw_response.retrieve( - file_id="file-abc123", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - client.vector_stores.files.with_raw_response.retrieve( - file_id="", - vector_store_id="vs_abc123", - ) - - @parametrize - def test_method_list(self, client: Omnistack) -> None: - file = client.vector_stores.files.list( - vector_store_id="vector_store_id", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Omnistack) -> None: - file = client.vector_stores.files.list( - vector_store_id="vector_store_id", - after="after", - before="before", - filter="in_progress", - limit=0, - order="asc", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Omnistack) -> None: - response = client.vector_stores.files.with_raw_response.list( - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Omnistack) -> None: - with client.vector_stores.files.with_streaming_response.list( - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.files.with_raw_response.list( - vector_store_id="", - ) - - @parametrize - def test_method_delete(self, client: Omnistack) -> None: - file = client.vector_stores.files.delete( - file_id="file_id", - vector_store_id="vector_store_id", - ) - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Omnistack) -> None: - response = client.vector_stores.files.with_raw_response.delete( - file_id="file_id", - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Omnistack) -> None: - with client.vector_stores.files.with_streaming_response.delete( - file_id="file_id", - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Omnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - client.vector_stores.files.with_raw_response.delete( - file_id="file_id", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - client.vector_stores.files.with_raw_response.delete( - file_id="", - vector_store_id="vector_store_id", - ) - - -class TestAsyncFiles: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncOmnistack) -> None: - file = await async_client.vector_stores.files.create( - vector_store_id="vs_abc123", - file_id="file_id", - ) - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncOmnistack) -> None: - file = await async_client.vector_stores.files.create( - vector_store_id="vs_abc123", - file_id="file_id", - chunking_strategy={"type": "auto"}, - ) - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.files.with_raw_response.create( - vector_store_id="vs_abc123", - file_id="file_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.files.with_streaming_response.create( - vector_store_id="vs_abc123", - file_id="file_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.files.with_raw_response.create( - vector_store_id="", - file_id="file_id", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncOmnistack) -> None: - file = await async_client.vector_stores.files.retrieve( - file_id="file-abc123", - vector_store_id="vs_abc123", - ) - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.files.with_raw_response.retrieve( - file_id="file-abc123", - vector_store_id="vs_abc123", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.files.with_streaming_response.retrieve( - file_id="file-abc123", - vector_store_id="vs_abc123", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(VectorStoreFileObject, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.files.with_raw_response.retrieve( - file_id="file-abc123", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - await async_client.vector_stores.files.with_raw_response.retrieve( - file_id="", - vector_store_id="vs_abc123", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncOmnistack) -> None: - file = await async_client.vector_stores.files.list( - vector_store_id="vector_store_id", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncOmnistack) -> None: - file = await async_client.vector_stores.files.list( - vector_store_id="vector_store_id", - after="after", - before="before", - filter="in_progress", - limit=0, - order="asc", - ) - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.files.with_raw_response.list( - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.files.with_streaming_response.list( - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.files.with_raw_response.list( - vector_store_id="", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncOmnistack) -> None: - file = await async_client.vector_stores.files.delete( - file_id="file_id", - vector_store_id="vector_store_id", - ) - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncOmnistack) -> None: - response = await async_client.vector_stores.files.with_raw_response.delete( - file_id="file_id", - vector_store_id="vector_store_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncOmnistack) -> None: - async with async_client.vector_stores.files.with_streaming_response.delete( - file_id="file_id", - vector_store_id="vector_store_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncOmnistack) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `vector_store_id` but received ''"): - await async_client.vector_stores.files.with_raw_response.delete( - file_id="file_id", - vector_store_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - await async_client.vector_stores.files.with_raw_response.delete( - file_id="", - vector_store_id="vector_store_id", - ) diff --git a/tests/conftest.py b/tests/conftest.py index 220fd0c..ce11aa1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,11 +1,11 @@ from __future__ import annotations import os -import asyncio import logging from typing import TYPE_CHECKING, Iterator, AsyncIterator import pytest +from pytest_asyncio import is_async_test from omnistack import Omnistack, AsyncOmnistack @@ -17,11 +17,13 @@ logging.getLogger("omnistack").setLevel(logging.DEBUG) -@pytest.fixture(scope="session") -def event_loop() -> Iterator[asyncio.AbstractEventLoop]: - loop = asyncio.new_event_loop() - yield loop - loop.close() +# automatically add `pytest.mark.asyncio()` to all of our async tests +# so we don't have to add that boilerplate everywhere +def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: + pytest_asyncio_tests = (item for item in items if is_async_test(item)) + session_scope_marker = pytest.mark.asyncio(loop_scope="session") + for async_test in pytest_asyncio_tests: + async_test.add_marker(session_scope_marker, append=False) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/test_client.py b/tests/test_client.py index 4a01c96..5f71053 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -10,6 +10,7 @@ import tracemalloc from typing import Any, Union, cast from unittest import mock +from typing_extensions import Literal import httpx import pytest @@ -737,7 +738,14 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("omnistack._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retries_taken(self, client: Omnistack, failures_before_success: int, respx_mock: MockRouter) -> None: + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) + def test_retries_taken( + self, + client: Omnistack, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, + ) -> None: client = client.with_options(max_retries=4) nb_retries = 0 @@ -746,6 +754,8 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: nonlocal nb_retries if nb_retries < failures_before_success: nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) @@ -1509,8 +1519,13 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) @mock.patch("omnistack._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) async def test_retries_taken( - self, async_client: AsyncOmnistack, failures_before_success: int, respx_mock: MockRouter + self, + async_client: AsyncOmnistack, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, ) -> None: client = async_client.with_options(max_retries=4) @@ -1520,6 +1535,8 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: nonlocal nb_retries if nb_retries < failures_before_success: nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") return httpx.Response(500) return httpx.Response(200) diff --git a/tests/test_models.py b/tests/test_models.py index 72c7a77..543c442 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -520,19 +520,15 @@ class Model(BaseModel): assert m3.to_dict(exclude_none=True) == {} assert m3.to_dict(exclude_defaults=True) == {} - if PYDANTIC_V2: - - class Model2(BaseModel): - created_at: datetime + class Model2(BaseModel): + created_at: datetime - time_str = "2024-03-21T11:39:01.275859" - m4 = Model2.construct(created_at=time_str) - assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} - assert m4.to_dict(mode="json") == {"created_at": time_str} - else: - with pytest.raises(ValueError, match="mode is only supported in Pydantic v2"): - m.to_dict(mode="json") + time_str = "2024-03-21T11:39:01.275859" + m4 = Model2.construct(created_at=time_str) + assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} + assert m4.to_dict(mode="json") == {"created_at": time_str} + if not PYDANTIC_V2: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_dict(warnings=False) @@ -558,9 +554,6 @@ class Model(BaseModel): assert m3.model_dump(exclude_none=True) == {} if not PYDANTIC_V2: - with pytest.raises(ValueError, match="mode is only supported in Pydantic v2"): - m.model_dump(mode="json") - with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump(round_trip=True) diff --git a/tests/test_transform.py b/tests/test_transform.py index 3ed58c9..6c699d1 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -177,17 +177,32 @@ class DateDict(TypedDict, total=False): foo: Annotated[date, PropertyInfo(format="iso8601")] +class DatetimeModel(BaseModel): + foo: datetime + + +class DateModel(BaseModel): + foo: Optional[date] + + @parametrize @pytest.mark.asyncio async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + tz = "Z" if PYDANTIC_V2 else "+00:00" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] dt = dt.replace(tzinfo=None) assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] assert await transform({"foo": None}, DateDict, use_async) == {"foo": None} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore assert await transform({"foo": date.fromisoformat("2023-02-23")}, DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == { + "foo": "2023-02-23" + } # type: ignore[comparison-overlap] @parametrize From 5ddefaf1b06efea26327550eba2a4587afccf5c1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:54:30 +0000 Subject: [PATCH 3/6] chore: rebuild project due to codegen change (#14) --- tests/test_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 5f71053..4bbf5db 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -693,7 +693,7 @@ class Model(BaseModel): [3, "", 0.5], [2, "", 0.5 * 2.0], [1, "", 0.5 * 4.0], - [-1100, "", 7.8], # test large number potentially overflowing + [-1100, "", 8], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) @@ -1472,7 +1472,7 @@ class Model(BaseModel): [3, "", 0.5], [2, "", 0.5 * 2.0], [1, "", 0.5 * 4.0], - [-1100, "", 7.8], # test large number potentially overflowing + [-1100, "", 8], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) From e6b633c0564978c6892a44bfc674b46846b6f33b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 02:57:51 +0000 Subject: [PATCH 4/6] chore: rebuild project due to codegen change (#15) --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c404e5..5d0603e 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,7 @@ import os from omnistack import Omnistack client = Omnistack( - # This is the default and can be omitted - api_key=os.environ.get("OMNISTACK_API_KEY"), + api_key=os.environ.get("OMNISTACK_API_KEY"), # This is the default and can be omitted ) completion = client.completions.create( @@ -54,8 +53,7 @@ import asyncio from omnistack import AsyncOmnistack client = AsyncOmnistack( - # This is the default and can be omitted - api_key=os.environ.get("OMNISTACK_API_KEY"), + api_key=os.environ.get("OMNISTACK_API_KEY"), # This is the default and can be omitted ) From 9bac6c8aa24352ddb2b4bfe12ae6a471af74cf52 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:21:16 +0000 Subject: [PATCH 5/6] chore: rebuild project due to codegen change (#16) --- src/omnistack/_utils/_transform.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/omnistack/_utils/_transform.py b/src/omnistack/_utils/_transform.py index d7c0534..a6b62ca 100644 --- a/src/omnistack/_utils/_transform.py +++ b/src/omnistack/_utils/_transform.py @@ -316,6 +316,11 @@ async def _async_transform_recursive( # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + inner_type = extract_type_arg(stripped_type, 0) return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] From 356de3675b2e07a278e5a317a5de1824e557f5ac Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 15:21:38 +0000 Subject: [PATCH 6/6] release: 0.1.0-alpha.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 16 ++++++++++++++++ pyproject.toml | 2 +- src/omnistack/_version.py | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f14b480..aaf968a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.2" + ".": "0.1.0-alpha.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index adf9493..7e99ec1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 0.1.0-alpha.3 (2024-11-12) + +Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/OmniStack-sh/omnistack-python/compare/v0.1.0-alpha.2...v0.1.0-alpha.3) + +### Features + +* **api:** api update ([#11](https://github.com/OmniStack-sh/omnistack-python/issues/11)) ([b575f9a](https://github.com/OmniStack-sh/omnistack-python/commit/b575f9a658e0223947ad94155262287a47da185f)) + + +### Chores + +* rebuild project due to codegen change ([#13](https://github.com/OmniStack-sh/omnistack-python/issues/13)) ([04f25d9](https://github.com/OmniStack-sh/omnistack-python/commit/04f25d91e512063832092b8e978007e7c0fa209a)) +* rebuild project due to codegen change ([#14](https://github.com/OmniStack-sh/omnistack-python/issues/14)) ([5ddefaf](https://github.com/OmniStack-sh/omnistack-python/commit/5ddefaf1b06efea26327550eba2a4587afccf5c1)) +* rebuild project due to codegen change ([#15](https://github.com/OmniStack-sh/omnistack-python/issues/15)) ([e6b633c](https://github.com/OmniStack-sh/omnistack-python/commit/e6b633c0564978c6892a44bfc674b46846b6f33b)) +* rebuild project due to codegen change ([#16](https://github.com/OmniStack-sh/omnistack-python/issues/16)) ([9bac6c8](https://github.com/OmniStack-sh/omnistack-python/commit/9bac6c8aa24352ddb2b4bfe12ae6a471af74cf52)) + ## 0.1.0-alpha.2 (2024-10-17) Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/OmniStack-sh/omnistack-python/compare/v0.1.0-alpha.1...v0.1.0-alpha.2) diff --git a/pyproject.toml b/pyproject.toml index cbf52f5..6b1a6b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "omnistack" -version = "0.1.0-alpha.2" +version = "0.1.0-alpha.3" description = "The official Python library for the omnistack API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/omnistack/_version.py b/src/omnistack/_version.py index 360f65f..e4e0efd 100644 --- a/src/omnistack/_version.py +++ b/src/omnistack/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "omnistack" -__version__ = "0.1.0-alpha.2" # x-release-please-version +__version__ = "0.1.0-alpha.3" # x-release-please-version