(variables []*ai_api_dto.AiPromptVariable)
| 56 | } |
| 57 | |
| 58 | func genRequestBodySchema(variables []*ai_api_dto.AiPromptVariable) *openapi3.Schema { |
| 59 | result := openapi3.NewObjectSchema() |
| 60 | required := make([]string, 0, 2) |
| 61 | required = append(required, "messages") |
| 62 | if len(variables) > 0 { |
| 63 | result.WithProperty("variables", genVariableSchema(variables)) |
| 64 | required = append(required, "variables") |
| 65 | } |
| 66 | |
| 67 | result.WithRequired(required) |
| 68 | streamSchema := openapi3.NewBoolSchema() |
| 69 | streamSchema.Title = "stream" |
| 70 | streamSchema.Description = "Whether to stream the response" |
| 71 | result.WithProperty("stream", streamSchema) |
| 72 | |
| 73 | result.WithPropertyRef("messages", messagesSchemaRef) |
| 74 | |
| 75 | return result |
| 76 | } |
| 77 | |
| 78 | func genVariableSchema(variables []*ai_api_dto.AiPromptVariable) *openapi3.Schema { |
| 79 | variableSchema := openapi3.NewObjectSchema() |
no test coverage detected