Files
minne/json_schema.md
2024-10-01 19:01:29 +02:00

2.1 KiB

In that case, here's an updated response schema that takes into account the entities being sources of knowledge and the user sending instructions and category with the LLM call:

{
  "type": "object",
  "properties": {
    "knowledge_sources": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {"type": "string"},
          "type": {"type": "string", "enum": ["Document", "Page", "TextSnippet"]},
          "title": {"type": "string"},
          "description": {"type": "string"},
          "relationships": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {"type": "string", "enum": ["RelatedTo", "RelevantTo", "SimilarTo"]},
                "target": {"type": "string", "description": "ID of the related knowledge source"}
              },
              "required": ["type", "target"]
            }
          }
        },
        "required": ["id", "type", "title", "description", "relationships"]
      }
    },
    "category": {"type": "string"},
    "instructions": {"type": "string"}
  },
  "required": ["knowledge_sources", "category", "instructions"],
  "additionalProperties": false
}

In this schema, the knowledge_sources array contains objects that represent individual sources of knowledge, with properties like id, type, title, description, and relationships. The relationships array contains objects that represent relationships between knowledge sources, with properties like type and target.

The category and instructions fields are also included as required properties, which will be populated with the user's input.

Note that I've used enums to restrict the values of the type fields in the knowledge_sources and relationships arrays. This ensures that the LLM can only return specific types of knowledge sources and relationships.

Also, as per your requirement, all fields are required, and additionalProperties is set to false to prevent the LLM from returning any additional fields not specified in the schema.