@@ -152,6 +152,36 @@ paths:
152
152
application/json :
153
153
schema :
154
154
$ref : " #/components/schemas/HttpError"
155
+ /guards/{guardName}/openai/v1/chat/completions :
156
+ post :
157
+ operationId : openaiChatCompletion
158
+ tags :
159
+ - openai
160
+ summary : OpenAI SDK compatible endpoint for Chat Completions
161
+ parameters :
162
+ - $ref : " #/components/parameters/GuardName"
163
+ security :
164
+ - ApiKeyAuth : []
165
+ - BearerAuth : []
166
+ requestBody :
167
+ required : true
168
+ content :
169
+ application/json :
170
+ schema :
171
+ $ref : " #/components/schemas/OpenAIChatCompletionPayload"
172
+ responses :
173
+ " 200 " :
174
+ description : The output of the completion
175
+ content :
176
+ application/json :
177
+ schema :
178
+ $ref : " #/components/schemas/OpenAIChatCompletion"
179
+ default :
180
+ description : Unexpected error
181
+ content :
182
+ application/json :
183
+ schema :
184
+ $ref : " #/components/schemas/HttpError"
155
185
/guards/{guardName}/validate :
156
186
post :
157
187
operationId : validate
@@ -252,6 +282,59 @@ components:
252
282
type : string
253
283
format : password
254
284
schemas :
285
+ OpenAIChatCompletionPayload :
286
+ type : object
287
+ properties :
288
+ model :
289
+ type : string
290
+ description : The model to use for the completion
291
+ example : gpt-3.5-turbo
292
+ messages :
293
+ type : array
294
+ items :
295
+ type : object
296
+ properties :
297
+ role :
298
+ type : string
299
+ description : The role of the message
300
+ content :
301
+ type : string
302
+ description : The content of the message
303
+ description : The messages to use for the completion
304
+ max_tokens :
305
+ type : integer
306
+ description : The maximum number of tokens to generate
307
+ temperature :
308
+ type : number
309
+ description : The sampling temperature
310
+ OpenAIChatCompletion :
311
+ type : object
312
+ properties :
313
+ id :
314
+ type : string
315
+ description : The id
316
+ created :
317
+ type : string
318
+ description : The created date
319
+ model_name :
320
+ type : string
321
+ description : The model name
322
+ choices :
323
+ type : array
324
+ items :
325
+ type : object
326
+ properties :
327
+ role :
328
+ type : string
329
+ description : The role of the message
330
+ content :
331
+ type : string
332
+ description : The content of the message
333
+ required :
334
+ - id
335
+ - created
336
+ - model_name
337
+ - choices
255
338
HttpError :
256
339
type : object
257
340
properties :
0 commit comments