forked from rnadigital/agentcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.rs
92 lines (84 loc) · 2.46 KB
/
models.rs
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use bson::DateTime;
use mongodb::bson::{doc, oid::ObjectId};
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct DatasourceConnectionSettings {
pub syncCatalog: Value,
pub scheduleType: String,
pub namespaceDefinition: Option<String>,
pub namespaceFormat: Option<String>,
pub nonBreakingSchemaUpdatesBehavior: String,
pub prefix: Option<String>,
pub name: String,
pub sourceId: String,
pub destinationId: String,
pub status: String,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct DataSources {
pub _id: ObjectId,
pub orgId: ObjectId,
pub teamId: ObjectId,
pub modelId: Option<ObjectId>,
pub name: String,
pub description: Option<String>,
pub filename: Option<String>,
pub originalName: String,
pub sourceType: String,
pub sourceId: Option<String>,
pub syncedCount: Option<i32>,
pub embeddedCount: Option<i32>,
pub destinationId: Option<String>,
pub workspaceId: Option<String>,
pub connectionId: Option<String>,
pub chunkStrategy: Option<String>,
pub chunkCharacter: Option<String>,
pub lastSyncedDate: Option<DateTime>,
pub embeddingField: Option<String>,
pub createdDate: Option<DateTime>,
pub status: String,
}
#[derive(Serialize, Deserialize)]
pub enum ChunkingStrategy {
SEMANTIC_CHUNKING,
CHARACTER_CHUNKING,
CODE_SPLIT,
UNKNOWN,
}
impl From<String> for ChunkingStrategy {
fn from(value: String) -> Self {
match value.as_str() {
"semantic" => ChunkingStrategy::SEMANTIC_CHUNKING,
"character" => ChunkingStrategy::CHARACTER_CHUNKING,
"code" => ChunkingStrategy::CODE_SPLIT,
_ => ChunkingStrategy::UNKNOWN,
}
}
}
#[derive(Serialize, Deserialize, Clone)]
pub struct Model {
pub _id: ObjectId,
pub orgId: ObjectId,
pub teamId: ObjectId,
pub credentialId: Option<ObjectId>,
pub name: String,
pub model: String,
pub embeddingLength: i32,
pub modelType: String,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct CredentialsObj {
pub key: Option<String>,
pub endpoint: Option<String>,
pub org: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Credentials {
pub _id: ObjectId,
pub orgId: ObjectId,
pub teamId: ObjectId,
pub name: String,
pub createdDate: Option<DateTime>,
pub credentials: Option<CredentialsObj>,
}