Skip to content

Commit 36322ec

Browse files
feat: convert models API to use a FastAPI router (#4407)
# What does this PR do? Migrate from @webmethod decorators to FastAPI router pattern Closes #4347 Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
1 parent 8f0dbe5 commit 36322ec

File tree

14 files changed

+673
-188
lines changed

14 files changed

+673
-188
lines changed

client-sdks/stainless/openapi.yml

Lines changed: 68 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ paths:
991991
get:
992992
responses:
993993
'200':
994-
description: A OpenAIListModelsResponse.
994+
description: A list of OpenAI model objects.
995995
content:
996996
application/json:
997997
schema:
@@ -1010,13 +1010,13 @@ paths:
10101010
$ref: '#/components/responses/DefaultError'
10111011
tags:
10121012
- Models
1013-
summary: Openai List Models
1013+
summary: List models using the OpenAI API.
10141014
description: List models using the OpenAI API.
10151015
operationId: openai_list_models_v1_models_get
10161016
post:
10171017
responses:
10181018
'200':
1019-
description: A Model.
1019+
description: The registered model object.
10201020
content:
10211021
application/json:
10221022
schema:
@@ -1035,11 +1035,8 @@ paths:
10351035
$ref: '#/components/responses/DefaultError'
10361036
tags:
10371037
- Models
1038-
summary: Register Model
1039-
description: |-
1040-
Register model.
1041-
1042-
Register a model.
1038+
summary: Register a model.
1039+
description: Register a model.
10431040
operationId: register_model_v1_models_post
10441041
requestBody:
10451042
content:
@@ -1052,69 +1049,67 @@ paths:
10521049
get:
10531050
responses:
10541051
'200':
1055-
description: A Model.
1052+
description: The model object.
10561053
content:
10571054
application/json:
10581055
schema:
10591056
$ref: '#/components/schemas/Model'
10601057
'400':
1061-
description: Bad Request
10621058
$ref: '#/components/responses/BadRequest400'
1059+
description: Bad Request
10631060
'429':
1064-
description: Too Many Requests
10651061
$ref: '#/components/responses/TooManyRequests429'
1062+
description: Too Many Requests
10661063
'500':
1067-
description: Internal Server Error
10681064
$ref: '#/components/responses/InternalServerError500'
1065+
description: Internal Server Error
10691066
default:
1070-
description: Default Response
10711067
$ref: '#/components/responses/DefaultError'
1068+
description: Default Response
10721069
tags:
10731070
- Models
1074-
summary: Get Model
1075-
description: |-
1076-
Get model.
1077-
1078-
Get a model by its identifier.
1071+
summary: Get a model by its identifier.
1072+
description: Get a model by its identifier.
10791073
operationId: get_model_v1_models__model_id__get
10801074
parameters:
10811075
- name: model_id
10821076
in: path
10831077
required: true
10841078
schema:
10851079
type: string
1086-
description: 'Path parameter: model_id'
1080+
description: The ID of the model to get.
1081+
title: Model Id
1082+
description: The ID of the model to get.
10871083
delete:
10881084
responses:
10891085
'400':
1090-
description: Bad Request
10911086
$ref: '#/components/responses/BadRequest400'
1087+
description: Bad Request
10921088
'429':
1093-
description: Too Many Requests
10941089
$ref: '#/components/responses/TooManyRequests429'
1090+
description: Too Many Requests
10951091
'500':
1096-
description: Internal Server Error
10971092
$ref: '#/components/responses/InternalServerError500'
1093+
description: Internal Server Error
10981094
default:
1099-
description: Default Response
11001095
$ref: '#/components/responses/DefaultError'
1096+
description: Default Response
11011097
'204':
1102-
description: Successful Response
1098+
description: The model was successfully unregistered.
11031099
tags:
11041100
- Models
1105-
summary: Unregister Model
1106-
description: |-
1107-
Unregister model.
1108-
1109-
Unregister a model.
1101+
summary: Unregister a model.
1102+
description: Unregister a model.
11101103
operationId: unregister_model_v1_models__model_id__delete
11111104
parameters:
11121105
- name: model_id
11131106
in: path
11141107
required: true
11151108
schema:
11161109
type: string
1117-
description: 'Path parameter: model_id'
1110+
description: The ID of the model to unregister.
1111+
title: Model Id
1112+
description: The ID of the model to unregister.
11181113
deprecated: true
11191114
/v1/moderations:
11201115
post:
@@ -6611,10 +6606,12 @@ components:
66116606
$ref: '#/components/schemas/OpenAIModel'
66126607
type: array
66136608
title: Data
6609+
description: List of OpenAI model objects.
66146610
type: object
66156611
required:
66166612
- data
66176613
title: OpenAIListModelsResponse
6614+
description: Response containing a list of OpenAI model objects.
66186615
Model:
66196616
properties:
66206617
identifier:
@@ -11618,29 +11615,35 @@ components:
1161811615
model_id:
1161911616
type: string
1162011617
title: Model Id
11618+
description: The identifier of the model to register.
1162111619
provider_model_id:
1162211620
anyOf:
1162311621
- type: string
1162411622
- type: 'null'
11623+
description: The identifier of the model in the provider.
1162511624
provider_id:
1162611625
anyOf:
1162711626
- type: string
1162811627
- type: 'null'
11628+
description: The identifier of the provider.
1162911629
metadata:
1163011630
anyOf:
1163111631
- additionalProperties: true
1163211632
type: object
1163311633
- type: 'null'
11634+
description: Any additional metadata for this model.
1163411635
model_type:
1163511636
anyOf:
1163611637
- $ref: '#/components/schemas/ModelType'
1163711638
title: ModelType
1163811639
- type: 'null'
11640+
description: The type of model to register.
1163911641
title: ModelType
1164011642
type: object
1164111643
required:
1164211644
- model_id
1164311645
title: RegisterModelRequest
11646+
description: Request model for registering a model.
1164411647
ParamType:
1164511648
discriminator:
1164611649
mapping:
@@ -13151,6 +13154,41 @@ components:
1315113154
- dataset_id
1315213155
title: UnregisterDatasetRequest
1315313156
type: object
13157+
ListModelsResponse:
13158+
description: Response containing a list of model objects.
13159+
properties:
13160+
data:
13161+
description: List of model objects.
13162+
items:
13163+
$ref: '#/components/schemas/Model'
13164+
title: Data
13165+
type: array
13166+
required:
13167+
- data
13168+
title: ListModelsResponse
13169+
type: object
13170+
GetModelRequest:
13171+
description: Request model for getting a model by ID.
13172+
properties:
13173+
model_id:
13174+
description: The ID of the model to get.
13175+
title: Model Id
13176+
type: string
13177+
required:
13178+
- model_id
13179+
title: GetModelRequest
13180+
type: object
13181+
UnregisterModelRequest:
13182+
description: Request model for unregistering a model.
13183+
properties:
13184+
model_id:
13185+
description: The ID of the model to unregister.
13186+
title: Model Id
13187+
type: string
13188+
required:
13189+
- model_id
13190+
title: UnregisterModelRequest
13191+
type: object
1315413192
DialogType:
1315513193
description: Parameter type for dialog data with semantic output labels.
1315613194
properties:

0 commit comments

Comments
 (0)