Skip to content

Commit 4bbaa8b

Browse files
feat(api): api update (#79)
1 parent 03045b6 commit 4bbaa8b

File tree

14 files changed

+95
-129
lines changed

14 files changed

+95
-129
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 10
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-f234f68066cbaa936bfa4ded50469ce229ade71284a5906bfb47209379889a19.yml
3-
openapi_spec_hash: 5a1addbaf095472b3f127bc60cfbca9b
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-48a7553ceffe2d8152a49b2a73b7a697ba7970643d2df03123cf18debbfe94f1.yml
3+
openapi_spec_hash: 95cd836db7dd399849563a9c60807257
44
config_hash: 63e7969fd7c560b6105e1de79148b568

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
Types:
44

55
```python
6-
from hyperspell.types import Document, DocumentStatus, Scores, DocumentListResponse
6+
from hyperspell.types import DocumentStatus, DocumentListResponse, DocumentGetResponse
77
```
88

99
Methods:
1010

1111
- <code title="get /documents/list">client.documents.<a href="./src/hyperspell/resources/documents.py">list</a>(\*\*<a href="src/hyperspell/types/document_list_params.py">params</a>) -> <a href="./src/hyperspell/types/document_list_response.py">SyncCursorPage[DocumentListResponse]</a></code>
1212
- <code title="post /documents/add">client.documents.<a href="./src/hyperspell/resources/documents.py">add</a>(\*\*<a href="src/hyperspell/types/document_add_params.py">params</a>) -> <a href="./src/hyperspell/types/document_status.py">DocumentStatus</a></code>
1313
- <code title="post /documents/scrape">client.documents.<a href="./src/hyperspell/resources/documents.py">add_url</a>(\*\*<a href="src/hyperspell/types/document_add_url_params.py">params</a>) -> <a href="./src/hyperspell/types/document_status.py">DocumentStatus</a></code>
14-
- <code title="get /documents/get/{document_id}">client.documents.<a href="./src/hyperspell/resources/documents.py">get</a>(document_id) -> <a href="./src/hyperspell/types/document.py">Document</a></code>
14+
- <code title="get /documents/get/{document_id}">client.documents.<a href="./src/hyperspell/resources/documents.py">get</a>(document_id) -> <a href="./src/hyperspell/types/document_get_response.py">DocumentGetResponse</a></code>
1515
- <code title="post /documents/upload">client.documents.<a href="./src/hyperspell/resources/documents.py">upload</a>(\*\*<a href="src/hyperspell/types/document_upload_params.py">params</a>) -> <a href="./src/hyperspell/types/document_status.py">DocumentStatus</a></code>
1616

1717
# Collections

src/hyperspell/resources/documents.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
)
3232
from ..pagination import SyncCursorPage, AsyncCursorPage
3333
from .._base_client import AsyncPaginator, make_request_options
34-
from ..types.document import Document
3534
from ..types.document_status import DocumentStatus
35+
from ..types.document_get_response import DocumentGetResponse
3636
from ..types.document_list_response import DocumentListResponse
3737

3838
__all__ = ["DocumentsResource", "AsyncDocumentsResource"]
@@ -111,7 +111,9 @@ def add(
111111
text: str,
112112
collection: Optional[str] | NotGiven = NOT_GIVEN,
113113
date: Union[str, datetime] | NotGiven = NOT_GIVEN,
114-
source: Literal["generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot"]
114+
source: Literal[
115+
"generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot", "reddit", "google-calendar"
116+
]
115117
| NotGiven = NOT_GIVEN,
116118
title: Optional[str] | NotGiven = NOT_GIVEN,
117119
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -228,7 +230,7 @@ def get(
228230
extra_query: Query | None = None,
229231
extra_body: Body | None = None,
230232
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
231-
) -> Document:
233+
) -> DocumentGetResponse:
232234
"""
233235
Retrieves a document by ID, including its collection name and sections.
234236
@@ -246,7 +248,7 @@ def get(
246248
options=make_request_options(
247249
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
248250
),
249-
cast_to=Document,
251+
cast_to=DocumentGetResponse,
250252
)
251253

252254
def upload(
@@ -376,7 +378,9 @@ async def add(
376378
text: str,
377379
collection: Optional[str] | NotGiven = NOT_GIVEN,
378380
date: Union[str, datetime] | NotGiven = NOT_GIVEN,
379-
source: Literal["generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot"]
381+
source: Literal[
382+
"generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot", "reddit", "google-calendar"
383+
]
380384
| NotGiven = NOT_GIVEN,
381385
title: Optional[str] | NotGiven = NOT_GIVEN,
382386
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -493,7 +497,7 @@ async def get(
493497
extra_query: Query | None = None,
494498
extra_body: Body | None = None,
495499
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
496-
) -> Document:
500+
) -> DocumentGetResponse:
497501
"""
498502
Retrieves a document by ID, including its collection name and sections.
499503
@@ -511,7 +515,7 @@ async def get(
511515
options=make_request_options(
512516
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
513517
),
514-
cast_to=Document,
518+
cast_to=DocumentGetResponse,
515519
)
516520

517521
async def upload(

src/hyperspell/resources/query.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def search(
5353
query: str,
5454
collections: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
5555
filter: query_search_params.Filter | NotGiven = NOT_GIVEN,
56-
include_elements: bool | NotGiven = NOT_GIVEN,
5756
max_results: int | NotGiven = NOT_GIVEN,
5857
query_type: Literal["auto", "semantic", "keyword"] | NotGiven = NOT_GIVEN,
5958
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -74,8 +73,6 @@ def search(
7473
7574
filter: Filter the query results.
7675
77-
include_elements: Include the elements of a section in the results.
78-
7976
max_results: Maximum number of results to return.
8077
8178
query_type: Type of query to run.
@@ -95,7 +92,6 @@ def search(
9592
"query": query,
9693
"collections": collections,
9794
"filter": filter,
98-
"include_elements": include_elements,
9995
"max_results": max_results,
10096
"query_type": query_type,
10197
},
@@ -134,7 +130,6 @@ async def search(
134130
query: str,
135131
collections: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
136132
filter: query_search_params.Filter | NotGiven = NOT_GIVEN,
137-
include_elements: bool | NotGiven = NOT_GIVEN,
138133
max_results: int | NotGiven = NOT_GIVEN,
139134
query_type: Literal["auto", "semantic", "keyword"] | NotGiven = NOT_GIVEN,
140135
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -155,8 +150,6 @@ async def search(
155150
156151
filter: Filter the query results.
157152
158-
include_elements: Include the elements of a section in the results.
159-
160153
max_results: Maximum number of results to return.
161154
162155
query_type: Type of query to run.
@@ -176,7 +169,6 @@ async def search(
176169
"query": query,
177170
"collections": collections,
178171
"filter": filter,
179-
"include_elements": include_elements,
180172
"max_results": max_results,
181173
"query_type": query_type,
182174
},

src/hyperspell/types/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
from __future__ import annotations
44

55
from .token import Token as Token
6-
from .scores import Scores as Scores
7-
from .document import Document as Document
86
from .collection import Collection as Collection
97
from .document_status import DocumentStatus as DocumentStatus
108
from .document_add_params import DocumentAddParams as DocumentAddParams
119
from .query_search_params import QuerySearchParams as QuerySearchParams
1210
from .document_list_params import DocumentListParams as DocumentListParams
11+
from .document_get_response import DocumentGetResponse as DocumentGetResponse
1312
from .query_search_response import QuerySearchResponse as QuerySearchResponse
1413
from .auth_user_token_params import AuthUserTokenParams as AuthUserTokenParams
1514
from .collection_list_params import CollectionListParams as CollectionListParams

src/hyperspell/types/document.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/hyperspell/types/document_add_params.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ class DocumentAddParams(TypedDict, total=False):
3131
range.
3232
"""
3333

34-
source: Literal["generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot"]
34+
source: Literal[
35+
"generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot", "reddit", "google-calendar"
36+
]
3537
"""Source of the document.
3638
3739
This helps in parsing the document. Note that some sources require the document
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
from datetime import datetime
5+
from typing_extensions import Literal
6+
7+
from .._models import BaseModel
8+
9+
__all__ = ["DocumentGetResponse", "Event"]
10+
11+
12+
class Event(BaseModel):
13+
message: str
14+
15+
type: Literal["error", "warning", "info"]
16+
17+
time: Optional[datetime] = None
18+
19+
20+
class DocumentGetResponse(BaseModel):
21+
collection: str
22+
23+
resource_id: str
24+
25+
source: Literal[
26+
"generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot", "reddit", "google-calendar"
27+
]
28+
29+
id: Optional[int] = None
30+
31+
data: Optional[List[object]] = None
32+
33+
events: Optional[List[Event]] = None
34+
35+
extra: Optional[object] = None
36+
37+
highlights: Optional[List[object]] = None
38+
39+
summary: Optional[str] = None
40+
41+
title: Optional[str] = None

src/hyperspell/types/document_list_response.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Dict, List, Union, Optional
3+
from typing import Dict, List, Optional
44
from datetime import datetime
55
from typing_extensions import Literal
66

7-
from .scores import Scores
87
from .._models import BaseModel
98

109
__all__ = ["DocumentListResponse", "Event", "Section"]
@@ -36,12 +35,10 @@ class Section(BaseModel):
3635

3736
metadata: Optional[Dict[str, object]] = None
3837

39-
scores: Optional[Scores] = None
40-
4138

4239
class DocumentListResponse(BaseModel):
43-
data: Union[List[object], object]
44-
"""Structured representation of the document"""
40+
data: List[object]
41+
"""Summary of the document"""
4542

4643
summary: str
4744
"""Summary of the document"""
@@ -65,7 +62,11 @@ class DocumentListResponse(BaseModel):
6562

6663
sections_count: Optional[int] = None
6764

68-
source: Optional[Literal["generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot"]] = None
65+
source: Optional[
66+
Literal[
67+
"generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot", "reddit", "google-calendar"
68+
]
69+
] = None
6970

7071
status: Optional[Literal["pending", "processing", "completed", "failed"]] = None
7172

@@ -96,5 +97,6 @@ class DocumentListResponse(BaseModel):
9697
"person",
9798
"company",
9899
"crm_contact",
100+
"event",
99101
]
100102
] = None

src/hyperspell/types/query_search_params.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ class QuerySearchParams(TypedDict, total=False):
2424
filter: Filter
2525
"""Filter the query results."""
2626

27-
include_elements: bool
28-
"""Include the elements of a section in the results."""
29-
3027
max_results: int
3128
"""Maximum number of results to return."""
3229

@@ -38,7 +35,11 @@ class Filter(TypedDict, total=False):
3835
end_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
3936
"""Only query documents before this date."""
4037

41-
source: List[Literal["generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot"]]
38+
source: List[
39+
Literal[
40+
"generic", "mcp", "slack", "s3", "gmail", "notion", "google_docs", "hubspot", "reddit", "google-calendar"
41+
]
42+
]
4243
"""Only query documents from these sources."""
4344

4445
start_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
@@ -69,6 +70,7 @@ class Filter(TypedDict, total=False):
6970
"person",
7071
"company",
7172
"crm_contact",
73+
"event",
7274
]
7375
]
7476
"""Only query documents of these types."""

0 commit comments

Comments
 (0)