@relevanceai/sdk 2.0.2 → 3.0.0-alpha.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.
Files changed (60) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +304 -105
  3. package/esm/agent-task.d.ts +61 -0
  4. package/esm/agent-task.js +112 -0
  5. package/esm/agent.d.ts +17 -0
  6. package/esm/agent.js +52 -0
  7. package/esm/client.d.ts +36 -0
  8. package/esm/client.js +69 -0
  9. package/esm/events.d.ts +40 -0
  10. package/esm/events.js +39 -0
  11. package/esm/key.d.ts +86 -0
  12. package/esm/key.js +121 -0
  13. package/esm/message.d.ts +18 -0
  14. package/esm/message.js +18 -0
  15. package/esm/mod.d.ts +7 -0
  16. package/esm/mod.js +4 -0
  17. package/esm/package.json +3 -0
  18. package/esm/region.d.ts +5 -0
  19. package/esm/region.js +6 -0
  20. package/esm/task.d.ts +25 -0
  21. package/esm/task.js +96 -0
  22. package/esm/utils.d.ts +8 -0
  23. package/esm/utils.js +29 -0
  24. package/package.json +11 -36
  25. package/dist-cjs/generated/VecDBApi.js +0 -1682
  26. package/dist-cjs/generated/_VecDBApiSchemaTypes.js +0 -3
  27. package/dist-cjs/generated/index.js +0 -17
  28. package/dist-cjs/index.js +0 -18
  29. package/dist-cjs/services/discovery/Dataset.js +0 -126
  30. package/dist-cjs/services/discovery/index.js +0 -159
  31. package/dist-cjs/services/index.js +0 -18
  32. package/dist-cjs/services/vecdb/Dataset.js +0 -137
  33. package/dist-cjs/services/vecdb/index.js +0 -137
  34. package/dist-cjs/shared/BaseClient.js +0 -35
  35. package/dist-cjs/shared/generate.js +0 -90
  36. package/dist-cjs/shared/serviceConfigs.js +0 -10
  37. package/dist-es/generated/VecDBApi.js +0 -2579
  38. package/dist-es/generated/_VecDBApiSchemaTypes.js +0 -2
  39. package/dist-es/generated/index.js +0 -1
  40. package/dist-es/index.js +0 -2
  41. package/dist-es/services/discovery/Dataset.js +0 -126
  42. package/dist-es/services/discovery/index.js +0 -159
  43. package/dist-es/services/index.js +0 -2
  44. package/dist-es/services/vecdb/Dataset.js +0 -356
  45. package/dist-es/services/vecdb/index.js +0 -184
  46. package/dist-es/shared/BaseClient.js +0 -82
  47. package/dist-es/shared/generate.js +0 -224
  48. package/dist-es/shared/serviceConfigs.js +0 -7
  49. package/dist-types/generated/VecDBApi.d.ts +0 -632
  50. package/dist-types/generated/_VecDBApiSchemaTypes.d.ts +0 -22299
  51. package/dist-types/generated/index.d.ts +0 -1
  52. package/dist-types/index.d.ts +0 -2
  53. package/dist-types/services/discovery/Dataset.d.ts +0 -0
  54. package/dist-types/services/discovery/index.d.ts +0 -0
  55. package/dist-types/services/index.d.ts +0 -1
  56. package/dist-types/services/vecdb/Dataset.d.ts +0 -52
  57. package/dist-types/services/vecdb/index.d.ts +0 -44
  58. package/dist-types/shared/BaseClient.d.ts +0 -28
  59. package/dist-types/shared/generate.d.ts +0 -1
  60. package/dist-types/shared/serviceConfigs.d.ts +0 -8
@@ -1,90 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const cross_fetch_1 = __importDefault(require("cross-fetch"));
7
- const fs_1 = require("fs");
8
- const openapi_typescript_1 = __importDefault(require("openapi-typescript"));
9
- const serviceConfigs_1 = require("./serviceConfigs");
10
- // download schema using cross-fetch
11
- // convert to sdk with typescript, can supply middleware methods that will be run ???
12
- function GetFlattenedSchema(schema) {
13
- var _a, _b, _c;
14
- if (!schema.paths)
15
- throw new Error('No paths in schema ${config.schema_url}');
16
- const final = [];
17
- for (const [path, methods] of Object.entries(schema.paths)) {
18
- for (const [method, pathData] of Object.entries(methods)) {
19
- const operation = pathData; // object.entries didnt work here
20
- const operationSummaryName = (_c = ((_b = (_a = operation === null || operation === void 0 ? void 0 : operation.operationId) !== null && _a !== void 0 ? _a : operation === null || operation === void 0 ? void 0 : operation.summary) !== null && _b !== void 0 ? _b : `${path}-${method}`)) === null || _c === void 0 ? void 0 : _c.replace(/[^A-Za-z0-9]/g, "");
21
- final.push({ path, method, operation, operationSummaryName });
22
- }
23
- }
24
- return final;
25
- }
26
- async function GenerateSDKFromOpenAPISchema({ config }) {
27
- const openapiSchema = await (await (0, cross_fetch_1.default)(config.schema_url)).json();
28
- const typescriptOutput = 'interface definitions {[id:string]:any};\n' + (await (0, openapi_typescript_1.default)(openapiSchema));
29
- let sdkText = '';
30
- const pipeline = [
31
- () => {
32
- sdkText += `import {CommandInput,_GenericClient,CommandOutput,_ClientInput,_GenericMethodOptions} from '../shared/BaseClient';
33
- import {operations} from './_${config.name}SchemaTypes';
34
- `;
35
- },
36
- () => {
37
- for (const { path, method, operation, operationSummaryName } of GetFlattenedSchema(openapiSchema)) {
38
- if (method.toLowerCase() !== 'get' && operation.requestBody) {
39
- sdkText += `
40
- export type ${operationSummaryName}Input = operations['${operation.operationId}']['requestBody']['content']['application/json']`;
41
- }
42
- else {
43
- sdkText += `
44
- export type ${operationSummaryName}Input = {}`;
45
- }
46
- sdkText += `
47
- export type ${operationSummaryName}Output = operations['${operation.operationId}']['responses']['200']['content']['application/json']`;
48
- }
49
- },
50
- () => {
51
- sdkText += `
52
- export class ${config.name}Client extends _GenericClient {
53
- constructor(config:_ClientInput){
54
- super({...config,service_name:'${config.name}'});
55
- }`;
56
- },
57
- () => {
58
- for (const { path, method, operationSummaryName } of GetFlattenedSchema(openapiSchema)) {
59
- sdkText += `
60
- public async ${operationSummaryName}(
61
- input: CommandInput<${operationSummaryName}Input>,
62
- options?: _GenericMethodOptions
63
- ):Promise<CommandOutput<${operationSummaryName}Output>> {
64
- return this.SendRequest({
65
- input,
66
- method:'${method}',
67
- path:'${path}',
68
- options
69
- });
70
- }`;
71
- }
72
- },
73
- () => {
74
- sdkText += '}';
75
- }
76
- ];
77
- for (const fn of pipeline)
78
- fn();
79
- await fs_1.promises.writeFile(`./src/generated/${config.name}.ts`, sdkText);
80
- await fs_1.promises.writeFile(`./src/generated/_${config.name}SchemaTypes.ts`, typescriptOutput);
81
- }
82
- async function GenerateSDKS() {
83
- let indexFileContent = '';
84
- for (const config of Object.values(serviceConfigs_1.serviceConfigs)) {
85
- GenerateSDKFromOpenAPISchema({ config });
86
- indexFileContent += `export * from "./${config.name}";\n`;
87
- }
88
- await fs_1.promises.writeFile(`./src/generated/index.ts`, indexFileContent);
89
- }
90
- GenerateSDKS();
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serviceConfigs = void 0;
4
- exports.serviceConfigs = {
5
- VecDBApi: {
6
- schema_url: 'https://api-f1db6c.stack.tryrelevance.com/latest/openapi_schema.json',
7
- endpoint: 'https://api-f1db6c.stack.tryrelevance.com',
8
- name: 'VecDBApi',
9
- },
10
- };