@coasys/ad4m 0.10.0-rc10 → 0.10.0-rc12

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.
package/lib/index.cjs CHANGED
@@ -14007,6 +14007,99 @@ class AIClient {
14007
14007
  _AIClient_transcriptionSubscriptions.set(this, new Map());
14008
14008
  __classPrivateFieldSet$3(this, _AIClient_apolloClient, apolloClient, "f");
14009
14009
  }
14010
+ async getModels() {
14011
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").query({
14012
+ query: gql `
14013
+ query {
14014
+ aiGetModels {
14015
+ id
14016
+ name
14017
+ api {
14018
+ baseUrl
14019
+ apiKey
14020
+ apiType
14021
+ }
14022
+ local {
14023
+ fileName
14024
+ tokenizerSource
14025
+ modelParameters
14026
+ }
14027
+ modelType
14028
+ }
14029
+ }
14030
+ `
14031
+ });
14032
+ return unwrapApolloResult(result).aiGetModels;
14033
+ }
14034
+ async addModel(model) {
14035
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14036
+ mutation: gql `
14037
+ mutation($model: ModelInput!) {
14038
+ aiAddModel(model: $model)
14039
+ }
14040
+ `,
14041
+ variables: { model }
14042
+ });
14043
+ return unwrapApolloResult(result).aiAddModel;
14044
+ }
14045
+ async updateModel(modelId, model) {
14046
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14047
+ mutation: gql `
14048
+ mutation($modelId: String!, $model: ModelInput!) {
14049
+ aiUpdateModel(modelId: $modelId, model: $model)
14050
+ }
14051
+ `,
14052
+ variables: { modelId, model }
14053
+ });
14054
+ return unwrapApolloResult(result).aiUpdateModel;
14055
+ }
14056
+ async removeModel(modelId) {
14057
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14058
+ mutation: gql `
14059
+ mutation($modelId: String!) {
14060
+ aiRemoveModel(modelId: $modelId)
14061
+ }
14062
+ `,
14063
+ variables: { modelId }
14064
+ });
14065
+ return unwrapApolloResult(result).aiRemoveModel;
14066
+ }
14067
+ async setDefaultModel(modelType, modelId) {
14068
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14069
+ mutation: gql `
14070
+ mutation($modelType: ModelType!, $modelId: String!) {
14071
+ aiSetDefaultModel(modelType: $modelType modelId: $modelId)
14072
+ }
14073
+ `,
14074
+ variables: { modelId, modelType }
14075
+ });
14076
+ return unwrapApolloResult(result).aiSetDefaultModel;
14077
+ }
14078
+ async getDefaultModel(modelType) {
14079
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").query({
14080
+ query: gql `
14081
+ query($modelType: ModelType!) {
14082
+ aiGetDefaultModel(modelType: $modelType) {
14083
+ id
14084
+ name
14085
+ api {
14086
+ baseUrl
14087
+ apiKey
14088
+ apiType
14089
+ }
14090
+ local {
14091
+ fileName
14092
+ tokenizerSource
14093
+ modelParameters
14094
+ }
14095
+ modelType
14096
+ }
14097
+ }
14098
+ `,
14099
+ variables: { modelType }
14100
+ });
14101
+ return unwrapApolloResult(result).aiGetDefaultModel;
14102
+ }
14010
14103
  async tasks() {
14011
14104
  const { aiTasks } = unwrapApolloResult(await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").query({
14012
14105
  query: gql `
@@ -15358,6 +15451,45 @@ input LinkQuery {
15358
15451
  untilDate: DateTime
15359
15452
  }
15360
15453
 
15454
+ type LocalModel {
15455
+ fileName: String!
15456
+ modelParameters: String!
15457
+ tokenizerSource: String!
15458
+ }
15459
+
15460
+ input LocalModelInput {
15461
+ fileName: String!
15462
+ modelParameters: String!
15463
+ tokenizerSource: String!
15464
+ }
15465
+
15466
+ type Model {
15467
+ api: ModelApi
15468
+ id: String!
15469
+ local: LocalModel
15470
+ modelType: String!
15471
+ name: String!
15472
+ }
15473
+
15474
+ type ModelApi {
15475
+ apiKey: String!
15476
+ apiType: String!
15477
+ baseUrl: String!
15478
+ }
15479
+
15480
+ input ModelApiInput {
15481
+ apiKey: String!
15482
+ apiType: String!
15483
+ baseUrl: String!
15484
+ }
15485
+
15486
+ input ModelInput {
15487
+ api: ModelApiInput
15488
+ local: LocalModelInput
15489
+ modelType: String!
15490
+ name: String!
15491
+ }
15492
+
15361
15493
  type Mutation {
15362
15494
  addTrustedAgents(agents: [String!]!): [String!]!
15363
15495
  agentAddEntanglementProofs(proofs: [EntanglementProofInput!]!): [EntanglementProof!]!
@@ -15375,13 +15507,17 @@ type Mutation {
15375
15507
  agentUnlock(holochain: Boolean!, passphrase: String!): AgentStatus!
15376
15508
  agentUpdateDirectMessageLanguage(directMessageLanguage: String!): Agent!
15377
15509
  agentUpdatePublicPerspective(perspective: PerspectiveInput!): Agent!
15510
+ aiAddModel(model: ModelInput!): String!
15378
15511
  aiAddTask(task: AITaskInput!): AITask!
15379
15512
  aiCloseTranscriptionStream(streamId: String!): String!
15380
15513
  aiEmbed(modelId: String!, text: String!): String!
15381
15514
  aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
15382
15515
  aiOpenTranscriptionStream(modelId: String!): String!
15383
15516
  aiPrompt(prompt: String!, taskId: String!): String!
15517
+ aiRemoveModel(modelId: String!): Boolean!
15384
15518
  aiRemoveTask(taskId: String!): AITask!
15519
+ aiSetDefaultModel(modelId: String!, modelType: String!): Boolean!
15520
+ aiUpdateModel(model: ModelInput!, modelId: String!): Boolean!
15385
15521
  aiUpdateTask(task: AITaskInput!, taskId: String!): AITask!
15386
15522
  deleteTrustedAgents(agents: [String!]!): [String!]!
15387
15523
  expressionCreate(content: String!, languageAddress: String!): String!
@@ -15503,6 +15639,8 @@ type Query {
15503
15639
  agentGetEntanglementProofs: [EntanglementProof!]!
15504
15640
  agentIsLocked: Boolean!
15505
15641
  agentStatus: AgentStatus!
15642
+ aiGetDefaultModel(modelType: String!): Model!
15643
+ aiGetModels: [Model!]!
15506
15644
  aiModelLoadingStatus(model: String!): AIModelLoadingStatus!
15507
15645
  aiTasks: [AITask!]!
15508
15646
  expression(url: String!): ExpressionRendered
package/lib/index.js CHANGED
@@ -14003,6 +14003,99 @@ class AIClient {
14003
14003
  _AIClient_transcriptionSubscriptions.set(this, new Map());
14004
14004
  __classPrivateFieldSet$3(this, _AIClient_apolloClient, apolloClient, "f");
14005
14005
  }
14006
+ async getModels() {
14007
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").query({
14008
+ query: gql `
14009
+ query {
14010
+ aiGetModels {
14011
+ id
14012
+ name
14013
+ api {
14014
+ baseUrl
14015
+ apiKey
14016
+ apiType
14017
+ }
14018
+ local {
14019
+ fileName
14020
+ tokenizerSource
14021
+ modelParameters
14022
+ }
14023
+ modelType
14024
+ }
14025
+ }
14026
+ `
14027
+ });
14028
+ return unwrapApolloResult(result).aiGetModels;
14029
+ }
14030
+ async addModel(model) {
14031
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14032
+ mutation: gql `
14033
+ mutation($model: ModelInput!) {
14034
+ aiAddModel(model: $model)
14035
+ }
14036
+ `,
14037
+ variables: { model }
14038
+ });
14039
+ return unwrapApolloResult(result).aiAddModel;
14040
+ }
14041
+ async updateModel(modelId, model) {
14042
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14043
+ mutation: gql `
14044
+ mutation($modelId: String!, $model: ModelInput!) {
14045
+ aiUpdateModel(modelId: $modelId, model: $model)
14046
+ }
14047
+ `,
14048
+ variables: { modelId, model }
14049
+ });
14050
+ return unwrapApolloResult(result).aiUpdateModel;
14051
+ }
14052
+ async removeModel(modelId) {
14053
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14054
+ mutation: gql `
14055
+ mutation($modelId: String!) {
14056
+ aiRemoveModel(modelId: $modelId)
14057
+ }
14058
+ `,
14059
+ variables: { modelId }
14060
+ });
14061
+ return unwrapApolloResult(result).aiRemoveModel;
14062
+ }
14063
+ async setDefaultModel(modelType, modelId) {
14064
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").mutate({
14065
+ mutation: gql `
14066
+ mutation($modelType: ModelType!, $modelId: String!) {
14067
+ aiSetDefaultModel(modelType: $modelType modelId: $modelId)
14068
+ }
14069
+ `,
14070
+ variables: { modelId, modelType }
14071
+ });
14072
+ return unwrapApolloResult(result).aiSetDefaultModel;
14073
+ }
14074
+ async getDefaultModel(modelType) {
14075
+ const result = await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").query({
14076
+ query: gql `
14077
+ query($modelType: ModelType!) {
14078
+ aiGetDefaultModel(modelType: $modelType) {
14079
+ id
14080
+ name
14081
+ api {
14082
+ baseUrl
14083
+ apiKey
14084
+ apiType
14085
+ }
14086
+ local {
14087
+ fileName
14088
+ tokenizerSource
14089
+ modelParameters
14090
+ }
14091
+ modelType
14092
+ }
14093
+ }
14094
+ `,
14095
+ variables: { modelType }
14096
+ });
14097
+ return unwrapApolloResult(result).aiGetDefaultModel;
14098
+ }
14006
14099
  async tasks() {
14007
14100
  const { aiTasks } = unwrapApolloResult(await __classPrivateFieldGet$3(this, _AIClient_apolloClient, "f").query({
14008
14101
  query: gql `
@@ -15354,6 +15447,45 @@ input LinkQuery {
15354
15447
  untilDate: DateTime
15355
15448
  }
15356
15449
 
15450
+ type LocalModel {
15451
+ fileName: String!
15452
+ modelParameters: String!
15453
+ tokenizerSource: String!
15454
+ }
15455
+
15456
+ input LocalModelInput {
15457
+ fileName: String!
15458
+ modelParameters: String!
15459
+ tokenizerSource: String!
15460
+ }
15461
+
15462
+ type Model {
15463
+ api: ModelApi
15464
+ id: String!
15465
+ local: LocalModel
15466
+ modelType: String!
15467
+ name: String!
15468
+ }
15469
+
15470
+ type ModelApi {
15471
+ apiKey: String!
15472
+ apiType: String!
15473
+ baseUrl: String!
15474
+ }
15475
+
15476
+ input ModelApiInput {
15477
+ apiKey: String!
15478
+ apiType: String!
15479
+ baseUrl: String!
15480
+ }
15481
+
15482
+ input ModelInput {
15483
+ api: ModelApiInput
15484
+ local: LocalModelInput
15485
+ modelType: String!
15486
+ name: String!
15487
+ }
15488
+
15357
15489
  type Mutation {
15358
15490
  addTrustedAgents(agents: [String!]!): [String!]!
15359
15491
  agentAddEntanglementProofs(proofs: [EntanglementProofInput!]!): [EntanglementProof!]!
@@ -15371,13 +15503,17 @@ type Mutation {
15371
15503
  agentUnlock(holochain: Boolean!, passphrase: String!): AgentStatus!
15372
15504
  agentUpdateDirectMessageLanguage(directMessageLanguage: String!): Agent!
15373
15505
  agentUpdatePublicPerspective(perspective: PerspectiveInput!): Agent!
15506
+ aiAddModel(model: ModelInput!): String!
15374
15507
  aiAddTask(task: AITaskInput!): AITask!
15375
15508
  aiCloseTranscriptionStream(streamId: String!): String!
15376
15509
  aiEmbed(modelId: String!, text: String!): String!
15377
15510
  aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
15378
15511
  aiOpenTranscriptionStream(modelId: String!): String!
15379
15512
  aiPrompt(prompt: String!, taskId: String!): String!
15513
+ aiRemoveModel(modelId: String!): Boolean!
15380
15514
  aiRemoveTask(taskId: String!): AITask!
15515
+ aiSetDefaultModel(modelId: String!, modelType: String!): Boolean!
15516
+ aiUpdateModel(model: ModelInput!, modelId: String!): Boolean!
15381
15517
  aiUpdateTask(task: AITaskInput!, taskId: String!): AITask!
15382
15518
  deleteTrustedAgents(agents: [String!]!): [String!]!
15383
15519
  expressionCreate(content: String!, languageAddress: String!): String!
@@ -15499,6 +15635,8 @@ type Query {
15499
15635
  agentGetEntanglementProofs: [EntanglementProof!]!
15500
15636
  agentIsLocked: Boolean!
15501
15637
  agentStatus: AgentStatus!
15638
+ aiGetDefaultModel(modelType: String!): Model!
15639
+ aiGetModels: [Model!]!
15502
15640
  aiModelLoadingStatus(model: String!): AIModelLoadingStatus!
15503
15641
  aiTasks: [AITask!]!
15504
15642
  expression(url: String!): ExpressionRendered
@@ -1,8 +1,15 @@
1
1
  import { ApolloClient } from "@apollo/client";
2
2
  import { AIModelLoadingStatus, AITask } from "./Tasks";
3
+ import { ModelInput, Model, ModelType } from "./AIResolver";
3
4
  export declare class AIClient {
4
5
  #private;
5
6
  constructor(apolloClient: ApolloClient<any>, subscribe?: boolean);
7
+ getModels(): Promise<Model[]>;
8
+ addModel(model: ModelInput): Promise<string>;
9
+ updateModel(modelId: string, model: ModelInput): Promise<boolean>;
10
+ removeModel(modelId: string): Promise<boolean>;
11
+ setDefaultModel(modelType: ModelType, modelId: string): Promise<boolean>;
12
+ getDefaultModel(modelType: ModelType): Promise<Model>;
6
13
  tasks(): Promise<AITask[]>;
7
14
  addTask(name: string, modelId: string, systemPrompt: string, promptExamples: {
8
15
  input: string;
@@ -21,6 +21,99 @@ export class AIClient {
21
21
  _AIClient_transcriptionSubscriptions.set(this, new Map());
22
22
  __classPrivateFieldSet(this, _AIClient_apolloClient, apolloClient, "f");
23
23
  }
24
+ async getModels() {
25
+ const result = await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").query({
26
+ query: gql `
27
+ query {
28
+ aiGetModels {
29
+ id
30
+ name
31
+ api {
32
+ baseUrl
33
+ apiKey
34
+ apiType
35
+ }
36
+ local {
37
+ fileName
38
+ tokenizerSource
39
+ modelParameters
40
+ }
41
+ modelType
42
+ }
43
+ }
44
+ `
45
+ });
46
+ return unwrapApolloResult(result).aiGetModels;
47
+ }
48
+ async addModel(model) {
49
+ const result = await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
50
+ mutation: gql `
51
+ mutation($model: ModelInput!) {
52
+ aiAddModel(model: $model)
53
+ }
54
+ `,
55
+ variables: { model }
56
+ });
57
+ return unwrapApolloResult(result).aiAddModel;
58
+ }
59
+ async updateModel(modelId, model) {
60
+ const result = await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
61
+ mutation: gql `
62
+ mutation($modelId: String!, $model: ModelInput!) {
63
+ aiUpdateModel(modelId: $modelId, model: $model)
64
+ }
65
+ `,
66
+ variables: { modelId, model }
67
+ });
68
+ return unwrapApolloResult(result).aiUpdateModel;
69
+ }
70
+ async removeModel(modelId) {
71
+ const result = await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
72
+ mutation: gql `
73
+ mutation($modelId: String!) {
74
+ aiRemoveModel(modelId: $modelId)
75
+ }
76
+ `,
77
+ variables: { modelId }
78
+ });
79
+ return unwrapApolloResult(result).aiRemoveModel;
80
+ }
81
+ async setDefaultModel(modelType, modelId) {
82
+ const result = await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
83
+ mutation: gql `
84
+ mutation($modelType: ModelType!, $modelId: String!) {
85
+ aiSetDefaultModel(modelType: $modelType modelId: $modelId)
86
+ }
87
+ `,
88
+ variables: { modelId, modelType }
89
+ });
90
+ return unwrapApolloResult(result).aiSetDefaultModel;
91
+ }
92
+ async getDefaultModel(modelType) {
93
+ const result = await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").query({
94
+ query: gql `
95
+ query($modelType: ModelType!) {
96
+ aiGetDefaultModel(modelType: $modelType) {
97
+ id
98
+ name
99
+ api {
100
+ baseUrl
101
+ apiKey
102
+ apiType
103
+ }
104
+ local {
105
+ fileName
106
+ tokenizerSource
107
+ modelParameters
108
+ }
109
+ modelType
110
+ }
111
+ }
112
+ `,
113
+ variables: { modelType }
114
+ });
115
+ return unwrapApolloResult(result).aiGetDefaultModel;
116
+ }
24
117
  async tasks() {
25
118
  const { aiTasks } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").query({
26
119
  query: gql `
@@ -1,5 +1,45 @@
1
1
  import { AIModelLoadingStatus, AITask, AITaskInput } from "./Tasks";
2
+ export declare class ModelApi {
3
+ baseUrl: string;
4
+ apiKey: string;
5
+ apiType: String;
6
+ }
7
+ export declare class LocalModel {
8
+ fileName: string;
9
+ tokenizerSource: string;
10
+ modelParameters: string;
11
+ }
12
+ export type ModelType = "LLM" | "EMBEDDING" | "TRANSCRIPTION";
13
+ export declare class Model {
14
+ id: string;
15
+ name: string;
16
+ api?: ModelApi;
17
+ local?: LocalModel;
18
+ modelType: ModelType;
19
+ }
20
+ export declare class ModelApiInput {
21
+ baseUrl: string;
22
+ apiKey: string;
23
+ apiType: string;
24
+ }
25
+ export declare class LocalModelInput {
26
+ fileName: string;
27
+ tokenizerSource: string;
28
+ modelParameters: string;
29
+ }
30
+ export declare class ModelInput {
31
+ name: string;
32
+ api?: ModelApiInput;
33
+ local?: LocalModelInput;
34
+ modelType: ModelType;
35
+ }
2
36
  export default class AIResolver {
37
+ aiGetModels(): Model[];
38
+ aiAddModel(model: ModelInput): string;
39
+ aiUpdateModel(modelId: string, model: ModelInput): boolean;
40
+ aiRemoveModel(modelId: string): boolean;
41
+ aiSetDefaultModel(modelType: ModelType, modelId: string): boolean;
42
+ aiGetDefaultModel(modelType: ModelType): Model;
3
43
  aiTasks(): AITask[];
4
44
  aiAddTask(task: AITaskInput): AITask;
5
45
  aiRemoveTask(taskId: string): AITask;
@@ -10,14 +10,187 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
- import { Query, Resolver, Mutation, Arg, Subscription, Float, PubSub } from "type-graphql";
13
+ import { Query, Resolver, Mutation, Arg, InputType, Field, Subscription, Float, PubSub, ObjectType } from "type-graphql";
14
14
  import { AIModelLoadingStatus, AITask, AITaskInput } from "./Tasks";
15
15
  import pako from "pako";
16
16
  import base64js from 'base64-js';
17
17
  import { AI_TRANSCRIPTION_TEXT_TOPIC } from "../PubSub";
18
18
  let createdAt = Date.now().toString();
19
19
  let updatedAt = Date.now().toString();
20
+ let ModelApi = class ModelApi {
21
+ };
22
+ __decorate([
23
+ Field(),
24
+ __metadata("design:type", String)
25
+ ], ModelApi.prototype, "baseUrl", void 0);
26
+ __decorate([
27
+ Field(),
28
+ __metadata("design:type", String)
29
+ ], ModelApi.prototype, "apiKey", void 0);
30
+ __decorate([
31
+ Field(),
32
+ __metadata("design:type", String)
33
+ ], ModelApi.prototype, "apiType", void 0);
34
+ ModelApi = __decorate([
35
+ ObjectType()
36
+ ], ModelApi);
37
+ export { ModelApi };
38
+ let LocalModel = class LocalModel {
39
+ };
40
+ __decorate([
41
+ Field(),
42
+ __metadata("design:type", String)
43
+ ], LocalModel.prototype, "fileName", void 0);
44
+ __decorate([
45
+ Field(),
46
+ __metadata("design:type", String)
47
+ ], LocalModel.prototype, "tokenizerSource", void 0);
48
+ __decorate([
49
+ Field(),
50
+ __metadata("design:type", String)
51
+ ], LocalModel.prototype, "modelParameters", void 0);
52
+ LocalModel = __decorate([
53
+ ObjectType()
54
+ ], LocalModel);
55
+ export { LocalModel };
56
+ let Model = class Model {
57
+ };
58
+ __decorate([
59
+ Field(),
60
+ __metadata("design:type", String)
61
+ ], Model.prototype, "id", void 0);
62
+ __decorate([
63
+ Field(),
64
+ __metadata("design:type", String)
65
+ ], Model.prototype, "name", void 0);
66
+ __decorate([
67
+ Field(type => ModelApi, { nullable: true }),
68
+ __metadata("design:type", ModelApi)
69
+ ], Model.prototype, "api", void 0);
70
+ __decorate([
71
+ Field(type => LocalModel, { nullable: true }),
72
+ __metadata("design:type", LocalModel)
73
+ ], Model.prototype, "local", void 0);
74
+ __decorate([
75
+ Field(),
76
+ __metadata("design:type", String)
77
+ ], Model.prototype, "modelType", void 0);
78
+ Model = __decorate([
79
+ ObjectType()
80
+ ], Model);
81
+ export { Model };
82
+ let ModelApiInput = class ModelApiInput {
83
+ };
84
+ __decorate([
85
+ Field(),
86
+ __metadata("design:type", String)
87
+ ], ModelApiInput.prototype, "baseUrl", void 0);
88
+ __decorate([
89
+ Field(),
90
+ __metadata("design:type", String)
91
+ ], ModelApiInput.prototype, "apiKey", void 0);
92
+ __decorate([
93
+ Field(),
94
+ __metadata("design:type", String)
95
+ ], ModelApiInput.prototype, "apiType", void 0);
96
+ ModelApiInput = __decorate([
97
+ InputType()
98
+ ], ModelApiInput);
99
+ export { ModelApiInput };
100
+ let LocalModelInput = class LocalModelInput {
101
+ };
102
+ __decorate([
103
+ Field(),
104
+ __metadata("design:type", String)
105
+ ], LocalModelInput.prototype, "fileName", void 0);
106
+ __decorate([
107
+ Field(),
108
+ __metadata("design:type", String)
109
+ ], LocalModelInput.prototype, "tokenizerSource", void 0);
110
+ __decorate([
111
+ Field(),
112
+ __metadata("design:type", String)
113
+ ], LocalModelInput.prototype, "modelParameters", void 0);
114
+ LocalModelInput = __decorate([
115
+ InputType()
116
+ ], LocalModelInput);
117
+ export { LocalModelInput };
118
+ let ModelInput = class ModelInput {
119
+ };
120
+ __decorate([
121
+ Field(),
122
+ __metadata("design:type", String)
123
+ ], ModelInput.prototype, "name", void 0);
124
+ __decorate([
125
+ Field(type => ModelApiInput, { nullable: true }),
126
+ __metadata("design:type", ModelApiInput)
127
+ ], ModelInput.prototype, "api", void 0);
128
+ __decorate([
129
+ Field(type => LocalModelInput, { nullable: true }),
130
+ __metadata("design:type", LocalModelInput)
131
+ ], ModelInput.prototype, "local", void 0);
132
+ __decorate([
133
+ Field(),
134
+ __metadata("design:type", String)
135
+ ], ModelInput.prototype, "modelType", void 0);
136
+ ModelInput = __decorate([
137
+ InputType()
138
+ ], ModelInput);
139
+ export { ModelInput };
20
140
  let AIResolver = class AIResolver {
141
+ aiGetModels() {
142
+ return [
143
+ {
144
+ id: "test-id",
145
+ name: "Test Model",
146
+ api: {
147
+ baseUrl: "https://api.example.com",
148
+ apiKey: "test-api-key",
149
+ apiType: "OpenAi"
150
+ },
151
+ local: {
152
+ fileName: "test-model.bin",
153
+ tokenizerSource: "test-tokenizer",
154
+ modelParameters: "{}"
155
+ },
156
+ modelType: "LLM"
157
+ }
158
+ ];
159
+ }
160
+ aiAddModel(model) {
161
+ // In a real implementation, this would add the model to storage
162
+ return "new-model-id";
163
+ }
164
+ aiUpdateModel(modelId, model) {
165
+ // In a real implementation, this would update the model in storage
166
+ return true;
167
+ }
168
+ aiRemoveModel(modelId) {
169
+ // In a real implementation, this would remove the model from storage
170
+ return true;
171
+ }
172
+ aiSetDefaultModel(modelType, modelId) {
173
+ // In a real implementation, this would set the default model
174
+ return true;
175
+ }
176
+ aiGetDefaultModel(modelType) {
177
+ // In a real implementation, this would get the default model for the given type
178
+ return {
179
+ id: "default-test-id",
180
+ name: "Default Test Model",
181
+ api: {
182
+ baseUrl: "https://api.example.com",
183
+ apiKey: "test-api-key",
184
+ apiType: "OpenAi"
185
+ },
186
+ local: {
187
+ fileName: "test-model.bin",
188
+ tokenizerSource: "test-tokenizer",
189
+ modelParameters: "{}"
190
+ },
191
+ modelType: modelType
192
+ };
193
+ }
21
194
  aiTasks() {
22
195
  return [new AITask("task1", "modelId", "task_id", "systemPrompt", [], undefined, createdAt, updatedAt),
23
196
  new AITask("task2", "modelId", "task_id", "systemPrompt", [], undefined, createdAt, updatedAt)];
@@ -58,6 +231,49 @@ let AIResolver = class AIResolver {
58
231
  return "transcription";
59
232
  }
60
233
  };
234
+ __decorate([
235
+ Query(returns => [Model]),
236
+ __metadata("design:type", Function),
237
+ __metadata("design:paramtypes", []),
238
+ __metadata("design:returntype", Array)
239
+ ], AIResolver.prototype, "aiGetModels", null);
240
+ __decorate([
241
+ Mutation(returns => String),
242
+ __param(0, Arg("model", type => ModelInput)),
243
+ __metadata("design:type", Function),
244
+ __metadata("design:paramtypes", [ModelInput]),
245
+ __metadata("design:returntype", String)
246
+ ], AIResolver.prototype, "aiAddModel", null);
247
+ __decorate([
248
+ Mutation(returns => Boolean),
249
+ __param(0, Arg("modelId", type => String)),
250
+ __param(1, Arg("model", type => ModelInput)),
251
+ __metadata("design:type", Function),
252
+ __metadata("design:paramtypes", [String, ModelInput]),
253
+ __metadata("design:returntype", Boolean)
254
+ ], AIResolver.prototype, "aiUpdateModel", null);
255
+ __decorate([
256
+ Mutation(returns => Boolean),
257
+ __param(0, Arg("modelId", type => String)),
258
+ __metadata("design:type", Function),
259
+ __metadata("design:paramtypes", [String]),
260
+ __metadata("design:returntype", Boolean)
261
+ ], AIResolver.prototype, "aiRemoveModel", null);
262
+ __decorate([
263
+ Mutation(returns => Boolean),
264
+ __param(0, Arg("modelType", type => String)),
265
+ __param(1, Arg("modelId", type => String)),
266
+ __metadata("design:type", Function),
267
+ __metadata("design:paramtypes", [String, String]),
268
+ __metadata("design:returntype", Boolean)
269
+ ], AIResolver.prototype, "aiSetDefaultModel", null);
270
+ __decorate([
271
+ Query(returns => Model),
272
+ __param(0, Arg("modelType", type => String)),
273
+ __metadata("design:type", Function),
274
+ __metadata("design:paramtypes", [String]),
275
+ __metadata("design:returntype", Model)
276
+ ], AIResolver.prototype, "aiGetDefaultModel", null);
61
277
  __decorate([
62
278
  Query(returns => [AITask]),
63
279
  __metadata("design:type", Function),
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import type { AppSignalCb } from '@holochain/client';
4
3
  import { Expression } from "../expression/Expression";
5
4
  export interface AgentService {
@@ -249,6 +249,45 @@ input LinkQuery {
249
249
  untilDate: DateTime
250
250
  }
251
251
 
252
+ type LocalModel {
253
+ fileName: String!
254
+ modelParameters: String!
255
+ tokenizerSource: String!
256
+ }
257
+
258
+ input LocalModelInput {
259
+ fileName: String!
260
+ modelParameters: String!
261
+ tokenizerSource: String!
262
+ }
263
+
264
+ type Model {
265
+ api: ModelApi
266
+ id: String!
267
+ local: LocalModel
268
+ modelType: String!
269
+ name: String!
270
+ }
271
+
272
+ type ModelApi {
273
+ apiKey: String!
274
+ apiType: String!
275
+ baseUrl: String!
276
+ }
277
+
278
+ input ModelApiInput {
279
+ apiKey: String!
280
+ apiType: String!
281
+ baseUrl: String!
282
+ }
283
+
284
+ input ModelInput {
285
+ api: ModelApiInput
286
+ local: LocalModelInput
287
+ modelType: String!
288
+ name: String!
289
+ }
290
+
252
291
  type Mutation {
253
292
  addTrustedAgents(agents: [String!]!): [String!]!
254
293
  agentAddEntanglementProofs(proofs: [EntanglementProofInput!]!): [EntanglementProof!]!
@@ -266,13 +305,17 @@ type Mutation {
266
305
  agentUnlock(holochain: Boolean!, passphrase: String!): AgentStatus!
267
306
  agentUpdateDirectMessageLanguage(directMessageLanguage: String!): Agent!
268
307
  agentUpdatePublicPerspective(perspective: PerspectiveInput!): Agent!
308
+ aiAddModel(model: ModelInput!): String!
269
309
  aiAddTask(task: AITaskInput!): AITask!
270
310
  aiCloseTranscriptionStream(streamId: String!): String!
271
311
  aiEmbed(modelId: String!, text: String!): String!
272
312
  aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
273
313
  aiOpenTranscriptionStream(modelId: String!): String!
274
314
  aiPrompt(prompt: String!, taskId: String!): String!
315
+ aiRemoveModel(modelId: String!): Boolean!
275
316
  aiRemoveTask(taskId: String!): AITask!
317
+ aiSetDefaultModel(modelId: String!, modelType: String!): Boolean!
318
+ aiUpdateModel(model: ModelInput!, modelId: String!): Boolean!
276
319
  aiUpdateTask(task: AITaskInput!, taskId: String!): AITask!
277
320
  deleteTrustedAgents(agents: [String!]!): [String!]!
278
321
  expressionCreate(content: String!, languageAddress: String!): String!
@@ -394,6 +437,8 @@ type Query {
394
437
  agentGetEntanglementProofs: [EntanglementProof!]!
395
438
  agentIsLocked: Boolean!
396
439
  agentStatus: AgentStatus!
440
+ aiGetDefaultModel(modelType: String!): Model!
441
+ aiGetModels: [Model!]!
397
442
  aiModelLoadingStatus(model: String!): AIModelLoadingStatus!
398
443
  aiTasks: [AITask!]!
399
444
  expression(url: String!): ExpressionRendered
@@ -245,6 +245,45 @@ input LinkQuery {
245
245
  untilDate: DateTime
246
246
  }
247
247
 
248
+ type LocalModel {
249
+ fileName: String!
250
+ modelParameters: String!
251
+ tokenizerSource: String!
252
+ }
253
+
254
+ input LocalModelInput {
255
+ fileName: String!
256
+ modelParameters: String!
257
+ tokenizerSource: String!
258
+ }
259
+
260
+ type Model {
261
+ api: ModelApi
262
+ id: String!
263
+ local: LocalModel
264
+ modelType: String!
265
+ name: String!
266
+ }
267
+
268
+ type ModelApi {
269
+ apiKey: String!
270
+ apiType: String!
271
+ baseUrl: String!
272
+ }
273
+
274
+ input ModelApiInput {
275
+ apiKey: String!
276
+ apiType: String!
277
+ baseUrl: String!
278
+ }
279
+
280
+ input ModelInput {
281
+ api: ModelApiInput
282
+ local: LocalModelInput
283
+ modelType: String!
284
+ name: String!
285
+ }
286
+
248
287
  type Mutation {
249
288
  addTrustedAgents(agents: [String!]!): [String!]!
250
289
  agentAddEntanglementProofs(proofs: [EntanglementProofInput!]!): [EntanglementProof!]!
@@ -262,13 +301,17 @@ type Mutation {
262
301
  agentUnlock(holochain: Boolean!, passphrase: String!): AgentStatus!
263
302
  agentUpdateDirectMessageLanguage(directMessageLanguage: String!): Agent!
264
303
  agentUpdatePublicPerspective(perspective: PerspectiveInput!): Agent!
304
+ aiAddModel(model: ModelInput!): String!
265
305
  aiAddTask(task: AITaskInput!): AITask!
266
306
  aiCloseTranscriptionStream(streamId: String!): String!
267
307
  aiEmbed(modelId: String!, text: String!): String!
268
308
  aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
269
309
  aiOpenTranscriptionStream(modelId: String!): String!
270
310
  aiPrompt(prompt: String!, taskId: String!): String!
311
+ aiRemoveModel(modelId: String!): Boolean!
271
312
  aiRemoveTask(taskId: String!): AITask!
313
+ aiSetDefaultModel(modelId: String!, modelType: String!): Boolean!
314
+ aiUpdateModel(model: ModelInput!, modelId: String!): Boolean!
272
315
  aiUpdateTask(task: AITaskInput!, taskId: String!): AITask!
273
316
  deleteTrustedAgents(agents: [String!]!): [String!]!
274
317
  expressionCreate(content: String!, languageAddress: String!): String!
@@ -390,6 +433,8 @@ type Query {
390
433
  agentGetEntanglementProofs: [EntanglementProof!]!
391
434
  agentIsLocked: Boolean!
392
435
  agentStatus: AgentStatus!
436
+ aiGetDefaultModel(modelType: String!): Model!
437
+ aiGetModels: [Model!]!
393
438
  aiModelLoadingStatus(model: String!): AIModelLoadingStatus!
394
439
  aiTasks: [AITask!]!
395
440
  expression(url: String!): ExpressionRendered
package/package.json CHANGED
@@ -64,7 +64,7 @@
64
64
  "react-dom": "*"
65
65
  },
66
66
  "patchedDependencies": {},
67
- "version": "0.10.0-rc10",
67
+ "version": "0.10.0-rc12",
68
68
  "pnpm": {
69
69
  "patchedDependencies": {
70
70
  "graphql@15.7.2": "patches/graphql@15.7.2.patch"
@@ -1153,6 +1153,87 @@ describe('Ad4mClient', () => {
1153
1153
  })
1154
1154
  })
1155
1155
  describe('.ai', () => {
1156
+ it('getModels smoke test', async () => {
1157
+ const models = await ad4mClient.ai.getModels();
1158
+ expect(models).toBeDefined();
1159
+ expect(Array.isArray(models)).toBe(true);
1160
+ if (models.length > 0) {
1161
+ expect(models[0]).toHaveProperty('name');
1162
+ expect(models[0]).toHaveProperty('api');
1163
+ expect(models[0]).toHaveProperty('local');
1164
+ }
1165
+ })
1166
+
1167
+ it('addModel smoke test', async () => {
1168
+ const newModel = {
1169
+ name: "New Test Model",
1170
+ api: {
1171
+ baseUrl: "https://api.newexample.com",
1172
+ apiKey: "new-test-api-key",
1173
+ apiType: "OpenAi"
1174
+ },
1175
+ local: {
1176
+ fileName: "new-test-model.bin",
1177
+ tokenizerSource: "new-test-tokenizer",
1178
+ modelParameters: "{}"
1179
+ },
1180
+ modelType: "LLM"
1181
+ };
1182
+ const result = await ad4mClient.ai.addModel(newModel);
1183
+ expect(result).toBe("new-model-id");
1184
+ })
1185
+
1186
+ it('updateModel smoke test', async () => {
1187
+ const modelId = "test-model-id";
1188
+ const updatedModel = {
1189
+ name: "Updated Test Model",
1190
+ api: {
1191
+ baseUrl: "https://api.updatedexample.com",
1192
+ apiKey: "updated-test-api-key",
1193
+ apiType: "OpenAi"
1194
+ },
1195
+ local: {
1196
+ fileName: "updated-test-model.bin",
1197
+ tokenizerSource: "updated-test-tokenizer",
1198
+ modelParameters: "{}"
1199
+ },
1200
+ modelType: "LLM"
1201
+ };
1202
+ const result = await ad4mClient.ai.updateModel(modelId, updatedModel);
1203
+ expect(result).toBe(true);
1204
+ })
1205
+
1206
+ it('removeModel smoke test', async () => {
1207
+ const modelName = "Test Model to Remove";
1208
+ const result = await ad4mClient.ai.removeModel(modelName);
1209
+ expect(result).toBe(true);
1210
+ })
1211
+
1212
+ // skip this because ModelType is a string enum that can't be annotated for
1213
+ // TypeGraphQL without changing it to a real enum.
1214
+ // This all works with the Rust resolvers in AD4M,
1215
+ // as the intergration tests demonstrate.
1216
+ it.skip('setDefaultModel and getDefaultModel smoke test', async () => {
1217
+ const modelName = "Test Model";
1218
+ const modelType = "LLM";
1219
+
1220
+ const setResult = await ad4mClient.ai.setDefaultModel(modelType, modelName);
1221
+ expect(setResult).toBe(true);
1222
+
1223
+ const model = await ad4mClient.ai.getDefaultModel(modelType);
1224
+ expect(model).toBeDefined();
1225
+ expect(model.name).toBe("Default Test Model");
1226
+ expect(model.api).toBeDefined();
1227
+ expect(model.api.baseUrl).toBe("https://api.example.com");
1228
+ expect(model.api.apiKey).toBe("test-api-key");
1229
+ expect(model.api.apiType).toBe("OpenAi");
1230
+ expect(model.local).toBeDefined();
1231
+ expect(model.local.fileName).toBe("test-model.bin");
1232
+ expect(model.local.tokenizerSource).toBe("test-tokenizer");
1233
+ expect(model.local.modelParameters).toBe("{}");
1234
+ expect(model.modelType).toBe(modelType);
1235
+ })
1236
+
1156
1237
  it('embed()', async () => {
1157
1238
  const vector = await ad4mClient.ai.embed("model", "test ets")
1158
1239
  expect(vector[0]).toEqual(0)
@@ -3,6 +3,7 @@ import unwrapApolloResult from "../unwrapApolloResult";
3
3
  import base64js from 'base64-js';
4
4
  import pako from 'pako'
5
5
  import { AIModelLoadingStatus, AITask, AITaskInput } from "./Tasks";
6
+ import { ModelInput, Model, ModelType } from "./AIResolver"
6
7
 
7
8
  export class AIClient {
8
9
  #apolloClient: ApolloClient<any>;
@@ -12,6 +13,105 @@ export class AIClient {
12
13
  this.#apolloClient = apolloClient;
13
14
  }
14
15
 
16
+ async getModels(): Promise<Model[]> {
17
+ const result = await this.#apolloClient.query({
18
+ query: gql`
19
+ query {
20
+ aiGetModels {
21
+ id
22
+ name
23
+ api {
24
+ baseUrl
25
+ apiKey
26
+ apiType
27
+ }
28
+ local {
29
+ fileName
30
+ tokenizerSource
31
+ modelParameters
32
+ }
33
+ modelType
34
+ }
35
+ }
36
+ `
37
+ });
38
+ return unwrapApolloResult(result).aiGetModels;
39
+ }
40
+
41
+ async addModel(model: ModelInput): Promise<string> {
42
+ const result = await this.#apolloClient.mutate({
43
+ mutation: gql`
44
+ mutation($model: ModelInput!) {
45
+ aiAddModel(model: $model)
46
+ }
47
+ `,
48
+ variables: { model }
49
+ });
50
+ return unwrapApolloResult(result).aiAddModel;
51
+ }
52
+
53
+ async updateModel(modelId: string, model: ModelInput): Promise<boolean> {
54
+ const result = await this.#apolloClient.mutate({
55
+ mutation: gql`
56
+ mutation($modelId: String!, $model: ModelInput!) {
57
+ aiUpdateModel(modelId: $modelId, model: $model)
58
+ }
59
+ `,
60
+ variables: { modelId, model }
61
+ });
62
+ return unwrapApolloResult(result).aiUpdateModel;
63
+ }
64
+
65
+ async removeModel(modelId: string): Promise<boolean> {
66
+ const result = await this.#apolloClient.mutate({
67
+ mutation: gql`
68
+ mutation($modelId: String!) {
69
+ aiRemoveModel(modelId: $modelId)
70
+ }
71
+ `,
72
+ variables: { modelId }
73
+ });
74
+ return unwrapApolloResult(result).aiRemoveModel;
75
+ }
76
+
77
+ async setDefaultModel(modelType: ModelType, modelId: string): Promise<boolean> {
78
+ const result = await this.#apolloClient.mutate({
79
+ mutation: gql`
80
+ mutation($modelType: ModelType!, $modelId: String!) {
81
+ aiSetDefaultModel(modelType: $modelType modelId: $modelId)
82
+ }
83
+ `,
84
+ variables: { modelId, modelType }
85
+ });
86
+ return unwrapApolloResult(result).aiSetDefaultModel;
87
+ }
88
+
89
+ async getDefaultModel(modelType: ModelType): Promise<Model> {
90
+ const result = await this.#apolloClient.query({
91
+ query: gql`
92
+ query($modelType: ModelType!) {
93
+ aiGetDefaultModel(modelType: $modelType) {
94
+ id
95
+ name
96
+ api {
97
+ baseUrl
98
+ apiKey
99
+ apiType
100
+ }
101
+ local {
102
+ fileName
103
+ tokenizerSource
104
+ modelParameters
105
+ }
106
+ modelType
107
+ }
108
+ }
109
+ `,
110
+ variables: { modelType }
111
+ });
112
+ return unwrapApolloResult(result).aiGetDefaultModel;
113
+ }
114
+
15
115
  async tasks(): Promise<AITask[]> {
16
116
  const { aiTasks } = unwrapApolloResult(await this.#apolloClient.query({
17
117
  query: gql`
@@ -1,4 +1,4 @@
1
- import { Query, Resolver, Mutation, Arg, InputType, Field, Subscription, Float, PubSub} from "type-graphql";
1
+ import { Query, Resolver, Mutation, Arg, InputType, Field, Subscription, Float, PubSub, ObjectType} from "type-graphql";
2
2
  import { AIModelLoadingStatus, AITask, AITaskInput } from "./Tasks";
3
3
  import pako from "pako";
4
4
  import base64js from 'base64-js';
@@ -7,8 +7,163 @@ import { AI_TRANSCRIPTION_TEXT_TOPIC } from "../PubSub";
7
7
  let createdAt = Date.now().toString();
8
8
  let updatedAt = Date.now().toString();
9
9
 
10
+
11
+ @ObjectType()
12
+ export class ModelApi {
13
+ @Field()
14
+ baseUrl: string;
15
+
16
+ @Field()
17
+ apiKey: string;
18
+
19
+ @Field()
20
+ apiType: String;
21
+ }
22
+
23
+ @ObjectType()
24
+ export class LocalModel {
25
+ @Field()
26
+ fileName: string;
27
+
28
+ @Field()
29
+ tokenizerSource: string;
30
+
31
+ @Field()
32
+ modelParameters: string;
33
+ }
34
+
35
+ export type ModelType = "LLM" | "EMBEDDING" | "TRANSCRIPTION";
36
+
37
+ @ObjectType()
38
+ export class Model {
39
+ @Field()
40
+ id: string;
41
+
42
+ @Field()
43
+ name: string;
44
+
45
+ @Field(type => ModelApi, { nullable: true })
46
+ api?: ModelApi;
47
+
48
+ @Field(type => LocalModel, { nullable: true })
49
+ local?: LocalModel;
50
+
51
+ @Field()
52
+ modelType: ModelType;
53
+ }
54
+
55
+ @InputType()
56
+ export class ModelApiInput {
57
+ @Field()
58
+ baseUrl: string;
59
+
60
+ @Field()
61
+ apiKey: string;
62
+
63
+ @Field()
64
+ apiType: string;
65
+ }
66
+
67
+ @InputType()
68
+ export class LocalModelInput {
69
+ @Field()
70
+ fileName: string;
71
+
72
+ @Field()
73
+ tokenizerSource: string;
74
+
75
+ @Field()
76
+ modelParameters: string;
77
+ }
78
+
79
+ @InputType()
80
+ export class ModelInput {
81
+ @Field()
82
+ name: string;
83
+
84
+ @Field(type => ModelApiInput, { nullable: true })
85
+ api?: ModelApiInput;
86
+
87
+ @Field(type => LocalModelInput, { nullable: true })
88
+ local?: LocalModelInput;
89
+
90
+ @Field()
91
+ modelType: ModelType;
92
+ }
93
+
10
94
  @Resolver()
11
95
  export default class AIResolver {
96
+ @Query(returns => [Model])
97
+ aiGetModels(): Model[] {
98
+ return [
99
+ {
100
+ id: "test-id",
101
+ name: "Test Model",
102
+ api: {
103
+ baseUrl: "https://api.example.com",
104
+ apiKey: "test-api-key",
105
+ apiType: "OpenAi"
106
+ },
107
+ local: {
108
+ fileName: "test-model.bin",
109
+ tokenizerSource: "test-tokenizer",
110
+ modelParameters: "{}"
111
+ },
112
+ modelType: "LLM"
113
+ }
114
+ ]
115
+ }
116
+
117
+ @Mutation(returns => String)
118
+ aiAddModel(@Arg("model", type => ModelInput) model: ModelInput): string {
119
+ // In a real implementation, this would add the model to storage
120
+ return "new-model-id"
121
+ }
122
+
123
+ @Mutation(returns => Boolean)
124
+ aiUpdateModel(
125
+ @Arg("modelId", type => String) modelId: string,
126
+ @Arg("model", type => ModelInput) model: ModelInput
127
+ ): boolean {
128
+ // In a real implementation, this would update the model in storage
129
+ return true
130
+ }
131
+
132
+ @Mutation(returns => Boolean)
133
+ aiRemoveModel(@Arg("modelId", type => String) modelId: string): boolean {
134
+ // In a real implementation, this would remove the model from storage
135
+ return true
136
+ }
137
+
138
+ @Mutation(returns => Boolean)
139
+ aiSetDefaultModel(
140
+ @Arg("modelType", type => String) modelType: ModelType,
141
+ @Arg("modelId", type => String) modelId: string,
142
+ ): boolean {
143
+ // In a real implementation, this would set the default model
144
+ return true
145
+ }
146
+
147
+ @Query(returns => Model)
148
+ aiGetDefaultModel(@Arg("modelType", type => String) modelType: ModelType): Model {
149
+ // In a real implementation, this would get the default model for the given type
150
+ return {
151
+ id: "default-test-id",
152
+ name: "Default Test Model",
153
+ api: {
154
+ baseUrl: "https://api.example.com",
155
+ apiKey: "test-api-key",
156
+ apiType: "OpenAi"
157
+ },
158
+ local: {
159
+ fileName: "test-model.bin",
160
+ tokenizerSource: "test-tokenizer",
161
+ modelParameters: "{}"
162
+ },
163
+ modelType: modelType
164
+ }
165
+ }
166
+
12
167
  @Query(returns => [AITask])
13
168
  aiTasks(): AITask[] {
14
169
  return [new AITask(