View Source InstructorLite.JSONSchema (instructor_lite v0.3.0)

Helper module to generate JSON Schema based on Ecto schema.

JSON Schema comes in many flavors and different LLMs have different limitations. Currently, this module aims to implement a schema suitable for OpenAI structured outputs. This type of JSON schema may not be optimal or compatible with other models. Therefore, it's recommended to use this module as a starting point to generate a schema during development. You can then manually refine the schema and either implement it in the InstructorLite.Instruction.json_schema/0 callback or pass it as an option.

Warning

For the reasons described above, neither backward compatibility nor compatibility with all built-in adapters are goals of this module.

Summary

Functions

Generates a JSON Schema from an Ecto schema.

Functions

from_ecto_schema(ecto_schema)

Generates a JSON Schema from an Ecto schema.