@liquidmetal-ai/raindrop 0.3.5 → 0.4.1
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/README.md +131 -92
- package/dist/base-command.d.ts +2 -1
- package/dist/base-command.d.ts.map +1 -1
- package/dist/base-command.js +10 -2
- package/dist/commands/build/branch.d.ts +1 -0
- package/dist/commands/build/branch.d.ts.map +1 -1
- package/dist/commands/build/branch.js +1 -1
- package/dist/commands/build/checkout.d.ts +1 -0
- package/dist/commands/build/checkout.d.ts.map +1 -1
- package/dist/commands/build/clone.d.ts.map +1 -1
- package/dist/commands/build/clone.js +0 -4
- package/dist/commands/build/delete.d.ts +1 -0
- package/dist/commands/build/delete.d.ts.map +1 -1
- package/dist/commands/build/delete.js +1 -1
- package/dist/commands/build/deploy.d.ts +1 -0
- package/dist/commands/build/deploy.d.ts.map +1 -1
- package/dist/commands/build/deploy.js +1 -1
- package/dist/commands/build/env/get.d.ts +1 -0
- package/dist/commands/build/env/get.d.ts.map +1 -1
- package/dist/commands/build/env/get.js +1 -1
- package/dist/commands/build/env/set.d.ts +1 -0
- package/dist/commands/build/env/set.d.ts.map +1 -1
- package/dist/commands/build/env/set.js +1 -1
- package/dist/commands/build/find.d.ts +1 -0
- package/dist/commands/build/find.d.ts.map +1 -1
- package/dist/commands/build/find.js +1 -1
- package/dist/commands/build/generate.js +1 -1
- package/dist/commands/build/list.d.ts +1 -0
- package/dist/commands/build/list.d.ts.map +1 -1
- package/dist/commands/build/list.js +1 -1
- package/dist/commands/build/sandbox.d.ts +1 -0
- package/dist/commands/build/sandbox.d.ts.map +1 -1
- package/dist/commands/build/start.d.ts +1 -0
- package/dist/commands/build/start.d.ts.map +1 -1
- package/dist/commands/build/start.js +1 -1
- package/dist/commands/build/status.d.ts +1 -0
- package/dist/commands/build/status.d.ts.map +1 -1
- package/dist/commands/build/status.js +1 -1
- package/dist/commands/build/stop.d.ts +1 -0
- package/dist/commands/build/stop.d.ts.map +1 -1
- package/dist/commands/build/stop.js +1 -1
- package/dist/commands/build/unsandbox.d.ts +1 -0
- package/dist/commands/build/unsandbox.d.ts.map +1 -1
- package/dist/commands/build/upload.d.ts +1 -0
- package/dist/commands/build/upload.d.ts.map +1 -1
- package/dist/commands/build/upload.js +1 -1
- package/dist/commands/build/validate.js +1 -1
- package/dist/commands/object/delete.d.ts +3 -1
- package/dist/commands/object/delete.d.ts.map +1 -1
- package/dist/commands/object/delete.js +51 -5
- package/dist/commands/object/get.d.ts +3 -1
- package/dist/commands/object/get.d.ts.map +1 -1
- package/dist/commands/object/get.js +49 -5
- package/dist/commands/object/list.d.ts +3 -1
- package/dist/commands/object/list.d.ts.map +1 -1
- package/dist/commands/object/list.js +51 -7
- package/dist/commands/object/put.d.ts +3 -1
- package/dist/commands/object/put.d.ts.map +1 -1
- package/dist/commands/object/put.js +53 -6
- package/dist/commands/query/chunk-search.d.ts +3 -0
- package/dist/commands/query/chunk-search.d.ts.map +1 -1
- package/dist/commands/query/chunk-search.js +39 -3
- package/dist/commands/query/document.d.ts +26 -0
- package/dist/commands/query/document.d.ts.map +1 -0
- package/dist/commands/query/document.js +117 -0
- package/dist/commands/query/search.d.ts +2 -0
- package/dist/commands/query/search.d.ts.map +1 -1
- package/dist/commands/query/search.js +34 -9
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +1615 -905
- package/package.json +1 -1
- package/templates/db/package.json +4 -3
|
@@ -26,8 +26,13 @@ Download file with key 'my-key' from my-bucket to output.txt
|
|
|
26
26
|
...BaseCommand.HIDDEN_FLAGS,
|
|
27
27
|
bucket: Flags.string({
|
|
28
28
|
char: 'b',
|
|
29
|
-
description: 'bucket
|
|
30
|
-
required:
|
|
29
|
+
description: 'bucket name version can be specified with #, e.g. my-bucket#versionId',
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
moduleId: Flags.string({
|
|
33
|
+
char: 'm',
|
|
34
|
+
description: 'moduleId',
|
|
35
|
+
required: false,
|
|
31
36
|
}),
|
|
32
37
|
format: Flags.string({
|
|
33
38
|
char: 'f',
|
|
@@ -42,7 +47,7 @@ Download file with key 'my-key' from my-bucket to output.txt
|
|
|
42
47
|
hidden: true,
|
|
43
48
|
}),
|
|
44
49
|
manifest: Flags.string({
|
|
45
|
-
char: '
|
|
50
|
+
char: 'M',
|
|
46
51
|
description: 'project manifest',
|
|
47
52
|
required: false,
|
|
48
53
|
default: 'raindrop.manifest',
|
|
@@ -50,12 +55,51 @@ Download file with key 'my-key' from my-bucket to output.txt
|
|
|
50
55
|
}),
|
|
51
56
|
};
|
|
52
57
|
async run() {
|
|
58
|
+
if (this.flags.bucket && this.flags.moduleId) {
|
|
59
|
+
this.error('Cannot specify both --bucket and --moduleId flags. Please use only one type of filter.');
|
|
60
|
+
}
|
|
61
|
+
if (!this.flags.bucket && !this.flags.moduleId) {
|
|
62
|
+
this.error('Either --bucket or --moduleId flag must be specified.');
|
|
63
|
+
}
|
|
53
64
|
const { args, flags } = await this.parse(ObjectGet);
|
|
54
|
-
|
|
65
|
+
let moduleId = this.flags.moduleId || '';
|
|
66
|
+
let bucket;
|
|
67
|
+
const { client: catalogService, userId, organizationId } = await this.catalogService();
|
|
68
|
+
if (!moduleId && this.flags.bucket) {
|
|
69
|
+
// If moduleId is not provided and bucket is specified, we need to fetch the moduleId from the catalog service
|
|
70
|
+
//string split on # to get bucket name and version
|
|
71
|
+
const [bucketName, version] = this.flags.bucket.split('#');
|
|
72
|
+
bucket = (await catalogService.resolveBucketLocationToModuleId({
|
|
73
|
+
userId,
|
|
74
|
+
organizationId,
|
|
75
|
+
bucketLocation: {
|
|
76
|
+
bucketLocation: {
|
|
77
|
+
case: 'bucket',
|
|
78
|
+
value: {
|
|
79
|
+
name: bucketName,
|
|
80
|
+
version: version || '',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
})).bucket;
|
|
85
|
+
if (!bucket || !bucket.moduleId) {
|
|
86
|
+
this.error(`Bucket "${this.flags.bucket}" not found or does not belong to any module.`);
|
|
87
|
+
}
|
|
88
|
+
moduleId = bucket.moduleId;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// query for the bucket if moduleId is provided
|
|
92
|
+
bucket = (await catalogService.resolveModuleIdToBucketLocation({
|
|
93
|
+
userId,
|
|
94
|
+
organizationId,
|
|
95
|
+
moduleId,
|
|
96
|
+
})).bucket;
|
|
97
|
+
}
|
|
98
|
+
const { client: objectService } = await this.objectService(moduleId);
|
|
55
99
|
const response = await objectService.getObject({
|
|
56
100
|
userId,
|
|
57
101
|
organizationId,
|
|
58
|
-
|
|
102
|
+
moduleId,
|
|
59
103
|
key: args.key,
|
|
60
104
|
});
|
|
61
105
|
if (!response.content) {
|
|
@@ -3,7 +3,8 @@ export default class ObjectList extends BaseCommand<typeof ObjectList> {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
-
bucket: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
bucket: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
moduleId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -13,6 +14,7 @@ export default class ObjectList extends BaseCommand<typeof ObjectList> {
|
|
|
13
14
|
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
15
|
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
16
|
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
sendVersionMetadata: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
18
|
};
|
|
17
19
|
run(): Promise<void>;
|
|
18
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/object/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/object/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMpD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW,CAAC,OAAO,UAAU,CAAC;IACpE,MAAM,CAAC,WAAW,SAA8B;IAEhD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;MA+BV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA4F3B"}
|
|
@@ -14,8 +14,13 @@ List all objects in my-bucket
|
|
|
14
14
|
...BaseCommand.HIDDEN_FLAGS,
|
|
15
15
|
bucket: Flags.string({
|
|
16
16
|
char: 'b',
|
|
17
|
-
description: 'bucket
|
|
18
|
-
required:
|
|
17
|
+
description: 'bucket name version can be specified with #, e.g. my-bucket#versionId',
|
|
18
|
+
required: false,
|
|
19
|
+
}),
|
|
20
|
+
moduleId: Flags.string({
|
|
21
|
+
char: 'm',
|
|
22
|
+
description: 'moduleId',
|
|
23
|
+
required: false,
|
|
19
24
|
}),
|
|
20
25
|
output: Flags.string({
|
|
21
26
|
char: 'o',
|
|
@@ -30,7 +35,7 @@ List all objects in my-bucket
|
|
|
30
35
|
hidden: true,
|
|
31
36
|
}),
|
|
32
37
|
manifest: Flags.string({
|
|
33
|
-
char: '
|
|
38
|
+
char: 'M',
|
|
34
39
|
description: 'project manifest',
|
|
35
40
|
required: false,
|
|
36
41
|
default: 'raindrop.manifest',
|
|
@@ -38,19 +43,58 @@ List all objects in my-bucket
|
|
|
38
43
|
}),
|
|
39
44
|
};
|
|
40
45
|
async run() {
|
|
46
|
+
if (this.flags.bucket && this.flags.moduleId) {
|
|
47
|
+
this.error('Cannot specify both --bucket and --moduleId flags. Please use only one type of filter.');
|
|
48
|
+
}
|
|
49
|
+
if (!this.flags.bucket && !this.flags.moduleId) {
|
|
50
|
+
this.error('Either --bucket or --moduleId flag must be specified.');
|
|
51
|
+
}
|
|
41
52
|
const { flags } = await this.parse(ObjectList);
|
|
42
|
-
|
|
53
|
+
let moduleId = this.flags.moduleId || '';
|
|
54
|
+
let bucket;
|
|
55
|
+
const { client: catalogService, userId, organizationId } = await this.catalogService();
|
|
56
|
+
if (!moduleId && this.flags.bucket) {
|
|
57
|
+
// If moduleId is not provided and bucket is specified, we need to fetch the moduleId from the catalog service
|
|
58
|
+
//string split on # to get bucket name and version
|
|
59
|
+
const [bucketName, version] = this.flags.bucket.split('#');
|
|
60
|
+
bucket = (await catalogService.resolveBucketLocationToModuleId({
|
|
61
|
+
userId,
|
|
62
|
+
organizationId,
|
|
63
|
+
bucketLocation: {
|
|
64
|
+
bucketLocation: {
|
|
65
|
+
case: 'bucket',
|
|
66
|
+
value: {
|
|
67
|
+
name: bucketName,
|
|
68
|
+
version: version || '',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
})).bucket;
|
|
73
|
+
if (!bucket || !bucket.moduleId) {
|
|
74
|
+
this.error(`Bucket "${this.flags.bucket}" not found or does not belong to any module.`);
|
|
75
|
+
}
|
|
76
|
+
moduleId = bucket.moduleId;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// query for the bucket if moduleId is provided
|
|
80
|
+
bucket = (await catalogService.resolveModuleIdToBucketLocation({
|
|
81
|
+
userId,
|
|
82
|
+
organizationId,
|
|
83
|
+
moduleId,
|
|
84
|
+
})).bucket;
|
|
85
|
+
}
|
|
86
|
+
const { client: objectService } = await this.objectService(moduleId);
|
|
43
87
|
let response;
|
|
44
88
|
try {
|
|
45
89
|
response = await objectService.listObjects({
|
|
46
90
|
userId,
|
|
47
91
|
organizationId,
|
|
48
|
-
|
|
92
|
+
moduleId,
|
|
49
93
|
});
|
|
50
94
|
}
|
|
51
95
|
catch (error) {
|
|
52
96
|
const err = error;
|
|
53
|
-
this.error(`Failed to list objects in bucket ${
|
|
97
|
+
this.error(`Failed to list objects in bucket ${bucket.bucketName}: ${err.message}`);
|
|
54
98
|
}
|
|
55
99
|
if (!response.objects?.length) {
|
|
56
100
|
console.log('No objects found in bucket');
|
|
@@ -69,7 +113,7 @@ List all objects in my-bucket
|
|
|
69
113
|
})));
|
|
70
114
|
break;
|
|
71
115
|
default:
|
|
72
|
-
console.log(`Objects in bucket ${
|
|
116
|
+
console.log(`Objects in bucket ${bucket.bucketName}:`);
|
|
73
117
|
for (const obj of response.objects) {
|
|
74
118
|
const lastModified = obj.lastModified ? timestampDate(obj.lastModified).toUTCString() : 'N/A';
|
|
75
119
|
console.log(`Key: ${obj.key}`);
|
|
@@ -9,7 +9,8 @@ export default class ObjectPut extends BaseCommand<typeof ObjectPut> {
|
|
|
9
9
|
static description: string;
|
|
10
10
|
static examples: string[];
|
|
11
11
|
static flags: {
|
|
12
|
-
bucket: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
bucket: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
moduleId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
contentType: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
15
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
16
|
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -20,6 +21,7 @@ export default class ObjectPut extends BaseCommand<typeof ObjectPut> {
|
|
|
20
21
|
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
22
|
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
23
|
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
sendVersionMetadata: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
25
|
};
|
|
24
26
|
run(): Promise<void>;
|
|
25
27
|
private getContentType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"put.d.ts","sourceRoot":"","sources":["../../../src/commands/object/put.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"put.d.ts","sourceRoot":"","sources":["../../../src/commands/object/put.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOpD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW,CAAC,OAAO,SAAS,CAAC;IAClE,MAAM,CAAC,IAAI;;;;;MAUT;IAEF,MAAM,CAAC,WAAW,SAAyC;IAE3D,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;MAoCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAyE1B,OAAO,CAAC,cAAc;CAavB"}
|
|
@@ -26,8 +26,13 @@ Upload myfile.txt to my-bucket with key 'my-key'
|
|
|
26
26
|
...BaseCommand.HIDDEN_FLAGS,
|
|
27
27
|
bucket: Flags.string({
|
|
28
28
|
char: 'b',
|
|
29
|
-
description: 'bucket
|
|
30
|
-
required:
|
|
29
|
+
description: 'bucket name version can be specified with #, e.g. my-bucket#versionId',
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
moduleId: Flags.string({
|
|
33
|
+
char: 'm',
|
|
34
|
+
description: 'moduleId',
|
|
35
|
+
required: false,
|
|
31
36
|
}),
|
|
32
37
|
contentType: Flags.string({
|
|
33
38
|
char: 't',
|
|
@@ -47,7 +52,7 @@ Upload myfile.txt to my-bucket with key 'my-key'
|
|
|
47
52
|
hidden: true,
|
|
48
53
|
}),
|
|
49
54
|
manifest: Flags.string({
|
|
50
|
-
char: '
|
|
55
|
+
char: 'M',
|
|
51
56
|
description: 'project manifest',
|
|
52
57
|
required: false,
|
|
53
58
|
default: 'raindrop.manifest',
|
|
@@ -55,8 +60,48 @@ Upload myfile.txt to my-bucket with key 'my-key'
|
|
|
55
60
|
}),
|
|
56
61
|
};
|
|
57
62
|
async run() {
|
|
63
|
+
if (this.flags.bucket && this.flags.moduleId) {
|
|
64
|
+
this.error('Cannot specify both --bucket and --moduleId flags. Please use only one type of filter.');
|
|
65
|
+
}
|
|
66
|
+
if (!this.flags.bucket && !this.flags.moduleId) {
|
|
67
|
+
this.error('Either --bucket or --moduleId flag must be specified.');
|
|
68
|
+
}
|
|
58
69
|
const { args, flags } = await this.parse(ObjectPut);
|
|
59
|
-
|
|
70
|
+
let moduleId = this.flags.moduleId || '';
|
|
71
|
+
let bucket;
|
|
72
|
+
const { client: catalogService, userId, organizationId } = await this.catalogService();
|
|
73
|
+
if (!moduleId && this.flags.bucket) {
|
|
74
|
+
// If moduleId is not provided and bucket is specified, we need to fetch the moduleId from the catalog service
|
|
75
|
+
//string split on # to get bucket name and version
|
|
76
|
+
const [bucketName, version] = this.flags.bucket.split('#');
|
|
77
|
+
bucket = (await catalogService.resolveBucketLocationToModuleId({
|
|
78
|
+
userId,
|
|
79
|
+
organizationId,
|
|
80
|
+
bucketLocation: {
|
|
81
|
+
bucketLocation: {
|
|
82
|
+
case: 'bucket',
|
|
83
|
+
value: {
|
|
84
|
+
name: bucketName,
|
|
85
|
+
version: version || '',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
})).bucket;
|
|
90
|
+
if (!bucket || !bucket.moduleId) {
|
|
91
|
+
this.error(`Bucket "${this.flags.bucket}" not found or does not belong to any module.`);
|
|
92
|
+
}
|
|
93
|
+
moduleId = bucket.moduleId;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// query for the bucket if moduleId is provided
|
|
97
|
+
bucket = (await catalogService.resolveModuleIdToBucketLocation({
|
|
98
|
+
userId,
|
|
99
|
+
organizationId,
|
|
100
|
+
moduleId,
|
|
101
|
+
})).bucket;
|
|
102
|
+
}
|
|
103
|
+
console.log(`Using moduleId: ${moduleId}`);
|
|
104
|
+
const { client: objectService } = await this.objectService(moduleId);
|
|
60
105
|
// Read the file
|
|
61
106
|
const fileContent = await fs.readFile(args.file);
|
|
62
107
|
// Get content type if not specified
|
|
@@ -64,17 +109,19 @@ Upload myfile.txt to my-bucket with key 'my-key'
|
|
|
64
109
|
const response = await objectService.putObject({
|
|
65
110
|
userId,
|
|
66
111
|
organizationId,
|
|
67
|
-
|
|
112
|
+
moduleId,
|
|
68
113
|
key: args.key,
|
|
69
114
|
content: fileContent,
|
|
70
115
|
contentType,
|
|
71
116
|
});
|
|
117
|
+
//attach the bucket to the response
|
|
118
|
+
response.bucket = bucket;
|
|
72
119
|
if (flags.output === 'json') {
|
|
73
120
|
console.log(toJsonString(PutObjectResponseSchema, response, { prettySpaces: 2 }));
|
|
74
121
|
}
|
|
75
122
|
else {
|
|
76
123
|
console.log('Successfully uploaded file:');
|
|
77
|
-
console.log(`Bucket: ${response.
|
|
124
|
+
console.log(`Bucket: ${response.bucket.bucketName}`);
|
|
78
125
|
console.log(`Key: ${response.key}`);
|
|
79
126
|
}
|
|
80
127
|
}
|
|
@@ -6,6 +6,8 @@ export default class RagSearch extends BaseCommand<typeof RagSearch> {
|
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
+
buckets: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
moduleIds: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
12
|
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
13
|
manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -15,6 +17,7 @@ export default class RagSearch extends BaseCommand<typeof RagSearch> {
|
|
|
15
17
|
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
18
|
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
19
|
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
sendVersionMetadata: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
21
|
};
|
|
19
22
|
searchAgent(query: string): Promise<void>;
|
|
20
23
|
run(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk-search.d.ts","sourceRoot":"","sources":["../../../src/commands/query/chunk-search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW,CAAC,OAAO,SAAS,CAAC;IAClE,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,WAAW,SAAoF;IAEtG,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"chunk-search.d.ts","sourceRoot":"","sources":["../../../src/commands/query/chunk-search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW,CAAC,OAAO,SAAS,CAAC;IAClE,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,WAAW,SAAoF;IAEtG,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;MAiCV;IAEI,WAAW,CAAC,KAAK,EAAE,MAAM;IA0DzB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAI3B"}
|
|
@@ -18,6 +18,18 @@ Run a RAG search query against a Smart Bucket.
|
|
|
18
18
|
];
|
|
19
19
|
static flags = {
|
|
20
20
|
...BaseCommand.HIDDEN_FLAGS,
|
|
21
|
+
buckets: Flags.string({
|
|
22
|
+
char: 'b',
|
|
23
|
+
description: 'Bucket names to search in, version can be specified with #, e.g. my-bucket#versionId',
|
|
24
|
+
multiple: true,
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
moduleIds: Flags.string({
|
|
28
|
+
char: 'm',
|
|
29
|
+
description: 'Module IDs to search in',
|
|
30
|
+
multiple: true,
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
21
33
|
output: Flags.string({
|
|
22
34
|
char: 'o',
|
|
23
35
|
description: 'output format',
|
|
@@ -31,7 +43,7 @@ Run a RAG search query against a Smart Bucket.
|
|
|
31
43
|
hidden: true,
|
|
32
44
|
}),
|
|
33
45
|
manifest: Flags.string({
|
|
34
|
-
char: '
|
|
46
|
+
char: 'M',
|
|
35
47
|
description: 'project manifest',
|
|
36
48
|
required: false,
|
|
37
49
|
default: 'raindrop.manifest',
|
|
@@ -39,12 +51,36 @@ Run a RAG search query against a Smart Bucket.
|
|
|
39
51
|
}),
|
|
40
52
|
};
|
|
41
53
|
async searchAgent(query) {
|
|
54
|
+
// Check if both buckets and moduleIds flags are set
|
|
55
|
+
if (this.flags.buckets?.length && this.flags.moduleIds?.length) {
|
|
56
|
+
this.error('Cannot specify both --buckets and --moduleIds flags. Please use only one type of filter.');
|
|
57
|
+
}
|
|
42
58
|
const { client: searchAgentService, userId, organizationId } = await this.searchAgentService();
|
|
43
59
|
// Run the RAG search
|
|
44
60
|
const response = await searchAgentService.ragSearch({
|
|
45
61
|
userId,
|
|
46
62
|
organizationId,
|
|
47
|
-
|
|
63
|
+
bucketLocations: [
|
|
64
|
+
...(this.flags.buckets || []).map((bucket) => {
|
|
65
|
+
//string split on # to get bucket name and version
|
|
66
|
+
const [bucketName, version] = bucket.split('#');
|
|
67
|
+
return {
|
|
68
|
+
bucketLocation: {
|
|
69
|
+
case: 'bucket',
|
|
70
|
+
value: {
|
|
71
|
+
name: bucketName,
|
|
72
|
+
version: version || '',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}),
|
|
77
|
+
...(this.flags.moduleIds || []).map((moduleId) => ({
|
|
78
|
+
bucketLocation: {
|
|
79
|
+
case: 'moduleId',
|
|
80
|
+
value: moduleId,
|
|
81
|
+
},
|
|
82
|
+
})),
|
|
83
|
+
],
|
|
48
84
|
requestId: ulid(),
|
|
49
85
|
input: query,
|
|
50
86
|
});
|
|
@@ -59,7 +95,7 @@ Run a RAG search query against a Smart Bucket.
|
|
|
59
95
|
console.log('----------------------------------------');
|
|
60
96
|
console.log(`Type: ${result.type || 'N/A'}`);
|
|
61
97
|
console.log(`Score: ${result.score || 0}`);
|
|
62
|
-
console.log(`Source: ${result.source ? `${result.source.bucket}/${result.source.object}` : 'N/A'}`);
|
|
98
|
+
console.log(`Source: ${result.source ? `${result.source.bucket?.bucketName}/${result.source.object}` : 'N/A'}`);
|
|
63
99
|
console.log(`Content: ${result.text || 'N/A'}`);
|
|
64
100
|
console.log('----------------------------------------\n');
|
|
65
101
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command.js';
|
|
2
|
+
export default class DocumentChat extends BaseCommand<typeof DocumentChat> {
|
|
3
|
+
static args: {
|
|
4
|
+
query: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
bucket: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
moduleId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
objectId: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
sendVersionMetadata: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
};
|
|
23
|
+
documentChat(query: string): Promise<void>;
|
|
24
|
+
run(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/commands/query/document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW,CAAC,OAAO,YAAY,CAAC;IACxE,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,WAAW,SAAmD;IAErE,MAAM,CAAC,QAAQ,WAOb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;MAoCV;IAEI,YAAY,CAAC,KAAK,EAAE,MAAM;IA2D1B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAI3B"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from '../../base-command.js';
|
|
3
|
+
import { ulid } from '@liquidmetal-ai/drizzle/ulid';
|
|
4
|
+
import { toJsonString } from '@bufbuild/protobuf';
|
|
5
|
+
import { DocumentChatResponseSchema } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/search_agent_pb';
|
|
6
|
+
export default class DocumentChat extends BaseCommand {
|
|
7
|
+
static args = {
|
|
8
|
+
query: Args.string({
|
|
9
|
+
description: 'question or query about the document',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static description = 'Chat with a document stored in a Smart Bucket';
|
|
14
|
+
static examples = [
|
|
15
|
+
`<%= config.bin %> query document "What is the main topic of this document?" -b my-bucket -o document.pdf
|
|
16
|
+
Chat with a document in a Smart Bucket using bucket name.
|
|
17
|
+
`,
|
|
18
|
+
`<%= config.bin %> query document "What is the main topic of this document?" -m module-id -o document.pdf
|
|
19
|
+
Chat with a document in a Smart Bucket using module ID.
|
|
20
|
+
`,
|
|
21
|
+
];
|
|
22
|
+
static flags = {
|
|
23
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
24
|
+
bucket: Flags.string({
|
|
25
|
+
char: 'b',
|
|
26
|
+
description: 'Bucket name containing the document, version can be specified with #, e.g. my-bucket#versionId',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
moduleId: Flags.string({
|
|
30
|
+
char: 'm',
|
|
31
|
+
description: 'Module ID containing the document',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
objectId: Flags.string({
|
|
35
|
+
char: 'o',
|
|
36
|
+
description: 'Object ID of the document to chat with',
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
output: Flags.string({
|
|
40
|
+
char: 'O',
|
|
41
|
+
description: 'output format',
|
|
42
|
+
default: 'text',
|
|
43
|
+
options: ['text', 'json'],
|
|
44
|
+
}),
|
|
45
|
+
impersonate: Flags.string({
|
|
46
|
+
char: 'i',
|
|
47
|
+
description: 'impersonate organization',
|
|
48
|
+
required: false,
|
|
49
|
+
hidden: true,
|
|
50
|
+
}),
|
|
51
|
+
manifest: Flags.string({
|
|
52
|
+
char: 'M',
|
|
53
|
+
description: 'project manifest',
|
|
54
|
+
required: false,
|
|
55
|
+
default: 'raindrop.manifest',
|
|
56
|
+
hidden: true,
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
async documentChat(query) {
|
|
60
|
+
// Check if both bucket and moduleId flags are set
|
|
61
|
+
if (this.flags.bucket && this.flags.moduleId) {
|
|
62
|
+
this.error('Cannot specify both --bucket and --moduleId flags. Please use only one type of location.');
|
|
63
|
+
}
|
|
64
|
+
// Check if at least one location is specified
|
|
65
|
+
if (!this.flags.bucket && !this.flags.moduleId) {
|
|
66
|
+
this.error('Must specify either --bucket or --moduleId flag to identify the document location.');
|
|
67
|
+
}
|
|
68
|
+
const { client: searchAgentService, userId, organizationId } = await this.searchAgentService();
|
|
69
|
+
let bucketLocation;
|
|
70
|
+
// Create bucket location based on which flag is used
|
|
71
|
+
if (this.flags.bucket) {
|
|
72
|
+
// Parse bucket name and version if provided
|
|
73
|
+
const [bucketName, version] = this.flags.bucket.split('#');
|
|
74
|
+
bucketLocation = {
|
|
75
|
+
bucketLocation: {
|
|
76
|
+
case: 'bucket',
|
|
77
|
+
value: {
|
|
78
|
+
name: bucketName,
|
|
79
|
+
version: version || '',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Use moduleId
|
|
86
|
+
bucketLocation = {
|
|
87
|
+
bucketLocation: {
|
|
88
|
+
case: 'moduleId',
|
|
89
|
+
value: this.flags.moduleId,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// Run the document chat
|
|
94
|
+
const response = await searchAgentService.documentChat({
|
|
95
|
+
userId,
|
|
96
|
+
organizationId,
|
|
97
|
+
bucketLocation,
|
|
98
|
+
objectId: this.flags.objectId,
|
|
99
|
+
requestId: ulid(),
|
|
100
|
+
input: query,
|
|
101
|
+
});
|
|
102
|
+
// Output results based on format flag
|
|
103
|
+
if (this.flags.output === 'json') {
|
|
104
|
+
console.log(toJsonString(DocumentChatResponseSchema, response, { prettySpaces: 2 }));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
console.log('\nDocument Chat Response:\n');
|
|
108
|
+
console.log('----------------------------------------');
|
|
109
|
+
console.log(response.answer);
|
|
110
|
+
console.log('----------------------------------------\n');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async run() {
|
|
114
|
+
const { args } = await this.parse(DocumentChat);
|
|
115
|
+
await this.documentChat(args.query);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -7,6 +7,7 @@ export default class AgentSearch extends BaseCommand<typeof AgentSearch> {
|
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
9
|
buckets: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
moduleIds: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
requestId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -18,6 +19,7 @@ export default class AgentSearch extends BaseCommand<typeof AgentSearch> {
|
|
|
18
19
|
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
20
|
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
21
|
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
sendVersionMetadata: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
23
|
};
|
|
22
24
|
run(): Promise<void>;
|
|
23
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/commands/query/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW,CAAC,OAAO,WAAW,CAAC;IACtE,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,WAAW,SAAsE;IAExF,MAAM,CAAC,QAAQ,WAOb;IAEF,MAAM,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/commands/query/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW,CAAC,OAAO,WAAW,CAAC;IACtE,MAAM,CAAC,IAAI;;MAKT;IAEF,MAAM,CAAC,WAAW,SAAsE;IAExF,MAAM,CAAC,QAAQ,WAOb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;MA0CV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAsG3B"}
|