@coasys/ad4m 0.10.0-prerelease → 0.10.0-rc10

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.
Files changed (40) hide show
  1. package/lib/index.cjs +8167 -683
  2. package/lib/index.js +8167 -684
  3. package/lib/src/Ad4mClient.d.ts +2 -0
  4. package/lib/src/Ad4mClient.js +8 -2
  5. package/lib/src/PubSub.d.ts +1 -0
  6. package/lib/src/PubSub.js +1 -0
  7. package/lib/src/ai/AIClient.d.ts +19 -0
  8. package/lib/src/ai/AIClient.js +236 -0
  9. package/lib/src/ai/AIResolver.d.ts +14 -0
  10. package/lib/src/ai/AIResolver.js +145 -0
  11. package/lib/src/ai/Tasks.d.ts +37 -0
  12. package/lib/src/ai/Tasks.js +165 -0
  13. package/lib/src/buildSchema.js +3 -1
  14. package/lib/src/expression/ExpressionClient.d.ts +1 -1
  15. package/lib/src/expression/ExpressionClient.js +13 -1
  16. package/lib/src/index.d.ts +2 -0
  17. package/lib/src/index.js +2 -0
  18. package/lib/src/language/LanguageContext.d.ts +1 -0
  19. package/lib/src/perspectives/PerspectiveProxy.js +84 -60
  20. package/lib/src/runtime/RuntimeClient.d.ts +0 -2
  21. package/lib/src/runtime/RuntimeClient.js +0 -20
  22. package/lib/src/runtime/RuntimeResolver.d.ts +0 -1
  23. package/lib/src/runtime/RuntimeResolver.js +1 -21
  24. package/lib/src/schema.gql +48 -1
  25. package/lib/src/subject/SubjectEntity.js +0 -2
  26. package/lib/src/typeDefs.js +48 -1
  27. package/package.json +7 -3
  28. package/src/Ad4mClient.test.ts +77 -1
  29. package/src/Ad4mClient.ts +7 -0
  30. package/src/PubSub.ts +2 -1
  31. package/src/ai/AIClient.ts +252 -0
  32. package/src/ai/AIResolver.ts +147 -0
  33. package/src/ai/Tasks.ts +121 -0
  34. package/src/buildSchema.ts +3 -1
  35. package/src/expression/ExpressionClient.ts +14 -1
  36. package/src/index.ts +2 -0
  37. package/src/perspectives/PerspectiveProxy.ts +90 -67
  38. package/src/runtime/RuntimeClient.ts +0 -21
  39. package/src/runtime/RuntimeResolver.ts +0 -17
  40. package/src/subject/SubjectEntity.ts +0 -2
@@ -5,6 +5,7 @@ import { NeighbourhoodClient } from './neighbourhood/NeighbourhoodClient';
5
5
  import { PerspectiveClient } from './perspectives/PerspectiveClient';
6
6
  import { RuntimeClient } from './runtime/RuntimeClient';
7
7
  import { ExpressionClient } from './expression/ExpressionClient';
8
+ import { AIClient } from './ai/AIClient';
8
9
  /**
9
10
  * Client for the Ad4m interface wrapping GraphQL queryies
10
11
  * for convenient use in user facing code.
@@ -23,4 +24,5 @@ export declare class Ad4mClient {
23
24
  get neighbourhood(): NeighbourhoodClient;
24
25
  get perspective(): PerspectiveClient;
25
26
  get runtime(): RuntimeClient;
27
+ get ai(): AIClient;
26
28
  }
@@ -9,13 +9,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _Ad4mClient_apolloClient, _Ad4mClient_agentClient, _Ad4mClient_expressionClient, _Ad4mClient_languageClient, _Ad4mClient_neighbourhoodClient, _Ad4mClient_perspectiveClient, _Ad4mClient_runtimeClient;
12
+ var _Ad4mClient_apolloClient, _Ad4mClient_agentClient, _Ad4mClient_expressionClient, _Ad4mClient_languageClient, _Ad4mClient_neighbourhoodClient, _Ad4mClient_perspectiveClient, _Ad4mClient_runtimeClient, _Ad4mClient_aiClient;
13
13
  import { AgentClient } from './agent/AgentClient';
14
14
  import { LanguageClient } from './language/LanguageClient';
15
15
  import { NeighbourhoodClient } from './neighbourhood/NeighbourhoodClient';
16
16
  import { PerspectiveClient } from './perspectives/PerspectiveClient';
17
17
  import { RuntimeClient } from './runtime/RuntimeClient';
18
18
  import { ExpressionClient } from './expression/ExpressionClient';
19
+ import { AIClient } from './ai/AIClient';
19
20
  /**
20
21
  * Client for the Ad4m interface wrapping GraphQL queryies
21
22
  * for convenient use in user facing code.
@@ -34,6 +35,7 @@ export class Ad4mClient {
34
35
  _Ad4mClient_neighbourhoodClient.set(this, void 0);
35
36
  _Ad4mClient_perspectiveClient.set(this, void 0);
36
37
  _Ad4mClient_runtimeClient.set(this, void 0);
38
+ _Ad4mClient_aiClient.set(this, void 0);
37
39
  __classPrivateFieldSet(this, _Ad4mClient_apolloClient, client, "f");
38
40
  __classPrivateFieldSet(this, _Ad4mClient_agentClient, new AgentClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
39
41
  __classPrivateFieldSet(this, _Ad4mClient_expressionClient, new ExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f")), "f");
@@ -43,6 +45,7 @@ export class Ad4mClient {
43
45
  __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setExpressionClient(__classPrivateFieldGet(this, _Ad4mClient_expressionClient, "f"));
44
46
  __classPrivateFieldGet(this, _Ad4mClient_perspectiveClient, "f").setNeighbourhoodClient(__classPrivateFieldGet(this, _Ad4mClient_neighbourhoodClient, "f"));
45
47
  __classPrivateFieldSet(this, _Ad4mClient_runtimeClient, new RuntimeClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
48
+ __classPrivateFieldSet(this, _Ad4mClient_aiClient, new AIClient(__classPrivateFieldGet(this, _Ad4mClient_apolloClient, "f"), subscribe), "f");
46
49
  }
47
50
  get agent() {
48
51
  return __classPrivateFieldGet(this, _Ad4mClient_agentClient, "f");
@@ -62,5 +65,8 @@ export class Ad4mClient {
62
65
  get runtime() {
63
66
  return __classPrivateFieldGet(this, _Ad4mClient_runtimeClient, "f");
64
67
  }
68
+ get ai() {
69
+ return __classPrivateFieldGet(this, _Ad4mClient_aiClient, "f");
70
+ }
65
71
  }
66
- _Ad4mClient_apolloClient = new WeakMap(), _Ad4mClient_agentClient = new WeakMap(), _Ad4mClient_expressionClient = new WeakMap(), _Ad4mClient_languageClient = new WeakMap(), _Ad4mClient_neighbourhoodClient = new WeakMap(), _Ad4mClient_perspectiveClient = new WeakMap(), _Ad4mClient_runtimeClient = new WeakMap();
72
+ _Ad4mClient_apolloClient = new WeakMap(), _Ad4mClient_agentClient = new WeakMap(), _Ad4mClient_expressionClient = new WeakMap(), _Ad4mClient_languageClient = new WeakMap(), _Ad4mClient_neighbourhoodClient = new WeakMap(), _Ad4mClient_perspectiveClient = new WeakMap(), _Ad4mClient_runtimeClient = new WeakMap(), _Ad4mClient_aiClient = new WeakMap();
@@ -14,3 +14,4 @@ export declare const RUNTIME_NOTIFICATION_TRIGGERED_TOPIC = "runtime-notificatio
14
14
  export declare const NEIGHBOURHOOD_SIGNAL_RECEIVED_TOPIC = "neighbourhood-signal-received-topic";
15
15
  export declare const PERSPECTIVE_SYNC_STATE_CHANGE = "perspective-sync-state-change";
16
16
  export declare const APPS_CHANGED = "apps-changed";
17
+ export declare const AI_TRANSCRIPTION_TEXT_TOPIC = "ai-transcription-text-topic";
package/lib/src/PubSub.js CHANGED
@@ -14,3 +14,4 @@ export const RUNTIME_NOTIFICATION_TRIGGERED_TOPIC = "runtime-notification-trigge
14
14
  export const NEIGHBOURHOOD_SIGNAL_RECEIVED_TOPIC = "neighbourhood-signal-received-topic";
15
15
  export const PERSPECTIVE_SYNC_STATE_CHANGE = "perspective-sync-state-change";
16
16
  export const APPS_CHANGED = "apps-changed";
17
+ export const AI_TRANSCRIPTION_TEXT_TOPIC = "ai-transcription-text-topic";
@@ -0,0 +1,19 @@
1
+ import { ApolloClient } from "@apollo/client";
2
+ import { AIModelLoadingStatus, AITask } from "./Tasks";
3
+ export declare class AIClient {
4
+ #private;
5
+ constructor(apolloClient: ApolloClient<any>, subscribe?: boolean);
6
+ tasks(): Promise<AITask[]>;
7
+ addTask(name: string, modelId: string, systemPrompt: string, promptExamples: {
8
+ input: string;
9
+ output: string;
10
+ }[], metaData?: string): Promise<AITask>;
11
+ removeTask(taskId: string): Promise<AITask>;
12
+ updateTask(taskId: string, task: AITask): Promise<AITask>;
13
+ modelLoadingStatus(model: string): Promise<AIModelLoadingStatus>;
14
+ prompt(taskId: string, prompt: string): Promise<string>;
15
+ embed(modelId: string, text: string): Promise<Array<number>>;
16
+ openTranscriptionStream(modelId: string, streamCallback: (text: string) => void): Promise<string>;
17
+ closeTranscriptionStream(streamId: string): Promise<void>;
18
+ feedTranscriptionStream(streamId: string, audio: Float32Array): Promise<void>;
19
+ }
@@ -0,0 +1,236 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _AIClient_apolloClient, _AIClient_transcriptionSubscriptions;
13
+ import { gql } from "@apollo/client";
14
+ import unwrapApolloResult from "../unwrapApolloResult";
15
+ import base64js from 'base64-js';
16
+ import pako from 'pako';
17
+ import { AITaskInput } from "./Tasks";
18
+ export class AIClient {
19
+ constructor(apolloClient, subscribe = true) {
20
+ _AIClient_apolloClient.set(this, void 0);
21
+ _AIClient_transcriptionSubscriptions.set(this, new Map());
22
+ __classPrivateFieldSet(this, _AIClient_apolloClient, apolloClient, "f");
23
+ }
24
+ async tasks() {
25
+ const { aiTasks } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").query({
26
+ query: gql `
27
+ query {
28
+ aiTasks {
29
+ name
30
+ modelId
31
+ taskId
32
+ systemPrompt
33
+ promptExamples {
34
+ input
35
+ output
36
+ }
37
+ metaData
38
+ createdAt
39
+ updatedAt
40
+ }
41
+ }
42
+ `
43
+ }));
44
+ return aiTasks;
45
+ }
46
+ async addTask(name, modelId, systemPrompt, promptExamples, metaData) {
47
+ const task = new AITaskInput(name, modelId, systemPrompt, promptExamples, metaData);
48
+ const { aiAddTask } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
49
+ mutation: gql `
50
+ mutation AiAddTask($task: AITaskInput!) {
51
+ aiAddTask(task: $task) {
52
+ name
53
+ modelId
54
+ taskId
55
+ systemPrompt
56
+ promptExamples {
57
+ input
58
+ output
59
+ }
60
+ metaData
61
+ createdAt
62
+ updatedAt
63
+ }
64
+ }
65
+ `,
66
+ variables: {
67
+ task
68
+ }
69
+ }));
70
+ return aiAddTask;
71
+ }
72
+ async removeTask(taskId) {
73
+ const { aiRemoveTask } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
74
+ mutation: gql `
75
+ mutation AiRemoveTask($taskId: String!) {
76
+ aiRemoveTask(taskId: $taskId) {
77
+ name
78
+ modelId
79
+ taskId
80
+ systemPrompt
81
+ promptExamples {
82
+ input
83
+ output
84
+ }
85
+ metaData
86
+ createdAt
87
+ updatedAt
88
+ }
89
+ }
90
+ `,
91
+ variables: {
92
+ taskId
93
+ }
94
+ }));
95
+ return aiRemoveTask;
96
+ }
97
+ async updateTask(taskId, task) {
98
+ const { aiUpdateTask } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
99
+ mutation: gql `
100
+ mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
101
+ aiUpdateTask(taskId: $taskId, task: $task) {
102
+ name
103
+ modelId
104
+ taskId
105
+ systemPrompt
106
+ promptExamples {
107
+ input
108
+ output
109
+ }
110
+ metaData
111
+ createdAt
112
+ updatedAt
113
+ }
114
+ }
115
+ `,
116
+ variables: {
117
+ taskId,
118
+ task: {
119
+ name: task.name,
120
+ modelId: task.modelId,
121
+ systemPrompt: task.systemPrompt,
122
+ promptExamples: task.promptExamples
123
+ }
124
+ }
125
+ }));
126
+ return aiUpdateTask;
127
+ }
128
+ async modelLoadingStatus(model) {
129
+ const { aiModelLoadingStatus } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").query({
130
+ query: gql `
131
+ query AiModelLoadingStatus($model: String!) {
132
+ aiModelLoadingStatus(model: $model) {
133
+ model
134
+ status
135
+ progress
136
+ loaded
137
+ downloaded
138
+ }
139
+ }
140
+ `,
141
+ variables: {
142
+ model
143
+ }
144
+ }));
145
+ return aiModelLoadingStatus;
146
+ }
147
+ async prompt(taskId, prompt) {
148
+ const { aiPrompt } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
149
+ mutation: gql `
150
+ mutation AiPrompt($taskId: String!, $prompt: String!) {
151
+ aiPrompt(taskId: $taskId, prompt: $prompt)
152
+ }
153
+ `,
154
+ variables: {
155
+ taskId,
156
+ prompt
157
+ }
158
+ }));
159
+ return aiPrompt;
160
+ }
161
+ async embed(modelId, text) {
162
+ const { aiEmbed } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
163
+ mutation: gql `
164
+ mutation aiEmbed($modelId: String!, $text: String!) {
165
+ aiEmbed(modelId: $modelId, text: $text)
166
+ }
167
+ `,
168
+ variables: {
169
+ modelId,
170
+ text
171
+ }
172
+ }));
173
+ const compressed = base64js.toByteArray(aiEmbed);
174
+ const decompressed = JSON.parse(pako.inflate(compressed, { to: 'string' }));
175
+ return decompressed;
176
+ }
177
+ async openTranscriptionStream(modelId, streamCallback) {
178
+ const { aiOpenTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
179
+ mutation: gql `
180
+ mutation AiOpenTranscriptionStream($modelId: String!) {
181
+ aiOpenTranscriptionStream(modelId: $modelId)
182
+ }
183
+ `,
184
+ variables: {
185
+ modelId
186
+ }
187
+ }));
188
+ const subscription = __classPrivateFieldGet(this, _AIClient_apolloClient, "f").subscribe({
189
+ query: gql ` subscription {
190
+ aiTranscriptionText(streamId: "${aiOpenTranscriptionStream}")
191
+ }`
192
+ }).subscribe({
193
+ next(data) {
194
+ streamCallback(data.data.aiTranscriptionText);
195
+ return data.data.aiTranscriptionText;
196
+ },
197
+ error(err) {
198
+ console.error(err);
199
+ }
200
+ });
201
+ __classPrivateFieldGet(this, _AIClient_transcriptionSubscriptions, "f").set(aiOpenTranscriptionStream, subscription);
202
+ return aiOpenTranscriptionStream;
203
+ }
204
+ async closeTranscriptionStream(streamId) {
205
+ const { aiCloseTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
206
+ mutation: gql `
207
+ mutation aiCloseTranscriptionStream($streamId: String!) {
208
+ aiCloseTranscriptionStream(streamId: $streamId)
209
+ }
210
+ `,
211
+ variables: {
212
+ streamId
213
+ }
214
+ }));
215
+ const subscription = __classPrivateFieldGet(this, _AIClient_transcriptionSubscriptions, "f").get(streamId);
216
+ if (!subscription.closed) {
217
+ subscription.unsubscribe();
218
+ }
219
+ return aiCloseTranscriptionStream;
220
+ }
221
+ async feedTranscriptionStream(streamId, audio) {
222
+ const { feedTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
223
+ mutation: gql `
224
+ mutation AiFeedTranscriptionStream($streamId: String!, $audio: [Float!]!) {
225
+ aiFeedTranscriptionStream(streamId: $streamId, audio: $audio)
226
+ }
227
+ `,
228
+ variables: {
229
+ streamId,
230
+ audio: audio
231
+ }
232
+ }));
233
+ return feedTranscriptionStream;
234
+ }
235
+ }
236
+ _AIClient_apolloClient = new WeakMap(), _AIClient_transcriptionSubscriptions = new WeakMap();
@@ -0,0 +1,14 @@
1
+ import { AIModelLoadingStatus, AITask, AITaskInput } from "./Tasks";
2
+ export default class AIResolver {
3
+ aiTasks(): AITask[];
4
+ aiAddTask(task: AITaskInput): AITask;
5
+ aiRemoveTask(taskId: string): AITask;
6
+ aiUpdateTask(taskId: string, task: AITaskInput): AITask;
7
+ aiModelLoadingStatus(model: string): AIModelLoadingStatus;
8
+ aiPrompt(taskId: string, input: string): string;
9
+ aiEmbed(modelId: string, text: string): string;
10
+ aiOpenTranscriptionStream(modelId: string): string;
11
+ aiCloseTranscriptionStream(streamId: string): boolean;
12
+ aiFeedTranscriptionStream(streamId: string, audio: number[], pubSub: any): boolean;
13
+ aiTranscriptionText(streamId: string): string;
14
+ }
@@ -0,0 +1,145 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Query, Resolver, Mutation, Arg, Subscription, Float, PubSub } from "type-graphql";
14
+ import { AIModelLoadingStatus, AITask, AITaskInput } from "./Tasks";
15
+ import pako from "pako";
16
+ import base64js from 'base64-js';
17
+ import { AI_TRANSCRIPTION_TEXT_TOPIC } from "../PubSub";
18
+ let createdAt = Date.now().toString();
19
+ let updatedAt = Date.now().toString();
20
+ let AIResolver = class AIResolver {
21
+ aiTasks() {
22
+ return [new AITask("task1", "modelId", "task_id", "systemPrompt", [], undefined, createdAt, updatedAt),
23
+ new AITask("task2", "modelId", "task_id", "systemPrompt", [], undefined, createdAt, updatedAt)];
24
+ }
25
+ aiAddTask(task) {
26
+ return new AITask("task_name", task.modelId, "task_id", task.systemPrompt, task.promptExamples, undefined, createdAt, updatedAt);
27
+ }
28
+ aiRemoveTask(taskId) {
29
+ return new AITask("task_name", "model_id", taskId, "system prompt", [], undefined, createdAt, updatedAt);
30
+ }
31
+ aiUpdateTask(taskId, task) {
32
+ return new AITask(task.name, task.modelId, taskId, task.systemPrompt, task.promptExamples, undefined, createdAt, updatedAt);
33
+ }
34
+ aiModelLoadingStatus(model) {
35
+ return new AIModelLoadingStatus(model, "loaded", 100.0, true, true);
36
+ }
37
+ aiPrompt(taskId, input) {
38
+ return "output";
39
+ }
40
+ aiEmbed(modelId, text) {
41
+ const vec = [0, 10, 20, 30];
42
+ const vecString = JSON.stringify(vec);
43
+ const compressed = pako.deflate(vecString);
44
+ const compressedString = base64js.fromByteArray(compressed);
45
+ return compressedString;
46
+ }
47
+ aiOpenTranscriptionStream(modelId) {
48
+ return "streamId";
49
+ }
50
+ aiCloseTranscriptionStream(streamId) {
51
+ return true;
52
+ }
53
+ aiFeedTranscriptionStream(streamId, audio, pubSub) {
54
+ pubSub.publish(AI_TRANSCRIPTION_TEXT_TOPIC, { streamId });
55
+ return true;
56
+ }
57
+ aiTranscriptionText(streamId) {
58
+ return "transcription";
59
+ }
60
+ };
61
+ __decorate([
62
+ Query(returns => [AITask]),
63
+ __metadata("design:type", Function),
64
+ __metadata("design:paramtypes", []),
65
+ __metadata("design:returntype", Array)
66
+ ], AIResolver.prototype, "aiTasks", null);
67
+ __decorate([
68
+ Mutation(returns => AITask),
69
+ __param(0, Arg("task")),
70
+ __metadata("design:type", Function),
71
+ __metadata("design:paramtypes", [AITaskInput]),
72
+ __metadata("design:returntype", AITask)
73
+ ], AIResolver.prototype, "aiAddTask", null);
74
+ __decorate([
75
+ Mutation(() => AITask),
76
+ __param(0, Arg("taskId")),
77
+ __metadata("design:type", Function),
78
+ __metadata("design:paramtypes", [String]),
79
+ __metadata("design:returntype", AITask)
80
+ ], AIResolver.prototype, "aiRemoveTask", null);
81
+ __decorate([
82
+ Mutation(() => AITask),
83
+ __param(0, Arg("taskId")),
84
+ __param(1, Arg("task")),
85
+ __metadata("design:type", Function),
86
+ __metadata("design:paramtypes", [String, AITaskInput]),
87
+ __metadata("design:returntype", AITask)
88
+ ], AIResolver.prototype, "aiUpdateTask", null);
89
+ __decorate([
90
+ Query(() => AIModelLoadingStatus),
91
+ __param(0, Arg("model")),
92
+ __metadata("design:type", Function),
93
+ __metadata("design:paramtypes", [String]),
94
+ __metadata("design:returntype", AIModelLoadingStatus)
95
+ ], AIResolver.prototype, "aiModelLoadingStatus", null);
96
+ __decorate([
97
+ Mutation(() => String),
98
+ __param(0, Arg("taskId")),
99
+ __param(1, Arg("prompt")),
100
+ __metadata("design:type", Function),
101
+ __metadata("design:paramtypes", [String, String]),
102
+ __metadata("design:returntype", String)
103
+ ], AIResolver.prototype, "aiPrompt", null);
104
+ __decorate([
105
+ Mutation(() => String),
106
+ __param(0, Arg("modelId")),
107
+ __param(1, Arg("text")),
108
+ __metadata("design:type", Function),
109
+ __metadata("design:paramtypes", [String, String]),
110
+ __metadata("design:returntype", String)
111
+ ], AIResolver.prototype, "aiEmbed", null);
112
+ __decorate([
113
+ Mutation(() => String),
114
+ __param(0, Arg("modelId")),
115
+ __metadata("design:type", Function),
116
+ __metadata("design:paramtypes", [String]),
117
+ __metadata("design:returntype", String)
118
+ ], AIResolver.prototype, "aiOpenTranscriptionStream", null);
119
+ __decorate([
120
+ Mutation(() => String),
121
+ __param(0, Arg("streamId")),
122
+ __metadata("design:type", Function),
123
+ __metadata("design:paramtypes", [String]),
124
+ __metadata("design:returntype", Boolean)
125
+ ], AIResolver.prototype, "aiCloseTranscriptionStream", null);
126
+ __decorate([
127
+ Mutation(() => String),
128
+ __param(0, Arg("streamId")),
129
+ __param(1, Arg("audio", () => [Float])),
130
+ __param(2, PubSub()),
131
+ __metadata("design:type", Function),
132
+ __metadata("design:paramtypes", [String, Array, Object]),
133
+ __metadata("design:returntype", Boolean)
134
+ ], AIResolver.prototype, "aiFeedTranscriptionStream", null);
135
+ __decorate([
136
+ Subscription({ topics: AI_TRANSCRIPTION_TEXT_TOPIC, nullable: false }),
137
+ __param(0, Arg("streamId")),
138
+ __metadata("design:type", Function),
139
+ __metadata("design:paramtypes", [String]),
140
+ __metadata("design:returntype", String)
141
+ ], AIResolver.prototype, "aiTranscriptionText", null);
142
+ AIResolver = __decorate([
143
+ Resolver()
144
+ ], AIResolver);
145
+ export default AIResolver;
@@ -0,0 +1,37 @@
1
+ export declare class AIPromptExamplesInput {
2
+ input: string;
3
+ output: string;
4
+ constructor(input: string, output: string);
5
+ }
6
+ export declare class AIPromptExamples {
7
+ input: string;
8
+ output: string;
9
+ constructor(input: string, output: string);
10
+ }
11
+ export declare class AITaskInput {
12
+ name: string;
13
+ modelId: string;
14
+ systemPrompt: string;
15
+ promptExamples: AIPromptExamplesInput[];
16
+ metaData: string;
17
+ constructor(name: string, model_id: string, system_prompt: string, prompt_examples: AIPromptExamplesInput[], metaData?: string);
18
+ }
19
+ export declare class AITask {
20
+ name: string;
21
+ modelId: string;
22
+ taskId: string;
23
+ systemPrompt: string;
24
+ promptExamples: AIPromptExamples[];
25
+ metaData?: string;
26
+ createdAt: string;
27
+ updatedAt: string;
28
+ constructor(name: string, model_id: string, task_id: string, system_prompt: string, prompt_examples: AIPromptExamples[], metaData?: string, created_at?: string, updated_at?: string);
29
+ }
30
+ export declare class AIModelLoadingStatus {
31
+ model: string;
32
+ status: string;
33
+ progress: number;
34
+ downloaded: boolean;
35
+ loaded: boolean;
36
+ constructor(model: string, status: string, progress: number, downloaded: boolean, loaded: boolean);
37
+ }