Skip to content

Commit

Permalink
feat(filepurpose): add generic file purpose (#346)
Browse files Browse the repository at this point in the history
Signed-off-by: Radek Ježek <pc.jezek@gmail.com>
  • Loading branch information
jezekra1 committed Apr 16, 2024
1 parent 9a97422 commit 60b991e
Show file tree
Hide file tree
Showing 4 changed files with 341 additions and 339 deletions.
9 changes: 5 additions & 4 deletions src/genai/schema/_api.py
@@ -1,5 +1,5 @@
# generated by datamodel-codegen:
# filename: 2024-03-22_openapi_schema
# filename: 2024-04-09_openapi_schema

from __future__ import annotations

Expand Down Expand Up @@ -110,6 +110,7 @@ class FilePurpose(str, Enum):
TEMPLATE = "template"
TUNE_IMPORT = "tune_import"
EXTRACTION = "extraction"
GENERIC_STRUCTURED = "generic_structured"


class FileResult(ApiBaseModel):
Expand Down Expand Up @@ -557,7 +558,7 @@ class BetaTimeSerieLimitRetrieveResponse(ApiBaseModel):


class _FileCreateParametersQuery(ApiBaseModel):
version: Literal["2023-12-15"] = "2023-12-15"
version: Literal["2024-04-09"] = "2024-04-09"


class _FileCreateRequest(ApiBaseModel):
Expand Down Expand Up @@ -591,7 +592,7 @@ class FileIdPatchResponse(ApiBaseModel):


class _FileIdRetrieveParametersQuery(ApiBaseModel):
version: Literal["2023-12-15"] = "2023-12-15"
version: Literal["2024-04-09"] = "2024-04-09"


class FileIdRetrieveResponse(ApiBaseModel):
Expand All @@ -606,7 +607,7 @@ class _FileRetrieveParametersQuery(ApiBaseModel):
search: Optional[str] = None
purpose: Optional[FilePurpose] = None
format_id: Optional[int] = None
version: Literal["2023-12-15"] = "2023-12-15"
version: Literal["2024-04-09"] = "2024-04-09"


class FileRetrieveResponse(ApiBaseModel):
Expand Down
6 changes: 3 additions & 3 deletions src/genai/schema/_endpoints.py
Expand Up @@ -51,13 +51,13 @@ class BetaTimeSerieLimitRetrieveEndpoint(ApiEndpoint):
class FileRetrieveEndpoint(ApiEndpoint):
path: str = "/v2/files"
method: str = "GET"
version: str = "2023-12-15"
version: str = "2024-04-09"


class FileCreateEndpoint(ApiEndpoint):
path: str = "/v2/files"
method: str = "POST"
version: str = "2023-12-15"
version: str = "2024-04-09"


class FileIdDeleteEndpoint(ApiEndpoint):
Expand All @@ -69,7 +69,7 @@ class FileIdDeleteEndpoint(ApiEndpoint):
class FileIdRetrieveEndpoint(ApiEndpoint):
path: str = "/v2/files/{id}"
method: str = "GET"
version: str = "2023-12-15"
version: str = "2024-04-09"


class FileIdPatchEndpoint(ApiEndpoint):
Expand Down
Expand Up @@ -15,23 +15,23 @@ interactions:
content-type:
- multipart/form-data; boundary=BOUNDARY
method: POST
uri: https://api.com/v2/files?version=2023-12-15
uri: https://api.com/v2/files?version=2024-04-09
response:
body:
string: '{"result":{"id":"28a0b804-0176-40d8-b0cb-386c9d7559d0","bytes":42,"file_name":"file.json","purpose":"template","storage_provider_location":"us-east","created_at":"2024-03-06T20:48:35.000Z","updated_at":"2024-03-06T20:48:35.000Z","file_formats":[],"descendants":[]}}'
string: '{"result":{"id":"89223a19-8324-4add-81c3-fd3bfadc7610","bytes":42,"file_name":"file.json","purpose":"template","storage_provider_location":"us-east","created_at":"2024-04-16T09:07:23.000Z","updated_at":"2024-04-16T09:07:23.000Z","file_formats":[],"descendants":[]}}'
headers:
Connection:
- keep-alive
Date:
- Wed, 06 Mar 2024 20:48:34 GMT
- Tue, 16 Apr 2024 09:07:23 GMT
Keep-Alive:
- timeout=72
content-length:
- '265'
content-type:
- application/json; charset=utf-8
content-version:
- '2023-12-15'
- '2024-04-09'
vary:
- accept-encoding
x-ratelimit-limit:
Expand All @@ -53,23 +53,23 @@ interactions:
connection:
- keep-alive
method: GET
uri: https://api.com/v2/files?search=file.json&version=2023-12-15
uri: https://api.com/v2/files?search=file.json&version=2024-04-09
response:
body:
string: '{"results":[{"id":"28a0b804-0176-40d8-b0cb-386c9d7559d0","bytes":"42","file_name":"file.json","purpose":"template","storage_provider_location":"us-east","created_at":"2024-03-06T20:48:35.000Z","updated_at":"2024-03-06T20:48:35.000Z","file_formats":[],"descendants":[]}],"total_count":1}'
string: '{"results":[{"id":"89223a19-8324-4add-81c3-fd3bfadc7610","bytes":"42","file_name":"file.json","purpose":"template","storage_provider_location":"us-east","created_at":"2024-04-16T09:07:23.000Z","updated_at":"2024-04-16T09:07:23.000Z","file_formats":[],"descendants":[]}],"total_count":1}'
headers:
Connection:
- keep-alive
Date:
- Wed, 06 Mar 2024 20:48:35 GMT
- Tue, 16 Apr 2024 09:07:23 GMT
Keep-Alive:
- timeout=72
content-length:
- '286'
content-type:
- application/json; charset=utf-8
content-version:
- '2023-12-15'
- '2024-04-09'
vary:
- accept-encoding
x-ratelimit-limit:
Expand All @@ -91,23 +91,23 @@ interactions:
connection:
- keep-alive
method: GET
uri: https://api.com/v2/files/28a0b804-0176-40d8-b0cb-386c9d7559d0?version=2023-12-15
uri: https://api.com/v2/files/89223a19-8324-4add-81c3-fd3bfadc7610?version=2024-04-09
response:
body:
string: '{"result":{"id":"28a0b804-0176-40d8-b0cb-386c9d7559d0","bytes":"42","file_name":"file.json","purpose":"template","storage_provider_location":"us-east","created_at":"2024-03-06T20:48:35.000Z","updated_at":"2024-03-06T20:48:35.000Z","file_formats":[],"descendants":[]}}'
string: '{"result":{"id":"89223a19-8324-4add-81c3-fd3bfadc7610","bytes":"42","file_name":"file.json","purpose":"template","storage_provider_location":"us-east","created_at":"2024-04-16T09:07:23.000Z","updated_at":"2024-04-16T09:07:23.000Z","file_formats":[],"descendants":[]}}'
headers:
Connection:
- keep-alive
Date:
- Wed, 06 Mar 2024 20:48:36 GMT
- Tue, 16 Apr 2024 09:07:24 GMT
Keep-Alive:
- timeout=72
content-length:
- '267'
content-type:
- application/json; charset=utf-8
content-version:
- '2023-12-15'
- '2024-04-09'
vary:
- accept-encoding
x-ratelimit-limit:
Expand All @@ -129,15 +129,15 @@ interactions:
connection:
- keep-alive
method: GET
uri: https://api.com/v2/files/28a0b804-0176-40d8-b0cb-386c9d7559d0/content?version=2023-11-22
uri: https://api.com/v2/files/89223a19-8324-4add-81c3-fd3bfadc7610/content?version=2023-11-22
response:
body:
string: '{"data": "EXAMPLE TEMPLATE {{variable}}}"}'
headers:
Connection:
- keep-alive
Date:
- Wed, 06 Mar 2024 20:48:37 GMT
- Tue, 16 Apr 2024 09:07:25 GMT
Keep-Alive:
- timeout=72
Transfer-Encoding:
Expand Down Expand Up @@ -174,19 +174,19 @@ interactions:
content-type:
- multipart/form-data; boundary=BOUNDARY
method: PATCH
uri: https://api.com/v2/files/28a0b804-0176-40d8-b0cb-386c9d7559d0?version=2023-11-22
uri: https://api.com/v2/files/89223a19-8324-4add-81c3-fd3bfadc7610?version=2023-11-22
response:
body:
string: '{"result":{"id":"28a0b804-0176-40d8-b0cb-386c9d7559d0","bytes":50,"file_name":"file_updated.json","purpose":"template","storage_provider_location":"us-east","created_at":"2024-03-06T20:48:35.000Z","updated_at":"2024-03-06T20:48:39.417Z","file_formats":[],"descendants":[]}}'
string: '{"result":{"id":"89223a19-8324-4add-81c3-fd3bfadc7610","bytes":50,"file_name":"file_updated.json","purpose":"template","storage_provider_location":"us-east","created_at":"2024-04-16T09:07:23.000Z","updated_at":"2024-04-16T09:07:27.778Z","file_formats":[],"descendants":[]}}'
headers:
Connection:
- keep-alive
Date:
- Wed, 06 Mar 2024 20:48:39 GMT
- Tue, 16 Apr 2024 09:07:28 GMT
Keep-Alive:
- timeout=72
content-length:
- '262'
- '273'
content-type:
- application/json; charset=utf-8
content-version:
Expand All @@ -212,15 +212,15 @@ interactions:
connection:
- keep-alive
method: GET
uri: https://api.com/v2/files/28a0b804-0176-40d8-b0cb-386c9d7559d0/content?version=2023-11-22
uri: https://api.com/v2/files/89223a19-8324-4add-81c3-fd3bfadc7610/content?version=2023-11-22
response:
body:
string: '{"data": "UPDATED EXAMPLE TEMPLATE {{variable}}}"}'
headers:
Connection:
- keep-alive
Date:
- Wed, 06 Mar 2024 20:48:41 GMT
- Tue, 16 Apr 2024 09:07:29 GMT
Keep-Alive:
- timeout=72
Transfer-Encoding:
Expand Down Expand Up @@ -252,15 +252,15 @@ interactions:
connection:
- keep-alive
method: DELETE
uri: https://api.com/v2/files/28a0b804-0176-40d8-b0cb-386c9d7559d0?version=2023-11-22
uri: https://api.com/v2/files/89223a19-8324-4add-81c3-fd3bfadc7610?version=2023-11-22
response:
body:
string: ''
headers:
Connection:
- keep-alive
Date:
- Wed, 06 Mar 2024 20:48:42 GMT
- Tue, 16 Apr 2024 09:07:30 GMT
Keep-Alive:
- timeout=72
content-version:
Expand All @@ -284,23 +284,23 @@ interactions:
connection:
- keep-alive
method: GET
uri: https://api.com/v2/files?search=file.json&version=2023-12-15
uri: https://api.com/v2/files?search=file.json&version=2024-04-09
response:
body:
string: '{"results":[],"total_count":0}'
headers:
Connection:
- keep-alive
Date:
- Wed, 06 Mar 2024 20:48:43 GMT
- Tue, 16 Apr 2024 09:07:31 GMT
Keep-Alive:
- timeout=72
content-length:
- '30'
content-type:
- application/json; charset=utf-8
content-version:
- '2023-12-15'
- '2024-04-09'
vary:
- accept-encoding
x-ratelimit-limit:
Expand Down

0 comments on commit 60b991e

Please sign in to comment.