DEPRECATED: we no longer support prompt caching. Parameters: - requested_at: float. Unix timestamp in milliseconds - req_payload: typing.Optional[typing.Any]. - tags: typing.Optional[typing.Dict[str, str]]. Extra tags to attach to the call for
(
self,
*,
requested_at: float,
req_payload: typing.Optional[typing.Any] = OMIT,
tags: typing.Optional[typing.Dict[str, str]] = OMIT,
)
| 59 | ) |
| 60 | |
| 61 | def check_cache( |
| 62 | self, |
| 63 | *, |
| 64 | requested_at: float, |
| 65 | req_payload: typing.Optional[typing.Any] = OMIT, |
| 66 | tags: typing.Optional[typing.Dict[str, str]] = OMIT, |
| 67 | ) -> CheckCacheResponse: |
| 68 | """ |
| 69 | DEPRECATED: we no longer support prompt caching. |
| 70 | |
| 71 | Parameters: |
| 72 | - requested_at: float. Unix timestamp in milliseconds |
| 73 | |
| 74 | - req_payload: typing.Optional[typing.Any]. |
| 75 | |
| 76 | - tags: typing.Optional[typing.Dict[str, str]]. Extra tags to attach to the call for filtering. Eg { "userId": "123", "promptId": "populate-title" } |
| 77 | """ |
| 78 | _request: typing.Dict[str, typing.Any] = {"requestedAt": requested_at} |
| 79 | if req_payload is not OMIT: |
| 80 | _request["reqPayload"] = req_payload |
| 81 | if tags is not OMIT: |
| 82 | _request["tags"] = tags |
| 83 | _response = self._client_wrapper.httpx_client.request( |
| 84 | "POST", |
| 85 | urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "check-cache"), |
| 86 | json=jsonable_encoder(_request), |
| 87 | headers=self._client_wrapper.get_headers(), |
| 88 | timeout=240, |
| 89 | ) |
| 90 | if 200 <= _response.status_code < 300: |
| 91 | return pydantic.parse_obj_as(CheckCacheResponse, _response.json()) # type: ignore |
| 92 | try: |
| 93 | _response_json = _response.json() |
| 94 | except JSONDecodeError: |
| 95 | raise ApiError(status_code=_response.status_code, body=_response.text) |
| 96 | raise ApiError(status_code=_response.status_code, body=_response_json) |
| 97 | |
| 98 | def create_chat_completion( |
| 99 | self, |
nothing calls this directly
no test coverage detected