diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6a005eb..c9b541ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,14 +61,18 @@ jobs: run: rye build - name: Get GitHub OIDC Token - if: github.repository == 'stainless-sdks/hyperspell-python' + if: |- + github.repository == 'stainless-sdks/hyperspell-python' && + !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball - if: github.repository == 'stainless-sdks/hyperspell-python' + if: |- + github.repository == 'stainless-sdks/hyperspell-python' && + !startsWith(github.ref, 'refs/heads/stl/') env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 53338790..1ff4a3ff 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -12,6 +12,9 @@ jobs: publish: name: publish runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v6 @@ -27,5 +30,3 @@ jobs: - name: Publish to PyPI run: | bash ./bin/publish-pypi - env: - PYPI_TOKEN: ${{ secrets.HYPERSPELL_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 7f739e2a..b7b5ce04 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -17,5 +17,3 @@ jobs: - name: Check release environment run: | bash ./bin/check-release-environment - env: - PYPI_TOKEN: ${{ secrets.HYPERSPELL_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 57dc0c3d..e4e1c3ce 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.33.0" + ".": "0.34.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 782ef1fc..fac402f6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 23 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-36cb6e2474f3fe09749b7a2f24409d48c8db332d624fa7eeb1ee6b6135774133.yml -openapi_spec_hash: 339a1b55d6b1a55213d16bf336045d0d -config_hash: 983708fc30c86269c2149a960d0bfec1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-e94268bb224f0aa46f151c81dba49c8def81c73b48da8a6f31b4f8a60aa5055c.yml +openapi_spec_hash: 2e2f8148f72a724fbafd05c51b7a62c9 +config_hash: b387daed43fa717ef3ac5811ae06307c diff --git a/CHANGELOG.md b/CHANGELOG.md index 254432cc..abc46505 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## 0.34.0 (2026-03-14) + +Full Changelog: [v0.33.0...v0.34.0](https://github.com/hyperspell/python-sdk/compare/v0.33.0...v0.34.0) + +### Features + +* **api:** api update ([f690c84](https://github.com/hyperspell/python-sdk/commit/f690c841ce28801b1511142026b62d7fcc2706ba)) +* **api:** api update ([784a11e](https://github.com/hyperspell/python-sdk/commit/784a11e826b748f682186bbb39e8f7580cb4d683)) +* **api:** api update ([0f66c9d](https://github.com/hyperspell/python-sdk/commit/0f66c9dfe8e50d22f1a66f6de9b3ee0f1a89ab38)) +* **api:** api update ([b76b873](https://github.com/hyperspell/python-sdk/commit/b76b873e4c01f4c9421cc6e452f216c19374b687)) +* **api:** api update ([b75e2b3](https://github.com/hyperspell/python-sdk/commit/b75e2b3bbb5a871a39d147e4cb0949d7279f3271)) +* **api:** api update ([d330dea](https://github.com/hyperspell/python-sdk/commit/d330deaec6f907f4abee6dd8fc786da018ea72a7)) +* **api:** api update ([e01d911](https://github.com/hyperspell/python-sdk/commit/e01d911cb400b1ee3827332299f054d278f867d4)) +* **api:** manual updates ([48f1e5b](https://github.com/hyperspell/python-sdk/commit/48f1e5b7a76e607c52a3a29c289352e07ca466c6)) + + +### Chores + +* **api:** python trusted publisher ([3d7a283](https://github.com/hyperspell/python-sdk/commit/3d7a283ebe54b78a23964a17a3167c50da0aeba2)) +* **ci:** skip uploading artifacts on stainless-internal branches ([2361dcb](https://github.com/hyperspell/python-sdk/commit/2361dcb5e76f8aeca00e12a4fcf6b912fca1084a)) +* **internal:** add request options to SSE classes ([6b5c9ad](https://github.com/hyperspell/python-sdk/commit/6b5c9ad8271ecb8887faf8cb678805e6d481459c)) +* **internal:** make `test_proxy_environment_variables` more resilient ([3cc3332](https://github.com/hyperspell/python-sdk/commit/3cc33321d35a6162c6c8540b571d4d3c2b63a022)) +* **internal:** make `test_proxy_environment_variables` more resilient to env ([2c99a7f](https://github.com/hyperspell/python-sdk/commit/2c99a7f619b2581f2bf7bc2bea4519fc1f6c5733)) +* **test:** do not count install time for mock server timeout ([ee29761](https://github.com/hyperspell/python-sdk/commit/ee29761e756adb19eb1f07232abde4e2a1e20d4f)) +* update placeholder string ([5608e0b](https://github.com/hyperspell/python-sdk/commit/5608e0bb6e840cd1b52b8ca79ec6042bc704de82)) + ## 0.33.0 (2026-02-20) Full Changelog: [v0.32.0...v0.33.0](https://github.com/hyperspell/python-sdk/compare/v0.32.0...v0.33.0) diff --git a/README.md b/README.md index 578f2940..96401a95 100644 --- a/README.md +++ b/README.md @@ -134,9 +134,7 @@ client = Hyperspell() all_memories = [] # Automatically fetches more pages as needed. -for memory in client.memories.list( - collection="REPLACE_ME", -): +for memory in client.memories.list(): # Do something with memory here all_memories.append(memory) print(all_memories) @@ -154,9 +152,7 @@ client = AsyncHyperspell() async def main() -> None: all_memories = [] # Iterate through items across all pages, issuing requests as needed. - async for memory in client.memories.list( - collection="REPLACE_ME", - ): + async for memory in client.memories.list(): all_memories.append(memory) print(all_memories) @@ -167,9 +163,7 @@ asyncio.run(main()) Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages: ```python -first_page = await client.memories.list( - collection="REPLACE_ME", -) +first_page = await client.memories.list() if first_page.has_next_page(): print(f"will fetch next page using these details: {first_page.next_page_info()}") next_page = await first_page.get_next_page() @@ -181,9 +175,7 @@ if first_page.has_next_page(): Or just work directly with the returned data: ```python -first_page = await client.memories.list( - collection="REPLACE_ME", -) +first_page = await client.memories.list() print(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..." for memory in first_page.items: diff --git a/bin/check-release-environment b/bin/check-release-environment index b845b0f4..1e951e9a 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ errors=() -if [ -z "${PYPI_TOKEN}" ]; then - 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[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-pypi b/bin/publish-pypi index 826054e9..4d74d121 100644 --- a/bin/publish-pypi +++ b/bin/publish-pypi @@ -3,4 +3,8 @@ set -eux mkdir -p dist rye build --clean -rye publish --yes --token=$PYPI_TOKEN +if [ -n "${PYPI_TOKEN:-}" ]; then + rye publish --yes --token=$PYPI_TOKEN +else + rye publish --yes +fi diff --git a/pyproject.toml b/pyproject.toml index 7a5607b4..5bc42897 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "hyperspell" -version = "0.33.0" +version = "0.34.0" description = "The official Python library for the hyperspell API" dynamic = ["readme"] license = "MIT" diff --git a/scripts/mock b/scripts/mock index 0b28f6ea..bcf3b392 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then + # Pre-install the package so the download doesn't eat into the startup timeout + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - # Wait for server to come online + # Wait for server to come online (max 30s) echo -n "Waiting for server" + attempts=0 while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + attempts=$((attempts + 1)) + if [ "$attempts" -ge 300 ]; then + echo + echo "Timed out waiting for Prism server to start" + cat .prism.log + exit 1 + fi echo -n "." sleep 0.1 done diff --git a/src/hyperspell/_response.py b/src/hyperspell/_response.py index e1cbe16a..3de65894 100644 --- a/src/hyperspell/_response.py +++ b/src/hyperspell/_response.py @@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: ), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: cast_to=extract_stream_chunk_type(self._stream_cls), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: cast_to=cast_to, response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) diff --git a/src/hyperspell/_streaming.py b/src/hyperspell/_streaming.py index ec124810..b32811c5 100644 --- a/src/hyperspell/_streaming.py +++ b/src/hyperspell/_streaming.py @@ -4,7 +4,7 @@ import json import inspect from types import TracebackType -from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast +from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable import httpx @@ -13,6 +13,7 @@ if TYPE_CHECKING: from ._client import Hyperspell, AsyncHyperspell + from ._models import FinalRequestOptions _T = TypeVar("_T") @@ -22,7 +23,7 @@ class Stream(Generic[_T]): """Provides the core interface to iterate over a synchronous stream response.""" response: httpx.Response - + _options: Optional[FinalRequestOptions] = None _decoder: SSEBytesDecoder def __init__( @@ -31,6 +32,7 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: Hyperspell, + options: Optional[FinalRequestOptions] = None, timeout: float | None = None, ) -> None: """Initialize the synchronous stream. @@ -44,6 +46,7 @@ def __init__( self.response = response self._cast_to = cast_to self._client = client + self._options = options self._timeout = timeout self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() @@ -115,7 +118,7 @@ class AsyncStream(Generic[_T]): """Provides the core interface to iterate over an asynchronous stream response.""" response: httpx.Response - + _options: Optional[FinalRequestOptions] = None _decoder: SSEDecoder | SSEBytesDecoder def __init__( @@ -124,6 +127,7 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: AsyncHyperspell, + options: Optional[FinalRequestOptions] = None, timeout: float | None = None, ) -> None: """Initialize the asynchronous stream. @@ -137,6 +141,7 @@ def __init__( self.response = response self._cast_to = cast_to self._client = client + self._options = options self._timeout = timeout self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() diff --git a/src/hyperspell/_version.py b/src/hyperspell/_version.py index 778314bc..19fe74d1 100644 --- a/src/hyperspell/_version.py +++ b/src/hyperspell/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "hyperspell" -__version__ = "0.33.0" # x-release-please-version +__version__ = "0.34.0" # x-release-please-version diff --git a/src/hyperspell/resources/memories.py b/src/hyperspell/resources/memories.py index 8665314f..f9bc45fe 100644 --- a/src/hyperspell/resources/memories.py +++ b/src/hyperspell/resources/memories.py @@ -72,8 +72,11 @@ def update( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ], collection: Union[str, object, None] | Omit = omit, metadata: Union[Dict[str, Union[str, float, bool, None]], object, None] | Omit = omit, @@ -152,8 +155,11 @@ def list( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] ] | Omit = omit, @@ -225,8 +231,11 @@ def delete( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ], # 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. @@ -395,8 +404,11 @@ def get( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ], # 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. @@ -446,8 +458,11 @@ def search( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] ] | Omit = omit, @@ -613,8 +628,11 @@ async def update( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ], collection: Union[str, object, None] | Omit = omit, metadata: Union[Dict[str, Union[str, float, bool, None]], object, None] | Omit = omit, @@ -693,8 +711,11 @@ def list( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] ] | Omit = omit, @@ -766,8 +787,11 @@ async def delete( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ], # 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. @@ -936,8 +960,11 @@ async def get( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ], # 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. @@ -987,8 +1014,11 @@ async def search( "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] ] | Omit = omit, diff --git a/src/hyperspell/resources/vaults.py b/src/hyperspell/resources/vaults.py index 4f0d9296..39f1fe78 100644 --- a/src/hyperspell/resources/vaults.py +++ b/src/hyperspell/resources/vaults.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Optional import httpx @@ -44,6 +45,7 @@ def with_streaming_response(self) -> VaultsResourceWithStreamingResponse: """ return VaultsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("This method will be removed in the future") def list( self, *, @@ -110,6 +112,7 @@ def with_streaming_response(self) -> AsyncVaultsResourceWithStreamingResponse: """ return AsyncVaultsResourceWithStreamingResponse(self) + @typing_extensions.deprecated("This method will be removed in the future") def list( self, *, @@ -160,8 +163,10 @@ class VaultsResourceWithRawResponse: def __init__(self, vaults: VaultsResource) -> None: self._vaults = vaults - self.list = to_raw_response_wrapper( - vaults.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + vaults.list, # pyright: ignore[reportDeprecated], + ) ) @@ -169,8 +174,10 @@ class AsyncVaultsResourceWithRawResponse: def __init__(self, vaults: AsyncVaultsResource) -> None: self._vaults = vaults - self.list = async_to_raw_response_wrapper( - vaults.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + vaults.list, # pyright: ignore[reportDeprecated], + ) ) @@ -178,8 +185,10 @@ class VaultsResourceWithStreamingResponse: def __init__(self, vaults: VaultsResource) -> None: self._vaults = vaults - self.list = to_streamed_response_wrapper( - vaults.list, + self.list = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + vaults.list, # pyright: ignore[reportDeprecated], + ) ) @@ -187,6 +196,8 @@ class AsyncVaultsResourceWithStreamingResponse: def __init__(self, vaults: AsyncVaultsResource) -> None: self._vaults = vaults - self.list = async_to_streamed_response_wrapper( - vaults.list, + self.list = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + vaults.list, # pyright: ignore[reportDeprecated], + ) ) diff --git a/src/hyperspell/types/auth_me_response.py b/src/hyperspell/types/auth_me_response.py index feeae525..cdff44b7 100644 --- a/src/hyperspell/types/auth_me_response.py +++ b/src/hyperspell/types/auth_me_response.py @@ -42,8 +42,11 @@ class AuthMeResponse(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] ] """All integrations available for the app""" @@ -58,8 +61,11 @@ class AuthMeResponse(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] ] """All integrations installed for the user""" diff --git a/src/hyperspell/types/connection_list_response.py b/src/hyperspell/types/connection_list_response.py index 6650045c..15f8f5f5 100644 --- a/src/hyperspell/types/connection_list_response.py +++ b/src/hyperspell/types/connection_list_response.py @@ -27,8 +27,11 @@ class Connection(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] """The connection's provider""" diff --git a/src/hyperspell/types/integration_list_response.py b/src/hyperspell/types/integration_list_response.py index fa6ef1a2..98e07e93 100644 --- a/src/hyperspell/types/integration_list_response.py +++ b/src/hyperspell/types/integration_list_response.py @@ -33,8 +33,11 @@ class Integration(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] """The integration's provider""" diff --git a/src/hyperspell/types/integrations/web_crawler_index_response.py b/src/hyperspell/types/integrations/web_crawler_index_response.py index 7e2a9a8c..48270784 100644 --- a/src/hyperspell/types/integrations/web_crawler_index_response.py +++ b/src/hyperspell/types/integrations/web_crawler_index_response.py @@ -19,8 +19,11 @@ class WebCrawlerIndexResponse(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] status: Literal["pending", "processing", "completed", "failed"] diff --git a/src/hyperspell/types/memory.py b/src/hyperspell/types/memory.py index 2e009f5d..aa0dc03b 100644 --- a/src/hyperspell/types/memory.py +++ b/src/hyperspell/types/memory.py @@ -25,8 +25,11 @@ class Memory(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] type: str diff --git a/src/hyperspell/types/memory_delete_response.py b/src/hyperspell/types/memory_delete_response.py index 47e97a6c..f7a175bd 100644 --- a/src/hyperspell/types/memory_delete_response.py +++ b/src/hyperspell/types/memory_delete_response.py @@ -23,8 +23,11 @@ class MemoryDeleteResponse(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] success: bool diff --git a/src/hyperspell/types/memory_list_params.py b/src/hyperspell/types/memory_list_params.py index 79d5cdba..b5911ab2 100644 --- a/src/hyperspell/types/memory_list_params.py +++ b/src/hyperspell/types/memory_list_params.py @@ -32,8 +32,11 @@ class MemoryListParams(TypedDict, total=False): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] ] """Filter documents by source.""" diff --git a/src/hyperspell/types/memory_list_response.py b/src/hyperspell/types/memory_list_response.py index 729bd3d6..9b407a2c 100644 --- a/src/hyperspell/types/memory_list_response.py +++ b/src/hyperspell/types/memory_list_response.py @@ -21,8 +21,11 @@ class MemoryListResponse(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] metadata: Optional[Metadata] = None diff --git a/src/hyperspell/types/memory_search_params.py b/src/hyperspell/types/memory_search_params.py index e5c93348..6d045db0 100644 --- a/src/hyperspell/types/memory_search_params.py +++ b/src/hyperspell/types/memory_search_params.py @@ -47,8 +47,11 @@ class MemorySearchParams(TypedDict, total=False): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] ] """Only query documents from these sources.""" @@ -225,7 +228,9 @@ class Options(TypedDict, total=False): after: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """Only query documents created on or after this date.""" - answer_model: Literal["llama-3.1", "gemma2", "qwen-qwq", "mistral-saba", "llama-4-scout", "deepseek-r1"] + answer_model: Literal[ + "llama-3.1", "gemma2", "qwen-qwq", "mistral-saba", "llama-4-scout", "deepseek-r1", "gpt-oss-20b", "gpt-oss-120b" + ] """Model to use for answer generation when answer=True""" before: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] @@ -252,12 +257,26 @@ class Options(TypedDict, total=False): max_results: int """Maximum number of results to return.""" + memory_types: List[Literal["procedure", "memory"]] + """Filter by memory type. + + Defaults to generic memories only. Pass multiple types to include procedures, + etc. + """ + notion: OptionsNotion """Search options for Notion""" reddit: OptionsReddit """Search options for Reddit""" + resource_ids: Optional[SequenceNotStr[str]] + """Only return results from these specific resource IDs. + + Useful for scoping searches to specific documents (e.g., a specific email thread + or uploaded file). + """ + slack: OptionsSlack """Search options for Slack""" diff --git a/src/hyperspell/types/memory_status.py b/src/hyperspell/types/memory_status.py index c9be10da..6e07fd66 100644 --- a/src/hyperspell/types/memory_status.py +++ b/src/hyperspell/types/memory_status.py @@ -19,8 +19,11 @@ class MemoryStatus(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] status: Literal["pending", "processing", "completed", "failed"] diff --git a/src/hyperspell/types/memory_update_params.py b/src/hyperspell/types/memory_update_params.py index 2ceecd6a..a1566dcc 100644 --- a/src/hyperspell/types/memory_update_params.py +++ b/src/hyperspell/types/memory_update_params.py @@ -19,8 +19,11 @@ class MemoryUpdateParams(TypedDict, total=False): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] ] diff --git a/src/hyperspell/types/shared/query_result.py b/src/hyperspell/types/shared/query_result.py index c3e07b78..eef3c190 100644 --- a/src/hyperspell/types/shared/query_result.py +++ b/src/hyperspell/types/shared/query_result.py @@ -21,8 +21,11 @@ class Document(BaseModel): "box", "dropbox", "google_drive", + "github", "vault", "web_crawler", + "trace", + "microsoft_teams", ] metadata: Optional[Metadata] = None diff --git a/tests/api_resources/test_memories.py b/tests/api_resources/test_memories.py index fb3fb951..7de03c3c 100644 --- a/tests/api_resources/test_memories.py +++ b/tests/api_resources/test_memories.py @@ -304,7 +304,8 @@ def test_method_search_with_all_params(self, client: Hyperspell) -> None: "label_ids": ["string"], "weight": 0, }, - "max_results": 0, + "max_results": 200, + "memory_types": ["procedure"], "notion": { "notion_page_ids": ["string"], "weight": 0, @@ -315,6 +316,7 @@ def test_method_search_with_all_params(self, client: Hyperspell) -> None: "subreddit": "subreddit", "weight": 0, }, + "resource_ids": ["string"], "slack": { "channels": ["string"], "exclude_archived": True, @@ -386,14 +388,14 @@ def test_streaming_response_status(self, client: Hyperspell) -> None: @parametrize def test_method_upload(self, client: Hyperspell) -> None: memory = client.memories.upload( - file=b"raw file contents", + file=b"Example data", ) assert_matches_type(MemoryStatus, memory, path=["response"]) @parametrize def test_method_upload_with_all_params(self, client: Hyperspell) -> None: memory = client.memories.upload( - file=b"raw file contents", + file=b"Example data", collection="collection", metadata="metadata", ) @@ -402,7 +404,7 @@ def test_method_upload_with_all_params(self, client: Hyperspell) -> None: @parametrize def test_raw_response_upload(self, client: Hyperspell) -> None: response = client.memories.with_raw_response.upload( - file=b"raw file contents", + file=b"Example data", ) assert response.is_closed is True @@ -413,7 +415,7 @@ def test_raw_response_upload(self, client: Hyperspell) -> None: @parametrize def test_streaming_response_upload(self, client: Hyperspell) -> None: with client.memories.with_streaming_response.upload( - file=b"raw file contents", + file=b"Example data", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -706,7 +708,8 @@ async def test_method_search_with_all_params(self, async_client: AsyncHyperspell "label_ids": ["string"], "weight": 0, }, - "max_results": 0, + "max_results": 200, + "memory_types": ["procedure"], "notion": { "notion_page_ids": ["string"], "weight": 0, @@ -717,6 +720,7 @@ async def test_method_search_with_all_params(self, async_client: AsyncHyperspell "subreddit": "subreddit", "weight": 0, }, + "resource_ids": ["string"], "slack": { "channels": ["string"], "exclude_archived": True, @@ -788,14 +792,14 @@ async def test_streaming_response_status(self, async_client: AsyncHyperspell) -> @parametrize async def test_method_upload(self, async_client: AsyncHyperspell) -> None: memory = await async_client.memories.upload( - file=b"raw file contents", + file=b"Example data", ) assert_matches_type(MemoryStatus, memory, path=["response"]) @parametrize async def test_method_upload_with_all_params(self, async_client: AsyncHyperspell) -> None: memory = await async_client.memories.upload( - file=b"raw file contents", + file=b"Example data", collection="collection", metadata="metadata", ) @@ -804,7 +808,7 @@ async def test_method_upload_with_all_params(self, async_client: AsyncHyperspell @parametrize async def test_raw_response_upload(self, async_client: AsyncHyperspell) -> None: response = await async_client.memories.with_raw_response.upload( - file=b"raw file contents", + file=b"Example data", ) assert response.is_closed is True @@ -815,7 +819,7 @@ async def test_raw_response_upload(self, async_client: AsyncHyperspell) -> None: @parametrize async def test_streaming_response_upload(self, async_client: AsyncHyperspell) -> None: async with async_client.memories.with_streaming_response.upload( - file=b"raw file contents", + file=b"Example data", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_vaults.py b/tests/api_resources/test_vaults.py index c0e4ab86..54538b98 100644 --- a/tests/api_resources/test_vaults.py +++ b/tests/api_resources/test_vaults.py @@ -12,6 +12,8 @@ from hyperspell.types import VaultListResponse from hyperspell.pagination import SyncCursorPage, AsyncCursorPage +# pyright: reportDeprecated=false + base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,20 +22,25 @@ class TestVaults: @parametrize def test_method_list(self, client: Hyperspell) -> None: - vault = client.vaults.list() + with pytest.warns(DeprecationWarning): + vault = client.vaults.list() + assert_matches_type(SyncCursorPage[VaultListResponse], vault, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Hyperspell) -> None: - vault = client.vaults.list( - cursor="cursor", - size=0, - ) + with pytest.warns(DeprecationWarning): + vault = client.vaults.list( + cursor="cursor", + size=0, + ) + assert_matches_type(SyncCursorPage[VaultListResponse], vault, path=["response"]) @parametrize def test_raw_response_list(self, client: Hyperspell) -> None: - response = client.vaults.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = client.vaults.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -42,12 +49,13 @@ def test_raw_response_list(self, client: Hyperspell) -> None: @parametrize def test_streaming_response_list(self, client: Hyperspell) -> None: - with client.vaults.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.vaults.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vault = response.parse() - assert_matches_type(SyncCursorPage[VaultListResponse], vault, path=["response"]) + vault = response.parse() + assert_matches_type(SyncCursorPage[VaultListResponse], vault, path=["response"]) assert cast(Any, response.is_closed) is True @@ -59,20 +67,25 @@ class TestAsyncVaults: @parametrize async def test_method_list(self, async_client: AsyncHyperspell) -> None: - vault = await async_client.vaults.list() + with pytest.warns(DeprecationWarning): + vault = await async_client.vaults.list() + assert_matches_type(AsyncCursorPage[VaultListResponse], vault, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncHyperspell) -> None: - vault = await async_client.vaults.list( - cursor="cursor", - size=0, - ) + with pytest.warns(DeprecationWarning): + vault = await async_client.vaults.list( + cursor="cursor", + size=0, + ) + assert_matches_type(AsyncCursorPage[VaultListResponse], vault, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncHyperspell) -> None: - response = await async_client.vaults.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = await async_client.vaults.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -81,11 +94,12 @@ async def test_raw_response_list(self, async_client: AsyncHyperspell) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncHyperspell) -> None: - async with async_client.vaults.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.vaults.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vault = await response.parse() - assert_matches_type(AsyncCursorPage[VaultListResponse], vault, path=["response"]) + vault = await response.parse() + assert_matches_type(AsyncCursorPage[VaultListResponse], vault, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index f3aef279..fedd4853 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1019,6 +1019,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultHttpxClient() @@ -1998,6 +2006,14 @@ async def test_get_platform(self) -> None: async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultAsyncHttpxClient()