-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.py
More file actions
63 lines (54 loc) · 1.91 KB
/
schema.py
File metadata and controls
63 lines (54 loc) · 1.91 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from pydantic import BaseModel
from uuid import uuid4
class IngestionRequest(BaseModel):
"""A model representing an ingestion request for document processing.
Parameters
----------
communityId : str
The unique identifier of the community.
platformId : str
The unique identifier of the platform.
text : str
The text content to be processed.
metadata : dict
Additional metadata associated with the document.
docId : str, optional
Unique identifier for the document. If not provided, a UUID will be generated.
Default is a new UUID.
excludedEmbedMetadataKeys : list[str], optional
List of metadata keys to exclude from embedding process.
Default is an empty list.
excludedLlmMetadataKeys : list[str], optional
List of metadata keys to exclude from LLM processing.
Default is an empty list.
collectionName : str | None, optional
The name of the collection to use for the document.
Default is `None` means it would follow the default pattern of `[communityId]_[platformId]`
"""
communityId: str
platformId: str
text: str
metadata: dict
docId: str = str(uuid4())
excludedEmbedMetadataKeys: list[str] = []
excludedLlmMetadataKeys: list[str] = []
collectionName: str | None = None
class BatchDocument(BaseModel):
"""A model representing a document for batch ingestion.
"""
docId: str
text: str
metadata: dict
excludedEmbedMetadataKeys: list[str] = []
excludedLlmMetadataKeys: list[str] = []
class BatchIngestionRequest(BaseModel):
"""A model representing a batch of ingestion requests for document processing.
Parameters
----------
ingestion_requests : list[IngestionRequest]
A list of ingestion requests.
"""
communityId: str
platformId: str
collectionName: str | None = None
document: list[BatchDocument]