MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / genRequestBodySchema

Function genRequestBodySchema

module/ai-api/schema.go:58–76  ·  view source on GitHub ↗
(variables []*ai_api_dto.AiPromptVariable)

Source from the content-addressed store, hash-verified

56}
57
58func 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
78func genVariableSchema(variables []*ai_api_dto.AiPromptVariable) *openapi3.Schema {
79 variableSchema := openapi3.NewObjectSchema()

Callers 1

genRequestBodyFunction · 0.85

Calls 1

genVariableSchemaFunction · 0.85

Tested by

no test coverage detected