ExOpenAI.Codegen.parse_component_schema

You're seeing just the function parse_component_schema, go back to ExOpenAI.Codegen module for more information.
Link to this function

parse_component_schema(map)

View Source

Parses the given schema recursively into a normalize representation such as %{description: "", example: "", name: "", type: ""}.

A "component schema" is what is defined in the original OpenAI openapi document under the path /components/schema and could look like this:

  ChatCompletionRequestMessage:
    type: object
    properties:
    content:
      type: string
      description: The contents of the message
    name:
      type: string
      description: The name of the user in a multi-user chat
    required:
    - name
  • required_props will consist of all properties that were listed under the "required" list
  • optional_props will be all others

"Type" will get normalized into a internal representation consiting of all it's nested children that can be unfolded easily later on:

  • "string" -> "string"
  • "integer" -> "integer"
  • "object" -> {:object, %{nestedobject...}}
  • "array" -> {:array, "string" | "integer" | etc}