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,
)
| 531 | raise ApiError(status_code=_response.status_code, body=_response_json) |
| 532 | |
| 533 | async def report( |
| 534 | self, |
| 535 | *, |
| 536 | requested_at: typing.Optional[float] = OMIT, |
| 537 | received_at: typing.Optional[float] = OMIT, |
| 538 | req_payload: typing.Optional[typing.Any] = OMIT, |
| 539 | resp_payload: typing.Optional[typing.Any] = OMIT, |
| 540 | status_code: typing.Optional[float] = OMIT, |
| 541 | error_message: typing.Optional[str] = OMIT, |
| 542 | tags: typing.Optional[typing.Dict[str, ReportRequestTagsValue]] = OMIT, |
| 543 | ) -> ReportResponse: |
| 544 | """ |
| 545 | Report an API call |
| 546 | |
| 547 | Parameters: |
| 548 | - requested_at: typing.Optional[float]. Unix timestamp in milliseconds |
| 549 | |
| 550 | - received_at: typing.Optional[float]. Unix timestamp in milliseconds |
| 551 | |
| 552 | - req_payload: typing.Optional[typing.Any]. |
| 553 | |
| 554 | - resp_payload: typing.Optional[typing.Any]. |
| 555 | |
| 556 | - status_code: typing.Optional[float]. HTTP status code of response |
| 557 | |
| 558 | - error_message: typing.Optional[str]. User-friendly error message |
| 559 | |
| 560 | - tags: typing.Optional[typing.Dict[str, ReportRequestTagsValue]]. Extra tags to attach to the call for filtering. Eg { "userId": "123", "promptId": "populate-title" } |
| 561 | --- |
| 562 | from OpenPipe.client import AsyncOpenPipeApi |
| 563 | |
| 564 | client = AsyncOpenPipeApi( |
| 565 | token="YOUR_TOKEN", |
| 566 | ) |
| 567 | await client.report() |
| 568 | """ |
| 569 | _request: typing.Dict[str, typing.Any] = {} |
| 570 | if requested_at is not OMIT: |
| 571 | _request["requestedAt"] = requested_at |
| 572 | if received_at is not OMIT: |
| 573 | _request["receivedAt"] = received_at |
| 574 | if req_payload is not OMIT: |
| 575 | _request["reqPayload"] = req_payload |
| 576 | if resp_payload is not OMIT: |
| 577 | _request["respPayload"] = resp_payload |
| 578 | if status_code is not OMIT: |
| 579 | _request["statusCode"] = status_code |
| 580 | if error_message is not OMIT: |
| 581 | _request["errorMessage"] = error_message |
| 582 | if tags is not OMIT: |
| 583 | _request["tags"] = tags |
| 584 | _response = await self._client_wrapper.httpx_client.request( |
| 585 | "POST", |
| 586 | urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "report"), |
| 587 | json=jsonable_encoder(_request), |
| 588 | headers=self._client_wrapper.get_headers(), |
| 589 | timeout=240, |
| 590 | ) |
nothing calls this directly
no test coverage detected