When generating types,client for the openai openapi spec, I see many errors similar to this example:
Duplicate types
// CreateChatCompletionResponse Represents a chat completion response returned by model, based on the provided input.
type CreateChatCompletionResponse struct {
// Choices A list of chat completion choices. Can be more than one if `n` is greater than 1.
Choices []struct {
// FinishReason The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,
// `length` if the maximum number of tokens specified in the request was reached,
// `content_filter` if content was omitted due to a flag from our content filters,
// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
FinishReason CreateChatCompletionResponseChoicesFinishReason `json:"finish_reason"`
// Index The index of the choice in the list of choices.
Index int `json:"index"`
//etc...
}
//...
type CreateChatCompletionResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *CreateChatCompletionResponse // name here matches both types
}
Error:
CreateChatCompletionResponse redeclared in this block
I believe this occurs when the schema for an operation's response has the same name as the generated name for <OperationId>Response, this is the yaml in question:
/chat/completions:
post:
operationId: createChatCompletion
tags:
- Chat
summary: Creates a model response for the given chat conversation.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateChatCompletionRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/CreateChatCompletionResponse"
Is there an expected flag to use to workaround this? Or is this a bug?
When generating
types,clientfor the openai openapi spec, I see many errors similar to this example:Duplicate types
Error:
I believe this occurs when the schema for an operation's response has the same name as the generated name for
<OperationId>Response, this is the yaml in question:Is there an expected flag to use to workaround this? Or is this a bug?