MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / report

Method report

client-libs/python/openpipe/api_client/client.py:182–246  ·  view source on GitHub ↗

Report an API call Parameters: - requested_at: typing.Optional[float]. Unix timestamp in milliseconds - received_at: typing.Optional[float]. Unix timestamp in milliseconds - req_payload: typing.Optional[typing.Any]. - resp_payload:

(
        self,
        *,
        requested_at: typing.Optional[float] = OMIT,
        received_at: typing.Optional[float] = OMIT,
        req_payload: typing.Optional[typing.Any] = OMIT,
        resp_payload: typing.Optional[typing.Any] = OMIT,
        status_code: typing.Optional[float] = OMIT,
        error_message: typing.Optional[str] = OMIT,
        tags: typing.Optional[typing.Dict[str, ReportRequestTagsValue]] = OMIT,
    )

Source from the content-addressed store, hash-verified

180 raise ApiError(status_code=_response.status_code, body=_response_json)
181
182 def report(
183 self,
184 *,
185 requested_at: typing.Optional[float] = OMIT,
186 received_at: typing.Optional[float] = OMIT,
187 req_payload: typing.Optional[typing.Any] = OMIT,
188 resp_payload: typing.Optional[typing.Any] = OMIT,
189 status_code: typing.Optional[float] = OMIT,
190 error_message: typing.Optional[str] = OMIT,
191 tags: typing.Optional[typing.Dict[str, ReportRequestTagsValue]] = OMIT,
192 ) -> ReportResponse:
193 """
194 Report an API call
195
196 Parameters:
197 - requested_at: typing.Optional[float]. Unix timestamp in milliseconds
198
199 - received_at: typing.Optional[float]. Unix timestamp in milliseconds
200
201 - req_payload: typing.Optional[typing.Any].
202
203 - resp_payload: typing.Optional[typing.Any].
204
205 - status_code: typing.Optional[float]. HTTP status code of response
206
207 - error_message: typing.Optional[str]. User-friendly error message
208
209 - tags: typing.Optional[typing.Dict[str, ReportRequestTagsValue]]. Extra tags to attach to the call for filtering. Eg { "userId": "123", "promptId": "populate-title" }
210 ---
211 from OpenPipe.client import OpenPipeApi
212
213 client = OpenPipeApi(
214 token="YOUR_TOKEN",
215 )
216 client.report()
217 """
218 _request: typing.Dict[str, typing.Any] = {}
219 if requested_at is not OMIT:
220 _request["requestedAt"] = requested_at
221 if received_at is not OMIT:
222 _request["receivedAt"] = received_at
223 if req_payload is not OMIT:
224 _request["reqPayload"] = req_payload
225 if resp_payload is not OMIT:
226 _request["respPayload"] = resp_payload
227 if status_code is not OMIT:
228 _request["statusCode"] = status_code
229 if error_message is not OMIT:
230 _request["errorMessage"] = error_message
231 if tags is not OMIT:
232 _request["tags"] = tags
233 _response = self._client_wrapper.httpx_client.request(
234 "POST",
235 urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "report"),
236 json=jsonable_encoder(_request),
237 headers=self._client_wrapper.get_headers(),
238 timeout=240,
239 )

Callers

nothing calls this directly

Calls 6

jsonable_encoderFunction · 0.90
ApiErrorClass · 0.90
get_base_urlMethod · 0.80
get_headersMethod · 0.80
requestMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected