Skip to content

Commit adcbd19

Browse files
feat(api): update via SDK Studio
1 parent ecab062 commit adcbd19

File tree

10 files changed

+46
-37
lines changed

10 files changed

+46
-37
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 18
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-55497442c9c2cf4077d1e8661fdf82ebe905dbb140ec65421ffa78da6d06a015.yml
33
openapi_spec_hash: aa9abda3ed926041c12f664e4225c5ed
4-
config_hash: 9e8bd25bb51a72f08b91887dff4f39e9
4+
config_hash: bd953556a1d60f48307815fdaf9ba88b

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ from hyperspell import Hyperspell
191191

192192
client = Hyperspell()
193193

194-
query = client.memories.search(
194+
query_result = client.memories.search(
195195
query="query",
196196
options={},
197197
)
198-
print(query.options)
198+
print(query_result.options)
199199
```
200200

201201
## File uploads

api.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Shared Types
2+
3+
```python
4+
from hyperspell.types import QueryResult
5+
```
6+
17
# Integrations
28

39
Types:
@@ -54,7 +60,7 @@ Methods:
5460
- <code title="delete /memories/delete/{source}/{resource_id}">client.memories.<a href="./src/hyperspell/resources/memories.py">delete</a>(resource_id, \*, source) -> <a href="./src/hyperspell/types/memory_delete_response.py">MemoryDeleteResponse</a></code>
5561
- <code title="post /memories/add">client.memories.<a href="./src/hyperspell/resources/memories.py">add</a>(\*\*<a href="src/hyperspell/types/memory_add_params.py">params</a>) -> <a href="./src/hyperspell/types/memory_status.py">MemoryStatus</a></code>
5662
- <code title="get /memories/get/{source}/{resource_id}">client.memories.<a href="./src/hyperspell/resources/memories.py">get</a>(resource_id, \*, source) -> <a href="./src/hyperspell/types/memory.py">Memory</a></code>
57-
- <code title="post /memories/query">client.memories.<a href="./src/hyperspell/resources/memories.py">search</a>(\*\*<a href="src/hyperspell/types/memory_search_params.py">params</a>) -> <a href="./src/hyperspell/types/query.py">Query</a></code>
63+
- <code title="post /memories/query">client.memories.<a href="./src/hyperspell/resources/memories.py">search</a>(\*\*<a href="src/hyperspell/types/memory_search_params.py">params</a>) -> <a href="./src/hyperspell/types/shared/query_result.py">QueryResult</a></code>
5864
- <code title="get /memories/status">client.memories.<a href="./src/hyperspell/resources/memories.py">status</a>() -> <a href="./src/hyperspell/types/memory_status_response.py">MemoryStatusResponse</a></code>
5965
- <code title="post /memories/upload">client.memories.<a href="./src/hyperspell/resources/memories.py">upload</a>(\*\*<a href="src/hyperspell/types/memory_upload_params.py">params</a>) -> <a href="./src/hyperspell/types/memory_status.py">MemoryStatus</a></code>
6066

@@ -63,12 +69,12 @@ Methods:
6369
Types:
6470

6571
```python
66-
from hyperspell.types import Query, EvaluateScoreHighlightResponse, EvaluateScoreQueryResponse
72+
from hyperspell.types import EvaluateScoreHighlightResponse, EvaluateScoreQueryResponse
6773
```
6874

6975
Methods:
7076

71-
- <code title="get /evaluate/query/{query_id}">client.evaluate.<a href="./src/hyperspell/resources/evaluate.py">get_query</a>(query_id) -> <a href="./src/hyperspell/types/query.py">Query</a></code>
77+
- <code title="get /evaluate/query/{query_id}">client.evaluate.<a href="./src/hyperspell/resources/evaluate.py">get_query</a>(query_id) -> <a href="./src/hyperspell/types/shared/query_result.py">QueryResult</a></code>
7278
- <code title="post /evaluate/highlight/{highlight_id}">client.evaluate.<a href="./src/hyperspell/resources/evaluate.py">score_highlight</a>(highlight_id, \*\*<a href="src/hyperspell/types/evaluate_score_highlight_params.py">params</a>) -> <a href="./src/hyperspell/types/evaluate_score_highlight_response.py">EvaluateScoreHighlightResponse</a></code>
7379
- <code title="post /evaluate/query/{query_id}">client.evaluate.<a href="./src/hyperspell/resources/evaluate.py">score_query</a>(query_id, \*\*<a href="src/hyperspell/types/evaluate_score_query_params.py">params</a>) -> <a href="./src/hyperspell/types/evaluate_score_query_response.py">EvaluateScoreQueryResponse</a></code>
7480

src/hyperspell/resources/evaluate.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
async_to_raw_response_wrapper,
1818
async_to_streamed_response_wrapper,
1919
)
20-
from ..types.query import Query
2120
from .._base_client import make_request_options
21+
from ..types.shared.query_result import QueryResult
2222
from ..types.evaluate_score_query_response import EvaluateScoreQueryResponse
2323
from ..types.evaluate_score_highlight_response import EvaluateScoreHighlightResponse
2424

@@ -55,7 +55,7 @@ def get_query(
5555
extra_query: Query | None = None,
5656
extra_body: Body | None = None,
5757
timeout: float | httpx.Timeout | None | NotGiven = not_given,
58-
) -> Query:
58+
) -> QueryResult:
5959
"""
6060
Retrieve the result of a previous query.
6161
@@ -75,7 +75,7 @@ def get_query(
7575
options=make_request_options(
7676
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
7777
),
78-
cast_to=Query,
78+
cast_to=QueryResult,
7979
)
8080

8181
def score_highlight(
@@ -192,7 +192,7 @@ async def get_query(
192192
extra_query: Query | None = None,
193193
extra_body: Body | None = None,
194194
timeout: float | httpx.Timeout | None | NotGiven = not_given,
195-
) -> Query:
195+
) -> QueryResult:
196196
"""
197197
Retrieve the result of a previous query.
198198
@@ -212,7 +212,7 @@ async def get_query(
212212
options=make_request_options(
213213
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
214214
),
215-
cast_to=Query,
215+
cast_to=QueryResult,
216216
)
217217

218218
async def score_highlight(

src/hyperspell/resources/memories.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
async_to_streamed_response_wrapper,
2121
)
2222
from ..pagination import SyncCursorPage, AsyncCursorPage
23-
from ..types.query import Query
2423
from .._base_client import AsyncPaginator, make_request_options
2524
from ..types.memory import Memory
2625
from ..types.memory_status import MemoryStatus
26+
from ..types.shared.query_result import QueryResult
2727
from ..types.memory_delete_response import MemoryDeleteResponse
2828
from ..types.memory_status_response import MemoryStatusResponse
2929

@@ -459,7 +459,7 @@ def search(
459459
extra_query: Query | None = None,
460460
extra_body: Body | None = None,
461461
timeout: float | httpx.Timeout | None | NotGiven = not_given,
462-
) -> Query:
462+
) -> QueryResult:
463463
"""
464464
Retrieves documents matching the query.
465465
@@ -497,7 +497,7 @@ def search(
497497
options=make_request_options(
498498
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
499499
),
500-
cast_to=Query,
500+
cast_to=QueryResult,
501501
)
502502

503503
def status(
@@ -1005,7 +1005,7 @@ async def search(
10051005
extra_query: Query | None = None,
10061006
extra_body: Body | None = None,
10071007
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1008-
) -> Query:
1008+
) -> QueryResult:
10091009
"""
10101010
Retrieves documents matching the query.
10111011
@@ -1043,7 +1043,7 @@ async def search(
10431043
options=make_request_options(
10441044
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
10451045
),
1046-
cast_to=Query,
1046+
cast_to=QueryResult,
10471047
)
10481048

10491049
async def status(

src/hyperspell/types/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from __future__ import annotations
44

5-
from .query import Query as Query
65
from .token import Token as Token
76
from .memory import Memory as Memory
7+
from .shared import QueryResult as QueryResult
88
from .memory_status import MemoryStatus as MemoryStatus
99
from .auth_me_response import AuthMeResponse as AuthMeResponse
1010
from .memory_add_params import MemoryAddParams as MemoryAddParams
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .query_result import QueryResult as QueryResult

src/hyperspell/types/query.py renamed to src/hyperspell/types/shared/query_result.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
from typing import Dict, List, Optional
44

5-
from .memory import Memory
6-
from .._models import BaseModel
5+
from ..memory import Memory
6+
from ..._models import BaseModel
77

8-
__all__ = ["Query"]
8+
__all__ = ["QueryResult"]
99

1010

11-
class Query(BaseModel):
11+
class QueryResult(BaseModel):
1212
documents: List[Memory]
1313

1414
answer: Optional[str] = None

tests/api_resources/test_evaluate.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
from hyperspell import Hyperspell, AsyncHyperspell
1111
from tests.utils import assert_matches_type
1212
from hyperspell.types import (
13-
Query,
1413
EvaluateScoreQueryResponse,
1514
EvaluateScoreHighlightResponse,
1615
)
16+
from hyperspell.types.shared import QueryResult
1717

1818
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1919

@@ -26,7 +26,7 @@ def test_method_get_query(self, client: Hyperspell) -> None:
2626
evaluate = client.evaluate.get_query(
2727
"query_id",
2828
)
29-
assert_matches_type(Query, evaluate, path=["response"])
29+
assert_matches_type(QueryResult, evaluate, path=["response"])
3030

3131
@parametrize
3232
def test_raw_response_get_query(self, client: Hyperspell) -> None:
@@ -37,7 +37,7 @@ def test_raw_response_get_query(self, client: Hyperspell) -> None:
3737
assert response.is_closed is True
3838
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
3939
evaluate = response.parse()
40-
assert_matches_type(Query, evaluate, path=["response"])
40+
assert_matches_type(QueryResult, evaluate, path=["response"])
4141

4242
@parametrize
4343
def test_streaming_response_get_query(self, client: Hyperspell) -> None:
@@ -48,7 +48,7 @@ def test_streaming_response_get_query(self, client: Hyperspell) -> None:
4848
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
4949

5050
evaluate = response.parse()
51-
assert_matches_type(Query, evaluate, path=["response"])
51+
assert_matches_type(QueryResult, evaluate, path=["response"])
5252

5353
assert cast(Any, response.is_closed) is True
5454

@@ -163,7 +163,7 @@ async def test_method_get_query(self, async_client: AsyncHyperspell) -> None:
163163
evaluate = await async_client.evaluate.get_query(
164164
"query_id",
165165
)
166-
assert_matches_type(Query, evaluate, path=["response"])
166+
assert_matches_type(QueryResult, evaluate, path=["response"])
167167

168168
@parametrize
169169
async def test_raw_response_get_query(self, async_client: AsyncHyperspell) -> None:
@@ -174,7 +174,7 @@ async def test_raw_response_get_query(self, async_client: AsyncHyperspell) -> No
174174
assert response.is_closed is True
175175
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
176176
evaluate = await response.parse()
177-
assert_matches_type(Query, evaluate, path=["response"])
177+
assert_matches_type(QueryResult, evaluate, path=["response"])
178178

179179
@parametrize
180180
async def test_streaming_response_get_query(self, async_client: AsyncHyperspell) -> None:
@@ -185,7 +185,7 @@ async def test_streaming_response_get_query(self, async_client: AsyncHyperspell)
185185
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
186186

187187
evaluate = await response.parse()
188-
assert_matches_type(Query, evaluate, path=["response"])
188+
assert_matches_type(QueryResult, evaluate, path=["response"])
189189

190190
assert cast(Any, response.is_closed) is True
191191

tests/api_resources/test_memories.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
from hyperspell import Hyperspell, AsyncHyperspell
1111
from tests.utils import assert_matches_type
1212
from hyperspell.types import (
13-
Query,
1413
Memory,
1514
MemoryStatus,
1615
MemoryDeleteResponse,
1716
MemoryStatusResponse,
1817
)
1918
from hyperspell._utils import parse_datetime
2019
from hyperspell.pagination import SyncCursorPage, AsyncCursorPage
20+
from hyperspell.types.shared import QueryResult
2121

2222
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
2323

@@ -191,7 +191,7 @@ def test_method_search(self, client: Hyperspell) -> None:
191191
memory = client.memories.search(
192192
query="query",
193193
)
194-
assert_matches_type(Query, memory, path=["response"])
194+
assert_matches_type(QueryResult, memory, path=["response"])
195195

196196
@parametrize
197197
def test_method_search_with_all_params(self, client: Hyperspell) -> None:
@@ -265,7 +265,7 @@ def test_method_search_with_all_params(self, client: Hyperspell) -> None:
265265
},
266266
sources=["collections"],
267267
)
268-
assert_matches_type(Query, memory, path=["response"])
268+
assert_matches_type(QueryResult, memory, path=["response"])
269269

270270
@parametrize
271271
def test_raw_response_search(self, client: Hyperspell) -> None:
@@ -276,7 +276,7 @@ def test_raw_response_search(self, client: Hyperspell) -> None:
276276
assert response.is_closed is True
277277
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
278278
memory = response.parse()
279-
assert_matches_type(Query, memory, path=["response"])
279+
assert_matches_type(QueryResult, memory, path=["response"])
280280

281281
@parametrize
282282
def test_streaming_response_search(self, client: Hyperspell) -> None:
@@ -287,7 +287,7 @@ def test_streaming_response_search(self, client: Hyperspell) -> None:
287287
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
288288

289289
memory = response.parse()
290-
assert_matches_type(Query, memory, path=["response"])
290+
assert_matches_type(QueryResult, memory, path=["response"])
291291

292292
assert cast(Any, response.is_closed) is True
293293

@@ -527,7 +527,7 @@ async def test_method_search(self, async_client: AsyncHyperspell) -> None:
527527
memory = await async_client.memories.search(
528528
query="query",
529529
)
530-
assert_matches_type(Query, memory, path=["response"])
530+
assert_matches_type(QueryResult, memory, path=["response"])
531531

532532
@parametrize
533533
async def test_method_search_with_all_params(self, async_client: AsyncHyperspell) -> None:
@@ -601,7 +601,7 @@ async def test_method_search_with_all_params(self, async_client: AsyncHyperspell
601601
},
602602
sources=["collections"],
603603
)
604-
assert_matches_type(Query, memory, path=["response"])
604+
assert_matches_type(QueryResult, memory, path=["response"])
605605

606606
@parametrize
607607
async def test_raw_response_search(self, async_client: AsyncHyperspell) -> None:
@@ -612,7 +612,7 @@ async def test_raw_response_search(self, async_client: AsyncHyperspell) -> None:
612612
assert response.is_closed is True
613613
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
614614
memory = await response.parse()
615-
assert_matches_type(Query, memory, path=["response"])
615+
assert_matches_type(QueryResult, memory, path=["response"])
616616

617617
@parametrize
618618
async def test_streaming_response_search(self, async_client: AsyncHyperspell) -> None:
@@ -623,7 +623,7 @@ async def test_streaming_response_search(self, async_client: AsyncHyperspell) ->
623623
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
624624

625625
memory = await response.parse()
626-
assert_matches_type(Query, memory, path=["response"])
626+
assert_matches_type(QueryResult, memory, path=["response"])
627627

628628
assert cast(Any, response.is_closed) is True
629629

0 commit comments

Comments
 (0)