Skip to content

Commit 959b17f

Browse files
author
stlc-bot
committed
feat(feedback): add agent feedback endpoint (#1322)
Stainless-Generated-From: 63028f8
1 parent 4e63b62 commit 959b17f

9 files changed

Lines changed: 506 additions & 2 deletions

File tree

‎.stats.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 43
1+
configured_endpoints: 44

‎api.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,15 @@ Methods:
214214

215215
- <code title="get /logs/{request_id}">client.logs.<a href="./src/context/dev/resources/logs.py">retrieve</a>(request_id) -> <a href="./src/context/dev/types/log_retrieve_response.py">LogRetrieveResponse</a></code>
216216
- <code title="get /logs">client.logs.<a href="./src/context/dev/resources/logs.py">list</a>(\*\*<a href="src/context/dev/types/log_list_params.py">params</a>) -> <a href="./src/context/dev/types/log_list_response.py">LogListResponse</a></code>
217+
218+
# Feedback
219+
220+
Types:
221+
222+
```python
223+
from context.dev.types import FeedbackSubmitResponse
224+
```
225+
226+
Methods:
227+
228+
- <code title="post /feedback">client.feedback.<a href="./src/context/dev/resources/feedback.py">submit</a>(\*\*<a href="src/context/dev/types/feedback_submit_params.py">params</a>) -> <a href="./src/context/dev/types/feedback_submit_response.py">FeedbackSubmitResponse</a></code>

‎src/context/dev/_client.py‎

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
)
3636

3737
if TYPE_CHECKING:
38-
from .resources import web, logs, news, batch, brand, parse, people, utility, industry, monitors, webhooks
38+
from .resources import web, logs, news, batch, brand, parse, people, utility, feedback, industry, monitors, webhooks
3939
from .resources.web import WebResource, AsyncWebResource
4040
from .resources.logs import LogsResource, AsyncLogsResource
4141
from .resources.news import NewsResource, AsyncNewsResource
@@ -44,6 +44,7 @@
4444
from .resources.parse import ParseResource, AsyncParseResource
4545
from .resources.people import PeopleResource, AsyncPeopleResource
4646
from .resources.utility import UtilityResource, AsyncUtilityResource
47+
from .resources.feedback import FeedbackResource, AsyncFeedbackResource
4748
from .resources.industry import IndustryResource, AsyncIndustryResource
4849
from .resources.monitors import MonitorsResource, AsyncMonitorsResource
4950
from .resources.webhooks.webhooks import WebhooksResource, AsyncWebhooksResource
@@ -199,6 +200,16 @@ def logs(self) -> LogsResource:
199200

200201
return LogsResource(self)
201202

203+
@cached_property
204+
def feedback(self) -> FeedbackResource:
205+
"""Report bugs, docs mismatches, and friction with any Context.dev API.
206+
207+
Submissions cost no credits and use a separate rate limit.
208+
"""
209+
from .resources.feedback import FeedbackResource
210+
211+
return FeedbackResource(self)
212+
202213
@cached_property
203214
def with_raw_response(self) -> ContextDevWithRawResponse:
204215
return ContextDevWithRawResponse(self)
@@ -451,6 +462,16 @@ def logs(self) -> AsyncLogsResource:
451462

452463
return AsyncLogsResource(self)
453464

465+
@cached_property
466+
def feedback(self) -> AsyncFeedbackResource:
467+
"""Report bugs, docs mismatches, and friction with any Context.dev API.
468+
469+
Submissions cost no credits and use a separate rate limit.
470+
"""
471+
from .resources.feedback import AsyncFeedbackResource
472+
473+
return AsyncFeedbackResource(self)
474+
454475
@cached_property
455476
def with_raw_response(self) -> AsyncContextDevWithRawResponse:
456477
return AsyncContextDevWithRawResponse(self)
@@ -645,6 +666,16 @@ def logs(self) -> logs.LogsResourceWithRawResponse:
645666

646667
return LogsResourceWithRawResponse(self._client.logs)
647668

669+
@cached_property
670+
def feedback(self) -> feedback.FeedbackResourceWithRawResponse:
671+
"""Report bugs, docs mismatches, and friction with any Context.dev API.
672+
673+
Submissions cost no credits and use a separate rate limit.
674+
"""
675+
from .resources.feedback import FeedbackResourceWithRawResponse
676+
677+
return FeedbackResourceWithRawResponse(self._client.feedback)
678+
648679

649680
class AsyncContextDevWithRawResponse:
650681
_client: AsyncContextDev
@@ -727,6 +758,16 @@ def logs(self) -> logs.AsyncLogsResourceWithRawResponse:
727758

728759
return AsyncLogsResourceWithRawResponse(self._client.logs)
729760

761+
@cached_property
762+
def feedback(self) -> feedback.AsyncFeedbackResourceWithRawResponse:
763+
"""Report bugs, docs mismatches, and friction with any Context.dev API.
764+
765+
Submissions cost no credits and use a separate rate limit.
766+
"""
767+
from .resources.feedback import AsyncFeedbackResourceWithRawResponse
768+
769+
return AsyncFeedbackResourceWithRawResponse(self._client.feedback)
770+
730771

731772
class ContextDevWithStreamedResponse:
732773
_client: ContextDev
@@ -809,6 +850,16 @@ def logs(self) -> logs.LogsResourceWithStreamingResponse:
809850

810851
return LogsResourceWithStreamingResponse(self._client.logs)
811852

853+
@cached_property
854+
def feedback(self) -> feedback.FeedbackResourceWithStreamingResponse:
855+
"""Report bugs, docs mismatches, and friction with any Context.dev API.
856+
857+
Submissions cost no credits and use a separate rate limit.
858+
"""
859+
from .resources.feedback import FeedbackResourceWithStreamingResponse
860+
861+
return FeedbackResourceWithStreamingResponse(self._client.feedback)
862+
812863

813864
class AsyncContextDevWithStreamedResponse:
814865
_client: AsyncContextDev
@@ -891,6 +942,16 @@ def logs(self) -> logs.AsyncLogsResourceWithStreamingResponse:
891942

892943
return AsyncLogsResourceWithStreamingResponse(self._client.logs)
893944

945+
@cached_property
946+
def feedback(self) -> feedback.AsyncFeedbackResourceWithStreamingResponse:
947+
"""Report bugs, docs mismatches, and friction with any Context.dev API.
948+
949+
Submissions cost no credits and use a separate rate limit.
950+
"""
951+
from .resources.feedback import AsyncFeedbackResourceWithStreamingResponse
952+
953+
return AsyncFeedbackResourceWithStreamingResponse(self._client.feedback)
954+
894955

895956
Client = ContextDev
896957

‎src/context/dev/resources/__init__.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@
6464
UtilityResourceWithStreamingResponse,
6565
AsyncUtilityResourceWithStreamingResponse,
6666
)
67+
from .feedback import (
68+
FeedbackResource,
69+
AsyncFeedbackResource,
70+
FeedbackResourceWithRawResponse,
71+
AsyncFeedbackResourceWithRawResponse,
72+
FeedbackResourceWithStreamingResponse,
73+
AsyncFeedbackResourceWithStreamingResponse,
74+
)
6775
from .industry import (
6876
IndustryResource,
6977
AsyncIndustryResource,
@@ -156,4 +164,10 @@
156164
"AsyncLogsResourceWithRawResponse",
157165
"LogsResourceWithStreamingResponse",
158166
"AsyncLogsResourceWithStreamingResponse",
167+
"FeedbackResource",
168+
"AsyncFeedbackResource",
169+
"FeedbackResourceWithRawResponse",
170+
"AsyncFeedbackResourceWithRawResponse",
171+
"FeedbackResourceWithStreamingResponse",
172+
"AsyncFeedbackResourceWithStreamingResponse",
159173
]
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal
6+
7+
import httpx
8+
9+
from ..types import feedback_submit_params
10+
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
11+
from .._utils import maybe_transform, async_maybe_transform
12+
from .._compat import cached_property
13+
from .._resource import SyncAPIResource, AsyncAPIResource
14+
from .._response import (
15+
to_raw_response_wrapper,
16+
to_streamed_response_wrapper,
17+
async_to_raw_response_wrapper,
18+
async_to_streamed_response_wrapper,
19+
)
20+
from .._base_client import make_request_options
21+
from ..types.feedback_submit_response import FeedbackSubmitResponse
22+
23+
__all__ = ["FeedbackResource", "AsyncFeedbackResource"]
24+
25+
26+
class FeedbackResource(SyncAPIResource):
27+
"""Report bugs, docs mismatches, and friction with any Context.dev API.
28+
29+
Submissions cost no credits and use a separate rate limit.
30+
"""
31+
32+
@cached_property
33+
def with_raw_response(self) -> FeedbackResourceWithRawResponse:
34+
"""
35+
This property can be used as a prefix for any HTTP method call to return
36+
the raw response object instead of the parsed content.
37+
38+
For more information, see https://www.github.com/context-dot-dev/context-python-sdk#accessing-raw-response-data-eg-headers
39+
"""
40+
return FeedbackResourceWithRawResponse(self)
41+
42+
@cached_property
43+
def with_streaming_response(self) -> FeedbackResourceWithStreamingResponse:
44+
"""
45+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
46+
47+
For more information, see https://www.github.com/context-dot-dev/context-python-sdk#with_streaming_response
48+
"""
49+
return FeedbackResourceWithStreamingResponse(self)
50+
51+
def submit(
52+
self,
53+
*,
54+
category: Literal["bug", "docs_mismatch", "friction", "feature_gap", "quality_degradation", "other"],
55+
note: str,
56+
request_id: str | Omit = omit,
57+
tags: SequenceNotStr[str] | Omit = omit,
58+
url: str | Omit = omit,
59+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
60+
# The extra values given here take precedence over values defined on the client or passed to this method.
61+
extra_headers: Headers | None = None,
62+
extra_query: Query | None = None,
63+
extra_body: Body | None = None,
64+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
65+
) -> FeedbackSubmitResponse:
66+
"""Report a problem with a Context.dev API call, docs page, SDK, or CLI.
67+
68+
Include
69+
request_id, url, or both.
70+
71+
Args:
72+
category: Kind of issue.
73+
74+
note: What went wrong and what you expected instead.
75+
76+
request_id: The request_id of the API call the feedback is about, from its response body or
77+
X-Request-Id header.
78+
79+
tags: Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
80+
81+
url: The page the feedback is about, such as one page of a crawl or a docs page.
82+
83+
extra_headers: Send extra headers
84+
85+
extra_query: Add additional query parameters to the request
86+
87+
extra_body: Add additional JSON properties to the request
88+
89+
timeout: Override the client-level default timeout for this request, in seconds
90+
"""
91+
return self._post(
92+
"/feedback",
93+
body=maybe_transform(
94+
{
95+
"category": category,
96+
"note": note,
97+
"request_id": request_id,
98+
"tags": tags,
99+
"url": url,
100+
},
101+
feedback_submit_params.FeedbackSubmitParams,
102+
),
103+
options=make_request_options(
104+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
105+
),
106+
cast_to=FeedbackSubmitResponse,
107+
)
108+
109+
110+
class AsyncFeedbackResource(AsyncAPIResource):
111+
"""Report bugs, docs mismatches, and friction with any Context.dev API.
112+
113+
Submissions cost no credits and use a separate rate limit.
114+
"""
115+
116+
@cached_property
117+
def with_raw_response(self) -> AsyncFeedbackResourceWithRawResponse:
118+
"""
119+
This property can be used as a prefix for any HTTP method call to return
120+
the raw response object instead of the parsed content.
121+
122+
For more information, see https://www.github.com/context-dot-dev/context-python-sdk#accessing-raw-response-data-eg-headers
123+
"""
124+
return AsyncFeedbackResourceWithRawResponse(self)
125+
126+
@cached_property
127+
def with_streaming_response(self) -> AsyncFeedbackResourceWithStreamingResponse:
128+
"""
129+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
130+
131+
For more information, see https://www.github.com/context-dot-dev/context-python-sdk#with_streaming_response
132+
"""
133+
return AsyncFeedbackResourceWithStreamingResponse(self)
134+
135+
async def submit(
136+
self,
137+
*,
138+
category: Literal["bug", "docs_mismatch", "friction", "feature_gap", "quality_degradation", "other"],
139+
note: str,
140+
request_id: str | Omit = omit,
141+
tags: SequenceNotStr[str] | Omit = omit,
142+
url: str | Omit = omit,
143+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
144+
# The extra values given here take precedence over values defined on the client or passed to this method.
145+
extra_headers: Headers | None = None,
146+
extra_query: Query | None = None,
147+
extra_body: Body | None = None,
148+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
149+
) -> FeedbackSubmitResponse:
150+
"""Report a problem with a Context.dev API call, docs page, SDK, or CLI.
151+
152+
Include
153+
request_id, url, or both.
154+
155+
Args:
156+
category: Kind of issue.
157+
158+
note: What went wrong and what you expected instead.
159+
160+
request_id: The request_id of the API call the feedback is about, from its response body or
161+
X-Request-Id header.
162+
163+
tags: Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
164+
165+
url: The page the feedback is about, such as one page of a crawl or a docs page.
166+
167+
extra_headers: Send extra headers
168+
169+
extra_query: Add additional query parameters to the request
170+
171+
extra_body: Add additional JSON properties to the request
172+
173+
timeout: Override the client-level default timeout for this request, in seconds
174+
"""
175+
return await self._post(
176+
"/feedback",
177+
body=await async_maybe_transform(
178+
{
179+
"category": category,
180+
"note": note,
181+
"request_id": request_id,
182+
"tags": tags,
183+
"url": url,
184+
},
185+
feedback_submit_params.FeedbackSubmitParams,
186+
),
187+
options=make_request_options(
188+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
189+
),
190+
cast_to=FeedbackSubmitResponse,
191+
)
192+
193+
194+
class FeedbackResourceWithRawResponse:
195+
def __init__(self, feedback: FeedbackResource) -> None:
196+
self._feedback = feedback
197+
198+
self.submit = to_raw_response_wrapper(
199+
feedback.submit,
200+
)
201+
202+
203+
class AsyncFeedbackResourceWithRawResponse:
204+
def __init__(self, feedback: AsyncFeedbackResource) -> None:
205+
self._feedback = feedback
206+
207+
self.submit = async_to_raw_response_wrapper(
208+
feedback.submit,
209+
)
210+
211+
212+
class FeedbackResourceWithStreamingResponse:
213+
def __init__(self, feedback: FeedbackResource) -> None:
214+
self._feedback = feedback
215+
216+
self.submit = to_streamed_response_wrapper(
217+
feedback.submit,
218+
)
219+
220+
221+
class AsyncFeedbackResourceWithStreamingResponse:
222+
def __init__(self, feedback: AsyncFeedbackResource) -> None:
223+
self._feedback = feedback
224+
225+
self.submit = async_to_streamed_response_wrapper(
226+
feedback.submit,
227+
)

0 commit comments

Comments
 (0)