Skip to content

Commit bdbe8e1

Browse files
feat(api): api update
1 parent 5304250 commit bdbe8e1

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
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: 12
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-ee3e5367e2c30e5e66d7ef26a20b4d55dbe739a120a3465c48b9bbe106a28940.yml
3-
openapi_spec_hash: a017a75019d7cc692e9ca7d7c6fedd8e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-4066d19206db91d6b4e638e78240ed568844eb3065b073126f0161fc95c39adc.yml
3+
openapi_spec_hash: 13b1fddffd88cb50d29b54280f58e526
44
config_hash: da009f16a6b9b4db17be2949180ace1e

src/hyperspell/resources/documents.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def add(
156156
text: str,
157157
collection: Optional[str] | NotGiven = NOT_GIVEN,
158158
date: Union[str, datetime] | NotGiven = NOT_GIVEN,
159+
resource_id: str | NotGiven = NOT_GIVEN,
159160
title: Optional[str] | NotGiven = NOT_GIVEN,
160161
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
161162
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -180,6 +181,9 @@ def add(
180181
the date of the last message). This helps the ranking algorithm and allows you
181182
to filter by date range.
182183
184+
resource_id: The resource ID to add the document to. If not provided, a new resource ID will
185+
be generated. If provided, the document will be updated if it already exists.
186+
183187
title: Title of the document.
184188
185189
extra_headers: Send extra headers
@@ -197,6 +201,7 @@ def add(
197201
"text": text,
198202
"collection": collection,
199203
"date": date,
204+
"resource_id": resource_id,
200205
"title": title,
201206
},
202207
document_add_params.DocumentAddParams,
@@ -493,6 +498,7 @@ async def add(
493498
text: str,
494499
collection: Optional[str] | NotGiven = NOT_GIVEN,
495500
date: Union[str, datetime] | NotGiven = NOT_GIVEN,
501+
resource_id: str | NotGiven = NOT_GIVEN,
496502
title: Optional[str] | NotGiven = NOT_GIVEN,
497503
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
498504
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -517,6 +523,9 @@ async def add(
517523
the date of the last message). This helps the ranking algorithm and allows you
518524
to filter by date range.
519525
526+
resource_id: The resource ID to add the document to. If not provided, a new resource ID will
527+
be generated. If provided, the document will be updated if it already exists.
528+
520529
title: Title of the document.
521530
522531
extra_headers: Send extra headers
@@ -534,6 +543,7 @@ async def add(
534543
"text": text,
535544
"collection": collection,
536545
"date": date,
546+
"resource_id": resource_id,
537547
"title": title,
538548
},
539549
document_add_params.DocumentAddParams,

src/hyperspell/types/document_add_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,12 @@ class DocumentAddParams(TypedDict, total=False):
2727
range.
2828
"""
2929

30+
resource_id: str
31+
"""The resource ID to add the document to.
32+
33+
If not provided, a new resource ID will be generated. If provided, the document
34+
will be updated if it already exists.
35+
"""
36+
3037
title: Optional[str]
3138
"""Title of the document."""

tests/api_resources/test_documents.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_method_add_with_all_params(self, client: Hyperspell) -> None:
7171
text="text",
7272
collection="collection",
7373
date=parse_datetime("2019-12-27T18:11:19.117Z"),
74+
resource_id="resource_id",
7475
title="title",
7576
)
7677
assert_matches_type(DocumentStatus, document, path=["response"])
@@ -257,6 +258,7 @@ async def test_method_add_with_all_params(self, async_client: AsyncHyperspell) -
257258
text="text",
258259
collection="collection",
259260
date=parse_datetime("2019-12-27T18:11:19.117Z"),
261+
resource_id="resource_id",
260262
title="title",
261263
)
262264
assert_matches_type(DocumentStatus, document, path=["response"])

0 commit comments

Comments
 (0)