From 380252a9cb2d9c723b5c6b36a33573c462e48049 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 13:17:33 +0000 Subject: [PATCH 1/6] chore: sync repo --- .github/workflows/ci.yml | 6 +- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- .release-please-manifest.json | 2 +- .stats.yml | 6 +- CHANGELOG.md | 152 ---- CONTRIBUTING.md | 6 +- README.md | 81 +- api.md | 50 +- mypy.ini | 2 +- pyproject.toml | 16 +- release-please-config.json | 2 +- scripts/lint | 2 +- scripts/utils/upload-artifact.sh | 2 +- src/supermemory/_version.py | 4 - src/supermemory/resources/connections.py | 273 ------- src/supermemory/types/__init__.py | 17 - .../types/memory_upload_file_params.py | 13 - .../__init__.py | 4 +- .../_base_client.py | 2 +- .../_client.py | 14 +- .../_compat.py | 0 .../_constants.py | 0 .../_exceptions.py | 0 .../_files.py | 2 +- .../_models.py | 0 src/{supermemory => supermemory_new}/_qs.py | 0 .../_resource.py | 0 .../_response.py | 8 +- .../_streaming.py | 0 .../_types.py | 2 +- .../_utils/__init__.py | 0 .../_utils/_logs.py | 4 +- .../_utils/_proxy.py | 0 .../_utils/_reflection.py | 0 .../_utils/_resources_proxy.py | 8 +- .../_utils/_streams.py | 0 .../_utils/_sync.py | 0 .../_utils/_transform.py | 0 .../_utils/_typing.py | 0 .../_utils/_utils.py | 0 src/supermemory_new/_version.py | 4 + .../lib/.keep | 0 src/{supermemory => supermemory_new}/py.typed | 0 .../resources/__init__.py | 14 + src/supermemory_new/resources/connections.py | 728 ++++++++++++++++++ .../resources/memories.py | 241 +++--- src/supermemory_new/resources/search.py | 300 ++++++++ .../resources/settings.py | 8 +- src/supermemory_new/types/__init__.py | 30 + .../types/connection_create_params.py | 0 .../types/connection_create_response.py | 0 .../connection_delete_by_provider_params.py | 15 + ...connection_delete_by_provider_response.py} | 6 +- .../types/connection_get_by_id_response.py} | 4 +- .../types/connection_get_by_tags_params.py | 15 + .../types/connection_get_by_tags_response.py | 25 + .../types/connection_import_params.py | 15 + .../types/connection_list_documents_params.py | 15 + .../connection_list_documents_response.py | 29 + .../types/connection_list_params.py | 15 + .../types/connection_list_response.py | 29 + .../types/memory_add_params.py | 0 .../types/memory_add_response.py | 0 .../types/memory_get_response.py | 0 .../types/memory_list_params.py | 34 + .../types/memory_list_response.py | 91 +++ .../types/memory_update_params.py | 0 .../types/memory_update_response.py | 0 .../types/search_execute_params.py | 93 +++ .../types/search_execute_response.py | 55 ++ .../types/setting_get_response.py | 0 .../types/setting_update_params.py | 0 .../types/setting_update_response.py | 0 tests/api_resources/test_connections.py | 447 ++++++++++- tests/api_resources/test_memories.py | 156 ++-- tests/api_resources/test_search.py | 164 ++++ tests/api_resources/test_settings.py | 4 +- tests/conftest.py | 6 +- tests/test_client.py | 46 +- tests/test_deepcopy.py | 2 +- tests/test_extract_files.py | 4 +- tests/test_files.py | 2 +- tests/test_models.py | 6 +- tests/test_qs.py | 2 +- tests/test_required_args.py | 2 +- tests/test_response.py | 14 +- tests/test_streaming.py | 4 +- tests/test_transform.py | 8 +- tests/test_utils/test_proxy.py | 2 +- tests/test_utils/test_typing.py | 2 +- tests/utils.py | 8 +- 92 files changed, 2505 insertions(+), 822 deletions(-) delete mode 100644 CHANGELOG.md delete mode 100644 src/supermemory/_version.py delete mode 100644 src/supermemory/resources/connections.py delete mode 100644 src/supermemory/types/__init__.py delete mode 100644 src/supermemory/types/memory_upload_file_params.py rename src/{supermemory => supermemory_new}/__init__.py (94%) rename src/{supermemory => supermemory_new}/_base_client.py (99%) rename src/{supermemory => supermemory_new}/_client.py (96%) rename src/{supermemory => supermemory_new}/_compat.py (100%) rename src/{supermemory => supermemory_new}/_constants.py (100%) rename src/{supermemory => supermemory_new}/_exceptions.py (100%) rename src/{supermemory => supermemory_new}/_files.py (96%) rename src/{supermemory => supermemory_new}/_models.py (100%) rename src/{supermemory => supermemory_new}/_qs.py (100%) rename src/{supermemory => supermemory_new}/_resource.py (100%) rename src/{supermemory => supermemory_new}/_response.py (99%) rename src/{supermemory => supermemory_new}/_streaming.py (100%) rename src/{supermemory => supermemory_new}/_types.py (99%) rename src/{supermemory => supermemory_new}/_utils/__init__.py (100%) rename src/{supermemory => supermemory_new}/_utils/_logs.py (75%) rename src/{supermemory => supermemory_new}/_utils/_proxy.py (100%) rename src/{supermemory => supermemory_new}/_utils/_reflection.py (100%) rename src/{supermemory => supermemory_new}/_utils/_resources_proxy.py (50%) rename src/{supermemory => supermemory_new}/_utils/_streams.py (100%) rename src/{supermemory => supermemory_new}/_utils/_sync.py (100%) rename src/{supermemory => supermemory_new}/_utils/_transform.py (100%) rename src/{supermemory => supermemory_new}/_utils/_typing.py (100%) rename src/{supermemory => supermemory_new}/_utils/_utils.py (100%) create mode 100644 src/supermemory_new/_version.py rename src/{supermemory => supermemory_new}/lib/.keep (100%) rename src/{supermemory => supermemory_new}/py.typed (100%) rename src/{supermemory => supermemory_new}/resources/__init__.py (77%) create mode 100644 src/supermemory_new/resources/connections.py rename src/{supermemory => supermemory_new}/resources/memories.py (86%) create mode 100644 src/supermemory_new/resources/search.py rename src/{supermemory => supermemory_new}/resources/settings.py (98%) create mode 100644 src/supermemory_new/types/__init__.py rename src/{supermemory => supermemory_new}/types/connection_create_params.py (100%) rename src/{supermemory => supermemory_new}/types/connection_create_response.py (100%) create mode 100644 src/supermemory_new/types/connection_delete_by_provider_params.py rename src/{supermemory/types/memory_upload_file_response.py => supermemory_new/types/connection_delete_by_provider_response.py} (52%) rename src/{supermemory/types/connection_get_response.py => supermemory_new/types/connection_get_by_id_response.py} (86%) create mode 100644 src/supermemory_new/types/connection_get_by_tags_params.py create mode 100644 src/supermemory_new/types/connection_get_by_tags_response.py create mode 100644 src/supermemory_new/types/connection_import_params.py create mode 100644 src/supermemory_new/types/connection_list_documents_params.py create mode 100644 src/supermemory_new/types/connection_list_documents_response.py create mode 100644 src/supermemory_new/types/connection_list_params.py create mode 100644 src/supermemory_new/types/connection_list_response.py rename src/{supermemory => supermemory_new}/types/memory_add_params.py (100%) rename src/{supermemory => supermemory_new}/types/memory_add_response.py (100%) rename src/{supermemory => supermemory_new}/types/memory_get_response.py (100%) create mode 100644 src/supermemory_new/types/memory_list_params.py create mode 100644 src/supermemory_new/types/memory_list_response.py rename src/{supermemory => supermemory_new}/types/memory_update_params.py (100%) rename src/{supermemory => supermemory_new}/types/memory_update_response.py (100%) create mode 100644 src/supermemory_new/types/search_execute_params.py create mode 100644 src/supermemory_new/types/search_execute_response.py rename src/{supermemory => supermemory_new}/types/setting_get_response.py (100%) rename src/{supermemory => supermemory_new}/types/setting_update_params.py (100%) rename src/{supermemory => supermemory_new}/types/setting_update_response.py (100%) create mode 100644 tests/api_resources/test_search.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43988b20..6e203f87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/supermemory-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ github.repository == 'stainless-sdks/supermemory-new-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -35,7 +35,7 @@ jobs: run: ./scripts/lint upload: - if: github.repository == 'stainless-sdks/supermemory-python' + if: github.repository == 'stainless-sdks/supermemory-new-python' timeout-minutes: 10 name: upload permissions: @@ -61,7 +61,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ${{ github.repository == 'stainless-sdks/supermemory-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ github.repository == 'stainless-sdks/supermemory-new-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 6b9ff8b6..b27d8436 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,6 +1,6 @@ # This workflow is triggered when a GitHub release is created. # It can also be run manually to re-publish to PyPI in case it failed for some reason. -# You can run this workflow by navigating to https://www.github.com/supermemoryai/python-sdk/actions/workflows/publish-pypi.yml +# You can run this workflow by navigating to https://www.github.com/supermemoryai/sdk-py/actions/workflows/publish-pypi.yml name: Publish PyPI on: workflow_dispatch: diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index c5235d30..952fa5cf 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -9,7 +9,7 @@ jobs: release_doctor: name: release doctor runs-on: ubuntu-latest - if: github.repository == 'supermemoryai/python-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + if: github.repository == 'supermemoryai/sdk-py' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - uses: actions/checkout@v4 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ef0780c0..c4762802 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.0.0-alpha.19" + ".": "0.0.1-alpha.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 561e86c8..b1703902 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 9 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-0e2874da641d72b5833ebef8cc792d86250d397b96eeedba7d4759ffabc076de.yml +configured_endpoints: 15 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-0e2874da641d72b5833ebef8cc792d86250d397b96eeedba7d4759ffabc076de.yml openapi_spec_hash: f13ea02b49134e11025cb18f3d45d313 -config_hash: 8477e3ee6fd596ab6ac911d052e4de79 +config_hash: 8e3fb817af0090cad960c30cab828aac diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index f6bfd4b5..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,152 +0,0 @@ -# Changelog - -## 3.0.0-alpha.19 (2025-06-26) - -Full Changelog: [v3.0.0-alpha.2...v3.0.0-alpha.19](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.2...v3.0.0-alpha.19) - -### Features - -* **api:** api update ([10e12a2](https://github.com/supermemoryai/python-sdk/commit/10e12a2f0453c3e5a2eaeee86a3da9738c161e50)) - -## 3.0.0-alpha.2 (2025-06-24) - -Full Changelog: [v3.0.0-alpha.1...v3.0.0-alpha.2](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.1...v3.0.0-alpha.2) - -### Features - -* **api:** api update ([75c22e3](https://github.com/supermemoryai/python-sdk/commit/75c22e3f2db8eda857ca184f5bd531ff736a1c8c)) -* **api:** api update ([fc586f7](https://github.com/supermemoryai/python-sdk/commit/fc586f729ac602946e95de2e61b6d27a8c3b1167)) -* **api:** api update ([5aefc85](https://github.com/supermemoryai/python-sdk/commit/5aefc85540c70a195c2c59a8e9cdd529ff124a3b)) -* **api:** api update ([200e97a](https://github.com/supermemoryai/python-sdk/commit/200e97acf9f2be46a3ffef069912da9e4d05a951)) -* **api:** api update ([2d9b26c](https://github.com/supermemoryai/python-sdk/commit/2d9b26ce58cf533ffbff6d7a002c8504752c1e6a)) -* **api:** api update ([c7e0c2c](https://github.com/supermemoryai/python-sdk/commit/c7e0c2ccae941136705f2328fe536870789cf52a)) -* **api:** api update ([486888d](https://github.com/supermemoryai/python-sdk/commit/486888da89d570779e132f3b810c7d1a4f59082a)) -* **api:** api update ([378085f](https://github.com/supermemoryai/python-sdk/commit/378085f0090ebf25bbc46d0e3947737457ae3a30)) -* **api:** api update ([7b7711f](https://github.com/supermemoryai/python-sdk/commit/7b7711f282eebbaf4edb462b1dc2ed5dfb1bc0fc)) -* **api:** api update ([c194b2e](https://github.com/supermemoryai/python-sdk/commit/c194b2ecbe42ebe5997aab4bc96fb7120a5f6b9c)) -* **api:** api update ([d517cbc](https://github.com/supermemoryai/python-sdk/commit/d517cbce5d74b7cd92d8921d16ba1bb025848549)) -* **api:** api update ([fa9f582](https://github.com/supermemoryai/python-sdk/commit/fa9f582226ed9dee9ea8196b78b9312938093465)) -* **api:** api update ([d1b2a97](https://github.com/supermemoryai/python-sdk/commit/d1b2a9719deb080c4b64ae97893ba139ecaebf68)) -* **api:** api update ([02180e2](https://github.com/supermemoryai/python-sdk/commit/02180e296f97a30626b183ba533f45879981cc62)) -* **api:** api update ([51586e6](https://github.com/supermemoryai/python-sdk/commit/51586e68f9ec7b04b7aba149142f6e550113c0b9)) -* **api:** api update ([cd4782d](https://github.com/supermemoryai/python-sdk/commit/cd4782de2b4f05196e6b3f37768de900a6a9e81d)) -* **api:** api update ([f58d93d](https://github.com/supermemoryai/python-sdk/commit/f58d93dc249798bdf62c00335c6b9bfdf8430795)) -* **api:** api update ([e95b77e](https://github.com/supermemoryai/python-sdk/commit/e95b77ee719a76f0eb22c56f07e90f05712de7cd)) -* **api:** api update ([beffc5e](https://github.com/supermemoryai/python-sdk/commit/beffc5e09b5aee9c1517453b2f5574881ecf5dd7)) -* **api:** api update ([173a337](https://github.com/supermemoryai/python-sdk/commit/173a337626cbd75d951d10a04e91261ed3a2a384)) -* **api:** api update ([02e8b00](https://github.com/supermemoryai/python-sdk/commit/02e8b0072cb84a52124f61f5d8f64d69809c7833)) -* **api:** api update ([1788d47](https://github.com/supermemoryai/python-sdk/commit/1788d476d76fd786ed495ee5f8048c301fae0799)) -* **api:** api update ([5bc5a86](https://github.com/supermemoryai/python-sdk/commit/5bc5a8611c00f3c77c1e3787f578c91577ddfbb0)) -* **api:** api update ([0c627bd](https://github.com/supermemoryai/python-sdk/commit/0c627bde6c7f6ef8d55e94993a612f34c75c7f80)) -* **client:** add follow_redirects request option ([abd637d](https://github.com/supermemoryai/python-sdk/commit/abd637db1e3642c0dcc609bf4cac3d0a2bdad061)) -* **client:** add support for aiohttp ([d376719](https://github.com/supermemoryai/python-sdk/commit/d37671920ac604d643c0d9edaaee08aaaea2d881)) - - -### Bug Fixes - -* **client:** correctly parse binary response | stream ([b236e85](https://github.com/supermemoryai/python-sdk/commit/b236e8552e9393048b3541c2c41d969fd5a88ac0)) -* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([f9bf3c1](https://github.com/supermemoryai/python-sdk/commit/f9bf3c135c6a6236c8ef0ee5d538843021448b9d)) - - -### Chores - -* **ci:** enable for pull requests ([ec1b12b](https://github.com/supermemoryai/python-sdk/commit/ec1b12b9447ff582d80a0dedf75dc5c924aee6e4)) -* **docs:** grammar improvements ([1f9f018](https://github.com/supermemoryai/python-sdk/commit/1f9f01876a2754521ab8cc75c92634b05221f6c5)) -* **docs:** remove reference to rye shell ([23840c8](https://github.com/supermemoryai/python-sdk/commit/23840c8b8a67cb3b60e94c1eb74994d28b3508f1)) -* **internal:** codegen related update ([2b10aa8](https://github.com/supermemoryai/python-sdk/commit/2b10aa88d82e044d1a7df2bdd266209f4c130c8d)) -* **internal:** codegen related update ([c4039a7](https://github.com/supermemoryai/python-sdk/commit/c4039a7d5124d2c6719508830bf8067ebbb4fd58)) -* **internal:** update conftest.py ([355810b](https://github.com/supermemoryai/python-sdk/commit/355810b458222ddf405ec130cf43887cf7b2138d)) -* **readme:** update badges ([9415b50](https://github.com/supermemoryai/python-sdk/commit/9415b50222cea2e827a8e9c13525ad8e19df9ff2)) -* **tests:** add tests for httpx client instantiation & proxies ([a462f22](https://github.com/supermemoryai/python-sdk/commit/a462f2240dac23bf780f540ba39da3febbc561e7)) -* **tests:** run tests in parallel ([79f6359](https://github.com/supermemoryai/python-sdk/commit/79f6359beb267f85e273a5a3017283d9e231e78a)) -* **tests:** skip some failing tests on the latest python versions ([394e639](https://github.com/supermemoryai/python-sdk/commit/394e639fb904cd4c27b299f5960fd2f02f159b10)) - - -### Documentation - -* **client:** fix httpx.Timeout documentation reference ([be3ccbd](https://github.com/supermemoryai/python-sdk/commit/be3ccbdebe4974592c670cb43ed572ced78e60a3)) - -## 3.0.0-alpha.1 (2025-05-17) - -Full Changelog: [v0.1.0-alpha.1...v3.0.0-alpha.1](https://github.com/supermemoryai/python-sdk/compare/v0.1.0-alpha.1...v3.0.0-alpha.1) - -### Features - -* **api:** api update ([aaf3546](https://github.com/supermemoryai/python-sdk/commit/aaf354623319d2e3f99031669a615d3af48c9dab)) -* **api:** api update ([c0150ac](https://github.com/supermemoryai/python-sdk/commit/c0150acac7ccae7e89707909d9250028fc4d5251)) -* **api:** api update ([063cf45](https://github.com/supermemoryai/python-sdk/commit/063cf45fced039b32de6f00fc4862a873d50451a)) -* **api:** api update ([7a81e80](https://github.com/supermemoryai/python-sdk/commit/7a81e8027fd0c76041672c71345e18724e71c10f)) -* **api:** api update ([722df63](https://github.com/supermemoryai/python-sdk/commit/722df6387d8fc3b38ee892d4382b19339a4b8165)) -* **api:** api update ([4052bae](https://github.com/supermemoryai/python-sdk/commit/4052baeca12183552a9bda674e97310e77b93623)) -* **api:** api update ([ed787b1](https://github.com/supermemoryai/python-sdk/commit/ed787b1abd49ebbc4e219f90bf71511306aafb2b)) -* **api:** api update ([7c0db70](https://github.com/supermemoryai/python-sdk/commit/7c0db70ec61ccd64197c333592457b925782f1ce)) -* **api:** api update ([844d56e](https://github.com/supermemoryai/python-sdk/commit/844d56ecd40cffb441c47050e5e820051d65af7e)) -* **api:** api update ([fda6f9f](https://github.com/supermemoryai/python-sdk/commit/fda6f9f111dac7db4bba42779e967356b8615e3c)) -* **api:** api update ([2403f1d](https://github.com/supermemoryai/python-sdk/commit/2403f1da4d83266ddf49ada0103c8f5d432bf966)) -* **api:** manual updates ([3fd7de2](https://github.com/supermemoryai/python-sdk/commit/3fd7de29691be3303c91fd89189371a0ef7845dc)) -* **api:** manual updates ([3e6314d](https://github.com/supermemoryai/python-sdk/commit/3e6314dba381eb65fe644941f2cca25dfcd93d3d)) -* **api:** manual updates ([4a6b77a](https://github.com/supermemoryai/python-sdk/commit/4a6b77aa6cd55d7135e33cbfb1138d9b2d00d40a)) -* **api:** manual updates ([5b0c810](https://github.com/supermemoryai/python-sdk/commit/5b0c81086db77a2ea5922d117f4e393475d2bd03)) -* **api:** manual updates ([af34c01](https://github.com/supermemoryai/python-sdk/commit/af34c01553feba151893eea0f6a905078146424f)) -* **api:** manual updates ([637811c](https://github.com/supermemoryai/python-sdk/commit/637811c4a31cfc9d258ca8562fee1cd38fb51320)) - - -### Bug Fixes - -* **package:** support direct resource imports ([aa29842](https://github.com/supermemoryai/python-sdk/commit/aa2984202e3ff68031618847bc5a438e5a42933f)) - - -### Chores - -* **ci:** fix installation instructions ([060e326](https://github.com/supermemoryai/python-sdk/commit/060e32620febdd50931ae4d6e692a527b36b99fe)) -* **ci:** upload sdks to package manager ([a327d7d](https://github.com/supermemoryai/python-sdk/commit/a327d7ddd1836e1a15b30eb5fb33388fe2580229)) -* **internal:** avoid errors for isinstance checks on proxies ([be6c667](https://github.com/supermemoryai/python-sdk/commit/be6c667dbff65c00fc7f3bd22e541b477c19ca08)) -* **internal:** codegen related update ([c0d13e2](https://github.com/supermemoryai/python-sdk/commit/c0d13e254d08d459edc35def2c38774ce11fcd0d)) - -## 0.1.0-alpha.1 (2025-04-29) - -Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/supermemoryai/python-sdk/compare/v0.0.1-alpha.0...v0.1.0-alpha.1) - -### Features - -* **api:** add filtering in list memories endpoint ([5d86a70](https://github.com/supermemoryai/python-sdk/commit/5d86a703c41b0ce90c8ac61f2eccd6c83f79c176)) -* **api:** api update ([924681b](https://github.com/supermemoryai/python-sdk/commit/924681b37fe9492f316be15559df2644e7660842)) -* **api:** api update ([02e6b69](https://github.com/supermemoryai/python-sdk/commit/02e6b6940d3e9a7d3bfa61af801bcfa5e1a11529)) -* **api:** api update ([7754bba](https://github.com/supermemoryai/python-sdk/commit/7754bba34d6a99d903acb7439caccbe5ab9aa598)) -* **api:** api update ([b15aa2f](https://github.com/supermemoryai/python-sdk/commit/b15aa2f8c7772f84485e610d5352e68c9f4b367b)) -* **api:** api update ([0dded4d](https://github.com/supermemoryai/python-sdk/commit/0dded4d6be51807c0a295495684bdb6aa5f853d1)) -* **api:** api update ([3a4c540](https://github.com/supermemoryai/python-sdk/commit/3a4c540b328cdfb4b9aba4e7f3a9a5def657e753)) -* **api:** api update ([c700956](https://github.com/supermemoryai/python-sdk/commit/c700956b44689bb82d054d2ffabc49a902be413b)) -* **api:** api update ([bc6255a](https://github.com/supermemoryai/python-sdk/commit/bc6255addc8757d56d803593913db96e9b12a4e1)) -* **api:** api update ([2abae10](https://github.com/supermemoryai/python-sdk/commit/2abae10ee88440ef931f7a127cb365c56d80a45d)) -* **api:** api update ([7d263ce](https://github.com/supermemoryai/python-sdk/commit/7d263cefd8242b701e96b181caf6e2b473f7acac)) -* **api:** api update ([ae64ee9](https://github.com/supermemoryai/python-sdk/commit/ae64ee969401c34da3704278bc05996cecc2214e)) -* **api:** api update ([e5b0dc5](https://github.com/supermemoryai/python-sdk/commit/e5b0dc54ccebf278fb3d26cce334daa816bc5324)) -* **api:** api update ([3d891f5](https://github.com/supermemoryai/python-sdk/commit/3d891f569dcec80be6b25757bd0f7fd41366b86c)) -* **api:** api update ([1cfd461](https://github.com/supermemoryai/python-sdk/commit/1cfd4616cd5230a3eedc01b4b6cb3fc2ad6828df)) -* **api:** api update ([775acf2](https://github.com/supermemoryai/python-sdk/commit/775acf29ed6814a9e00928a21d7e1b269bd1c827)) - - -### Bug Fixes - -* **pydantic v1:** more robust ModelField.annotation check ([7ab1994](https://github.com/supermemoryai/python-sdk/commit/7ab19942fc0ec181a3ada4c2748cef5c6f604f86)) - - -### Chores - -* broadly detect json family of content-type headers ([4adab85](https://github.com/supermemoryai/python-sdk/commit/4adab85222033e3ab74864916e3913590c2e3983)) -* **ci:** add timeout thresholds for CI jobs ([6f41dd1](https://github.com/supermemoryai/python-sdk/commit/6f41dd1bcde3a7bc32c02b5e9fe301699274a19f)) -* **ci:** only use depot for staging repos ([380881a](https://github.com/supermemoryai/python-sdk/commit/380881ab4ca3cc2b121f2fc4d16a567afd6bc763)) -* **client:** minor internal fixes ([1d88cf8](https://github.com/supermemoryai/python-sdk/commit/1d88cf891c3bfb06983f28fd7bc3365e92c45f84)) -* configure new SDK language ([2aa9714](https://github.com/supermemoryai/python-sdk/commit/2aa971422b0eeddb9319fe6780fcd4bfd5a9b6c7)) -* **internal:** base client updates ([2d628e4](https://github.com/supermemoryai/python-sdk/commit/2d628e42bdfdee7dbda8e177950b93efc3f0875d)) -* **internal:** bump pyright version ([ab4080a](https://github.com/supermemoryai/python-sdk/commit/ab4080a27dc73e5956fc663449720ece5966f383)) -* **internal:** codegen related update ([072db72](https://github.com/supermemoryai/python-sdk/commit/072db7257871c72e512c6776cfe680c2fb5df738)) -* **internal:** fix list file params ([67f4ba4](https://github.com/supermemoryai/python-sdk/commit/67f4ba4b3f89f42bd0f17c5bd88fb4663e3dbf1b)) -* **internal:** import reformatting ([154b1c5](https://github.com/supermemoryai/python-sdk/commit/154b1c58b7fd421aa2039cfb4438b72e2cbe4d38)) -* **internal:** minor formatting changes ([f07f0b9](https://github.com/supermemoryai/python-sdk/commit/f07f0b9dbc8c5f0ef4d3c4acfa980d991aba3943)) -* **internal:** refactor retries to not use recursion ([63072f1](https://github.com/supermemoryai/python-sdk/commit/63072f131bca572e22af65c2c8b3b42f5e5d866a)) -* **internal:** update models test ([24d7e92](https://github.com/supermemoryai/python-sdk/commit/24d7e92ceed67b23dc0189d36d30c8eb8bb2d075)) -* **internal:** update pyright settings ([211f7e9](https://github.com/supermemoryai/python-sdk/commit/211f7e9f03d8ff06f680364b8cfb1c38dde54935)) -* update SDK settings ([cc260f1](https://github.com/supermemoryai/python-sdk/commit/cc260f124b2858bfd9495a8da074fd20890f3f10)) -* update SDK settings ([937b5cb](https://github.com/supermemoryai/python-sdk/commit/937b5cb5e302e009bfc7475c4f942d4f5c24bcdd)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0f988c37..181c8da4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,7 @@ $ pip install -r requirements-dev.lock Most of the SDK is generated code. Modifications to code will be persisted between generations, but may result in merge conflicts between manual patches and changes from the generator. The generator will never -modify the contents of the `src/supermemory/lib/` and `examples/` directories. +modify the contents of the `src/supermemory_new/lib/` and `examples/` directories. ## Adding and running examples @@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g To install via git: ```sh -$ pip install git+ssh://git@github.com/supermemoryai/python-sdk.git +$ pip install git+ssh://git@github.com/supermemoryai/sdk-py.git ``` Alternatively, you can build from source and install the wheel file: @@ -120,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel ### Publish with a GitHub workflow -You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/supermemoryai/python-sdk/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/supermemoryai/sdk-py/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. ### Publish manually diff --git a/README.md b/README.md index 4458331d..386eaab9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainless.com/). ## Documentation -The REST API documentation can be found on [docs.supermemory.com](https://docs.supermemory.com). The full API of this library can be found in [api.md](api.md). +The REST API documentation can be found on [docs.supermemory.ai](https://docs.supermemory.ai). The full API of this library can be found in [api.md](api.md). ## Installation @@ -25,16 +25,16 @@ The full API of this library can be found in [api.md](api.md). ```python import os -from supermemory import Supermemory +from supermemory_new import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) -response = client.memories.add( - content="This is a detailed article about machine learning concepts...", +response = client.search.execute( + q="documents related to python", ) -print(response.id) +print(response.results) ``` While you can provide an `api_key` keyword argument, @@ -49,7 +49,7 @@ Simply import `AsyncSupermemory` instead of `Supermemory` and use `await` with e ```python import os import asyncio -from supermemory import AsyncSupermemory +from supermemory_new import AsyncSupermemory client = AsyncSupermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted @@ -57,10 +57,10 @@ client = AsyncSupermemory( async def main() -> None: - response = await client.memories.add( - content="This is a detailed article about machine learning concepts...", + response = await client.search.execute( + q="documents related to python", ) - print(response.id) + print(response.results) asyncio.run(main()) @@ -84,8 +84,8 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH ```python import os import asyncio -from supermemory import DefaultAioHttpClient -from supermemory import AsyncSupermemory +from supermemory_new import DefaultAioHttpClient +from supermemory_new import AsyncSupermemory async def main() -> None: @@ -93,10 +93,10 @@ async def main() -> None: api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted http_client=DefaultAioHttpClient(), ) as client: - response = await client.memories.add( - content="This is a detailed article about machine learning concepts...", + response = await client.search.execute( + q="documents related to python", ) - print(response.id) + print(response.results) asyncio.run(main()) @@ -111,35 +111,18 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. -## File uploads - -Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. - -```python -from pathlib import Path -from supermemory import Supermemory - -client = Supermemory() - -client.memories.upload_file( - file=Path("/path/to/file"), -) -``` - -The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically. - ## Handling errors -When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory.APIConnectionError` is raised. +When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `supermemory_new.APIConnectionError` is raised. When the API returns a non-success status code (that is, 4xx or 5xx -response), a subclass of `supermemory.APIStatusError` is raised, containing `status_code` and `response` properties. +response), a subclass of `supermemory_new.APIStatusError` is raised, containing `status_code` and `response` properties. -All errors inherit from `supermemory.APIError`. +All errors inherit from `supermemory_new.APIError`. ```python -import supermemory -from supermemory import Supermemory +import supermemory_new +from supermemory_new import Supermemory client = Supermemory() @@ -147,12 +130,12 @@ try: client.memories.add( content="This is a detailed article about machine learning concepts...", ) -except supermemory.APIConnectionError as e: +except supermemory_new.APIConnectionError as e: print("The server could not be reached") print(e.__cause__) # an underlying Exception, likely raised within httpx. -except supermemory.RateLimitError as e: +except supermemory_new.RateLimitError as e: print("A 429 status code was received; we should back off a bit.") -except supermemory.APIStatusError as e: +except supermemory_new.APIStatusError as e: print("Another non-200-range status code was received") print(e.status_code) print(e.response) @@ -180,7 +163,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ You can use the `max_retries` option to configure or disable retry settings: ```python -from supermemory import Supermemory +from supermemory_new import Supermemory # Configure the default for all requests: client = Supermemory( @@ -200,7 +183,7 @@ By default requests time out after 1 minute. You can configure this with a `time which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object: ```python -from supermemory import Supermemory +from supermemory_new import Supermemory # Configure the default for all requests: client = Supermemory( @@ -254,7 +237,7 @@ if response.my_field is None: The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g., ```py -from supermemory import Supermemory +from supermemory_new import Supermemory client = Supermemory() response = client.memories.with_raw_response.add( @@ -266,9 +249,9 @@ memory = response.parse() # get the object that `memories.add()` would have ret print(memory.id) ``` -These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory/_response.py) object. +These methods return an [`APIResponse`](https://github.com/supermemoryai/sdk-py/tree/main/src/supermemory_new/_response.py) object. -The async client returns an [`AsyncAPIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. +The async client returns an [`AsyncAPIResponse`](https://github.com/supermemoryai/sdk-py/tree/main/src/supermemory_new/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. #### `.with_streaming_response` @@ -332,7 +315,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c ```python import httpx -from supermemory import Supermemory, DefaultHttpxClient +from supermemory_new import Supermemory, DefaultHttpxClient client = Supermemory( # Or use the `SUPERMEMORY_BASE_URL` env var @@ -355,7 +338,7 @@ client.with_options(http_client=DefaultHttpxClient(...)) By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. ```py -from supermemory import Supermemory +from supermemory_new import Supermemory with Supermemory() as client: # make requests here @@ -374,7 +357,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. -We are keen for your feedback; please open an [issue](https://www.github.com/supermemoryai/python-sdk/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/supermemoryai/sdk-py/issues) with questions, bugs, or suggestions. ### Determining the installed version @@ -383,8 +366,8 @@ If you've upgraded to the latest version but aren't seeing any new features you You can determine the version that is being used at runtime with: ```py -import supermemory -print(supermemory.__version__) +import supermemory_new +print(supermemory_new.__version__) ``` ## Requirements diff --git a/api.md b/api.md index fa4e72a2..b49df9c3 100644 --- a/api.md +++ b/api.md @@ -3,44 +3,68 @@ Types: ```python -from supermemory.types import ( +from supermemory_new.types import ( MemoryUpdateResponse, + MemoryListResponse, MemoryAddResponse, MemoryGetResponse, - MemoryUploadFileResponse, ) ``` Methods: -- client.memories.update(id, \*\*params) -> MemoryUpdateResponse -- client.memories.delete(id) -> None -- client.memories.add(\*\*params) -> MemoryAddResponse -- client.memories.get(id) -> MemoryGetResponse -- client.memories.upload_file(\*\*params) -> MemoryUploadFileResponse +- client.memories.update(id, \*\*params) -> MemoryUpdateResponse +- client.memories.list(\*\*params) -> MemoryListResponse +- client.memories.delete(id) -> None +- client.memories.add(\*\*params) -> MemoryAddResponse +- client.memories.get(id) -> MemoryGetResponse + +# Search + +Types: + +```python +from supermemory_new.types import SearchExecuteResponse +``` + +Methods: + +- client.search.execute(\*\*params) -> SearchExecuteResponse # Settings Types: ```python -from supermemory.types import SettingUpdateResponse, SettingGetResponse +from supermemory_new.types import SettingUpdateResponse, SettingGetResponse ``` Methods: -- client.settings.update(\*\*params) -> SettingUpdateResponse -- client.settings.get() -> SettingGetResponse +- client.settings.update(\*\*params) -> SettingUpdateResponse +- client.settings.get() -> SettingGetResponse # Connections Types: ```python -from supermemory.types import ConnectionCreateResponse, ConnectionGetResponse +from supermemory_new.types import ( + ConnectionCreateResponse, + ConnectionListResponse, + ConnectionDeleteByProviderResponse, + ConnectionGetByIDResponse, + ConnectionGetByTagsResponse, + ConnectionListDocumentsResponse, +) ``` Methods: -- client.connections.create(provider, \*\*params) -> ConnectionCreateResponse -- client.connections.get(connection_id) -> ConnectionGetResponse +- client.connections.create(provider, \*\*params) -> ConnectionCreateResponse +- client.connections.list(\*\*params) -> ConnectionListResponse +- client.connections.delete_by_provider(provider, \*\*params) -> ConnectionDeleteByProviderResponse +- client.connections.get_by_id(connection_id) -> ConnectionGetByIDResponse +- client.connections.get_by_tags(provider, \*\*params) -> ConnectionGetByTagsResponse +- client.connections.import\_(provider, \*\*params) -> None +- client.connections.list_documents(provider, \*\*params) -> ConnectionListDocumentsResponse diff --git a/mypy.ini b/mypy.ini index 08c8f486..b9a84617 100644 --- a/mypy.ini +++ b/mypy.ini @@ -8,7 +8,7 @@ show_error_codes = True # # We also exclude our `tests` as mypy doesn't always infer # types correctly and Pyright will still catch any type errors. -exclude = ^(src/supermemory/_files\.py|_dev/.*\.py|tests/.*)$ +exclude = ^(src/supermemory_new/_files\.py|_dev/.*\.py|tests/.*)$ strict_equality = True implicit_reexport = True diff --git a/pyproject.toml b/pyproject.toml index 40c7241e..dedc9c6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "supermemory" -version = "3.0.0-alpha.19" +version = "0.0.1-alpha.0" description = "The official Python library for the supermemory API" dynamic = ["readme"] license = "Apache-2.0" @@ -34,8 +34,8 @@ classifiers = [ ] [project.urls] -Homepage = "https://github.com/supermemoryai/python-sdk" -Repository = "https://github.com/supermemoryai/python-sdk" +Homepage = "https://github.com/supermemoryai/sdk-py" +Repository = "https://github.com/supermemoryai/sdk-py" [project.optional-dependencies] aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"] @@ -78,14 +78,14 @@ format = { chain = [ "check:ruff" = "ruff check ." "fix:ruff" = "ruff check --fix ." -"check:importable" = "python -c 'import supermemory'" +"check:importable" = "python -c 'import supermemory_new'" typecheck = { chain = [ "typecheck:pyright", "typecheck:mypy" ]} "typecheck:pyright" = "pyright" -"typecheck:verify-types" = "pyright --verifytypes supermemory --ignoreexternal" +"typecheck:verify-types" = "pyright --verifytypes supermemory_new --ignoreexternal" "typecheck:mypy" = "mypy ." [build-system] @@ -98,7 +98,7 @@ include = [ ] [tool.hatch.build.targets.wheel] -packages = ["src/supermemory"] +packages = ["src/supermemory_new"] [tool.hatch.build.targets.sdist] # Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc) @@ -124,7 +124,7 @@ path = "README.md" [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] # replace relative links with absolute links pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' -replacement = '[\1](https://github.com/supermemoryai/python-sdk/tree/main/\g<2>)' +replacement = '[\1](https://github.com/supermemoryai/sdk-py/tree/main/\g<2>)' [tool.pytest.ini_options] testpaths = ["tests"] @@ -201,7 +201,7 @@ length-sort = true length-sort-straight = true combine-as-imports = true extra-standard-library = ["typing_extensions"] -known-first-party = ["supermemory", "tests"] +known-first-party = ["supermemory_new", "tests"] [tool.ruff.lint.per-file-ignores] "bin/**.py" = ["T201", "T203"] diff --git a/release-please-config.json b/release-please-config.json index 247d1fda..e2aa4047 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -61,6 +61,6 @@ ], "release-type": "python", "extra-files": [ - "src/supermemory/_version.py" + "src/supermemory_new/_version.py" ] } \ No newline at end of file diff --git a/scripts/lint b/scripts/lint index d4303570..64dfb350 100755 --- a/scripts/lint +++ b/scripts/lint @@ -8,4 +8,4 @@ echo "==> Running lints" rye run lint echo "==> Making sure it imports" -rye run python -c 'import supermemory' +rye run python -c 'import supermemory_new' diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh index 11632537..0772bc81 100755 --- a/scripts/utils/upload-artifact.sh +++ b/scripts/utils/upload-artifact.sh @@ -18,7 +18,7 @@ UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then echo -e "\033[32mUploaded build to Stainless storage.\033[0m" - echo -e "\033[32mInstallation: pip install --pre 'https://pkg.stainless.com/s/supermemory-python/$SHA'\033[0m" + echo -e "\033[32mInstallation: pip install --pre 'https://pkg.stainless.com/s/supermemory-new-python/$SHA'\033[0m" else echo -e "\033[31mFailed to upload artifact.\033[0m" exit 1 diff --git a/src/supermemory/_version.py b/src/supermemory/_version.py deleted file mode 100644 index d5e7dc08..00000000 --- a/src/supermemory/_version.py +++ /dev/null @@ -1,4 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -__title__ = "supermemory" -__version__ = "3.0.0-alpha.19" # x-release-please-version diff --git a/src/supermemory/resources/connections.py b/src/supermemory/resources/connections.py deleted file mode 100644 index f431a728..00000000 --- a/src/supermemory/resources/connections.py +++ /dev/null @@ -1,273 +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, Optional -from typing_extensions import Literal - -import httpx - -from ..types import connection_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.connection_get_response import ConnectionGetResponse -from ..types.connection_create_response import ConnectionCreateResponse - -__all__ = ["ConnectionsResource", "AsyncConnectionsResource"] - - -class ConnectionsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ConnectionsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers - """ - return ConnectionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ConnectionsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response - """ - return ConnectionsResourceWithStreamingResponse(self) - - def create( - self, - provider: Literal["notion", "google-drive", "onedrive"], - *, - container_tags: List[str] | NotGiven = NOT_GIVEN, - document_limit: int | NotGiven = NOT_GIVEN, - metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN, - redirect_url: 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, - ) -> ConnectionCreateResponse: - """ - Initialize connection and get authorization URL - - 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 provider: - raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") - return self._post( - f"/v3/connections/{provider}", - body=maybe_transform( - { - "container_tags": container_tags, - "document_limit": document_limit, - "metadata": metadata, - "redirect_url": redirect_url, - }, - connection_create_params.ConnectionCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ConnectionCreateResponse, - ) - - def get( - self, - connection_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, - ) -> ConnectionGetResponse: - """ - Get connection details with id - - 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 connection_id: - raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}") - return self._get( - f"/v3/connections/{connection_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ConnectionGetResponse, - ) - - -class AsyncConnectionsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncConnectionsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers - """ - return AsyncConnectionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncConnectionsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response - """ - return AsyncConnectionsResourceWithStreamingResponse(self) - - async def create( - self, - provider: Literal["notion", "google-drive", "onedrive"], - *, - container_tags: List[str] | NotGiven = NOT_GIVEN, - document_limit: int | NotGiven = NOT_GIVEN, - metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN, - redirect_url: 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, - ) -> ConnectionCreateResponse: - """ - Initialize connection and get authorization URL - - 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 provider: - raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") - return await self._post( - f"/v3/connections/{provider}", - body=await async_maybe_transform( - { - "container_tags": container_tags, - "document_limit": document_limit, - "metadata": metadata, - "redirect_url": redirect_url, - }, - connection_create_params.ConnectionCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ConnectionCreateResponse, - ) - - async def get( - self, - connection_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, - ) -> ConnectionGetResponse: - """ - Get connection details with id - - 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 connection_id: - raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}") - return await self._get( - f"/v3/connections/{connection_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ConnectionGetResponse, - ) - - -class ConnectionsResourceWithRawResponse: - def __init__(self, connections: ConnectionsResource) -> None: - self._connections = connections - - self.create = to_raw_response_wrapper( - connections.create, - ) - self.get = to_raw_response_wrapper( - connections.get, - ) - - -class AsyncConnectionsResourceWithRawResponse: - def __init__(self, connections: AsyncConnectionsResource) -> None: - self._connections = connections - - self.create = async_to_raw_response_wrapper( - connections.create, - ) - self.get = async_to_raw_response_wrapper( - connections.get, - ) - - -class ConnectionsResourceWithStreamingResponse: - def __init__(self, connections: ConnectionsResource) -> None: - self._connections = connections - - self.create = to_streamed_response_wrapper( - connections.create, - ) - self.get = to_streamed_response_wrapper( - connections.get, - ) - - -class AsyncConnectionsResourceWithStreamingResponse: - def __init__(self, connections: AsyncConnectionsResource) -> None: - self._connections = connections - - self.create = async_to_streamed_response_wrapper( - connections.create, - ) - self.get = async_to_streamed_response_wrapper( - connections.get, - ) diff --git a/src/supermemory/types/__init__.py b/src/supermemory/types/__init__.py deleted file mode 100644 index b87bc6d6..00000000 --- a/src/supermemory/types/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .memory_add_params import MemoryAddParams as MemoryAddParams -from .memory_add_response import MemoryAddResponse as MemoryAddResponse -from .memory_get_response import MemoryGetResponse as MemoryGetResponse -from .memory_update_params import MemoryUpdateParams as MemoryUpdateParams -from .setting_get_response import SettingGetResponse as SettingGetResponse -from .setting_update_params import SettingUpdateParams as SettingUpdateParams -from .memory_update_response import MemoryUpdateResponse as MemoryUpdateResponse -from .connection_get_response import ConnectionGetResponse as ConnectionGetResponse -from .setting_update_response import SettingUpdateResponse as SettingUpdateResponse -from .connection_create_params import ConnectionCreateParams as ConnectionCreateParams -from .memory_upload_file_params import MemoryUploadFileParams as MemoryUploadFileParams -from .connection_create_response import ConnectionCreateResponse as ConnectionCreateResponse -from .memory_upload_file_response import MemoryUploadFileResponse as MemoryUploadFileResponse diff --git a/src/supermemory/types/memory_upload_file_params.py b/src/supermemory/types/memory_upload_file_params.py deleted file mode 100644 index aa6c082a..00000000 --- a/src/supermemory/types/memory_upload_file_params.py +++ /dev/null @@ -1,13 +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__ = ["MemoryUploadFileParams"] - - -class MemoryUploadFileParams(TypedDict, total=False): - file: Required[FileTypes] diff --git a/src/supermemory/__init__.py b/src/supermemory_new/__init__.py similarity index 94% rename from src/supermemory/__init__.py rename to src/supermemory_new/__init__.py index bb87a0cf..64e2798a 100644 --- a/src/supermemory/__init__.py +++ b/src/supermemory_new/__init__.py @@ -89,12 +89,12 @@ # Update the __module__ attribute for exported symbols so that # error messages point to this module instead of the module # it was originally defined in, e.g. -# supermemory._exceptions.NotFoundError -> supermemory.NotFoundError +# supermemory_new._exceptions.NotFoundError -> supermemory_new.NotFoundError __locals = locals() for __name in __all__: if not __name.startswith("__"): try: - __locals[__name].__module__ = "supermemory" + __locals[__name].__module__ = "supermemory_new" except (TypeError, AttributeError): # Some of our exported symbols are builtins which we can't set attributes for. pass diff --git a/src/supermemory/_base_client.py b/src/supermemory_new/_base_client.py similarity index 99% rename from src/supermemory/_base_client.py rename to src/supermemory_new/_base_client.py index 9a46a403..d15f975b 100644 --- a/src/supermemory/_base_client.py +++ b/src/supermemory_new/_base_client.py @@ -389,7 +389,7 @@ def __init__( if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] raise TypeError( - "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `supermemory.DEFAULT_MAX_RETRIES`" + "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `supermemory_new.DEFAULT_MAX_RETRIES`" ) def _enforce_trailing_slash(self, url: URL) -> URL: diff --git a/src/supermemory/_client.py b/src/supermemory_new/_client.py similarity index 96% rename from src/supermemory/_client.py rename to src/supermemory_new/_client.py index 0a336bf6..2fdf196b 100644 --- a/src/supermemory/_client.py +++ b/src/supermemory_new/_client.py @@ -21,7 +21,7 @@ ) from ._utils import is_given, get_async_library from ._version import __version__ -from .resources import memories, settings, connections +from .resources import search, memories, settings, connections from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import APIStatusError, SupermemoryError from ._base_client import ( @@ -44,6 +44,7 @@ class Supermemory(SyncAPIClient): memories: memories.MemoriesResource + search: search.SearchResource settings: settings.SettingsResource connections: connections.ConnectionsResource with_raw_response: SupermemoryWithRawResponse @@ -90,7 +91,7 @@ def __init__( if base_url is None: base_url = os.environ.get("SUPERMEMORY_BASE_URL") if base_url is None: - base_url = f"https://api.supermemory.ai/" + base_url = f"https://api.supermemory.ai" super().__init__( version=__version__, @@ -104,6 +105,7 @@ def __init__( ) self.memories = memories.MemoriesResource(self) + self.search = search.SearchResource(self) self.settings = settings.SettingsResource(self) self.connections = connections.ConnectionsResource(self) self.with_raw_response = SupermemoryWithRawResponse(self) @@ -216,6 +218,7 @@ def _make_status_error( class AsyncSupermemory(AsyncAPIClient): memories: memories.AsyncMemoriesResource + search: search.AsyncSearchResource settings: settings.AsyncSettingsResource connections: connections.AsyncConnectionsResource with_raw_response: AsyncSupermemoryWithRawResponse @@ -262,7 +265,7 @@ def __init__( if base_url is None: base_url = os.environ.get("SUPERMEMORY_BASE_URL") if base_url is None: - base_url = f"https://api.supermemory.ai/" + base_url = f"https://api.supermemory.ai" super().__init__( version=__version__, @@ -276,6 +279,7 @@ def __init__( ) self.memories = memories.AsyncMemoriesResource(self) + self.search = search.AsyncSearchResource(self) self.settings = settings.AsyncSettingsResource(self) self.connections = connections.AsyncConnectionsResource(self) self.with_raw_response = AsyncSupermemoryWithRawResponse(self) @@ -389,6 +393,7 @@ def _make_status_error( class SupermemoryWithRawResponse: def __init__(self, client: Supermemory) -> None: self.memories = memories.MemoriesResourceWithRawResponse(client.memories) + self.search = search.SearchResourceWithRawResponse(client.search) self.settings = settings.SettingsResourceWithRawResponse(client.settings) self.connections = connections.ConnectionsResourceWithRawResponse(client.connections) @@ -396,6 +401,7 @@ def __init__(self, client: Supermemory) -> None: class AsyncSupermemoryWithRawResponse: def __init__(self, client: AsyncSupermemory) -> None: self.memories = memories.AsyncMemoriesResourceWithRawResponse(client.memories) + self.search = search.AsyncSearchResourceWithRawResponse(client.search) self.settings = settings.AsyncSettingsResourceWithRawResponse(client.settings) self.connections = connections.AsyncConnectionsResourceWithRawResponse(client.connections) @@ -403,6 +409,7 @@ def __init__(self, client: AsyncSupermemory) -> None: class SupermemoryWithStreamedResponse: def __init__(self, client: Supermemory) -> None: self.memories = memories.MemoriesResourceWithStreamingResponse(client.memories) + self.search = search.SearchResourceWithStreamingResponse(client.search) self.settings = settings.SettingsResourceWithStreamingResponse(client.settings) self.connections = connections.ConnectionsResourceWithStreamingResponse(client.connections) @@ -410,6 +417,7 @@ def __init__(self, client: Supermemory) -> None: class AsyncSupermemoryWithStreamedResponse: def __init__(self, client: AsyncSupermemory) -> None: self.memories = memories.AsyncMemoriesResourceWithStreamingResponse(client.memories) + self.search = search.AsyncSearchResourceWithStreamingResponse(client.search) self.settings = settings.AsyncSettingsResourceWithStreamingResponse(client.settings) self.connections = connections.AsyncConnectionsResourceWithStreamingResponse(client.connections) diff --git a/src/supermemory/_compat.py b/src/supermemory_new/_compat.py similarity index 100% rename from src/supermemory/_compat.py rename to src/supermemory_new/_compat.py diff --git a/src/supermemory/_constants.py b/src/supermemory_new/_constants.py similarity index 100% rename from src/supermemory/_constants.py rename to src/supermemory_new/_constants.py diff --git a/src/supermemory/_exceptions.py b/src/supermemory_new/_exceptions.py similarity index 100% rename from src/supermemory/_exceptions.py rename to src/supermemory_new/_exceptions.py diff --git a/src/supermemory/_files.py b/src/supermemory_new/_files.py similarity index 96% rename from src/supermemory/_files.py rename to src/supermemory_new/_files.py index 0dcf63d3..715cc207 100644 --- a/src/supermemory/_files.py +++ b/src/supermemory_new/_files.py @@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: if not is_file_content(obj): prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`" raise RuntimeError( - f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/supermemoryai/python-sdk/tree/main#file-uploads" + f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead." ) from None diff --git a/src/supermemory/_models.py b/src/supermemory_new/_models.py similarity index 100% rename from src/supermemory/_models.py rename to src/supermemory_new/_models.py diff --git a/src/supermemory/_qs.py b/src/supermemory_new/_qs.py similarity index 100% rename from src/supermemory/_qs.py rename to src/supermemory_new/_qs.py diff --git a/src/supermemory/_resource.py b/src/supermemory_new/_resource.py similarity index 100% rename from src/supermemory/_resource.py rename to src/supermemory_new/_resource.py diff --git a/src/supermemory/_response.py b/src/supermemory_new/_response.py similarity index 99% rename from src/supermemory/_response.py rename to src/supermemory_new/_response.py index 9a6b956f..c3381986 100644 --- a/src/supermemory/_response.py +++ b/src/supermemory_new/_response.py @@ -218,7 +218,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: and issubclass(origin, pydantic.BaseModel) ): raise TypeError( - "Pydantic models must subclass our base model type, e.g. `from supermemory import BaseModel`" + "Pydantic models must subclass our base model type, e.g. `from supermemory_new import BaseModel`" ) if ( @@ -285,7 +285,7 @@ def parse(self, *, to: type[_T] | None = None) -> R | _T: the `to` argument, e.g. ```py - from supermemory import BaseModel + from supermemory_new import BaseModel class MyModel(BaseModel): @@ -387,7 +387,7 @@ async def parse(self, *, to: type[_T] | None = None) -> R | _T: the `to` argument, e.g. ```py - from supermemory import BaseModel + from supermemory_new import BaseModel class MyModel(BaseModel): @@ -558,7 +558,7 @@ async def stream_to_file( class MissingStreamClassError(TypeError): def __init__(self) -> None: super().__init__( - "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `supermemory._streaming` for reference", + "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `supermemory_new._streaming` for reference", ) diff --git a/src/supermemory/_streaming.py b/src/supermemory_new/_streaming.py similarity index 100% rename from src/supermemory/_streaming.py rename to src/supermemory_new/_streaming.py diff --git a/src/supermemory/_types.py b/src/supermemory_new/_types.py similarity index 99% rename from src/supermemory/_types.py rename to src/supermemory_new/_types.py index 8491d513..f63365fc 100644 --- a/src/supermemory/_types.py +++ b/src/supermemory_new/_types.py @@ -81,7 +81,7 @@ # This unfortunately means that you will either have # to import this type and pass it explicitly: # -# from supermemory import NoneType +# from supermemory_new import NoneType # client.get('/foo', cast_to=NoneType) # # or build it yourself: diff --git a/src/supermemory/_utils/__init__.py b/src/supermemory_new/_utils/__init__.py similarity index 100% rename from src/supermemory/_utils/__init__.py rename to src/supermemory_new/_utils/__init__.py diff --git a/src/supermemory/_utils/_logs.py b/src/supermemory_new/_utils/_logs.py similarity index 75% rename from src/supermemory/_utils/_logs.py rename to src/supermemory_new/_utils/_logs.py index b4d8cbf3..219dd778 100644 --- a/src/supermemory/_utils/_logs.py +++ b/src/supermemory_new/_utils/_logs.py @@ -1,12 +1,12 @@ import os import logging -logger: logging.Logger = logging.getLogger("supermemory") +logger: logging.Logger = logging.getLogger("supermemory_new") httpx_logger: logging.Logger = logging.getLogger("httpx") def _basic_config() -> None: - # e.g. [2023-10-05 14:12:26 - supermemory._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK" + # e.g. [2023-10-05 14:12:26 - supermemory_new._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK" logging.basicConfig( format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S", diff --git a/src/supermemory/_utils/_proxy.py b/src/supermemory_new/_utils/_proxy.py similarity index 100% rename from src/supermemory/_utils/_proxy.py rename to src/supermemory_new/_utils/_proxy.py diff --git a/src/supermemory/_utils/_reflection.py b/src/supermemory_new/_utils/_reflection.py similarity index 100% rename from src/supermemory/_utils/_reflection.py rename to src/supermemory_new/_utils/_reflection.py diff --git a/src/supermemory/_utils/_resources_proxy.py b/src/supermemory_new/_utils/_resources_proxy.py similarity index 50% rename from src/supermemory/_utils/_resources_proxy.py rename to src/supermemory_new/_utils/_resources_proxy.py index 53b457d1..5186de41 100644 --- a/src/supermemory/_utils/_resources_proxy.py +++ b/src/supermemory_new/_utils/_resources_proxy.py @@ -7,17 +7,17 @@ class ResourcesProxy(LazyProxy[Any]): - """A proxy for the `supermemory.resources` module. + """A proxy for the `supermemory_new.resources` module. - This is used so that we can lazily import `supermemory.resources` only when - needed *and* so that users can just import `supermemory` and reference `supermemory.resources` + This is used so that we can lazily import `supermemory_new.resources` only when + needed *and* so that users can just import `supermemory_new` and reference `supermemory_new.resources` """ @override def __load__(self) -> Any: import importlib - mod = importlib.import_module("supermemory.resources") + mod = importlib.import_module("supermemory_new.resources") return mod diff --git a/src/supermemory/_utils/_streams.py b/src/supermemory_new/_utils/_streams.py similarity index 100% rename from src/supermemory/_utils/_streams.py rename to src/supermemory_new/_utils/_streams.py diff --git a/src/supermemory/_utils/_sync.py b/src/supermemory_new/_utils/_sync.py similarity index 100% rename from src/supermemory/_utils/_sync.py rename to src/supermemory_new/_utils/_sync.py diff --git a/src/supermemory/_utils/_transform.py b/src/supermemory_new/_utils/_transform.py similarity index 100% rename from src/supermemory/_utils/_transform.py rename to src/supermemory_new/_utils/_transform.py diff --git a/src/supermemory/_utils/_typing.py b/src/supermemory_new/_utils/_typing.py similarity index 100% rename from src/supermemory/_utils/_typing.py rename to src/supermemory_new/_utils/_typing.py diff --git a/src/supermemory/_utils/_utils.py b/src/supermemory_new/_utils/_utils.py similarity index 100% rename from src/supermemory/_utils/_utils.py rename to src/supermemory_new/_utils/_utils.py diff --git a/src/supermemory_new/_version.py b/src/supermemory_new/_version.py new file mode 100644 index 00000000..c96c1a71 --- /dev/null +++ b/src/supermemory_new/_version.py @@ -0,0 +1,4 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +__title__ = "supermemory_new" +__version__ = "0.0.1-alpha.0" # x-release-please-version diff --git a/src/supermemory/lib/.keep b/src/supermemory_new/lib/.keep similarity index 100% rename from src/supermemory/lib/.keep rename to src/supermemory_new/lib/.keep diff --git a/src/supermemory/py.typed b/src/supermemory_new/py.typed similarity index 100% rename from src/supermemory/py.typed rename to src/supermemory_new/py.typed diff --git a/src/supermemory/resources/__init__.py b/src/supermemory_new/resources/__init__.py similarity index 77% rename from src/supermemory/resources/__init__.py rename to src/supermemory_new/resources/__init__.py index 5a1fb723..275ecfbe 100644 --- a/src/supermemory/resources/__init__.py +++ b/src/supermemory_new/resources/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .search import ( + SearchResource, + AsyncSearchResource, + SearchResourceWithRawResponse, + AsyncSearchResourceWithRawResponse, + SearchResourceWithStreamingResponse, + AsyncSearchResourceWithStreamingResponse, +) from .memories import ( MemoriesResource, AsyncMemoriesResource, @@ -32,6 +40,12 @@ "AsyncMemoriesResourceWithRawResponse", "MemoriesResourceWithStreamingResponse", "AsyncMemoriesResourceWithStreamingResponse", + "SearchResource", + "AsyncSearchResource", + "SearchResourceWithRawResponse", + "AsyncSearchResourceWithRawResponse", + "SearchResourceWithStreamingResponse", + "AsyncSearchResourceWithStreamingResponse", "SettingsResource", "AsyncSettingsResource", "SettingsResourceWithRawResponse", diff --git a/src/supermemory_new/resources/connections.py b/src/supermemory_new/resources/connections.py new file mode 100644 index 00000000..d8a64631 --- /dev/null +++ b/src/supermemory_new/resources/connections.py @@ -0,0 +1,728 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Union, Optional +from typing_extensions import Literal + +import httpx + +from ..types import ( + connection_list_params, + connection_create_params, + connection_import_params, + connection_get_by_tags_params, + connection_list_documents_params, + connection_delete_by_provider_params, +) +from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, 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.connection_list_response import ConnectionListResponse +from ..types.connection_create_response import ConnectionCreateResponse +from ..types.connection_get_by_id_response import ConnectionGetByIDResponse +from ..types.connection_get_by_tags_response import ConnectionGetByTagsResponse +from ..types.connection_list_documents_response import ConnectionListDocumentsResponse +from ..types.connection_delete_by_provider_response import ConnectionDeleteByProviderResponse + +__all__ = ["ConnectionsResource", "AsyncConnectionsResource"] + + +class ConnectionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ConnectionsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + """ + return ConnectionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ConnectionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + """ + return ConnectionsResourceWithStreamingResponse(self) + + def create( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: List[str] | NotGiven = NOT_GIVEN, + document_limit: int | NotGiven = NOT_GIVEN, + metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN, + redirect_url: 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, + ) -> ConnectionCreateResponse: + """ + Initialize connection and get authorization URL + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + return self._post( + f"/v3/connections/{provider}", + body=maybe_transform( + { + "container_tags": container_tags, + "document_limit": document_limit, + "metadata": metadata, + "redirect_url": redirect_url, + }, + connection_create_params.ConnectionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionCreateResponse, + ) + + def list( + self, + *, + container_tags: 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, + ) -> ConnectionListResponse: + """ + List all connections + + Args: + container_tags: Optional comma-separated list of container tags to filter documents by + + 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( + "/v3/connections/list", + body=maybe_transform({"container_tags": container_tags}, connection_list_params.ConnectionListParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionListResponse, + ) + + def delete_by_provider( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: List[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, + ) -> ConnectionDeleteByProviderResponse: + """ + Delete connection for a specific provider and container tags + + Args: + container_tags: Optional comma-separated list of container tags to filter connections by + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + return self._delete( + f"/v3/connections/{provider}", + body=maybe_transform( + {"container_tags": container_tags}, + connection_delete_by_provider_params.ConnectionDeleteByProviderParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionDeleteByProviderResponse, + ) + + def get_by_id( + self, + connection_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, + ) -> ConnectionGetByIDResponse: + """ + Get connection details with id + + 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 connection_id: + raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}") + return self._get( + f"/v3/connections/{connection_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionGetByIDResponse, + ) + + def get_by_tags( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: List[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, + ) -> ConnectionGetByTagsResponse: + """ + Get connection details with provider and container tags + + Args: + container_tags: Comma-separated list of container tags to filter connection by + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + return self._post( + f"/v3/connections/{provider}/connection", + body=maybe_transform( + {"container_tags": container_tags}, connection_get_by_tags_params.ConnectionGetByTagsParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionGetByTagsResponse, + ) + + def import_( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: 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, + ) -> None: + """ + Initiate a manual sync of connections + + Args: + container_tags: Optional comma-separated list of container tags to filter connections by + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + f"/v3/connections/{provider}/import", + body=maybe_transform({"container_tags": container_tags}, connection_import_params.ConnectionImportParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def list_documents( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: 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, + ) -> ConnectionListDocumentsResponse: + """ + List documents indexed for a provider and container tags + + Args: + container_tags: Optional comma-separated list of container tags to filter documents by + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + return self._post( + f"/v3/connections/{provider}/documents", + body=maybe_transform( + {"container_tags": container_tags}, connection_list_documents_params.ConnectionListDocumentsParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionListDocumentsResponse, + ) + + +class AsyncConnectionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncConnectionsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + """ + return AsyncConnectionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncConnectionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + """ + return AsyncConnectionsResourceWithStreamingResponse(self) + + async def create( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: List[str] | NotGiven = NOT_GIVEN, + document_limit: int | NotGiven = NOT_GIVEN, + metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN, + redirect_url: 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, + ) -> ConnectionCreateResponse: + """ + Initialize connection and get authorization URL + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + return await self._post( + f"/v3/connections/{provider}", + body=await async_maybe_transform( + { + "container_tags": container_tags, + "document_limit": document_limit, + "metadata": metadata, + "redirect_url": redirect_url, + }, + connection_create_params.ConnectionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionCreateResponse, + ) + + async def list( + self, + *, + container_tags: 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, + ) -> ConnectionListResponse: + """ + List all connections + + Args: + container_tags: Optional comma-separated list of container tags to filter documents by + + 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( + "/v3/connections/list", + body=await async_maybe_transform( + {"container_tags": container_tags}, connection_list_params.ConnectionListParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionListResponse, + ) + + async def delete_by_provider( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: List[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, + ) -> ConnectionDeleteByProviderResponse: + """ + Delete connection for a specific provider and container tags + + Args: + container_tags: Optional comma-separated list of container tags to filter connections by + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + return await self._delete( + f"/v3/connections/{provider}", + body=await async_maybe_transform( + {"container_tags": container_tags}, + connection_delete_by_provider_params.ConnectionDeleteByProviderParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionDeleteByProviderResponse, + ) + + async def get_by_id( + self, + connection_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, + ) -> ConnectionGetByIDResponse: + """ + Get connection details with id + + 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 connection_id: + raise ValueError(f"Expected a non-empty value for `connection_id` but received {connection_id!r}") + return await self._get( + f"/v3/connections/{connection_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionGetByIDResponse, + ) + + async def get_by_tags( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: List[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, + ) -> ConnectionGetByTagsResponse: + """ + Get connection details with provider and container tags + + Args: + container_tags: Comma-separated list of container tags to filter connection by + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + return await self._post( + f"/v3/connections/{provider}/connection", + body=await async_maybe_transform( + {"container_tags": container_tags}, connection_get_by_tags_params.ConnectionGetByTagsParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionGetByTagsResponse, + ) + + async def import_( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: 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, + ) -> None: + """ + Initiate a manual sync of connections + + Args: + container_tags: Optional comma-separated list of container tags to filter connections by + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + f"/v3/connections/{provider}/import", + body=await async_maybe_transform( + {"container_tags": container_tags}, connection_import_params.ConnectionImportParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def list_documents( + self, + provider: Literal["notion", "google-drive", "onedrive"], + *, + container_tags: 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, + ) -> ConnectionListDocumentsResponse: + """ + List documents indexed for a provider and container tags + + Args: + container_tags: Optional comma-separated list of container tags to filter documents by + + 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 provider: + raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}") + return await self._post( + f"/v3/connections/{provider}/documents", + body=await async_maybe_transform( + {"container_tags": container_tags}, connection_list_documents_params.ConnectionListDocumentsParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionListDocumentsResponse, + ) + + +class ConnectionsResourceWithRawResponse: + def __init__(self, connections: ConnectionsResource) -> None: + self._connections = connections + + self.create = to_raw_response_wrapper( + connections.create, + ) + self.list = to_raw_response_wrapper( + connections.list, + ) + self.delete_by_provider = to_raw_response_wrapper( + connections.delete_by_provider, + ) + self.get_by_id = to_raw_response_wrapper( + connections.get_by_id, + ) + self.get_by_tags = to_raw_response_wrapper( + connections.get_by_tags, + ) + self.import_ = to_raw_response_wrapper( + connections.import_, + ) + self.list_documents = to_raw_response_wrapper( + connections.list_documents, + ) + + +class AsyncConnectionsResourceWithRawResponse: + def __init__(self, connections: AsyncConnectionsResource) -> None: + self._connections = connections + + self.create = async_to_raw_response_wrapper( + connections.create, + ) + self.list = async_to_raw_response_wrapper( + connections.list, + ) + self.delete_by_provider = async_to_raw_response_wrapper( + connections.delete_by_provider, + ) + self.get_by_id = async_to_raw_response_wrapper( + connections.get_by_id, + ) + self.get_by_tags = async_to_raw_response_wrapper( + connections.get_by_tags, + ) + self.import_ = async_to_raw_response_wrapper( + connections.import_, + ) + self.list_documents = async_to_raw_response_wrapper( + connections.list_documents, + ) + + +class ConnectionsResourceWithStreamingResponse: + def __init__(self, connections: ConnectionsResource) -> None: + self._connections = connections + + self.create = to_streamed_response_wrapper( + connections.create, + ) + self.list = to_streamed_response_wrapper( + connections.list, + ) + self.delete_by_provider = to_streamed_response_wrapper( + connections.delete_by_provider, + ) + self.get_by_id = to_streamed_response_wrapper( + connections.get_by_id, + ) + self.get_by_tags = to_streamed_response_wrapper( + connections.get_by_tags, + ) + self.import_ = to_streamed_response_wrapper( + connections.import_, + ) + self.list_documents = to_streamed_response_wrapper( + connections.list_documents, + ) + + +class AsyncConnectionsResourceWithStreamingResponse: + def __init__(self, connections: AsyncConnectionsResource) -> None: + self._connections = connections + + self.create = async_to_streamed_response_wrapper( + connections.create, + ) + self.list = async_to_streamed_response_wrapper( + connections.list, + ) + self.delete_by_provider = async_to_streamed_response_wrapper( + connections.delete_by_provider, + ) + self.get_by_id = async_to_streamed_response_wrapper( + connections.get_by_id, + ) + self.get_by_tags = async_to_streamed_response_wrapper( + connections.get_by_tags, + ) + self.import_ = async_to_streamed_response_wrapper( + connections.import_, + ) + self.list_documents = async_to_streamed_response_wrapper( + connections.list_documents, + ) diff --git a/src/supermemory/resources/memories.py b/src/supermemory_new/resources/memories.py similarity index 86% rename from src/supermemory/resources/memories.py rename to src/supermemory_new/resources/memories.py index 6fe1d56a..6d7705d1 100644 --- a/src/supermemory/resources/memories.py +++ b/src/supermemory_new/resources/memories.py @@ -2,13 +2,14 @@ from __future__ import annotations -from typing import Dict, List, Union, Mapping, cast +from typing import Dict, List, Union +from typing_extensions import Literal import httpx -from ..types import memory_add_params, memory_update_params, memory_upload_file_params -from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes -from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform +from ..types import memory_add_params, memory_list_params, memory_update_params +from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -20,8 +21,8 @@ from .._base_client import make_request_options from ..types.memory_add_response import MemoryAddResponse from ..types.memory_get_response import MemoryGetResponse +from ..types.memory_list_response import MemoryListResponse from ..types.memory_update_response import MemoryUpdateResponse -from ..types.memory_upload_file_response import MemoryUploadFileResponse __all__ = ["MemoriesResource", "AsyncMemoriesResource"] @@ -33,7 +34,7 @@ def with_raw_response(self) -> MemoriesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers """ return MemoriesResourceWithRawResponse(self) @@ -42,7 +43,7 @@ def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response + For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response """ return MemoriesResourceWithStreamingResponse(self) @@ -113,6 +114,66 @@ def update( cast_to=MemoryUpdateResponse, ) + def list( + self, + *, + container_tags: List[str] | NotGiven = NOT_GIVEN, + filters: str | NotGiven = NOT_GIVEN, + limit: Union[str, float] | NotGiven = NOT_GIVEN, + order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + page: Union[str, float] | NotGiven = NOT_GIVEN, + sort: Literal["createdAt", "updatedAt"] | 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, + ) -> MemoryListResponse: + """ + Retrieves a paginated list of memories with their metadata and workflow status + + Args: + container_tags: Optional tags this memory should be containerized by. This can be an ID for your + user, a project ID, or any other identifier you wish to use to group memories. + + filters: Optional filters to apply to the search + + limit: Number of items per page + + order: Sort order + + page: Page number to fetch + + sort: Field to sort by + + 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( + "/v3/memories/list", + body=maybe_transform( + { + "container_tags": container_tags, + "filters": filters, + "limit": limit, + "order": order, + "page": page, + "sort": sort, + }, + memory_list_params.MemoryListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=MemoryListResponse, + ) + def delete( self, id: str, @@ -244,45 +305,6 @@ def get( cast_to=MemoryGetResponse, ) - def upload_file( - self, - *, - file: 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, - ) -> MemoryUploadFileResponse: - """ - Upload a file to be processed - - 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 - """ - body = deepcopy_minimal({"file": file}) - 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( - "/v3/memories/file", - body=maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=MemoryUploadFileResponse, - ) - class AsyncMemoriesResource(AsyncAPIResource): @cached_property @@ -291,7 +313,7 @@ def with_raw_response(self) -> AsyncMemoriesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers """ return AsyncMemoriesResourceWithRawResponse(self) @@ -300,7 +322,7 @@ def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response + For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response """ return AsyncMemoriesResourceWithStreamingResponse(self) @@ -371,6 +393,66 @@ async def update( cast_to=MemoryUpdateResponse, ) + async def list( + self, + *, + container_tags: List[str] | NotGiven = NOT_GIVEN, + filters: str | NotGiven = NOT_GIVEN, + limit: Union[str, float] | NotGiven = NOT_GIVEN, + order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + page: Union[str, float] | NotGiven = NOT_GIVEN, + sort: Literal["createdAt", "updatedAt"] | 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, + ) -> MemoryListResponse: + """ + Retrieves a paginated list of memories with their metadata and workflow status + + Args: + container_tags: Optional tags this memory should be containerized by. This can be an ID for your + user, a project ID, or any other identifier you wish to use to group memories. + + filters: Optional filters to apply to the search + + limit: Number of items per page + + order: Sort order + + page: Page number to fetch + + sort: Field to sort by + + 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( + "/v3/memories/list", + body=await async_maybe_transform( + { + "container_tags": container_tags, + "filters": filters, + "limit": limit, + "order": order, + "page": page, + "sort": sort, + }, + memory_list_params.MemoryListParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=MemoryListResponse, + ) + async def delete( self, id: str, @@ -502,45 +584,6 @@ async def get( cast_to=MemoryGetResponse, ) - async def upload_file( - self, - *, - file: 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, - ) -> MemoryUploadFileResponse: - """ - Upload a file to be processed - - 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 - """ - body = deepcopy_minimal({"file": file}) - 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( - "/v3/memories/file", - body=await async_maybe_transform(body, memory_upload_file_params.MemoryUploadFileParams), - files=files, - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=MemoryUploadFileResponse, - ) - class MemoriesResourceWithRawResponse: def __init__(self, memories: MemoriesResource) -> None: @@ -549,6 +592,9 @@ def __init__(self, memories: MemoriesResource) -> None: self.update = to_raw_response_wrapper( memories.update, ) + self.list = to_raw_response_wrapper( + memories.list, + ) self.delete = to_raw_response_wrapper( memories.delete, ) @@ -558,9 +604,6 @@ def __init__(self, memories: MemoriesResource) -> None: self.get = to_raw_response_wrapper( memories.get, ) - self.upload_file = to_raw_response_wrapper( - memories.upload_file, - ) class AsyncMemoriesResourceWithRawResponse: @@ -570,6 +613,9 @@ def __init__(self, memories: AsyncMemoriesResource) -> None: self.update = async_to_raw_response_wrapper( memories.update, ) + self.list = async_to_raw_response_wrapper( + memories.list, + ) self.delete = async_to_raw_response_wrapper( memories.delete, ) @@ -579,9 +625,6 @@ def __init__(self, memories: AsyncMemoriesResource) -> None: self.get = async_to_raw_response_wrapper( memories.get, ) - self.upload_file = async_to_raw_response_wrapper( - memories.upload_file, - ) class MemoriesResourceWithStreamingResponse: @@ -591,6 +634,9 @@ def __init__(self, memories: MemoriesResource) -> None: self.update = to_streamed_response_wrapper( memories.update, ) + self.list = to_streamed_response_wrapper( + memories.list, + ) self.delete = to_streamed_response_wrapper( memories.delete, ) @@ -600,9 +646,6 @@ def __init__(self, memories: MemoriesResource) -> None: self.get = to_streamed_response_wrapper( memories.get, ) - self.upload_file = to_streamed_response_wrapper( - memories.upload_file, - ) class AsyncMemoriesResourceWithStreamingResponse: @@ -612,6 +655,9 @@ def __init__(self, memories: AsyncMemoriesResource) -> None: self.update = async_to_streamed_response_wrapper( memories.update, ) + self.list = async_to_streamed_response_wrapper( + memories.list, + ) self.delete = async_to_streamed_response_wrapper( memories.delete, ) @@ -621,6 +667,3 @@ def __init__(self, memories: AsyncMemoriesResource) -> None: self.get = async_to_streamed_response_wrapper( memories.get, ) - self.upload_file = async_to_streamed_response_wrapper( - memories.upload_file, - ) diff --git a/src/supermemory_new/resources/search.py b/src/supermemory_new/resources/search.py new file mode 100644 index 00000000..b516ba78 --- /dev/null +++ b/src/supermemory_new/resources/search.py @@ -0,0 +1,300 @@ +# 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 search_execute_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.search_execute_response import SearchExecuteResponse + +__all__ = ["SearchResource", "AsyncSearchResource"] + + +class SearchResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SearchResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + """ + return SearchResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SearchResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + """ + return SearchResourceWithStreamingResponse(self) + + def execute( + self, + *, + q: str, + categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN, + chunk_threshold: float | NotGiven = NOT_GIVEN, + container_tags: List[str] | NotGiven = NOT_GIVEN, + doc_id: str | NotGiven = NOT_GIVEN, + document_threshold: float | NotGiven = NOT_GIVEN, + filters: search_execute_params.Filters | NotGiven = NOT_GIVEN, + include_full_docs: bool | NotGiven = NOT_GIVEN, + include_summary: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + only_matching_chunks: bool | NotGiven = NOT_GIVEN, + rerank: bool | NotGiven = NOT_GIVEN, + rewrite_query: 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, + ) -> SearchExecuteResponse: + """ + Search memories with advanced filtering + + Args: + q: Search query string + + categories_filter: Optional category filters + + chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most + chunks, more results), 1 is most sensitive (returns lesser chunks, accurate + results) + + container_tags: Optional tags this search should be containerized by. This can be an ID for your + user, a project ID, or any other identifier you wish to use to filter memories. + + doc_id: Optional document ID to search within. You can use this to find chunks in a very + large document. + + document_threshold: Threshold / sensitivity for document selection. 0 is least sensitive (returns + most documents, more results), 1 is most sensitive (returns lesser documents, + accurate results) + + filters: Optional filters to apply to the search + + include_full_docs: If true, include full document in the response. This is helpful if you want a + chatbot to know the full context of the document. + + include_summary: If true, include document summary in the response. This is helpful if you want a + chatbot to know the full context of the document. + + limit: Maximum number of results to return + + only_matching_chunks: If true, only return matching chunks without context. Normally, we send the + previous and next chunk to provide more context for LLMs. If you only want the + matching chunk, set this to true. + + rerank: If true, rerank the results based on the query. This is helpful if you want to + ensure the most relevant results are returned. + + rewrite_query: If true, rewrites the query to make it easier to find documents. This increases + the latency by about 400ms + + 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( + "/v3/search", + body=maybe_transform( + { + "q": q, + "categories_filter": categories_filter, + "chunk_threshold": chunk_threshold, + "container_tags": container_tags, + "doc_id": doc_id, + "document_threshold": document_threshold, + "filters": filters, + "include_full_docs": include_full_docs, + "include_summary": include_summary, + "limit": limit, + "only_matching_chunks": only_matching_chunks, + "rerank": rerank, + "rewrite_query": rewrite_query, + }, + search_execute_params.SearchExecuteParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SearchExecuteResponse, + ) + + +class AsyncSearchResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSearchResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + """ + return AsyncSearchResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSearchResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + """ + return AsyncSearchResourceWithStreamingResponse(self) + + async def execute( + self, + *, + q: str, + categories_filter: List[Literal["technology", "science", "business", "health"]] | NotGiven = NOT_GIVEN, + chunk_threshold: float | NotGiven = NOT_GIVEN, + container_tags: List[str] | NotGiven = NOT_GIVEN, + doc_id: str | NotGiven = NOT_GIVEN, + document_threshold: float | NotGiven = NOT_GIVEN, + filters: search_execute_params.Filters | NotGiven = NOT_GIVEN, + include_full_docs: bool | NotGiven = NOT_GIVEN, + include_summary: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + only_matching_chunks: bool | NotGiven = NOT_GIVEN, + rerank: bool | NotGiven = NOT_GIVEN, + rewrite_query: 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, + ) -> SearchExecuteResponse: + """ + Search memories with advanced filtering + + Args: + q: Search query string + + categories_filter: Optional category filters + + chunk_threshold: Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most + chunks, more results), 1 is most sensitive (returns lesser chunks, accurate + results) + + container_tags: Optional tags this search should be containerized by. This can be an ID for your + user, a project ID, or any other identifier you wish to use to filter memories. + + doc_id: Optional document ID to search within. You can use this to find chunks in a very + large document. + + document_threshold: Threshold / sensitivity for document selection. 0 is least sensitive (returns + most documents, more results), 1 is most sensitive (returns lesser documents, + accurate results) + + filters: Optional filters to apply to the search + + include_full_docs: If true, include full document in the response. This is helpful if you want a + chatbot to know the full context of the document. + + include_summary: If true, include document summary in the response. This is helpful if you want a + chatbot to know the full context of the document. + + limit: Maximum number of results to return + + only_matching_chunks: If true, only return matching chunks without context. Normally, we send the + previous and next chunk to provide more context for LLMs. If you only want the + matching chunk, set this to true. + + rerank: If true, rerank the results based on the query. This is helpful if you want to + ensure the most relevant results are returned. + + rewrite_query: If true, rewrites the query to make it easier to find documents. This increases + the latency by about 400ms + + 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( + "/v3/search", + body=await async_maybe_transform( + { + "q": q, + "categories_filter": categories_filter, + "chunk_threshold": chunk_threshold, + "container_tags": container_tags, + "doc_id": doc_id, + "document_threshold": document_threshold, + "filters": filters, + "include_full_docs": include_full_docs, + "include_summary": include_summary, + "limit": limit, + "only_matching_chunks": only_matching_chunks, + "rerank": rerank, + "rewrite_query": rewrite_query, + }, + search_execute_params.SearchExecuteParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SearchExecuteResponse, + ) + + +class SearchResourceWithRawResponse: + def __init__(self, search: SearchResource) -> None: + self._search = search + + self.execute = to_raw_response_wrapper( + search.execute, + ) + + +class AsyncSearchResourceWithRawResponse: + def __init__(self, search: AsyncSearchResource) -> None: + self._search = search + + self.execute = async_to_raw_response_wrapper( + search.execute, + ) + + +class SearchResourceWithStreamingResponse: + def __init__(self, search: SearchResource) -> None: + self._search = search + + self.execute = to_streamed_response_wrapper( + search.execute, + ) + + +class AsyncSearchResourceWithStreamingResponse: + def __init__(self, search: AsyncSearchResource) -> None: + self._search = search + + self.execute = async_to_streamed_response_wrapper( + search.execute, + ) diff --git a/src/supermemory/resources/settings.py b/src/supermemory_new/resources/settings.py similarity index 98% rename from src/supermemory/resources/settings.py rename to src/supermemory_new/resources/settings.py index 1ae36b65..f8057693 100644 --- a/src/supermemory/resources/settings.py +++ b/src/supermemory_new/resources/settings.py @@ -31,7 +31,7 @@ def with_raw_response(self) -> SettingsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers """ return SettingsResourceWithRawResponse(self) @@ -40,7 +40,7 @@ def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response + For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response """ return SettingsResourceWithStreamingResponse(self) @@ -134,7 +134,7 @@ def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers """ return AsyncSettingsResourceWithRawResponse(self) @@ -143,7 +143,7 @@ def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response + For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response """ return AsyncSettingsResourceWithStreamingResponse(self) diff --git a/src/supermemory_new/types/__init__.py b/src/supermemory_new/types/__init__.py new file mode 100644 index 00000000..9fe804d2 --- /dev/null +++ b/src/supermemory_new/types/__init__.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .memory_add_params import MemoryAddParams as MemoryAddParams +from .memory_list_params import MemoryListParams as MemoryListParams +from .memory_add_response import MemoryAddResponse as MemoryAddResponse +from .memory_get_response import MemoryGetResponse as MemoryGetResponse +from .memory_list_response import MemoryListResponse as MemoryListResponse +from .memory_update_params import MemoryUpdateParams as MemoryUpdateParams +from .setting_get_response import SettingGetResponse as SettingGetResponse +from .search_execute_params import SearchExecuteParams as SearchExecuteParams +from .setting_update_params import SettingUpdateParams as SettingUpdateParams +from .connection_list_params import ConnectionListParams as ConnectionListParams +from .memory_update_response import MemoryUpdateResponse as MemoryUpdateResponse +from .search_execute_response import SearchExecuteResponse as SearchExecuteResponse +from .setting_update_response import SettingUpdateResponse as SettingUpdateResponse +from .connection_create_params import ConnectionCreateParams as ConnectionCreateParams +from .connection_import_params import ConnectionImportParams as ConnectionImportParams +from .connection_list_response import ConnectionListResponse as ConnectionListResponse +from .connection_create_response import ConnectionCreateResponse as ConnectionCreateResponse +from .connection_get_by_id_response import ConnectionGetByIDResponse as ConnectionGetByIDResponse +from .connection_get_by_tags_params import ConnectionGetByTagsParams as ConnectionGetByTagsParams +from .connection_get_by_tags_response import ConnectionGetByTagsResponse as ConnectionGetByTagsResponse +from .connection_list_documents_params import ConnectionListDocumentsParams as ConnectionListDocumentsParams +from .connection_list_documents_response import ConnectionListDocumentsResponse as ConnectionListDocumentsResponse +from .connection_delete_by_provider_params import ConnectionDeleteByProviderParams as ConnectionDeleteByProviderParams +from .connection_delete_by_provider_response import ( + ConnectionDeleteByProviderResponse as ConnectionDeleteByProviderResponse, +) diff --git a/src/supermemory/types/connection_create_params.py b/src/supermemory_new/types/connection_create_params.py similarity index 100% rename from src/supermemory/types/connection_create_params.py rename to src/supermemory_new/types/connection_create_params.py diff --git a/src/supermemory/types/connection_create_response.py b/src/supermemory_new/types/connection_create_response.py similarity index 100% rename from src/supermemory/types/connection_create_response.py rename to src/supermemory_new/types/connection_create_response.py diff --git a/src/supermemory_new/types/connection_delete_by_provider_params.py b/src/supermemory_new/types/connection_delete_by_provider_params.py new file mode 100644 index 00000000..5b7fdaeb --- /dev/null +++ b/src/supermemory_new/types/connection_delete_by_provider_params.py @@ -0,0 +1,15 @@ +# 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, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ConnectionDeleteByProviderParams"] + + +class ConnectionDeleteByProviderParams(TypedDict, total=False): + container_tags: Required[Annotated[List[str], PropertyInfo(alias="containerTags")]] + """Optional comma-separated list of container tags to filter connections by""" diff --git a/src/supermemory/types/memory_upload_file_response.py b/src/supermemory_new/types/connection_delete_by_provider_response.py similarity index 52% rename from src/supermemory/types/memory_upload_file_response.py rename to src/supermemory_new/types/connection_delete_by_provider_response.py index f67b958f..e698e7e4 100644 --- a/src/supermemory/types/memory_upload_file_response.py +++ b/src/supermemory_new/types/connection_delete_by_provider_response.py @@ -2,10 +2,10 @@ from .._models import BaseModel -__all__ = ["MemoryUploadFileResponse"] +__all__ = ["ConnectionDeleteByProviderResponse"] -class MemoryUploadFileResponse(BaseModel): +class ConnectionDeleteByProviderResponse(BaseModel): id: str - status: str + provider: str diff --git a/src/supermemory/types/connection_get_response.py b/src/supermemory_new/types/connection_get_by_id_response.py similarity index 86% rename from src/supermemory/types/connection_get_response.py rename to src/supermemory_new/types/connection_get_by_id_response.py index 69d9e7b0..e8abd6fe 100644 --- a/src/supermemory/types/connection_get_response.py +++ b/src/supermemory_new/types/connection_get_by_id_response.py @@ -6,10 +6,10 @@ from .._models import BaseModel -__all__ = ["ConnectionGetResponse"] +__all__ = ["ConnectionGetByIDResponse"] -class ConnectionGetResponse(BaseModel): +class ConnectionGetByIDResponse(BaseModel): id: str created_at: float = FieldInfo(alias="createdAt") diff --git a/src/supermemory_new/types/connection_get_by_tags_params.py b/src/supermemory_new/types/connection_get_by_tags_params.py new file mode 100644 index 00000000..a38fa389 --- /dev/null +++ b/src/supermemory_new/types/connection_get_by_tags_params.py @@ -0,0 +1,15 @@ +# 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, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ConnectionGetByTagsParams"] + + +class ConnectionGetByTagsParams(TypedDict, total=False): + container_tags: Required[Annotated[List[str], PropertyInfo(alias="containerTags")]] + """Comma-separated list of container tags to filter connection by""" diff --git a/src/supermemory_new/types/connection_get_by_tags_response.py b/src/supermemory_new/types/connection_get_by_tags_response.py new file mode 100644 index 00000000..221e6b20 --- /dev/null +++ b/src/supermemory_new/types/connection_get_by_tags_response.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["ConnectionGetByTagsResponse"] + + +class ConnectionGetByTagsResponse(BaseModel): + id: str + + created_at: float = FieldInfo(alias="createdAt") + + provider: str + + document_limit: Optional[float] = FieldInfo(alias="documentLimit", default=None) + + email: Optional[str] = None + + expires_at: Optional[float] = FieldInfo(alias="expiresAt", default=None) + + metadata: Optional[Dict[str, object]] = None diff --git a/src/supermemory_new/types/connection_import_params.py b/src/supermemory_new/types/connection_import_params.py new file mode 100644 index 00000000..e25d8b1e --- /dev/null +++ b/src/supermemory_new/types/connection_import_params.py @@ -0,0 +1,15 @@ +# 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 Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ConnectionImportParams"] + + +class ConnectionImportParams(TypedDict, total=False): + container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")] + """Optional comma-separated list of container tags to filter connections by""" diff --git a/src/supermemory_new/types/connection_list_documents_params.py b/src/supermemory_new/types/connection_list_documents_params.py new file mode 100644 index 00000000..b83f00ff --- /dev/null +++ b/src/supermemory_new/types/connection_list_documents_params.py @@ -0,0 +1,15 @@ +# 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 Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ConnectionListDocumentsParams"] + + +class ConnectionListDocumentsParams(TypedDict, total=False): + container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")] + """Optional comma-separated list of container tags to filter documents by""" diff --git a/src/supermemory_new/types/connection_list_documents_response.py b/src/supermemory_new/types/connection_list_documents_response.py new file mode 100644 index 00000000..f42fed90 --- /dev/null +++ b/src/supermemory_new/types/connection_list_documents_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import TypeAlias + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["ConnectionListDocumentsResponse", "ConnectionListDocumentsResponseItem"] + + +class ConnectionListDocumentsResponseItem(BaseModel): + id: str + + created_at: str = FieldInfo(alias="createdAt") + + status: str + + summary: Optional[str] = None + + title: Optional[str] = None + + type: str + + updated_at: str = FieldInfo(alias="updatedAt") + + +ConnectionListDocumentsResponse: TypeAlias = List[ConnectionListDocumentsResponseItem] diff --git a/src/supermemory_new/types/connection_list_params.py b/src/supermemory_new/types/connection_list_params.py new file mode 100644 index 00000000..ad7b98eb --- /dev/null +++ b/src/supermemory_new/types/connection_list_params.py @@ -0,0 +1,15 @@ +# 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 Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ConnectionListParams"] + + +class ConnectionListParams(TypedDict, total=False): + container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")] + """Optional comma-separated list of container tags to filter documents by""" diff --git a/src/supermemory_new/types/connection_list_response.py b/src/supermemory_new/types/connection_list_response.py new file mode 100644 index 00000000..6da37725 --- /dev/null +++ b/src/supermemory_new/types/connection_list_response.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import TypeAlias + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["ConnectionListResponse", "ConnectionListResponseItem"] + + +class ConnectionListResponseItem(BaseModel): + id: str + + created_at: float = FieldInfo(alias="createdAt") + + provider: str + + document_limit: Optional[float] = FieldInfo(alias="documentLimit", default=None) + + email: Optional[str] = None + + expires_at: Optional[float] = FieldInfo(alias="expiresAt", default=None) + + metadata: Optional[Dict[str, object]] = None + + +ConnectionListResponse: TypeAlias = List[ConnectionListResponseItem] diff --git a/src/supermemory/types/memory_add_params.py b/src/supermemory_new/types/memory_add_params.py similarity index 100% rename from src/supermemory/types/memory_add_params.py rename to src/supermemory_new/types/memory_add_params.py diff --git a/src/supermemory/types/memory_add_response.py b/src/supermemory_new/types/memory_add_response.py similarity index 100% rename from src/supermemory/types/memory_add_response.py rename to src/supermemory_new/types/memory_add_response.py diff --git a/src/supermemory/types/memory_get_response.py b/src/supermemory_new/types/memory_get_response.py similarity index 100% rename from src/supermemory/types/memory_get_response.py rename to src/supermemory_new/types/memory_get_response.py diff --git a/src/supermemory_new/types/memory_list_params.py b/src/supermemory_new/types/memory_list_params.py new file mode 100644 index 00000000..7e683d71 --- /dev/null +++ b/src/supermemory_new/types/memory_list_params.py @@ -0,0 +1,34 @@ +# 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, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["MemoryListParams"] + + +class MemoryListParams(TypedDict, total=False): + container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")] + """Optional tags this memory should be containerized by. + + This can be an ID for your user, a project ID, or any other identifier you wish + to use to group memories. + """ + + filters: str + """Optional filters to apply to the search""" + + limit: Union[str, float] + """Number of items per page""" + + order: Literal["asc", "desc"] + """Sort order""" + + page: Union[str, float] + """Page number to fetch""" + + sort: Literal["createdAt", "updatedAt"] + """Field to sort by""" diff --git a/src/supermemory_new/types/memory_list_response.py b/src/supermemory_new/types/memory_list_response.py new file mode 100644 index 00000000..1f166784 --- /dev/null +++ b/src/supermemory_new/types/memory_list_response.py @@ -0,0 +1,91 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["MemoryListResponse", "Memory", "Pagination"] + + +class Memory(BaseModel): + id: str + """Unique identifier of the memory.""" + + connection_id: Optional[str] = FieldInfo(alias="connectionId", default=None) + """Optional ID of connection the memory was created from. + + This is useful for identifying the source of the memory. + """ + + created_at: datetime = FieldInfo(alias="createdAt") + """Creation timestamp""" + + custom_id: Optional[str] = FieldInfo(alias="customId", default=None) + """Optional custom ID of the memory. + + This could be an ID from your database that will uniquely identify this memory. + """ + + metadata: Union[str, float, bool, Dict[str, object], List[object], None] = None + """Optional metadata for the memory. + + This is used to store additional information about the memory. You can use this + to store any additional information you need about the memory. Metadata can be + filtered through. Keys must be strings and are case sensitive. Values can be + strings, numbers, or booleans. You cannot nest objects. + """ + + status: Literal["unknown", "queued", "extracting", "chunking", "embedding", "indexing", "done", "failed"] + """Status of the memory""" + + summary: Optional[str] = None + """Summary of the memory content""" + + title: Optional[str] = None + """Title of the memory""" + + type: Literal[ + "text", + "pdf", + "tweet", + "google_doc", + "google_slide", + "google_sheet", + "image", + "video", + "notion_doc", + "webpage", + "onedrive", + ] + """Type of the memory""" + + updated_at: datetime = FieldInfo(alias="updatedAt") + """Last update timestamp""" + + container_tags: Optional[List[str]] = FieldInfo(alias="containerTags", default=None) + """Optional tags this memory should be containerized by. + + This can be an ID for your user, a project ID, or any other identifier you wish + to use to group memories. + """ + + +class Pagination(BaseModel): + current_page: float = FieldInfo(alias="currentPage") + + limit: float + + total_items: float = FieldInfo(alias="totalItems") + + total_pages: float = FieldInfo(alias="totalPages") + + +class MemoryListResponse(BaseModel): + memories: List[Memory] + + pagination: Pagination + """Pagination metadata""" diff --git a/src/supermemory/types/memory_update_params.py b/src/supermemory_new/types/memory_update_params.py similarity index 100% rename from src/supermemory/types/memory_update_params.py rename to src/supermemory_new/types/memory_update_params.py diff --git a/src/supermemory/types/memory_update_response.py b/src/supermemory_new/types/memory_update_response.py similarity index 100% rename from src/supermemory/types/memory_update_response.py rename to src/supermemory_new/types/memory_update_response.py diff --git a/src/supermemory_new/types/search_execute_params.py b/src/supermemory_new/types/search_execute_params.py new file mode 100644 index 00000000..db48a814 --- /dev/null +++ b/src/supermemory_new/types/search_execute_params.py @@ -0,0 +1,93 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Union, Iterable +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["SearchExecuteParams", "Filters", "FiltersUnionMember0"] + + +class SearchExecuteParams(TypedDict, total=False): + q: Required[str] + """Search query string""" + + categories_filter: Annotated[ + List[Literal["technology", "science", "business", "health"]], PropertyInfo(alias="categoriesFilter") + ] + """Optional category filters""" + + chunk_threshold: Annotated[float, PropertyInfo(alias="chunkThreshold")] + """Threshold / sensitivity for chunk selection. + + 0 is least sensitive (returns most chunks, more results), 1 is most sensitive + (returns lesser chunks, accurate results) + """ + + container_tags: Annotated[List[str], PropertyInfo(alias="containerTags")] + """Optional tags this search should be containerized by. + + This can be an ID for your user, a project ID, or any other identifier you wish + to use to filter memories. + """ + + doc_id: Annotated[str, PropertyInfo(alias="docId")] + """Optional document ID to search within. + + You can use this to find chunks in a very large document. + """ + + document_threshold: Annotated[float, PropertyInfo(alias="documentThreshold")] + """Threshold / sensitivity for document selection. + + 0 is least sensitive (returns most documents, more results), 1 is most sensitive + (returns lesser documents, accurate results) + """ + + filters: Filters + """Optional filters to apply to the search""" + + include_full_docs: Annotated[bool, PropertyInfo(alias="includeFullDocs")] + """If true, include full document in the response. + + This is helpful if you want a chatbot to know the full context of the document. + """ + + include_summary: Annotated[bool, PropertyInfo(alias="includeSummary")] + """If true, include document summary in the response. + + This is helpful if you want a chatbot to know the full context of the document. + """ + + limit: int + """Maximum number of results to return""" + + only_matching_chunks: Annotated[bool, PropertyInfo(alias="onlyMatchingChunks")] + """If true, only return matching chunks without context. + + Normally, we send the previous and next chunk to provide more context for LLMs. + If you only want the matching chunk, set this to true. + """ + + rerank: bool + """If true, rerank the results based on the query. + + This is helpful if you want to ensure the most relevant results are returned. + """ + + rewrite_query: Annotated[bool, PropertyInfo(alias="rewriteQuery")] + """If true, rewrites the query to make it easier to find documents. + + This increases the latency by about 400ms + """ + + +class FiltersUnionMember0(TypedDict, total=False): + and_: Annotated[Iterable[object], PropertyInfo(alias="AND")] + + or_: Annotated[Iterable[object], PropertyInfo(alias="OR")] + + +Filters: TypeAlias = Union[FiltersUnionMember0, Dict[str, object]] diff --git a/src/supermemory_new/types/search_execute_response.py b/src/supermemory_new/types/search_execute_response.py new file mode 100644 index 00000000..b48b351d --- /dev/null +++ b/src/supermemory_new/types/search_execute_response.py @@ -0,0 +1,55 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["SearchExecuteResponse", "Result", "ResultChunk"] + + +class ResultChunk(BaseModel): + content: str + """Content of the matching chunk""" + + is_relevant: bool = FieldInfo(alias="isRelevant") + """Whether this chunk is relevant to the query""" + + score: float + """Similarity score for this chunk""" + + +class Result(BaseModel): + chunks: List[ResultChunk] + """Matching content chunks from the document""" + + created_at: datetime = FieldInfo(alias="createdAt") + """Document creation date""" + + document_id: str = FieldInfo(alias="documentId") + """ID of the matching document""" + + metadata: Optional[Dict[str, object]] = None + """Document metadata""" + + score: float + """Relevance score of the match""" + + title: Optional[str] = None + """Document title""" + + updated_at: datetime = FieldInfo(alias="updatedAt") + """Document last update date""" + + summary: Optional[str] = None + """Document summary""" + + +class SearchExecuteResponse(BaseModel): + results: List[Result] + + timing: float + + total: float diff --git a/src/supermemory/types/setting_get_response.py b/src/supermemory_new/types/setting_get_response.py similarity index 100% rename from src/supermemory/types/setting_get_response.py rename to src/supermemory_new/types/setting_get_response.py diff --git a/src/supermemory/types/setting_update_params.py b/src/supermemory_new/types/setting_update_params.py similarity index 100% rename from src/supermemory/types/setting_update_params.py rename to src/supermemory_new/types/setting_update_params.py diff --git a/src/supermemory/types/setting_update_response.py b/src/supermemory_new/types/setting_update_response.py similarity index 100% rename from src/supermemory/types/setting_update_response.py rename to src/supermemory_new/types/setting_update_response.py diff --git a/tests/api_resources/test_connections.py b/tests/api_resources/test_connections.py index bb4ed3e0..e3d7a7a1 100644 --- a/tests/api_resources/test_connections.py +++ b/tests/api_resources/test_connections.py @@ -7,9 +7,16 @@ import pytest -from supermemory import Supermemory, AsyncSupermemory from tests.utils import assert_matches_type -from supermemory.types import ConnectionGetResponse, ConnectionCreateResponse +from supermemory_new import Supermemory, AsyncSupermemory +from supermemory_new.types import ( + ConnectionListResponse, + ConnectionCreateResponse, + ConnectionGetByIDResponse, + ConnectionGetByTagsResponse, + ConnectionListDocumentsResponse, + ConnectionDeleteByProviderResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -65,46 +72,242 @@ def test_streaming_response_create(self, client: Supermemory) -> None: @pytest.mark.skip() @parametrize - def test_method_get(self, client: Supermemory) -> None: - connection = client.connections.get( + def test_method_list(self, client: Supermemory) -> None: + connection = client.connections.list() + assert_matches_type(ConnectionListResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Supermemory) -> None: + connection = client.connections.list( + container_tags=["user_123", "project_123"], + ) + assert_matches_type(ConnectionListResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list(self, client: Supermemory) -> None: + response = client.connections.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = response.parse() + assert_matches_type(ConnectionListResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list(self, client: Supermemory) -> None: + with client.connections.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = response.parse() + assert_matches_type(ConnectionListResponse, connection, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_method_delete_by_provider(self, client: Supermemory) -> None: + connection = client.connections.delete_by_provider( + provider="notion", + container_tags=["user_123", "project_123"], + ) + assert_matches_type(ConnectionDeleteByProviderResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_delete_by_provider(self, client: Supermemory) -> None: + response = client.connections.with_raw_response.delete_by_provider( + provider="notion", + container_tags=["user_123", "project_123"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = response.parse() + assert_matches_type(ConnectionDeleteByProviderResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_delete_by_provider(self, client: Supermemory) -> None: + with client.connections.with_streaming_response.delete_by_provider( + provider="notion", + container_tags=["user_123", "project_123"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = response.parse() + assert_matches_type(ConnectionDeleteByProviderResponse, connection, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_method_get_by_id(self, client: Supermemory) -> None: + connection = client.connections.get_by_id( "connectionId", ) - assert_matches_type(ConnectionGetResponse, connection, path=["response"]) + assert_matches_type(ConnectionGetByIDResponse, connection, path=["response"]) @pytest.mark.skip() @parametrize - def test_raw_response_get(self, client: Supermemory) -> None: - response = client.connections.with_raw_response.get( + def test_raw_response_get_by_id(self, client: Supermemory) -> None: + response = client.connections.with_raw_response.get_by_id( "connectionId", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = response.parse() - assert_matches_type(ConnectionGetResponse, connection, path=["response"]) + assert_matches_type(ConnectionGetByIDResponse, connection, path=["response"]) @pytest.mark.skip() @parametrize - def test_streaming_response_get(self, client: Supermemory) -> None: - with client.connections.with_streaming_response.get( + def test_streaming_response_get_by_id(self, client: Supermemory) -> None: + with client.connections.with_streaming_response.get_by_id( "connectionId", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = response.parse() - assert_matches_type(ConnectionGetResponse, connection, path=["response"]) + assert_matches_type(ConnectionGetByIDResponse, connection, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - def test_path_params_get(self, client: Supermemory) -> None: + def test_path_params_get_by_id(self, client: Supermemory) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `connection_id` but received ''"): - client.connections.with_raw_response.get( + client.connections.with_raw_response.get_by_id( "", ) + @pytest.mark.skip() + @parametrize + def test_method_get_by_tags(self, client: Supermemory) -> None: + connection = client.connections.get_by_tags( + provider="notion", + container_tags=["user_123", "project_123"], + ) + assert_matches_type(ConnectionGetByTagsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_get_by_tags(self, client: Supermemory) -> None: + response = client.connections.with_raw_response.get_by_tags( + provider="notion", + container_tags=["user_123", "project_123"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = response.parse() + assert_matches_type(ConnectionGetByTagsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_get_by_tags(self, client: Supermemory) -> None: + with client.connections.with_streaming_response.get_by_tags( + provider="notion", + container_tags=["user_123", "project_123"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = response.parse() + assert_matches_type(ConnectionGetByTagsResponse, connection, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_method_import(self, client: Supermemory) -> None: + connection = client.connections.import_( + provider="notion", + ) + assert connection is None + + @pytest.mark.skip() + @parametrize + def test_method_import_with_all_params(self, client: Supermemory) -> None: + connection = client.connections.import_( + provider="notion", + container_tags=["user_123", "project_123"], + ) + assert connection is None + + @pytest.mark.skip() + @parametrize + def test_raw_response_import(self, client: Supermemory) -> None: + response = client.connections.with_raw_response.import_( + provider="notion", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = response.parse() + assert connection is None + + @pytest.mark.skip() + @parametrize + def test_streaming_response_import(self, client: Supermemory) -> None: + with client.connections.with_streaming_response.import_( + provider="notion", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = response.parse() + assert connection is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + def test_method_list_documents(self, client: Supermemory) -> None: + connection = client.connections.list_documents( + provider="notion", + ) + assert_matches_type(ConnectionListDocumentsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_documents_with_all_params(self, client: Supermemory) -> None: + connection = client.connections.list_documents( + provider="notion", + container_tags=["user_123", "project_123"], + ) + assert_matches_type(ConnectionListDocumentsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list_documents(self, client: Supermemory) -> None: + response = client.connections.with_raw_response.list_documents( + provider="notion", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = response.parse() + assert_matches_type(ConnectionListDocumentsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list_documents(self, client: Supermemory) -> None: + with client.connections.with_streaming_response.list_documents( + provider="notion", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = response.parse() + assert_matches_type(ConnectionListDocumentsResponse, connection, path=["response"]) + + assert cast(Any, response.is_closed) is True + class TestAsyncConnections: parametrize = pytest.mark.parametrize( @@ -159,42 +362,238 @@ async def test_streaming_response_create(self, async_client: AsyncSupermemory) - @pytest.mark.skip() @parametrize - async def test_method_get(self, async_client: AsyncSupermemory) -> None: - connection = await async_client.connections.get( + async def test_method_list(self, async_client: AsyncSupermemory) -> None: + connection = await async_client.connections.list() + assert_matches_type(ConnectionListResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncSupermemory) -> None: + connection = await async_client.connections.list( + container_tags=["user_123", "project_123"], + ) + assert_matches_type(ConnectionListResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list(self, async_client: AsyncSupermemory) -> None: + response = await async_client.connections.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = await response.parse() + assert_matches_type(ConnectionListResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list(self, async_client: AsyncSupermemory) -> None: + async with async_client.connections.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = await response.parse() + assert_matches_type(ConnectionListResponse, connection, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_method_delete_by_provider(self, async_client: AsyncSupermemory) -> None: + connection = await async_client.connections.delete_by_provider( + provider="notion", + container_tags=["user_123", "project_123"], + ) + assert_matches_type(ConnectionDeleteByProviderResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_delete_by_provider(self, async_client: AsyncSupermemory) -> None: + response = await async_client.connections.with_raw_response.delete_by_provider( + provider="notion", + container_tags=["user_123", "project_123"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = await response.parse() + assert_matches_type(ConnectionDeleteByProviderResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_delete_by_provider(self, async_client: AsyncSupermemory) -> None: + async with async_client.connections.with_streaming_response.delete_by_provider( + provider="notion", + container_tags=["user_123", "project_123"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = await response.parse() + assert_matches_type(ConnectionDeleteByProviderResponse, connection, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_method_get_by_id(self, async_client: AsyncSupermemory) -> None: + connection = await async_client.connections.get_by_id( "connectionId", ) - assert_matches_type(ConnectionGetResponse, connection, path=["response"]) + assert_matches_type(ConnectionGetByIDResponse, connection, path=["response"]) @pytest.mark.skip() @parametrize - async def test_raw_response_get(self, async_client: AsyncSupermemory) -> None: - response = await async_client.connections.with_raw_response.get( + async def test_raw_response_get_by_id(self, async_client: AsyncSupermemory) -> None: + response = await async_client.connections.with_raw_response.get_by_id( "connectionId", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = await response.parse() - assert_matches_type(ConnectionGetResponse, connection, path=["response"]) + assert_matches_type(ConnectionGetByIDResponse, connection, path=["response"]) @pytest.mark.skip() @parametrize - async def test_streaming_response_get(self, async_client: AsyncSupermemory) -> None: - async with async_client.connections.with_streaming_response.get( + async def test_streaming_response_get_by_id(self, async_client: AsyncSupermemory) -> None: + async with async_client.connections.with_streaming_response.get_by_id( "connectionId", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = await response.parse() - assert_matches_type(ConnectionGetResponse, connection, path=["response"]) + assert_matches_type(ConnectionGetByIDResponse, connection, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip() @parametrize - async def test_path_params_get(self, async_client: AsyncSupermemory) -> None: + async def test_path_params_get_by_id(self, async_client: AsyncSupermemory) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `connection_id` but received ''"): - await async_client.connections.with_raw_response.get( + await async_client.connections.with_raw_response.get_by_id( "", ) + + @pytest.mark.skip() + @parametrize + async def test_method_get_by_tags(self, async_client: AsyncSupermemory) -> None: + connection = await async_client.connections.get_by_tags( + provider="notion", + container_tags=["user_123", "project_123"], + ) + assert_matches_type(ConnectionGetByTagsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_get_by_tags(self, async_client: AsyncSupermemory) -> None: + response = await async_client.connections.with_raw_response.get_by_tags( + provider="notion", + container_tags=["user_123", "project_123"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = await response.parse() + assert_matches_type(ConnectionGetByTagsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_get_by_tags(self, async_client: AsyncSupermemory) -> None: + async with async_client.connections.with_streaming_response.get_by_tags( + provider="notion", + container_tags=["user_123", "project_123"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = await response.parse() + assert_matches_type(ConnectionGetByTagsResponse, connection, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_method_import(self, async_client: AsyncSupermemory) -> None: + connection = await async_client.connections.import_( + provider="notion", + ) + assert connection is None + + @pytest.mark.skip() + @parametrize + async def test_method_import_with_all_params(self, async_client: AsyncSupermemory) -> None: + connection = await async_client.connections.import_( + provider="notion", + container_tags=["user_123", "project_123"], + ) + assert connection is None + + @pytest.mark.skip() + @parametrize + async def test_raw_response_import(self, async_client: AsyncSupermemory) -> None: + response = await async_client.connections.with_raw_response.import_( + provider="notion", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = await response.parse() + assert connection is None + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_import(self, async_client: AsyncSupermemory) -> None: + async with async_client.connections.with_streaming_response.import_( + provider="notion", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = await response.parse() + assert connection is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip() + @parametrize + async def test_method_list_documents(self, async_client: AsyncSupermemory) -> None: + connection = await async_client.connections.list_documents( + provider="notion", + ) + assert_matches_type(ConnectionListDocumentsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_documents_with_all_params(self, async_client: AsyncSupermemory) -> None: + connection = await async_client.connections.list_documents( + provider="notion", + container_tags=["user_123", "project_123"], + ) + assert_matches_type(ConnectionListDocumentsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list_documents(self, async_client: AsyncSupermemory) -> None: + response = await async_client.connections.with_raw_response.list_documents( + provider="notion", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = await response.parse() + assert_matches_type(ConnectionListDocumentsResponse, connection, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list_documents(self, async_client: AsyncSupermemory) -> None: + async with async_client.connections.with_streaming_response.list_documents( + provider="notion", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + connection = await response.parse() + assert_matches_type(ConnectionListDocumentsResponse, connection, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_memories.py b/tests/api_resources/test_memories.py index a9e1c726..87b9e41b 100644 --- a/tests/api_resources/test_memories.py +++ b/tests/api_resources/test_memories.py @@ -7,13 +7,13 @@ import pytest -from supermemory import Supermemory, AsyncSupermemory from tests.utils import assert_matches_type -from supermemory.types import ( +from supermemory_new import Supermemory, AsyncSupermemory +from supermemory_new.types import ( MemoryAddResponse, MemoryGetResponse, + MemoryListResponse, MemoryUpdateResponse, - MemoryUploadFileResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -87,6 +87,47 @@ def test_path_params_update(self, client: Supermemory) -> None: content="This is a detailed article about machine learning concepts...", ) + @pytest.mark.skip() + @parametrize + def test_method_list(self, client: Supermemory) -> None: + memory = client.memories.list() + assert_matches_type(MemoryListResponse, memory, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_list_with_all_params(self, client: Supermemory) -> None: + memory = client.memories.list( + container_tags=["user_123", "project_123"], + filters='{"AND":[{"key":"group","value":"jira_users","negate":false},{"filterType":"numeric","key":"timestamp","value":"1742745777","negate":false,"numericOperator":">"}]}', + limit=10, + order="desc", + page=1, + sort="createdAt", + ) + assert_matches_type(MemoryListResponse, memory, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_list(self, client: Supermemory) -> None: + response = client.memories.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + memory = response.parse() + assert_matches_type(MemoryListResponse, memory, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_list(self, client: Supermemory) -> None: + with client.memories.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + memory = response.parse() + assert_matches_type(MemoryListResponse, memory, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip() @parametrize def test_method_delete(self, client: Supermemory) -> None: @@ -223,40 +264,6 @@ def test_path_params_get(self, client: Supermemory) -> None: "", ) - @pytest.mark.skip() - @parametrize - def test_method_upload_file(self, client: Supermemory) -> None: - memory = client.memories.upload_file( - file=b"raw file contents", - ) - assert_matches_type(MemoryUploadFileResponse, memory, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_upload_file(self, client: Supermemory) -> None: - response = client.memories.with_raw_response.upload_file( - file=b"raw file contents", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - memory = response.parse() - assert_matches_type(MemoryUploadFileResponse, memory, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_upload_file(self, client: Supermemory) -> None: - with client.memories.with_streaming_response.upload_file( - file=b"raw file contents", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - memory = response.parse() - assert_matches_type(MemoryUploadFileResponse, memory, path=["response"]) - - assert cast(Any, response.is_closed) is True - class TestAsyncMemories: parametrize = pytest.mark.parametrize( @@ -328,6 +335,47 @@ async def test_path_params_update(self, async_client: AsyncSupermemory) -> None: content="This is a detailed article about machine learning concepts...", ) + @pytest.mark.skip() + @parametrize + async def test_method_list(self, async_client: AsyncSupermemory) -> None: + memory = await async_client.memories.list() + assert_matches_type(MemoryListResponse, memory, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncSupermemory) -> None: + memory = await async_client.memories.list( + container_tags=["user_123", "project_123"], + filters='{"AND":[{"key":"group","value":"jira_users","negate":false},{"filterType":"numeric","key":"timestamp","value":"1742745777","negate":false,"numericOperator":">"}]}', + limit=10, + order="desc", + page=1, + sort="createdAt", + ) + assert_matches_type(MemoryListResponse, memory, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_list(self, async_client: AsyncSupermemory) -> None: + response = await async_client.memories.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + memory = await response.parse() + assert_matches_type(MemoryListResponse, memory, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_list(self, async_client: AsyncSupermemory) -> None: + async with async_client.memories.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + memory = await response.parse() + assert_matches_type(MemoryListResponse, memory, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip() @parametrize async def test_method_delete(self, async_client: AsyncSupermemory) -> None: @@ -463,37 +511,3 @@ async def test_path_params_get(self, async_client: AsyncSupermemory) -> None: await async_client.memories.with_raw_response.get( "", ) - - @pytest.mark.skip() - @parametrize - async def test_method_upload_file(self, async_client: AsyncSupermemory) -> None: - memory = await async_client.memories.upload_file( - file=b"raw file contents", - ) - assert_matches_type(MemoryUploadFileResponse, memory, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_upload_file(self, async_client: AsyncSupermemory) -> None: - response = await async_client.memories.with_raw_response.upload_file( - file=b"raw file contents", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - memory = await response.parse() - assert_matches_type(MemoryUploadFileResponse, memory, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_upload_file(self, async_client: AsyncSupermemory) -> None: - async with async_client.memories.with_streaming_response.upload_file( - file=b"raw file contents", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - memory = await response.parse() - assert_matches_type(MemoryUploadFileResponse, memory, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_search.py b/tests/api_resources/test_search.py new file mode 100644 index 00000000..176f006c --- /dev/null +++ b/tests/api_resources/test_search.py @@ -0,0 +1,164 @@ +# 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 tests.utils import assert_matches_type +from supermemory_new import Supermemory, AsyncSupermemory +from supermemory_new.types import SearchExecuteResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSearch: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip() + @parametrize + def test_method_execute(self, client: Supermemory) -> None: + search = client.search.execute( + q="machine learning concepts", + ) + assert_matches_type(SearchExecuteResponse, search, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_method_execute_with_all_params(self, client: Supermemory) -> None: + search = client.search.execute( + q="machine learning concepts", + categories_filter=["technology", "science"], + chunk_threshold=0.5, + container_tags=["user_123", "project_123"], + doc_id="doc_xyz789", + document_threshold=0.5, + filters={ + "and_": [ + { + "key": "group", + "value": "jira_users", + "negate": False, + }, + { + "filterType": "numeric", + "key": "timestamp", + "value": "1742745777", + "negate": False, + "numericOperator": ">", + }, + ], + "or_": [{}], + }, + include_full_docs=False, + include_summary=False, + limit=10, + only_matching_chunks=False, + rerank=False, + rewrite_query=False, + ) + assert_matches_type(SearchExecuteResponse, search, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_execute(self, client: Supermemory) -> None: + response = client.search.with_raw_response.execute( + q="machine learning concepts", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + search = response.parse() + assert_matches_type(SearchExecuteResponse, search, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_execute(self, client: Supermemory) -> None: + with client.search.with_streaming_response.execute( + q="machine learning concepts", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + search = response.parse() + assert_matches_type(SearchExecuteResponse, search, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncSearch: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip() + @parametrize + async def test_method_execute(self, async_client: AsyncSupermemory) -> None: + search = await async_client.search.execute( + q="machine learning concepts", + ) + assert_matches_type(SearchExecuteResponse, search, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_method_execute_with_all_params(self, async_client: AsyncSupermemory) -> None: + search = await async_client.search.execute( + q="machine learning concepts", + categories_filter=["technology", "science"], + chunk_threshold=0.5, + container_tags=["user_123", "project_123"], + doc_id="doc_xyz789", + document_threshold=0.5, + filters={ + "and_": [ + { + "key": "group", + "value": "jira_users", + "negate": False, + }, + { + "filterType": "numeric", + "key": "timestamp", + "value": "1742745777", + "negate": False, + "numericOperator": ">", + }, + ], + "or_": [{}], + }, + include_full_docs=False, + include_summary=False, + limit=10, + only_matching_chunks=False, + rerank=False, + rewrite_query=False, + ) + assert_matches_type(SearchExecuteResponse, search, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_execute(self, async_client: AsyncSupermemory) -> None: + response = await async_client.search.with_raw_response.execute( + q="machine learning concepts", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + search = await response.parse() + assert_matches_type(SearchExecuteResponse, search, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_execute(self, async_client: AsyncSupermemory) -> None: + async with async_client.search.with_streaming_response.execute( + q="machine learning concepts", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + search = await response.parse() + assert_matches_type(SearchExecuteResponse, search, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_settings.py b/tests/api_resources/test_settings.py index ac790b15..278abf9d 100644 --- a/tests/api_resources/test_settings.py +++ b/tests/api_resources/test_settings.py @@ -7,9 +7,9 @@ import pytest -from supermemory import Supermemory, AsyncSupermemory from tests.utils import assert_matches_type -from supermemory.types import SettingGetResponse, SettingUpdateResponse +from supermemory_new import Supermemory, AsyncSupermemory +from supermemory_new.types import SettingGetResponse, SettingUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/conftest.py b/tests/conftest.py index 2baaab81..475e33e2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,15 +10,15 @@ import pytest from pytest_asyncio import is_async_test -from supermemory import Supermemory, AsyncSupermemory, DefaultAioHttpClient -from supermemory._utils import is_dict +from supermemory_new import Supermemory, AsyncSupermemory, DefaultAioHttpClient +from supermemory_new._utils import is_dict if TYPE_CHECKING: from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage] pytest.register_assert_rewrite("tests.utils") -logging.getLogger("supermemory").setLevel(logging.DEBUG) +logging.getLogger("supermemory_new").setLevel(logging.DEBUG) # automatically add `pytest.mark.asyncio()` to all of our async tests diff --git a/tests/test_client.py b/tests/test_client.py index ecc086ec..22628172 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -21,11 +21,11 @@ from respx import MockRouter from pydantic import ValidationError -from supermemory import Supermemory, AsyncSupermemory, APIResponseValidationError -from supermemory._types import Omit -from supermemory._models import BaseModel, FinalRequestOptions -from supermemory._exceptions import APIStatusError, APITimeoutError, SupermemoryError, APIResponseValidationError -from supermemory._base_client import ( +from supermemory_new import Supermemory, AsyncSupermemory, APIResponseValidationError +from supermemory_new._types import Omit +from supermemory_new._models import BaseModel, FinalRequestOptions +from supermemory_new._exceptions import APIStatusError, APITimeoutError, SupermemoryError, APIResponseValidationError +from supermemory_new._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, @@ -232,10 +232,10 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic # to_raw_response_wrapper leaks through the @functools.wraps() decorator. # # removing the decorator fixes the leak for reasons we don't understand. - "supermemory/_legacy_response.py", - "supermemory/_response.py", + "supermemory_new/_legacy_response.py", + "supermemory_new/_response.py", # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - "supermemory/_compat.py", + "supermemory_new/_compat.py", # Standard library leaks we don't care about. "/logging/__init__.py", ] @@ -721,7 +721,7 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: Supermemory) -> None: respx_mock.post("/v3/memories").mock(side_effect=httpx.TimeoutException("Test timeout error")) @@ -733,7 +733,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien assert _get_open_connections(self.client) == 0 - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: Supermemory) -> None: respx_mock.post("/v3/memories").mock(return_value=httpx.Response(500)) @@ -745,7 +745,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client assert _get_open_connections(self.client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @pytest.mark.parametrize("failure_mode", ["status", "exception"]) def test_retries_taken( @@ -778,7 +778,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_omit_retry_count_header( self, client: Supermemory, failures_before_success: int, respx_mock: MockRouter @@ -804,7 +804,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_overwrite_retry_count_header( self, client: Supermemory, failures_before_success: int, respx_mock: MockRouter @@ -1055,10 +1055,10 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic # to_raw_response_wrapper leaks through the @functools.wraps() decorator. # # removing the decorator fixes the leak for reasons we don't understand. - "supermemory/_legacy_response.py", - "supermemory/_response.py", + "supermemory_new/_legacy_response.py", + "supermemory_new/_response.py", # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - "supermemory/_compat.py", + "supermemory_new/_compat.py", # Standard library leaks we don't care about. "/logging/__init__.py", ] @@ -1548,7 +1548,7 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_retrying_timeout_errors_doesnt_leak( self, respx_mock: MockRouter, async_client: AsyncSupermemory @@ -1562,7 +1562,7 @@ async def test_retrying_timeout_errors_doesnt_leak( assert _get_open_connections(self.client) == 0 - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_retrying_status_errors_doesnt_leak( self, respx_mock: MockRouter, async_client: AsyncSupermemory @@ -1576,7 +1576,7 @@ async def test_retrying_status_errors_doesnt_leak( assert _get_open_connections(self.client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._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"]) @@ -1610,7 +1610,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_omit_retry_count_header( @@ -1637,7 +1637,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) - @mock.patch("supermemory._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("supermemory_new._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_overwrite_retry_count_header( @@ -1674,8 +1674,8 @@ def test_get_platform(self) -> None: import nest_asyncio import threading - from supermemory._utils import asyncify - from supermemory._base_client import get_platform + from supermemory_new._utils import asyncify + from supermemory_new._base_client import get_platform async def test_main() -> None: result = await asyncify(get_platform)() diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index c464e633..5db64d01 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -1,4 +1,4 @@ -from supermemory._utils import deepcopy_minimal +from supermemory_new._utils import deepcopy_minimal def assert_different_identities(obj1: object, obj2: object) -> None: diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py index b5940c71..68166331 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -4,8 +4,8 @@ import pytest -from supermemory._types import FileTypes -from supermemory._utils import extract_files +from supermemory_new._types import FileTypes +from supermemory_new._utils import extract_files def test_removes_files_from_input() -> None: diff --git a/tests/test_files.py b/tests/test_files.py index fe8388cc..bd750637 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -4,7 +4,7 @@ import pytest from dirty_equals import IsDict, IsList, IsBytes, IsTuple -from supermemory._files import to_httpx_files, async_to_httpx_files +from supermemory_new._files import to_httpx_files, async_to_httpx_files readme_path = Path(__file__).parent.parent.joinpath("README.md") diff --git a/tests/test_models.py b/tests/test_models.py index 4e795b1e..da648259 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -7,9 +7,9 @@ import pydantic from pydantic import Field -from supermemory._utils import PropertyInfo -from supermemory._compat import PYDANTIC_V2, parse_obj, model_dump, model_json -from supermemory._models import BaseModel, construct_type +from supermemory_new._utils import PropertyInfo +from supermemory_new._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from supermemory_new._models import BaseModel, construct_type class BasicModel(BaseModel): diff --git a/tests/test_qs.py b/tests/test_qs.py index 8b0e27bb..cfee5c95 100644 --- a/tests/test_qs.py +++ b/tests/test_qs.py @@ -4,7 +4,7 @@ import pytest -from supermemory._qs import Querystring, stringify +from supermemory_new._qs import Querystring, stringify def test_empty() -> None: diff --git a/tests/test_required_args.py b/tests/test_required_args.py index d886edee..12634af4 100644 --- a/tests/test_required_args.py +++ b/tests/test_required_args.py @@ -2,7 +2,7 @@ import pytest -from supermemory._utils import required_args +from supermemory_new._utils import required_args def test_too_many_positional_params() -> None: diff --git a/tests/test_response.py b/tests/test_response.py index 829b3c8b..c6d78148 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -6,8 +6,8 @@ import pytest import pydantic -from supermemory import BaseModel, Supermemory, AsyncSupermemory -from supermemory._response import ( +from supermemory_new import BaseModel, Supermemory, AsyncSupermemory +from supermemory_new._response import ( APIResponse, BaseAPIResponse, AsyncAPIResponse, @@ -15,8 +15,8 @@ AsyncBinaryAPIResponse, extract_response_type, ) -from supermemory._streaming import Stream -from supermemory._base_client import FinalRequestOptions +from supermemory_new._streaming import Stream +from supermemory_new._base_client import FinalRequestOptions class ConcreteBaseAPIResponse(APIResponse[bytes]): ... @@ -37,7 +37,7 @@ def test_extract_response_type_direct_classes() -> None: def test_extract_response_type_direct_class_missing_type_arg() -> None: with pytest.raises( RuntimeError, - match="Expected type to have a type argument at index 0 but it did not", + match="Expected type to have a type argument at index 0 but it did not", ): extract_response_type(AsyncAPIResponse) @@ -68,7 +68,7 @@ def test_response_parse_mismatched_basemodel(client: Supermemory) -> None: with pytest.raises( TypeError, - match="Pydantic models must subclass our base model type, e.g. `from supermemory import BaseModel`", + match="Pydantic models must subclass our base model type, e.g. `from supermemory_new import BaseModel`", ): response.parse(to=PydanticModel) @@ -86,7 +86,7 @@ async def test_async_response_parse_mismatched_basemodel(async_client: AsyncSupe with pytest.raises( TypeError, - match="Pydantic models must subclass our base model type, e.g. `from supermemory import BaseModel`", + match="Pydantic models must subclass our base model type, e.g. `from supermemory_new import BaseModel`", ): await response.parse(to=PydanticModel) diff --git a/tests/test_streaming.py b/tests/test_streaming.py index ee2d2c5f..ac61ea11 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -5,8 +5,8 @@ import httpx import pytest -from supermemory import Supermemory, AsyncSupermemory -from supermemory._streaming import Stream, AsyncStream, ServerSentEvent +from supermemory_new import Supermemory, AsyncSupermemory +from supermemory_new._streaming import Stream, AsyncStream, ServerSentEvent @pytest.mark.asyncio diff --git a/tests/test_transform.py b/tests/test_transform.py index 8a3a412e..3bac94c1 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,15 +8,15 @@ import pytest -from supermemory._types import NOT_GIVEN, Base64FileInput -from supermemory._utils import ( +from supermemory_new._types import NOT_GIVEN, Base64FileInput +from supermemory_new._utils import ( PropertyInfo, transform as _transform, parse_datetime, async_transform as _async_transform, ) -from supermemory._compat import PYDANTIC_V2 -from supermemory._models import BaseModel +from supermemory_new._compat import PYDANTIC_V2 +from supermemory_new._models import BaseModel _T = TypeVar("_T") diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py index 74440350..0a17be19 100644 --- a/tests/test_utils/test_proxy.py +++ b/tests/test_utils/test_proxy.py @@ -2,7 +2,7 @@ from typing import Any from typing_extensions import override -from supermemory._utils import LazyProxy +from supermemory_new._utils import LazyProxy class RecursiveLazyProxy(LazyProxy[Any]): diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index 5e9a15ec..f5da46f3 100644 --- a/tests/test_utils/test_typing.py +++ b/tests/test_utils/test_typing.py @@ -2,7 +2,7 @@ from typing import Generic, TypeVar, cast -from supermemory._utils import extract_type_var_from_base +from supermemory_new._utils import extract_type_var_from_base _T = TypeVar("_T") _T2 = TypeVar("_T2") diff --git a/tests/utils.py b/tests/utils.py index 0d6779c4..9795d49f 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -8,8 +8,8 @@ from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type -from supermemory._types import Omit, NoneType -from supermemory._utils import ( +from supermemory_new._types import Omit, NoneType +from supermemory_new._utils import ( is_dict, is_list, is_list_type, @@ -18,8 +18,8 @@ is_annotated_type, is_type_alias_type, ) -from supermemory._compat import PYDANTIC_V2, field_outer_type, get_model_fields -from supermemory._models import BaseModel +from supermemory_new._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from supermemory_new._models import BaseModel BaseModelT = TypeVar("BaseModelT", bound=BaseModel) From 8c6f297fc2b8f7a6b600205a5c313767a99612cb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 13:17:51 +0000 Subject: [PATCH 2/6] chore: update SDK settings --- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- .release-please-manifest.json | 2 +- .stats.yml | 2 +- CONTRIBUTING.md | 4 ++-- README.md | 6 +++--- pyproject.toml | 8 ++++---- src/supermemory_new/_version.py | 2 +- src/supermemory_new/resources/connections.py | 8 ++++---- src/supermemory_new/resources/memories.py | 8 ++++---- src/supermemory_new/resources/search.py | 8 ++++---- src/supermemory_new/resources/settings.py | 8 ++++---- 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index b27d8436..6b9ff8b6 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,6 +1,6 @@ # This workflow is triggered when a GitHub release is created. # It can also be run manually to re-publish to PyPI in case it failed for some reason. -# You can run this workflow by navigating to https://www.github.com/supermemoryai/sdk-py/actions/workflows/publish-pypi.yml +# You can run this workflow by navigating to https://www.github.com/supermemoryai/python-sdk/actions/workflows/publish-pypi.yml name: Publish PyPI on: workflow_dispatch: diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 952fa5cf..c5235d30 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -9,7 +9,7 @@ jobs: release_doctor: name: release doctor runs-on: ubuntu-latest - if: github.repository == 'supermemoryai/sdk-py' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + if: github.repository == 'supermemoryai/python-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - uses: actions/checkout@v4 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c4762802..ef0780c0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1-alpha.0" + ".": "3.0.0-alpha.19" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b1703902..04223142 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 15 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-0e2874da641d72b5833ebef8cc792d86250d397b96eeedba7d4759ffabc076de.yml openapi_spec_hash: f13ea02b49134e11025cb18f3d45d313 -config_hash: 8e3fb817af0090cad960c30cab828aac +config_hash: 98555becb03f89d0fcf2e35a0fa6a41b diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 181c8da4..583ed499 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g To install via git: ```sh -$ pip install git+ssh://git@github.com/supermemoryai/sdk-py.git +$ pip install git+ssh://git@github.com/supermemoryai/python-sdk.git ``` Alternatively, you can build from source and install the wheel file: @@ -120,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel ### Publish with a GitHub workflow -You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/supermemoryai/sdk-py/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/supermemoryai/python-sdk/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. ### Publish manually diff --git a/README.md b/README.md index 386eaab9..609596e8 100644 --- a/README.md +++ b/README.md @@ -249,9 +249,9 @@ memory = response.parse() # get the object that `memories.add()` would have ret print(memory.id) ``` -These methods return an [`APIResponse`](https://github.com/supermemoryai/sdk-py/tree/main/src/supermemory_new/_response.py) object. +These methods return an [`APIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory_new/_response.py) object. -The async client returns an [`AsyncAPIResponse`](https://github.com/supermemoryai/sdk-py/tree/main/src/supermemory_new/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. +The async client returns an [`AsyncAPIResponse`](https://github.com/supermemoryai/python-sdk/tree/main/src/supermemory_new/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. #### `.with_streaming_response` @@ -357,7 +357,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. -We are keen for your feedback; please open an [issue](https://www.github.com/supermemoryai/sdk-py/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/supermemoryai/python-sdk/issues) with questions, bugs, or suggestions. ### Determining the installed version diff --git a/pyproject.toml b/pyproject.toml index dedc9c6e..aba532e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "supermemory" -version = "0.0.1-alpha.0" +version = "3.0.0-alpha.19" description = "The official Python library for the supermemory API" dynamic = ["readme"] license = "Apache-2.0" @@ -34,8 +34,8 @@ classifiers = [ ] [project.urls] -Homepage = "https://github.com/supermemoryai/sdk-py" -Repository = "https://github.com/supermemoryai/sdk-py" +Homepage = "https://github.com/supermemoryai/python-sdk" +Repository = "https://github.com/supermemoryai/python-sdk" [project.optional-dependencies] aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"] @@ -124,7 +124,7 @@ path = "README.md" [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] # replace relative links with absolute links pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' -replacement = '[\1](https://github.com/supermemoryai/sdk-py/tree/main/\g<2>)' +replacement = '[\1](https://github.com/supermemoryai/python-sdk/tree/main/\g<2>)' [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/src/supermemory_new/_version.py b/src/supermemory_new/_version.py index c96c1a71..be10cc8c 100644 --- a/src/supermemory_new/_version.py +++ b/src/supermemory_new/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "supermemory_new" -__version__ = "0.0.1-alpha.0" # x-release-please-version +__version__ = "3.0.0-alpha.19" # x-release-please-version diff --git a/src/supermemory_new/resources/connections.py b/src/supermemory_new/resources/connections.py index d8a64631..27fdda8a 100644 --- a/src/supermemory_new/resources/connections.py +++ b/src/supermemory_new/resources/connections.py @@ -43,7 +43,7 @@ def with_raw_response(self) -> ConnectionsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers """ return ConnectionsResourceWithRawResponse(self) @@ -52,7 +52,7 @@ def with_streaming_response(self) -> ConnectionsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response """ return ConnectionsResourceWithStreamingResponse(self) @@ -333,7 +333,7 @@ def with_raw_response(self) -> AsyncConnectionsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers """ return AsyncConnectionsResourceWithRawResponse(self) @@ -342,7 +342,7 @@ def with_streaming_response(self) -> AsyncConnectionsResourceWithStreamingRespon """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response """ return AsyncConnectionsResourceWithStreamingResponse(self) diff --git a/src/supermemory_new/resources/memories.py b/src/supermemory_new/resources/memories.py index 6d7705d1..787edf71 100644 --- a/src/supermemory_new/resources/memories.py +++ b/src/supermemory_new/resources/memories.py @@ -34,7 +34,7 @@ def with_raw_response(self) -> MemoriesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers """ return MemoriesResourceWithRawResponse(self) @@ -43,7 +43,7 @@ def with_streaming_response(self) -> MemoriesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response """ return MemoriesResourceWithStreamingResponse(self) @@ -313,7 +313,7 @@ def with_raw_response(self) -> AsyncMemoriesResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers """ return AsyncMemoriesResourceWithRawResponse(self) @@ -322,7 +322,7 @@ def with_streaming_response(self) -> AsyncMemoriesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response """ return AsyncMemoriesResourceWithStreamingResponse(self) diff --git a/src/supermemory_new/resources/search.py b/src/supermemory_new/resources/search.py index b516ba78..5bb291fb 100644 --- a/src/supermemory_new/resources/search.py +++ b/src/supermemory_new/resources/search.py @@ -31,7 +31,7 @@ def with_raw_response(self) -> SearchResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers """ return SearchResourceWithRawResponse(self) @@ -40,7 +40,7 @@ def with_streaming_response(self) -> SearchResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response """ return SearchResourceWithStreamingResponse(self) @@ -151,7 +151,7 @@ def with_raw_response(self) -> AsyncSearchResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers """ return AsyncSearchResourceWithRawResponse(self) @@ -160,7 +160,7 @@ def with_streaming_response(self) -> AsyncSearchResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response """ return AsyncSearchResourceWithStreamingResponse(self) diff --git a/src/supermemory_new/resources/settings.py b/src/supermemory_new/resources/settings.py index f8057693..1ae36b65 100644 --- a/src/supermemory_new/resources/settings.py +++ b/src/supermemory_new/resources/settings.py @@ -31,7 +31,7 @@ def with_raw_response(self) -> SettingsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers """ return SettingsResourceWithRawResponse(self) @@ -40,7 +40,7 @@ def with_streaming_response(self) -> SettingsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response """ return SettingsResourceWithStreamingResponse(self) @@ -134,7 +134,7 @@ def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. - For more information, see https://www.github.com/supermemoryai/sdk-py#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/supermemoryai/python-sdk#accessing-raw-response-data-eg-headers """ return AsyncSettingsResourceWithRawResponse(self) @@ -143,7 +143,7 @@ def with_streaming_response(self) -> AsyncSettingsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/supermemoryai/sdk-py#with_streaming_response + For more information, see https://www.github.com/supermemoryai/python-sdk#with_streaming_response """ return AsyncSettingsResourceWithStreamingResponse(self) From dadfa9f74851fc81e5af92e47c41115bee87aad7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 02:24:37 +0000 Subject: [PATCH 3/6] =?UTF-8?q?fix(ci):=20release-doctor=20=E2=80=94=20rep?= =?UTF-8?q?ort=20correct=20token=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/check-release-environment | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/check-release-environment b/bin/check-release-environment index f2334980..b845b0f4 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -3,7 +3,7 @@ errors=() if [ -z "${PYPI_TOKEN}" ]; then - errors+=("The SUPERMEMORY_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") + errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") fi lenErrors=${#errors[@]} From 08ffef95b8f7be8ce8a57ba2fe2761653cd42e5d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 17:19:37 +0000 Subject: [PATCH 4/6] feat(api): api update --- .stats.yml | 4 ++-- tests/api_resources/test_memories.py | 28 ++++++++++++++-------------- tests/api_resources/test_search.py | 12 ++++++------ 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.stats.yml b/.stats.yml index 04223142..de327485 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-0e2874da641d72b5833ebef8cc792d86250d397b96eeedba7d4759ffabc076de.yml -openapi_spec_hash: f13ea02b49134e11025cb18f3d45d313 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-cce7bb1b7a1050f38b133f61e37f61f47027d357c5cab4288964debeffbc8cb5.yml +openapi_spec_hash: 04e56c24ba345f177419422d70a82f08 config_hash: 98555becb03f89d0fcf2e35a0fa6a41b diff --git a/tests/api_resources/test_memories.py b/tests/api_resources/test_memories.py index 87b9e41b..bbe21739 100644 --- a/tests/api_resources/test_memories.py +++ b/tests/api_resources/test_memories.py @@ -40,12 +40,12 @@ def test_method_update_with_all_params(self, client: Supermemory) -> None: container_tags=["user_123", "project_123"], custom_id="mem_abc123", metadata={ - "source": "web", "category": "technology", + "isPublic": True, + "readingTime": 5, + "source": "web", "tag_1": "ai", "tag_2": "machine-learning", - "readingTime": 5, - "isPublic": True, }, ) assert_matches_type(MemoryUpdateResponse, memory, path=["response"]) @@ -98,7 +98,7 @@ def test_method_list(self, client: Supermemory) -> None: def test_method_list_with_all_params(self, client: Supermemory) -> None: memory = client.memories.list( container_tags=["user_123", "project_123"], - filters='{"AND":[{"key":"group","value":"jira_users","negate":false},{"filterType":"numeric","key":"timestamp","value":"1742745777","negate":false,"numericOperator":">"}]}', + filters='{"AND":[{"key":"group","negate":false,"value":"jira_users"},{"filterType":"numeric","key":"timestamp","negate":false,"numericOperator":">","value":"1742745777"}]}', limit=10, order="desc", page=1, @@ -186,12 +186,12 @@ def test_method_add_with_all_params(self, client: Supermemory) -> None: container_tags=["user_123", "project_123"], custom_id="mem_abc123", metadata={ - "source": "web", "category": "technology", + "isPublic": True, + "readingTime": 5, + "source": "web", "tag_1": "ai", "tag_2": "machine-learning", - "readingTime": 5, - "isPublic": True, }, ) assert_matches_type(MemoryAddResponse, memory, path=["response"]) @@ -288,12 +288,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncSupermemor container_tags=["user_123", "project_123"], custom_id="mem_abc123", metadata={ - "source": "web", "category": "technology", + "isPublic": True, + "readingTime": 5, + "source": "web", "tag_1": "ai", "tag_2": "machine-learning", - "readingTime": 5, - "isPublic": True, }, ) assert_matches_type(MemoryUpdateResponse, memory, path=["response"]) @@ -346,7 +346,7 @@ async def test_method_list(self, async_client: AsyncSupermemory) -> None: async def test_method_list_with_all_params(self, async_client: AsyncSupermemory) -> None: memory = await async_client.memories.list( container_tags=["user_123", "project_123"], - filters='{"AND":[{"key":"group","value":"jira_users","negate":false},{"filterType":"numeric","key":"timestamp","value":"1742745777","negate":false,"numericOperator":">"}]}', + filters='{"AND":[{"key":"group","negate":false,"value":"jira_users"},{"filterType":"numeric","key":"timestamp","negate":false,"numericOperator":">","value":"1742745777"}]}', limit=10, order="desc", page=1, @@ -434,12 +434,12 @@ async def test_method_add_with_all_params(self, async_client: AsyncSupermemory) container_tags=["user_123", "project_123"], custom_id="mem_abc123", metadata={ - "source": "web", "category": "technology", + "isPublic": True, + "readingTime": 5, + "source": "web", "tag_1": "ai", "tag_2": "machine-learning", - "readingTime": 5, - "isPublic": True, }, ) assert_matches_type(MemoryAddResponse, memory, path=["response"]) diff --git a/tests/api_resources/test_search.py b/tests/api_resources/test_search.py index 176f006c..c9b891c1 100644 --- a/tests/api_resources/test_search.py +++ b/tests/api_resources/test_search.py @@ -39,15 +39,15 @@ def test_method_execute_with_all_params(self, client: Supermemory) -> None: "and_": [ { "key": "group", - "value": "jira_users", "negate": False, + "value": "jira_users", }, { "filterType": "numeric", "key": "timestamp", - "value": "1742745777", "negate": False, "numericOperator": ">", + "value": "1742745777", }, ], "or_": [{}], @@ -57,7 +57,7 @@ def test_method_execute_with_all_params(self, client: Supermemory) -> None: limit=10, only_matching_chunks=False, rerank=False, - rewrite_query=False, + rewrite_query=True, ) assert_matches_type(SearchExecuteResponse, search, path=["response"]) @@ -115,15 +115,15 @@ async def test_method_execute_with_all_params(self, async_client: AsyncSupermemo "and_": [ { "key": "group", - "value": "jira_users", "negate": False, + "value": "jira_users", }, { "filterType": "numeric", "key": "timestamp", - "value": "1742745777", "negate": False, "numericOperator": ">", + "value": "1742745777", }, ], "or_": [{}], @@ -133,7 +133,7 @@ async def test_method_execute_with_all_params(self, async_client: AsyncSupermemo limit=10, only_matching_chunks=False, rerank=False, - rewrite_query=False, + rewrite_query=True, ) assert_matches_type(SearchExecuteResponse, search, path=["response"]) From 3c357637aab2e68e3a80e33b9f721c3a8182483a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 21:13:56 +0000 Subject: [PATCH 5/6] feat(api): api update --- .stats.yml | 4 ++-- tests/api_resources/test_search.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index de327485..5f5ec9ce 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-cce7bb1b7a1050f38b133f61e37f61f47027d357c5cab4288964debeffbc8cb5.yml -openapi_spec_hash: 04e56c24ba345f177419422d70a82f08 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/supermemory--inc%2Fsupermemory-new-f259b18e66afb10f009640c303c9a2b829114ac52f968780c24a99655405d5f0.yml +openapi_spec_hash: a65d5f45b4d666a1caf6a22525690c8c config_hash: 98555becb03f89d0fcf2e35a0fa6a41b diff --git a/tests/api_resources/test_search.py b/tests/api_resources/test_search.py index c9b891c1..5aec7f5b 100644 --- a/tests/api_resources/test_search.py +++ b/tests/api_resources/test_search.py @@ -57,7 +57,7 @@ def test_method_execute_with_all_params(self, client: Supermemory) -> None: limit=10, only_matching_chunks=False, rerank=False, - rewrite_query=True, + rewrite_query=False, ) assert_matches_type(SearchExecuteResponse, search, path=["response"]) @@ -133,7 +133,7 @@ async def test_method_execute_with_all_params(self, async_client: AsyncSupermemo limit=10, only_matching_chunks=False, rerank=False, - rewrite_query=True, + rewrite_query=False, ) assert_matches_type(SearchExecuteResponse, search, path=["response"]) From eaad4515d02890e889d62e1189f2b4c390b45bf2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 21:14:14 +0000 Subject: [PATCH 6/6] release: 3.0.0-alpha.20 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ pyproject.toml | 2 +- src/supermemory_new/_version.py | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ef0780c0..df6e9c55 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.0.0-alpha.19" + ".": "3.0.0-alpha.20" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..c8881eaa --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,21 @@ +# Changelog + +## 3.0.0-alpha.20 (2025-06-27) + +Full Changelog: [v3.0.0-alpha.19...v3.0.0-alpha.20](https://github.com/supermemoryai/python-sdk/compare/v3.0.0-alpha.19...v3.0.0-alpha.20) + +### Features + +* **api:** api update ([3c35763](https://github.com/supermemoryai/python-sdk/commit/3c357637aab2e68e3a80e33b9f721c3a8182483a)) +* **api:** api update ([08ffef9](https://github.com/supermemoryai/python-sdk/commit/08ffef95b8f7be8ce8a57ba2fe2761653cd42e5d)) + + +### Bug Fixes + +* **ci:** release-doctor — report correct token name ([dadfa9f](https://github.com/supermemoryai/python-sdk/commit/dadfa9f74851fc81e5af92e47c41115bee87aad7)) + + +### Chores + +* sync repo ([380252a](https://github.com/supermemoryai/python-sdk/commit/380252a9cb2d9c723b5c6b36a33573c462e48049)) +* update SDK settings ([8c6f297](https://github.com/supermemoryai/python-sdk/commit/8c6f297fc2b8f7a6b600205a5c313767a99612cb)) diff --git a/pyproject.toml b/pyproject.toml index aba532e5..618b735f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "supermemory" -version = "3.0.0-alpha.19" +version = "3.0.0-alpha.20" description = "The official Python library for the supermemory API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/supermemory_new/_version.py b/src/supermemory_new/_version.py index be10cc8c..4482b497 100644 --- a/src/supermemory_new/_version.py +++ b/src/supermemory_new/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "supermemory_new" -__version__ = "3.0.0-alpha.19" # x-release-please-version +__version__ = "3.0.0-alpha.20" # x-release-please-version