Skip to content

Commit ef744ef

Browse files
feat(api): update via SDK Studio
1 parent 04d45a7 commit ef744ef

File tree

11 files changed

+490
-22
lines changed

11 files changed

+490
-22
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 32
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-4dd01a1cc34bd1131d544f6d0123bb623c02d3352022df9f901574492b481b4c.yml
1+
configured_endpoints: 33
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-1f26653d7b3e3e626cc3f4b2778533b1536660b46bf39052befe85c7be594ec5.yml

api.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,21 @@ from contextual.types.agents import QueryResponse, QueryFeedbackResponse, QueryM
104104

105105
Methods:
106106

107-
- <code title="post /agents/{agent_id}/feedback">client.agents.query.<a href="./src/contextual/resources/agents/query.py">feedback</a>(agent_id, \*\*<a href="src/contextual/types/agents/query_feedback_params.py">params</a>) -> <a href="./src/contextual/types/agents/query_feedback_response.py">object</a></code>
108-
- <code title="get /agents/{agent_id}/metrics">client.agents.query.<a href="./src/contextual/resources/agents/query.py">metrics</a>(agent_id, \*\*<a href="src/contextual/types/agents/query_metrics_params.py">params</a>) -> <a href="./src/contextual/types/agents/query_metrics_response.py">QueryMetricsResponse</a></code>
109-
- <code title="post /agents/{agent_id}/query">client.agents.query.<a href="./src/contextual/resources/agents/query.py">start</a>(agent_id, \*\*<a href="src/contextual/types/agents/query_start_params.py">params</a>) -> <a href="./src/contextual/types/agents/query_response.py">QueryResponse</a></code>
107+
- <code title="post /agents/{agent_id}/feedback">client.agents.query.<a href="./src/contextual/resources/agents/query/query.py">feedback</a>(agent_id, \*\*<a href="src/contextual/types/agents/query_feedback_params.py">params</a>) -> <a href="./src/contextual/types/agents/query_feedback_response.py">object</a></code>
108+
- <code title="get /agents/{agent_id}/metrics">client.agents.query.<a href="./src/contextual/resources/agents/query/query.py">metrics</a>(agent_id, \*\*<a href="src/contextual/types/agents/query_metrics_params.py">params</a>) -> <a href="./src/contextual/types/agents/query_metrics_response.py">QueryMetricsResponse</a></code>
109+
- <code title="post /agents/{agent_id}/query">client.agents.query.<a href="./src/contextual/resources/agents/query/query.py">start</a>(agent_id, \*\*<a href="src/contextual/types/agents/query_start_params.py">params</a>) -> <a href="./src/contextual/types/agents/query_response.py">QueryResponse</a></code>
110+
111+
### Retrieval
112+
113+
Types:
114+
115+
```python
116+
from contextual.types.agents.query import RetrievalInfoResponse
117+
```
118+
119+
Methods:
120+
121+
- <code title="get /agents/{agent_id}/query/{message_id}/retrieval/info">client.agents.query.retrieval.<a href="./src/contextual/resources/agents/query/retrieval.py">info</a>(message_id, \*, agent_id, \*\*<a href="src/contextual/types/agents/query/retrieval_info_params.py">params</a>) -> <a href="./src/contextual/types/agents/query/retrieval_info_response.py">RetrievalInfoResponse</a></code>
110122

111123
## Evaluate
112124

src/contextual/resources/agents/agents.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66

77
import httpx
88

9-
from .query import (
10-
QueryResource,
11-
AsyncQueryResource,
12-
QueryResourceWithRawResponse,
13-
AsyncQueryResourceWithRawResponse,
14-
QueryResourceWithStreamingResponse,
15-
AsyncQueryResourceWithStreamingResponse,
16-
)
179
from ...types import agent_list_params, agent_create_params, agent_update_params
1810
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1911
from ..._utils import (
@@ -44,6 +36,14 @@
4436
async_to_raw_response_wrapper,
4537
async_to_streamed_response_wrapper,
4638
)
39+
from .query.query import (
40+
QueryResource,
41+
AsyncQueryResource,
42+
QueryResourceWithRawResponse,
43+
AsyncQueryResourceWithRawResponse,
44+
QueryResourceWithStreamingResponse,
45+
AsyncQueryResourceWithStreamingResponse,
46+
)
4747
from ...pagination import SyncPage, AsyncPage
4848
from ...types.agent import Agent
4949
from ..._base_client import AsyncPaginator, make_request_options
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .query import (
4+
QueryResource,
5+
AsyncQueryResource,
6+
QueryResourceWithRawResponse,
7+
AsyncQueryResourceWithRawResponse,
8+
QueryResourceWithStreamingResponse,
9+
AsyncQueryResourceWithStreamingResponse,
10+
)
11+
from .retrieval import (
12+
RetrievalResource,
13+
AsyncRetrievalResource,
14+
RetrievalResourceWithRawResponse,
15+
AsyncRetrievalResourceWithRawResponse,
16+
RetrievalResourceWithStreamingResponse,
17+
AsyncRetrievalResourceWithStreamingResponse,
18+
)
19+
20+
__all__ = [
21+
"RetrievalResource",
22+
"AsyncRetrievalResource",
23+
"RetrievalResourceWithRawResponse",
24+
"AsyncRetrievalResourceWithRawResponse",
25+
"RetrievalResourceWithStreamingResponse",
26+
"AsyncRetrievalResourceWithStreamingResponse",
27+
"QueryResource",
28+
"AsyncQueryResource",
29+
"QueryResourceWithRawResponse",
30+
"AsyncQueryResourceWithRawResponse",
31+
"QueryResourceWithStreamingResponse",
32+
"AsyncQueryResourceWithStreamingResponse",
33+
]

src/contextual/resources/agents/query.py renamed to src/contextual/resources/agents/query/query.py

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,40 @@
88

99
import httpx
1010

11-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12-
from ..._utils import (
11+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12+
from ...._utils import (
1313
maybe_transform,
1414
async_maybe_transform,
1515
)
16-
from ..._compat import cached_property
17-
from ..._resource import SyncAPIResource, AsyncAPIResource
18-
from ..._response import (
16+
from .retrieval import (
17+
RetrievalResource,
18+
AsyncRetrievalResource,
19+
RetrievalResourceWithRawResponse,
20+
AsyncRetrievalResourceWithRawResponse,
21+
RetrievalResourceWithStreamingResponse,
22+
AsyncRetrievalResourceWithStreamingResponse,
23+
)
24+
from ...._compat import cached_property
25+
from ...._resource import SyncAPIResource, AsyncAPIResource
26+
from ...._response import (
1927
to_raw_response_wrapper,
2028
to_streamed_response_wrapper,
2129
async_to_raw_response_wrapper,
2230
async_to_streamed_response_wrapper,
2331
)
24-
from ..._base_client import make_request_options
25-
from ...types.agents import query_start_params, query_metrics_params, query_feedback_params
26-
from ...types.agents.query_response import QueryResponse
27-
from ...types.agents.query_metrics_response import QueryMetricsResponse
32+
from ...._base_client import make_request_options
33+
from ....types.agents import query_start_params, query_metrics_params, query_feedback_params
34+
from ....types.agents.query_response import QueryResponse
35+
from ....types.agents.query_metrics_response import QueryMetricsResponse
2836

2937
__all__ = ["QueryResource", "AsyncQueryResource"]
3038

3139

3240
class QueryResource(SyncAPIResource):
41+
@cached_property
42+
def retrieval(self) -> RetrievalResource:
43+
return RetrievalResource(self._client)
44+
3345
@cached_property
3446
def with_raw_response(self) -> QueryResourceWithRawResponse:
3547
"""
@@ -243,6 +255,10 @@ def start(
243255

244256

245257
class AsyncQueryResource(AsyncAPIResource):
258+
@cached_property
259+
def retrieval(self) -> AsyncRetrievalResource:
260+
return AsyncRetrievalResource(self._client)
261+
246262
@cached_property
247263
def with_raw_response(self) -> AsyncQueryResourceWithRawResponse:
248264
"""
@@ -471,6 +487,10 @@ def __init__(self, query: QueryResource) -> None:
471487
query.start,
472488
)
473489

490+
@cached_property
491+
def retrieval(self) -> RetrievalResourceWithRawResponse:
492+
return RetrievalResourceWithRawResponse(self._query.retrieval)
493+
474494

475495
class AsyncQueryResourceWithRawResponse:
476496
def __init__(self, query: AsyncQueryResource) -> None:
@@ -486,6 +506,10 @@ def __init__(self, query: AsyncQueryResource) -> None:
486506
query.start,
487507
)
488508

509+
@cached_property
510+
def retrieval(self) -> AsyncRetrievalResourceWithRawResponse:
511+
return AsyncRetrievalResourceWithRawResponse(self._query.retrieval)
512+
489513

490514
class QueryResourceWithStreamingResponse:
491515
def __init__(self, query: QueryResource) -> None:
@@ -501,6 +525,10 @@ def __init__(self, query: QueryResource) -> None:
501525
query.start,
502526
)
503527

528+
@cached_property
529+
def retrieval(self) -> RetrievalResourceWithStreamingResponse:
530+
return RetrievalResourceWithStreamingResponse(self._query.retrieval)
531+
504532

505533
class AsyncQueryResourceWithStreamingResponse:
506534
def __init__(self, query: AsyncQueryResource) -> None:
@@ -515,3 +543,7 @@ def __init__(self, query: AsyncQueryResource) -> None:
515543
self.start = async_to_streamed_response_wrapper(
516544
query.start,
517545
)
546+
547+
@cached_property
548+
def retrieval(self) -> AsyncRetrievalResourceWithStreamingResponse:
549+
return AsyncRetrievalResourceWithStreamingResponse(self._query.retrieval)
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import List
6+
7+
import httpx
8+
9+
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from ...._utils import (
11+
maybe_transform,
12+
async_maybe_transform,
13+
)
14+
from ...._compat import cached_property
15+
from ...._resource import SyncAPIResource, AsyncAPIResource
16+
from ...._response import (
17+
to_raw_response_wrapper,
18+
to_streamed_response_wrapper,
19+
async_to_raw_response_wrapper,
20+
async_to_streamed_response_wrapper,
21+
)
22+
from ...._base_client import make_request_options
23+
from ....types.agents.query import retrieval_info_params
24+
from ....types.agents.query.retrieval_info_response import RetrievalInfoResponse
25+
26+
__all__ = ["RetrievalResource", "AsyncRetrievalResource"]
27+
28+
29+
class RetrievalResource(SyncAPIResource):
30+
@cached_property
31+
def with_raw_response(self) -> RetrievalResourceWithRawResponse:
32+
"""
33+
This property can be used as a prefix for any HTTP method call to return the
34+
the raw response object instead of the parsed content.
35+
36+
For more information, see https://www.github.com/stainless-sdks/sunrise-python#accessing-raw-response-data-eg-headers
37+
"""
38+
return RetrievalResourceWithRawResponse(self)
39+
40+
@cached_property
41+
def with_streaming_response(self) -> RetrievalResourceWithStreamingResponse:
42+
"""
43+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44+
45+
For more information, see https://www.github.com/stainless-sdks/sunrise-python#with_streaming_response
46+
"""
47+
return RetrievalResourceWithStreamingResponse(self)
48+
49+
def info(
50+
self,
51+
message_id: str,
52+
*,
53+
agent_id: str,
54+
content_ids: List[str],
55+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
56+
# The extra values given here take precedence over values defined on the client or passed to this method.
57+
extra_headers: Headers | None = None,
58+
extra_query: Query | None = None,
59+
extra_body: Body | None = None,
60+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
61+
) -> RetrievalInfoResponse:
62+
"""
63+
Return content metadata of the contents used to generate response for a given
64+
message.
65+
66+
Args:
67+
agent_id: Agent ID of the agent which sent the provided message.
68+
69+
message_id: Message ID for which the content metadata needs to be retrieved.
70+
71+
content_ids: List of content ids for which to get the metadata.
72+
73+
extra_headers: Send extra headers
74+
75+
extra_query: Add additional query parameters to the request
76+
77+
extra_body: Add additional JSON properties to the request
78+
79+
timeout: Override the client-level default timeout for this request, in seconds
80+
"""
81+
if not agent_id:
82+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
83+
if not message_id:
84+
raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
85+
return self._get(
86+
f"/agents/{agent_id}/query/{message_id}/retrieval/info",
87+
options=make_request_options(
88+
extra_headers=extra_headers,
89+
extra_query=extra_query,
90+
extra_body=extra_body,
91+
timeout=timeout,
92+
query=maybe_transform({"content_ids": content_ids}, retrieval_info_params.RetrievalInfoParams),
93+
),
94+
cast_to=RetrievalInfoResponse,
95+
)
96+
97+
98+
class AsyncRetrievalResource(AsyncAPIResource):
99+
@cached_property
100+
def with_raw_response(self) -> AsyncRetrievalResourceWithRawResponse:
101+
"""
102+
This property can be used as a prefix for any HTTP method call to return the
103+
the raw response object instead of the parsed content.
104+
105+
For more information, see https://www.github.com/stainless-sdks/sunrise-python#accessing-raw-response-data-eg-headers
106+
"""
107+
return AsyncRetrievalResourceWithRawResponse(self)
108+
109+
@cached_property
110+
def with_streaming_response(self) -> AsyncRetrievalResourceWithStreamingResponse:
111+
"""
112+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
113+
114+
For more information, see https://www.github.com/stainless-sdks/sunrise-python#with_streaming_response
115+
"""
116+
return AsyncRetrievalResourceWithStreamingResponse(self)
117+
118+
async def info(
119+
self,
120+
message_id: str,
121+
*,
122+
agent_id: str,
123+
content_ids: List[str],
124+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
125+
# The extra values given here take precedence over values defined on the client or passed to this method.
126+
extra_headers: Headers | None = None,
127+
extra_query: Query | None = None,
128+
extra_body: Body | None = None,
129+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
130+
) -> RetrievalInfoResponse:
131+
"""
132+
Return content metadata of the contents used to generate response for a given
133+
message.
134+
135+
Args:
136+
agent_id: Agent ID of the agent which sent the provided message.
137+
138+
message_id: Message ID for which the content metadata needs to be retrieved.
139+
140+
content_ids: List of content ids for which to get the metadata.
141+
142+
extra_headers: Send extra headers
143+
144+
extra_query: Add additional query parameters to the request
145+
146+
extra_body: Add additional JSON properties to the request
147+
148+
timeout: Override the client-level default timeout for this request, in seconds
149+
"""
150+
if not agent_id:
151+
raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}")
152+
if not message_id:
153+
raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
154+
return await self._get(
155+
f"/agents/{agent_id}/query/{message_id}/retrieval/info",
156+
options=make_request_options(
157+
extra_headers=extra_headers,
158+
extra_query=extra_query,
159+
extra_body=extra_body,
160+
timeout=timeout,
161+
query=await async_maybe_transform(
162+
{"content_ids": content_ids}, retrieval_info_params.RetrievalInfoParams
163+
),
164+
),
165+
cast_to=RetrievalInfoResponse,
166+
)
167+
168+
169+
class RetrievalResourceWithRawResponse:
170+
def __init__(self, retrieval: RetrievalResource) -> None:
171+
self._retrieval = retrieval
172+
173+
self.info = to_raw_response_wrapper(
174+
retrieval.info,
175+
)
176+
177+
178+
class AsyncRetrievalResourceWithRawResponse:
179+
def __init__(self, retrieval: AsyncRetrievalResource) -> None:
180+
self._retrieval = retrieval
181+
182+
self.info = async_to_raw_response_wrapper(
183+
retrieval.info,
184+
)
185+
186+
187+
class RetrievalResourceWithStreamingResponse:
188+
def __init__(self, retrieval: RetrievalResource) -> None:
189+
self._retrieval = retrieval
190+
191+
self.info = to_streamed_response_wrapper(
192+
retrieval.info,
193+
)
194+
195+
196+
class AsyncRetrievalResourceWithStreamingResponse:
197+
def __init__(self, retrieval: AsyncRetrievalResource) -> None:
198+
self._retrieval = retrieval
199+
200+
self.info = async_to_streamed_response_wrapper(
201+
retrieval.info,
202+
)

0 commit comments

Comments
 (0)