File size: 918 Bytes
a840639
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from pydantic import BaseModel
from typing import List


class Chunk(BaseModel):
    content: str
    source: str
    tags: List[str] = []
    type: str = "prg"


class Settings:
    response_schema = {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "content": {
                    "type": "string",
                    "description": "Text of the chunk (100-500 words, do not cut mid-sentence/paragraph/table)",
                },
                "source": {"type": "string", "description": "PDF filename"},
                "tags": {"type": "array", "items": {"type": "string"}},
                "type": {
                    "type": "string",
                    "description": "Chunk type",
                    "default": "prg",
                },
            },
            "required": ["content", "source", "tags", "type"],
        },
    }