dokuments 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dokuments/__init__.py +14 -0
- dokuments/api/project.json +139 -0
- dokuments/api/schema.graphql +378 -0
- dokuments/api/schema.py +1822 -0
- dokuments/arkitekt.py +73 -0
- dokuments/dokuments.py +9 -0
- dokuments/errors.py +4 -0
- dokuments/funcs.py +68 -0
- dokuments/py.typed +0 -0
- dokuments/rath.py +45 -0
- dokuments/rekuest.py +30 -0
- dokuments-0.4.0.dist-info/METADATA +24 -0
- dokuments-0.4.0.dist-info/RECORD +14 -0
- dokuments-0.4.0.dist-info/WHEEL +4 -0
dokuments/__init__.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_url": "http://localhost/dokuments/graphql",
|
|
3
|
+
"documents": "graphql/dokuments/*/**.graphql",
|
|
4
|
+
"extensions": {
|
|
5
|
+
"turms": {
|
|
6
|
+
"pydantic_version": "v2",
|
|
7
|
+
"domain": null,
|
|
8
|
+
"out_dir": "dokuments/api",
|
|
9
|
+
"dump_configuration": true,
|
|
10
|
+
"configuration_name": "project.json",
|
|
11
|
+
"dump_schema": true,
|
|
12
|
+
"schema_name": "schema.graphql",
|
|
13
|
+
"generated_name": "schema.py",
|
|
14
|
+
"documents": "graphql/dokuments/*/**.graphql",
|
|
15
|
+
"verbose": false,
|
|
16
|
+
"exit_on_error": true,
|
|
17
|
+
"allow_introspection": true,
|
|
18
|
+
"object_bases": [
|
|
19
|
+
"pydantic.BaseModel"
|
|
20
|
+
],
|
|
21
|
+
"interface_bases": null,
|
|
22
|
+
"always_resolve_interfaces": true,
|
|
23
|
+
"exclude_typenames": true,
|
|
24
|
+
"scalar_definitions": {
|
|
25
|
+
"uuid": "str",
|
|
26
|
+
"Callback": "str",
|
|
27
|
+
"Any": "typing.Any",
|
|
28
|
+
"JSON": "typing.Any",
|
|
29
|
+
"ID": "rath.scalars.ID"
|
|
30
|
+
},
|
|
31
|
+
"freeze": {
|
|
32
|
+
"enabled": true,
|
|
33
|
+
"types": [
|
|
34
|
+
"input",
|
|
35
|
+
"fragment",
|
|
36
|
+
"object"
|
|
37
|
+
],
|
|
38
|
+
"exclude": null,
|
|
39
|
+
"include": null,
|
|
40
|
+
"exclude_fields": [],
|
|
41
|
+
"include_fields": [],
|
|
42
|
+
"convert_list_to_tuple": true
|
|
43
|
+
},
|
|
44
|
+
"create_catchall": true,
|
|
45
|
+
"options": {
|
|
46
|
+
"enabled": true,
|
|
47
|
+
"extra": "forbid",
|
|
48
|
+
"allow_mutation": null,
|
|
49
|
+
"allow_population_by_field_name": true,
|
|
50
|
+
"orm_mode": null,
|
|
51
|
+
"use_enum_values": true,
|
|
52
|
+
"validate_assignment": null,
|
|
53
|
+
"types": [
|
|
54
|
+
"input"
|
|
55
|
+
],
|
|
56
|
+
"exclude": null,
|
|
57
|
+
"include": null
|
|
58
|
+
},
|
|
59
|
+
"skip_forwards": false,
|
|
60
|
+
"additional_bases": {},
|
|
61
|
+
"additional_config": {},
|
|
62
|
+
"force_plugin_order": true,
|
|
63
|
+
"parsers": [],
|
|
64
|
+
"plugins": [
|
|
65
|
+
{
|
|
66
|
+
"type": "turms.plugins.enums.EnumsPlugin"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"type": "turms.plugins.inputs.InputsPlugin"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"type": "turms.plugins.fragments.FragmentsPlugin"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"type": "turms.plugins.operations.OperationsPlugin"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "turms.plugins.funcs.FuncsPlugin",
|
|
79
|
+
"coercible_scalars": {
|
|
80
|
+
"ID": "rath.scalars.IDCoercible"
|
|
81
|
+
},
|
|
82
|
+
"expand_input_types": [
|
|
83
|
+
"input"
|
|
84
|
+
],
|
|
85
|
+
"global_kwargs": [
|
|
86
|
+
{
|
|
87
|
+
"type": "dokuments.rath.DokumentsRath",
|
|
88
|
+
"key": "rath",
|
|
89
|
+
"description": "The client we want to use (defaults to the currently active client)"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"definitions": [
|
|
93
|
+
{
|
|
94
|
+
"type": "subscription",
|
|
95
|
+
"is_async": true,
|
|
96
|
+
"use": "dokuments.funcs.asubscribe"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "query",
|
|
100
|
+
"is_async": true,
|
|
101
|
+
"use": "dokuments.funcs.aexecute"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "mutation",
|
|
105
|
+
"is_async": true,
|
|
106
|
+
"use": "dokuments.funcs.aexecute"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"type": "subscription",
|
|
110
|
+
"use": "dokuments.funcs.subscribe"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"type": "query",
|
|
114
|
+
"use": "dokuments.funcs.execute"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"type": "mutation",
|
|
118
|
+
"use": "dokuments.funcs.execute"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"processors": [
|
|
124
|
+
{
|
|
125
|
+
"type": "turms.processors.black.BlackProcessor"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"stylers": [
|
|
129
|
+
{
|
|
130
|
+
"type": "turms.stylers.default.DefaultStyler"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "turms.stylers.appender.AppenderStyler",
|
|
134
|
+
"append_fragment": ""
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
type Query {
|
|
2
|
+
rooms(filters: RoomFilter, pagination: OffsetPaginationInput): [Room!]!
|
|
3
|
+
providers(filters: ProviderFilter, pagination: OffsetPaginationInput): [Provider!]!
|
|
4
|
+
llmModels(filters: LLMModelFilter, pagination: OffsetPaginationInput): [LLMModel!]!
|
|
5
|
+
chromaCollections(filters: ChromaCollectionFilter, pagination: OffsetPaginationInput): [ChromaCollection!]!
|
|
6
|
+
room(id: ID!): Room!
|
|
7
|
+
documents(collection: ID!, queryTexts: [String!] = null, nResults: Int = 3, where: JSON = null): [Document!]!
|
|
8
|
+
llmModel(id: ID!): LLMModel!
|
|
9
|
+
chromaCollection(id: ID!): ChromaCollection!
|
|
10
|
+
provider(id: ID!): Provider!
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
"""Room(id, title, description, creator)"""
|
|
14
|
+
type Room {
|
|
15
|
+
id: ID!
|
|
16
|
+
|
|
17
|
+
"""The Title of the Room"""
|
|
18
|
+
title: String!
|
|
19
|
+
description: String!
|
|
20
|
+
messages(filters: MessageFilter, pagination: OffsetPaginationInput): [Message!]!
|
|
21
|
+
agents(pagination: OffsetPaginationInput): [Agent!]!
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
"""Message represent the message of an agent on a room"""
|
|
25
|
+
type Message {
|
|
26
|
+
id: ID!
|
|
27
|
+
title: String!
|
|
28
|
+
|
|
29
|
+
"""A clear text representation of the rich comment"""
|
|
30
|
+
text: String!
|
|
31
|
+
|
|
32
|
+
"""The user that created this comment"""
|
|
33
|
+
agent: Agent!
|
|
34
|
+
|
|
35
|
+
"""The collections that can be embedded with this model"""
|
|
36
|
+
attachedStructures: [Structure!]!
|
|
37
|
+
|
|
38
|
+
"""The time this comment got created"""
|
|
39
|
+
createdAt: DateTime!
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
"""Agent(id, room, name, client, user)"""
|
|
43
|
+
type Agent {
|
|
44
|
+
id: ID!
|
|
45
|
+
room: Room!
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
"""The type of the tool"""
|
|
49
|
+
type Structure {
|
|
50
|
+
identifier: String!
|
|
51
|
+
object: String!
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
"""Date with time (isoformat)"""
|
|
55
|
+
scalar DateTime
|
|
56
|
+
|
|
57
|
+
"""Message represent the message of an agent on a room"""
|
|
58
|
+
input MessageFilter {
|
|
59
|
+
ids: [ID!]
|
|
60
|
+
search: String
|
|
61
|
+
AND: MessageFilter
|
|
62
|
+
OR: MessageFilter
|
|
63
|
+
NOT: MessageFilter
|
|
64
|
+
DISTINCT: Boolean
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
input OffsetPaginationInput {
|
|
68
|
+
offset: Int! = 0
|
|
69
|
+
limit: Int
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
"""Room(id, title, description, creator)"""
|
|
73
|
+
input RoomFilter {
|
|
74
|
+
search: String
|
|
75
|
+
ids: [ID!]
|
|
76
|
+
AND: RoomFilter
|
|
77
|
+
OR: RoomFilter
|
|
78
|
+
NOT: RoomFilter
|
|
79
|
+
DISTINCT: Boolean
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
"""A provider of LLMs"""
|
|
83
|
+
type Provider {
|
|
84
|
+
id: String!
|
|
85
|
+
name: String!
|
|
86
|
+
apiKey: String!
|
|
87
|
+
apiBase: String!
|
|
88
|
+
additionalConfig: JSON!
|
|
89
|
+
models(filters: LLMModelFilter, pagination: OffsetPaginationInput): [LLMModel!]!
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
"""
|
|
93
|
+
The `JSON` scalar type represents JSON values as specified by [ECMA-404](https://ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf).
|
|
94
|
+
"""
|
|
95
|
+
scalar JSON
|
|
96
|
+
|
|
97
|
+
"""A LLM model to chage with"""
|
|
98
|
+
type LLMModel {
|
|
99
|
+
id: ID!
|
|
100
|
+
modelId: String!
|
|
101
|
+
label: String!
|
|
102
|
+
provider: Provider!
|
|
103
|
+
|
|
104
|
+
"""The features supported by the model"""
|
|
105
|
+
features: [FeatureType!]!
|
|
106
|
+
|
|
107
|
+
"""The collections that can be embedded with this model"""
|
|
108
|
+
embedderFor(filters: ChromaCollectionFilter, pagination: OffsetPaginationInput): [ChromaCollection!]!
|
|
109
|
+
|
|
110
|
+
"""The string to use for the LLM model"""
|
|
111
|
+
llmString: String!
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
"""The type of the thinking block"""
|
|
115
|
+
enum FeatureType {
|
|
116
|
+
EMBEDDING
|
|
117
|
+
CHATTING
|
|
118
|
+
CHAT
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
"""A collection of documents searchable by string"""
|
|
122
|
+
type ChromaCollection {
|
|
123
|
+
id: ID!
|
|
124
|
+
name: String!
|
|
125
|
+
description: String!
|
|
126
|
+
createdAt: DateTime!
|
|
127
|
+
owner: User!
|
|
128
|
+
count: Int!
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
"""A reflection on the real User"""
|
|
132
|
+
type User {
|
|
133
|
+
sub: String!
|
|
134
|
+
preferredUsername: String!
|
|
135
|
+
roles: [String!]!
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
"""Filter for ChromaCollection"""
|
|
139
|
+
input ChromaCollectionFilter {
|
|
140
|
+
search: String
|
|
141
|
+
ids: [ID!]
|
|
142
|
+
AND: ChromaCollectionFilter
|
|
143
|
+
OR: ChromaCollectionFilter
|
|
144
|
+
NOT: ChromaCollectionFilter
|
|
145
|
+
DISTINCT: Boolean
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
"""Filter for LLMModel"""
|
|
149
|
+
input LLMModelFilter {
|
|
150
|
+
ids: [ID!]
|
|
151
|
+
search: String
|
|
152
|
+
AND: LLMModelFilter
|
|
153
|
+
OR: LLMModelFilter
|
|
154
|
+
NOT: LLMModelFilter
|
|
155
|
+
DISTINCT: Boolean
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
"""Filter for Provider"""
|
|
159
|
+
input ProviderFilter {
|
|
160
|
+
search: String
|
|
161
|
+
ids: [ID!]
|
|
162
|
+
AND: ProviderFilter
|
|
163
|
+
OR: ProviderFilter
|
|
164
|
+
NOT: ProviderFilter
|
|
165
|
+
DISTINCT: Boolean
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
type Document {
|
|
169
|
+
id: String!
|
|
170
|
+
content: String!
|
|
171
|
+
distance: Float
|
|
172
|
+
metadata: JSON
|
|
173
|
+
|
|
174
|
+
"""A function definition for a large language model"""
|
|
175
|
+
structure: Structure
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
type Mutation {
|
|
179
|
+
createRoom(input: CreateRoomInput!): Room!
|
|
180
|
+
deleteRoom(input: DeleteRoomInput!): ID!
|
|
181
|
+
createProvider(input: ProviderInput!): Provider!
|
|
182
|
+
send(input: SendMessageInput!): Message!
|
|
183
|
+
chat(input: ChatInput!): ChatResponse!
|
|
184
|
+
pull(input: PullInput!): OllamaPullResult!
|
|
185
|
+
createCollection(input: ChromaCollectionInput!): ChromaCollection!
|
|
186
|
+
ensureCollection(input: ChromaCollectionInput!): ChromaCollection!
|
|
187
|
+
deleteCollection(input: AddDocumentsToCollectionInput!): ID!
|
|
188
|
+
addDocumentsToCollection(input: AddDocumentsToCollectionInput!): [Document!]!
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
input CreateRoomInput {
|
|
192
|
+
description: String = null
|
|
193
|
+
title: String = null
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
input DeleteRoomInput {
|
|
197
|
+
id: ID!
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
"""A large language model to change with"""
|
|
201
|
+
input ProviderInput {
|
|
202
|
+
description: String = null
|
|
203
|
+
name: String!
|
|
204
|
+
apiKey: String = null
|
|
205
|
+
apiBase: String = null
|
|
206
|
+
additionalConfig: JSON = null
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
input SendMessageInput {
|
|
210
|
+
room: ID!
|
|
211
|
+
agentId: String!
|
|
212
|
+
text: String!
|
|
213
|
+
parent: ID = null
|
|
214
|
+
notify: Boolean = null
|
|
215
|
+
attachStructures: [StructureInput!] = null
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
"""A function definition for a large language model"""
|
|
219
|
+
input StructureInput {
|
|
220
|
+
identifier: String!
|
|
221
|
+
object: String!
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
type ChatResponse {
|
|
225
|
+
id: String!
|
|
226
|
+
object: String!
|
|
227
|
+
systemFingerprint: String
|
|
228
|
+
created: Int!
|
|
229
|
+
model: String!
|
|
230
|
+
choices: [Choice!]!
|
|
231
|
+
usage: Usage
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
type Choice {
|
|
235
|
+
index: Int!
|
|
236
|
+
message: ChatMessage!
|
|
237
|
+
finishReason: String
|
|
238
|
+
thinkingBlocks: [ThinkingBlock!]
|
|
239
|
+
reasoningContent: String
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
type ChatMessage {
|
|
243
|
+
role: Role!
|
|
244
|
+
content: String
|
|
245
|
+
name: String
|
|
246
|
+
toolCallId: String
|
|
247
|
+
functionCall: FunctionCall
|
|
248
|
+
toolCalls: [ToolCall!]
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
"""The type of the message sender"""
|
|
252
|
+
enum Role {
|
|
253
|
+
SYSTEM
|
|
254
|
+
USER
|
|
255
|
+
ASSISTANT
|
|
256
|
+
TOOL
|
|
257
|
+
FUNCTION
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
"""The type of the tool"""
|
|
261
|
+
type FunctionCall {
|
|
262
|
+
name: String!
|
|
263
|
+
arguments: String!
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
"""A function definition for a large language model"""
|
|
267
|
+
type ToolCall {
|
|
268
|
+
id: String!
|
|
269
|
+
type: ToolType!
|
|
270
|
+
function: FunctionCall!
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
"""The type of the tool"""
|
|
274
|
+
enum ToolType {
|
|
275
|
+
FUNCTION
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
type ThinkingBlock {
|
|
279
|
+
type: ThinkingBlockType!
|
|
280
|
+
thinking: String!
|
|
281
|
+
signature: String
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
"""The type of the thinking block"""
|
|
285
|
+
enum ThinkingBlockType {
|
|
286
|
+
THINKING
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
type Usage {
|
|
290
|
+
promptTokens: Int!
|
|
291
|
+
completionTokens: Int!
|
|
292
|
+
totalTokens: Int!
|
|
293
|
+
promptTokenDetails: JSON
|
|
294
|
+
completionTokenDetails: JSON
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
"""A chat message input"""
|
|
298
|
+
input ChatInput {
|
|
299
|
+
model: ID!
|
|
300
|
+
messages: [ChatMessageInput!]!
|
|
301
|
+
tools: [ToolInput!] = null
|
|
302
|
+
temperature: Float = null
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
"""A chat message input"""
|
|
306
|
+
input ChatMessageInput {
|
|
307
|
+
role: Role!
|
|
308
|
+
content: String = null
|
|
309
|
+
name: String = null
|
|
310
|
+
toolCallId: String = null
|
|
311
|
+
functionCall: FunctionCallInput = null
|
|
312
|
+
toolCalls: [ToolCallInput!] = null
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
"""A function call input"""
|
|
316
|
+
input FunctionCallInput {
|
|
317
|
+
name: String!
|
|
318
|
+
arguments: String!
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
"""A tool call input"""
|
|
322
|
+
input ToolCallInput {
|
|
323
|
+
id: String!
|
|
324
|
+
function: FunctionCallInput!
|
|
325
|
+
type: ToolType!
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
"""A large language model function call"""
|
|
329
|
+
input ToolInput {
|
|
330
|
+
type: ToolType! = FUNCTION
|
|
331
|
+
function: FunctionDefinitionInput!
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
"""A large language model function defintion"""
|
|
335
|
+
input FunctionDefinitionInput {
|
|
336
|
+
name: String!
|
|
337
|
+
description: String = null
|
|
338
|
+
parameters: JSON = null
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
type OllamaPullResult {
|
|
342
|
+
status: String!
|
|
343
|
+
detail: String
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
input PullInput {
|
|
347
|
+
modelName: String!
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
input ChromaCollectionInput {
|
|
351
|
+
name: String!
|
|
352
|
+
embedder: ID!
|
|
353
|
+
description: String = null
|
|
354
|
+
isPublic: Boolean = false
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
input AddDocumentsToCollectionInput {
|
|
358
|
+
collection: ID!
|
|
359
|
+
documents: [DocumentInput!]!
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
"""A document to put into the vector database"""
|
|
363
|
+
input DocumentInput {
|
|
364
|
+
content: String!
|
|
365
|
+
structure: StructureInput = null
|
|
366
|
+
id: String = null
|
|
367
|
+
metadata: JSON = null
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
type Subscription {
|
|
371
|
+
room(room: ID!, agentId: ID!, filterOwn: Boolean! = true): RoomEvent!
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
type RoomEvent {
|
|
375
|
+
message: Message
|
|
376
|
+
join: Agent
|
|
377
|
+
leave: Agent
|
|
378
|
+
}
|