Skip to content

Commit 9cfa06b

Browse files
feat(api): api update (#86)
1 parent 4597f85 commit 9cfa06b

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-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: 10
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-22761e18c9e84e2bc357771cca49e85f66b8d6b76c7f6e682effe2501ea3cf2e.yml
3-
openapi_spec_hash: b467d9287bf9504412b7252da9e46fb7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-18698512a973e239c981a42d11523d0fb47dfb597894d1dce89da76013cab7fa.yml
3+
openapi_spec_hash: 1e66229ea35397cba6c3908d812a5631
44
config_hash: 63e7969fd7c560b6105e1de79148b568

src/hyperspell/resources/query.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def search(
5151
self,
5252
*,
5353
query: str,
54+
answer: bool | NotGiven = NOT_GIVEN,
5455
filter: query_search_params.Filter | NotGiven = NOT_GIVEN,
5556
max_results: int | NotGiven = NOT_GIVEN,
5657
sources: List[
@@ -81,6 +82,8 @@ def search(
8182
Args:
8283
query: Query to run.
8384
85+
answer: If true, the query will be answered along with matching source documents.
86+
8487
filter: Filter the query results.
8588
8689
max_results: Maximum number of results to return.
@@ -100,6 +103,7 @@ def search(
100103
body=maybe_transform(
101104
{
102105
"query": query,
106+
"answer": answer,
103107
"filter": filter,
104108
"max_results": max_results,
105109
"sources": sources,
@@ -137,6 +141,7 @@ async def search(
137141
self,
138142
*,
139143
query: str,
144+
answer: bool | NotGiven = NOT_GIVEN,
140145
filter: query_search_params.Filter | NotGiven = NOT_GIVEN,
141146
max_results: int | NotGiven = NOT_GIVEN,
142147
sources: List[
@@ -167,6 +172,8 @@ async def search(
167172
Args:
168173
query: Query to run.
169174
175+
answer: If true, the query will be answered along with matching source documents.
176+
170177
filter: Filter the query results.
171178
172179
max_results: Maximum number of results to return.
@@ -186,6 +193,7 @@ async def search(
186193
body=await async_maybe_transform(
187194
{
188195
"query": query,
196+
"answer": answer,
189197
"filter": filter,
190198
"max_results": max_results,
191199
"sources": sources,

src/hyperspell/types/query_search_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class QuerySearchParams(TypedDict, total=False):
1515
query: Required[str]
1616
"""Query to run."""
1717

18+
answer: bool
19+
"""If true, the query will be answered along with matching source documents."""
20+
1821
filter: Filter
1922
"""Filter the query results."""
2023

src/hyperspell/types/query_search_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class Error(BaseModel):
4242
class QuerySearchResponse(BaseModel):
4343
documents: List[Document]
4444

45+
answer: Optional[str] = None
46+
"""The answer to the query, if the request was set to answer."""
47+
4548
errors: Optional[List[Error]] = None
4649
"""Errors that occurred during the query.
4750

tests/api_resources/test_query.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def test_method_search(self, client: Hyperspell) -> None:
2929
def test_method_search_with_all_params(self, client: Hyperspell) -> None:
3030
query = client.query.search(
3131
query="query",
32+
answer=True,
3233
filter={
3334
"after": parse_datetime("2019-12-27T18:11:19.117Z"),
3435
"before": parse_datetime("2019-12-27T18:11:19.117Z"),
@@ -78,6 +79,7 @@ async def test_method_search(self, async_client: AsyncHyperspell) -> None:
7879
async def test_method_search_with_all_params(self, async_client: AsyncHyperspell) -> None:
7980
query = await async_client.query.search(
8081
query="query",
82+
answer=True,
8183
filter={
8284
"after": parse_datetime("2019-12-27T18:11:19.117Z"),
8385
"before": parse_datetime("2019-12-27T18:11:19.117Z"),

0 commit comments

Comments
 (0)