@tambo-ai/typescript-sdk 0.31.0 → 0.33.0
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/CHANGELOG.md +21 -0
- package/README.md +2 -0
- package/core.js +2 -1
- package/core.js.map +1 -1
- package/core.mjs +2 -1
- package/core.mjs.map +1 -1
- package/index.d.mts +15 -2
- package/index.d.ts +15 -2
- package/index.d.ts.map +1 -1
- package/index.js +12 -6
- package/index.js.map +1 -1
- package/index.mjs +11 -3
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/beta.d.ts +0 -4
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +0 -4
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +0 -4
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.ts +0 -1
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +1 -3
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +0 -1
- package/resources/beta/index.mjs.map +1 -1
- package/src/core.ts +2 -2
- package/src/index.ts +25 -3
- package/src/resources/beta/beta.ts +0 -22
- package/src/resources/beta/index.ts +0 -9
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/lib/streaming-components.d.ts +0 -7
- package/lib/streaming-components.d.ts.map +0 -1
- package/lib/streaming-components.js +0 -48
- package/lib/streaming-components.js.map +0 -1
- package/lib/streaming-components.mjs +0 -43
- package/lib/streaming-components.mjs.map +0 -1
- package/resources/beta/components.d.ts +0 -44
- package/resources/beta/components.d.ts.map +0 -1
- package/resources/beta/components.js +0 -29
- package/resources/beta/components.js.map +0 -1
- package/resources/beta/components.mjs +0 -25
- package/resources/beta/components.mjs.map +0 -1
- package/src/lib/streaming-components.ts +0 -71
- package/src/resources/beta/components.ts +0 -97
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beta.d.ts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"beta.d.ts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,WAAW,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,yBAAyB,EACzB,MAAM,EACN,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,OAAO,EACP,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,IAAK,SAAQ,WAAW;IACnC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAA0C;IACxE,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAA0C;IACxE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;CACpE;AAOD,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EAAE,QAAQ,IAAI,QAAQ,EAAE,KAAK,wBAAwB,IAAI,wBAAwB,EAAE,CAAC;IAE3F,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,qBAAqB,IAAI,qBAAqB,EAC9C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
|
package/resources/beta/beta.js
CHANGED
|
@@ -26,8 +26,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
exports.Beta = void 0;
|
|
28
28
|
const resource_1 = require("../../resource.js");
|
|
29
|
-
const ComponentsAPI = __importStar(require("./components.js"));
|
|
30
|
-
const components_1 = require("./components.js");
|
|
31
29
|
const RegistryAPI = __importStar(require("./registry.js"));
|
|
32
30
|
const registry_1 = require("./registry.js");
|
|
33
31
|
const ProjectsAPI = __importStar(require("./projects/projects.js"));
|
|
@@ -37,14 +35,12 @@ const threads_1 = require("./threads/threads.js");
|
|
|
37
35
|
class Beta extends resource_1.APIResource {
|
|
38
36
|
constructor() {
|
|
39
37
|
super(...arguments);
|
|
40
|
-
this.components = new ComponentsAPI.Components(this._client);
|
|
41
38
|
this.registry = new RegistryAPI.Registry(this._client);
|
|
42
39
|
this.projects = new ProjectsAPI.Projects(this._client);
|
|
43
40
|
this.threads = new ThreadsAPI.Threads(this._client);
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
43
|
exports.Beta = Beta;
|
|
47
|
-
Beta.Components = components_1.Components;
|
|
48
44
|
Beta.Registry = registry_1.Registry;
|
|
49
45
|
Beta.Projects = projects_1.Projects;
|
|
50
46
|
Beta.Threads = threads_1.Threads;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beta.js","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAC7C
|
|
1
|
+
{"version":3,"file":"beta.js","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAC7C,2DAA0C;AAC1C,4CAAgE;AAChE,oEAAmD;AACnD,qDAS6B;AAC7B,iEAAgD;AAChD,kDAc2B;AAE3B,MAAa,IAAK,SAAQ,sBAAW;IAArC;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;CAAA;AAJD,oBAIC;AAED,IAAI,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AACzB,IAAI,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AACzB,IAAI,CAAC,OAAO,GAAG,iBAAO,CAAC;AACvB,IAAI,CAAC,qBAAqB,GAAG,+BAAqB,CAAC"}
|
package/resources/beta/beta.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { APIResource } from "../../resource.mjs";
|
|
3
|
-
import * as ComponentsAPI from "./components.mjs";
|
|
4
|
-
import { Components, } from "./components.mjs";
|
|
5
3
|
import * as RegistryAPI from "./registry.mjs";
|
|
6
4
|
import { Registry } from "./registry.mjs";
|
|
7
5
|
import * as ProjectsAPI from "./projects/projects.mjs";
|
|
@@ -11,13 +9,11 @@ import { Threads, ThreadsOffsetAndLimit, } from "./threads/threads.mjs";
|
|
|
11
9
|
export class Beta extends APIResource {
|
|
12
10
|
constructor() {
|
|
13
11
|
super(...arguments);
|
|
14
|
-
this.components = new ComponentsAPI.Components(this._client);
|
|
15
12
|
this.registry = new RegistryAPI.Registry(this._client);
|
|
16
13
|
this.projects = new ProjectsAPI.Projects(this._client);
|
|
17
14
|
this.threads = new ThreadsAPI.Threads(this._client);
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
Beta.Components = Components;
|
|
21
17
|
Beta.Registry = Registry;
|
|
22
18
|
Beta.Projects = Projects;
|
|
23
19
|
Beta.Threads = Threads;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beta.mjs","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,
|
|
1
|
+
{"version":3,"file":"beta.mjs","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAAE,QAAQ,EAA4B;OACtC,KAAK,WAAW;OAChB,EAQL,QAAQ,GACT;OACM,KAAK,UAAU;OACf,EAYL,OAAO,EACP,qBAAqB,GACtB;AAED,MAAM,OAAO,IAAK,SAAQ,WAAW;IAArC;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;CAAA;AAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { Beta } from "./beta.js";
|
|
2
|
-
export { Components, type ComponentGenerateResponse, type ComponentHydrateResponse, type ComponentGenerateParams, type ComponentGenerateStreamParams, type ComponentHydrateParams, type ComponentHydrateStreamParams, } from "./components.js";
|
|
3
2
|
export { Projects, type ProjectCreateResponse, type ProjectRetrieveResponse, type ProjectUpdateResponse, type ProjectDeleteResponse, type ProjectGetCurrentResponse, type ProjectCreateParams, type ProjectUpdateParams, } from "./projects/index.js";
|
|
4
3
|
export { Registry, type RegistryRetrieveResponse } from "./registry.js";
|
|
5
4
|
export { ThreadsOffsetAndLimit, Threads, type ChatCompletionContentPart, type Thread, type ThreadMessage, type ThreadRetrieveResponse, type ThreadAdvanceResponse, type ThreadAdvanceByIDResponse, type ThreadCreateParams, type ThreadUpdateParams, type ThreadListParams, type ThreadAdvanceParams, type ThreadAdvanceByIDParams, } from "./threads/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EACL,QAAQ,EACR,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,KAAK,yBAAyB,EAC9B,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,GAC7B,MAAM,iBAAiB,CAAC"}
|
package/resources/beta/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Threads = exports.ThreadsOffsetAndLimit = exports.Registry = exports.Projects = exports.
|
|
4
|
+
exports.Threads = exports.ThreadsOffsetAndLimit = exports.Registry = exports.Projects = exports.Beta = void 0;
|
|
5
5
|
var beta_1 = require("./beta.js");
|
|
6
6
|
Object.defineProperty(exports, "Beta", { enumerable: true, get: function () { return beta_1.Beta; } });
|
|
7
|
-
var components_1 = require("./components.js");
|
|
8
|
-
Object.defineProperty(exports, "Components", { enumerable: true, get: function () { return components_1.Components; } });
|
|
9
7
|
var index_1 = require("./projects/index.js");
|
|
10
8
|
Object.defineProperty(exports, "Projects", { enumerable: true, get: function () { return index_1.Projects; } });
|
|
11
9
|
var registry_1 = require("./registry.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kCAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kCAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,6CAS0B;AARxB,iGAAA,QAAQ,OAAA;AASV,0CAAqE;AAA5D,oGAAA,QAAQ,OAAA;AACjB,4CAcyB;AAbvB,8GAAA,qBAAqB,OAAA;AACrB,gGAAA,OAAO,OAAA"}
|
package/resources/beta/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
export { Beta } from "./beta.mjs";
|
|
3
|
-
export { Components, } from "./components.mjs";
|
|
4
3
|
export { Projects, } from "./projects/index.mjs";
|
|
5
4
|
export { Registry } from "./registry.mjs";
|
|
6
5
|
export { ThreadsOffsetAndLimit, Threads, } from "./threads/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,IAAI,EAAE;OACR,EACL,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/beta/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,IAAI,EAAE;OACR,EACL,QAAQ,GAQT;OACM,EAAE,QAAQ,EAAiC;OAC3C,EACL,qBAAqB,EACrB,OAAO,GAYR"}
|
package/src/core.ts
CHANGED
|
@@ -48,8 +48,8 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const contentType = response.headers.get('content-type');
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
const mediaType = contentType?.split(';')[0]?.trim();
|
|
52
|
+
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
|
|
53
53
|
if (isJSON) {
|
|
54
54
|
const json = await response.json();
|
|
55
55
|
|
package/src/index.ts
CHANGED
|
@@ -17,12 +17,27 @@ import {
|
|
|
17
17
|
} from './resources/components';
|
|
18
18
|
import { Beta } from './resources/beta/beta';
|
|
19
19
|
|
|
20
|
+
const environments = {
|
|
21
|
+
production: 'https://api.tambo.co',
|
|
22
|
+
staging: 'https://hydra-api-dev.up.railway.app',
|
|
23
|
+
};
|
|
24
|
+
type Environment = keyof typeof environments;
|
|
25
|
+
|
|
20
26
|
export interface ClientOptions {
|
|
21
27
|
/**
|
|
22
28
|
* API key used for authentication
|
|
23
29
|
*/
|
|
24
30
|
apiKey?: string | null | undefined;
|
|
25
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the environment to use for the API.
|
|
34
|
+
*
|
|
35
|
+
* Each environment maps to a different base URL:
|
|
36
|
+
* - `production` corresponds to `https://api.tambo.co`
|
|
37
|
+
* - `staging` corresponds to `https://hydra-api-dev.up.railway.app`
|
|
38
|
+
*/
|
|
39
|
+
environment?: Environment | undefined;
|
|
40
|
+
|
|
26
41
|
/**
|
|
27
42
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
28
43
|
*
|
|
@@ -92,7 +107,8 @@ export class TamboAI extends Core.APIClient {
|
|
|
92
107
|
* API Client for interfacing with the Tambo AI API.
|
|
93
108
|
*
|
|
94
109
|
* @param {string | null | undefined} [opts.apiKey=process.env['TAMBO_API_KEY'] ?? null]
|
|
95
|
-
* @param {
|
|
110
|
+
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
|
|
111
|
+
* @param {string} [opts.baseURL=process.env['TAMBO_AI_BASE_URL'] ?? https://api.tambo.co] - Override the default base URL for the API.
|
|
96
112
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
97
113
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
98
114
|
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -109,10 +125,17 @@ export class TamboAI extends Core.APIClient {
|
|
|
109
125
|
apiKey,
|
|
110
126
|
...opts,
|
|
111
127
|
baseURL,
|
|
128
|
+
environment: opts.environment ?? 'production',
|
|
112
129
|
};
|
|
113
130
|
|
|
131
|
+
if (baseURL && opts.environment) {
|
|
132
|
+
throw new Errors.TamboAIError(
|
|
133
|
+
'Ambiguous URL; The `baseURL` option (or TAMBO_AI_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null',
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
114
137
|
super({
|
|
115
|
-
baseURL: options.baseURL
|
|
138
|
+
baseURL: options.baseURL || environments[options.environment || 'production'],
|
|
116
139
|
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
117
140
|
httpAgent: options.httpAgent,
|
|
118
141
|
maxRetries: options.maxRetries,
|
|
@@ -225,5 +248,4 @@ export {
|
|
|
225
248
|
} from './error';
|
|
226
249
|
|
|
227
250
|
export default TamboAI;
|
|
228
|
-
export { generateStream, hydrateStream } from './lib/streaming-components';
|
|
229
251
|
export { advanceStream } from './lib/advance-stream';
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
|
-
import * as ComponentsAPI from './components';
|
|
5
|
-
import {
|
|
6
|
-
ComponentGenerateParams,
|
|
7
|
-
ComponentGenerateResponse,
|
|
8
|
-
ComponentGenerateStreamParams,
|
|
9
|
-
ComponentHydrateParams,
|
|
10
|
-
ComponentHydrateResponse,
|
|
11
|
-
ComponentHydrateStreamParams,
|
|
12
|
-
Components,
|
|
13
|
-
} from './components';
|
|
14
4
|
import * as RegistryAPI from './registry';
|
|
15
5
|
import { Registry, RegistryRetrieveResponse } from './registry';
|
|
16
6
|
import * as ProjectsAPI from './projects/projects';
|
|
@@ -42,29 +32,17 @@ import {
|
|
|
42
32
|
} from './threads/threads';
|
|
43
33
|
|
|
44
34
|
export class Beta extends APIResource {
|
|
45
|
-
components: ComponentsAPI.Components = new ComponentsAPI.Components(this._client);
|
|
46
35
|
registry: RegistryAPI.Registry = new RegistryAPI.Registry(this._client);
|
|
47
36
|
projects: ProjectsAPI.Projects = new ProjectsAPI.Projects(this._client);
|
|
48
37
|
threads: ThreadsAPI.Threads = new ThreadsAPI.Threads(this._client);
|
|
49
38
|
}
|
|
50
39
|
|
|
51
|
-
Beta.Components = Components;
|
|
52
40
|
Beta.Registry = Registry;
|
|
53
41
|
Beta.Projects = Projects;
|
|
54
42
|
Beta.Threads = Threads;
|
|
55
43
|
Beta.ThreadsOffsetAndLimit = ThreadsOffsetAndLimit;
|
|
56
44
|
|
|
57
45
|
export declare namespace Beta {
|
|
58
|
-
export {
|
|
59
|
-
Components as Components,
|
|
60
|
-
type ComponentGenerateResponse as ComponentGenerateResponse,
|
|
61
|
-
type ComponentHydrateResponse as ComponentHydrateResponse,
|
|
62
|
-
type ComponentGenerateParams as ComponentGenerateParams,
|
|
63
|
-
type ComponentGenerateStreamParams as ComponentGenerateStreamParams,
|
|
64
|
-
type ComponentHydrateParams as ComponentHydrateParams,
|
|
65
|
-
type ComponentHydrateStreamParams as ComponentHydrateStreamParams,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
46
|
export { Registry as Registry, type RegistryRetrieveResponse as RegistryRetrieveResponse };
|
|
69
47
|
|
|
70
48
|
export {
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
export { Beta } from './beta';
|
|
4
|
-
export {
|
|
5
|
-
Components,
|
|
6
|
-
type ComponentGenerateResponse,
|
|
7
|
-
type ComponentHydrateResponse,
|
|
8
|
-
type ComponentGenerateParams,
|
|
9
|
-
type ComponentGenerateStreamParams,
|
|
10
|
-
type ComponentHydrateParams,
|
|
11
|
-
type ComponentHydrateStreamParams,
|
|
12
|
-
} from './components';
|
|
13
4
|
export {
|
|
14
5
|
Projects,
|
|
15
6
|
type ProjectCreateResponse,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.33.0'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.33.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.33.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type TamboAI } from "/...js";
|
|
2
|
-
import * as Core from "../core.js";
|
|
3
|
-
import { Components as BetaComponents } from "../resources/beta/components.js";
|
|
4
|
-
import { Components as BaseComponents } from "../resources/components.js";
|
|
5
|
-
export declare function generateStream(client: TamboAI, body: BaseComponents.ComponentGenerateParams | BetaComponents.ComponentGenerateParams, options?: Core.RequestOptions): Promise<AsyncIterable<BaseComponents.ComponentGenerateResponse | BetaComponents.ComponentGenerateResponse>>;
|
|
6
|
-
export declare function hydrateStream(client: TamboAI, body: BaseComponents.ComponentHydrateParams | BetaComponents.ComponentHydrateParams, options?: Core.RequestOptions): Promise<AsyncIterable<BaseComponents.ComponentHydrateResponse | BetaComponents.ComponentHydrateResponse>>;
|
|
7
|
-
//# sourceMappingURL=streaming-components.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-components.d.ts","sourceRoot":"","sources":["../src/lib/streaming-components.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEvE,wBAAsB,cAAc,CAClC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,cAAc,CAAC,uBAAuB,GAAG,cAAc,CAAC,uBAAuB,EACrF,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,OAAO,CACR,aAAa,CAAC,cAAc,CAAC,yBAAyB,GAAG,cAAc,CAAC,yBAAyB,CAAC,CACnG,CAgBA;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,cAAc,CAAC,sBAAsB,GAAG,cAAc,CAAC,sBAAsB,EACnF,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,wBAAwB,GAAG,cAAc,CAAC,wBAAwB,CAAC,CAAC,CAe3G"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hydrateStream = exports.generateStream = void 0;
|
|
4
|
-
async function generateStream(client, body, options) {
|
|
5
|
-
const responsePromise = client.post('/components/generatestream', {
|
|
6
|
-
body,
|
|
7
|
-
...options,
|
|
8
|
-
headers: {
|
|
9
|
-
...options?.headers,
|
|
10
|
-
Accept: 'text/event-stream',
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
const response = await responsePromise.asResponse();
|
|
14
|
-
return handleStreamResponse(response);
|
|
15
|
-
}
|
|
16
|
-
exports.generateStream = generateStream;
|
|
17
|
-
async function hydrateStream(client, body, options) {
|
|
18
|
-
const responsePromise = client.post('/components/hydratestream', {
|
|
19
|
-
body,
|
|
20
|
-
...options,
|
|
21
|
-
headers: {
|
|
22
|
-
...options?.headers,
|
|
23
|
-
Accept: 'text/event-stream',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
const response = await responsePromise.asResponse();
|
|
27
|
-
return handleStreamResponse(response);
|
|
28
|
-
}
|
|
29
|
-
exports.hydrateStream = hydrateStream;
|
|
30
|
-
async function* handleStreamResponse(response) {
|
|
31
|
-
const decoder = new TextDecoder();
|
|
32
|
-
for await (const chunk of response.body) {
|
|
33
|
-
const text = decoder.decode(chunk);
|
|
34
|
-
//handle server-combined events
|
|
35
|
-
const messages = text.split('\n').filter((msg) => msg.trim());
|
|
36
|
-
for (const msg of messages) {
|
|
37
|
-
if (msg === 'data: DONE') {
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
const jsonStr = msg.startsWith('data: ') ? msg.slice(6) : msg;
|
|
41
|
-
if (!jsonStr) {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
yield JSON.parse(jsonStr);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=streaming-components.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-components.js","sourceRoot":"","sources":["../src/lib/streaming-components.ts"],"names":[],"mappings":";;;AAMO,KAAK,UAAU,cAAc,CAClC,MAAe,EACf,IAAqF,EACrF,OAA6B;IAI7B,MAAM,eAAe,GAEjB,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE;QAC5C,IAAI;QACJ,GAAG,OAAO;QACV,OAAO,EAAE;YACP,GAAG,OAAO,EAAE,OAAO;YACnB,MAAM,EAAE,mBAAmB;SAC5B;KACF,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,UAAU,EAAE,CAAC;IAEpD,OAAO,oBAAoB,CAEzB,QAAQ,CAAC,CAAC;AACd,CAAC;AAtBD,wCAsBC;AAEM,KAAK,UAAU,aAAa,CACjC,MAAe,EACf,IAAmF,EACnF,OAA6B;IAE7B,MAAM,eAAe,GAEjB,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;QAC3C,IAAI;QACJ,GAAG,OAAO;QACV,OAAO,EAAE;YACP,GAAG,OAAO,EAAE,OAAO;YACnB,MAAM,EAAE,mBAAmB;SAC5B;KACF,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,UAAU,EAAE,CAAC;IACpD,OAAO,oBAAoB,CAEzB,QAAQ,CAAC,CAAC;AACd,CAAC;AAnBD,sCAmBC;AAED,KAAK,SAAS,CAAC,CAAC,oBAAoB,CAAI,QAAkB;IACxD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE;QACvC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAmB,CAAC,CAAC;QAEjD,+BAA+B;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QAE9D,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;YAC1B,IAAI,GAAG,KAAK,YAAY,EAAE;gBACxB,SAAS;aACV;YACD,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YAC9D,IAAI,CAAC,OAAO,EAAE;gBACZ,SAAS;aACV;YACD,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;SAChC;KACF;AACH,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export async function generateStream(client, body, options) {
|
|
2
|
-
const responsePromise = client.post('/components/generatestream', {
|
|
3
|
-
body,
|
|
4
|
-
...options,
|
|
5
|
-
headers: {
|
|
6
|
-
...options?.headers,
|
|
7
|
-
Accept: 'text/event-stream',
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
const response = await responsePromise.asResponse();
|
|
11
|
-
return handleStreamResponse(response);
|
|
12
|
-
}
|
|
13
|
-
export async function hydrateStream(client, body, options) {
|
|
14
|
-
const responsePromise = client.post('/components/hydratestream', {
|
|
15
|
-
body,
|
|
16
|
-
...options,
|
|
17
|
-
headers: {
|
|
18
|
-
...options?.headers,
|
|
19
|
-
Accept: 'text/event-stream',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
const response = await responsePromise.asResponse();
|
|
23
|
-
return handleStreamResponse(response);
|
|
24
|
-
}
|
|
25
|
-
async function* handleStreamResponse(response) {
|
|
26
|
-
const decoder = new TextDecoder();
|
|
27
|
-
for await (const chunk of response.body) {
|
|
28
|
-
const text = decoder.decode(chunk);
|
|
29
|
-
//handle server-combined events
|
|
30
|
-
const messages = text.split('\n').filter((msg) => msg.trim());
|
|
31
|
-
for (const msg of messages) {
|
|
32
|
-
if (msg === 'data: DONE') {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
const jsonStr = msg.startsWith('data: ') ? msg.slice(6) : msg;
|
|
36
|
-
if (!jsonStr) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
yield JSON.parse(jsonStr);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=streaming-components.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-components.mjs","sourceRoot":"","sources":["../src/lib/streaming-components.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAe,EACf,IAAqF,EACrF,OAA6B;IAI7B,MAAM,eAAe,GAEjB,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE;QAC5C,IAAI;QACJ,GAAG,OAAO;QACV,OAAO,EAAE;YACP,GAAG,OAAO,EAAE,OAAO;YACnB,MAAM,EAAE,mBAAmB;SAC5B;KACF,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,UAAU,EAAE,CAAC;IAEpD,OAAO,oBAAoB,CAEzB,QAAQ,CAAC,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAe,EACf,IAAmF,EACnF,OAA6B;IAE7B,MAAM,eAAe,GAEjB,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;QAC3C,IAAI;QACJ,GAAG,OAAO;QACV,OAAO,EAAE;YACP,GAAG,OAAO,EAAE,OAAO;YACnB,MAAM,EAAE,mBAAmB;SAC5B;KACF,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,UAAU,EAAE,CAAC;IACpD,OAAO,oBAAoB,CAEzB,QAAQ,CAAC,CAAC;AACd,CAAC;AAED,KAAK,SAAS,CAAC,CAAC,oBAAoB,CAAI,QAAkB;IACxD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE;QACvC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAmB,CAAC,CAAC;QAEjD,+BAA+B;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QAE9D,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;YAC1B,IAAI,GAAG,KAAK,YAAY,EAAE;gBACxB,SAAS;aACV;YACD,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YAC9D,IAAI,CAAC,OAAO,EAAE;gBACZ,SAAS;aACV;YACD,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;SAChC;KACF;AACH,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { APIResource } from "../../resource.js";
|
|
2
|
-
import * as Core from "../../core.js";
|
|
3
|
-
import * as Shared from "../shared.js";
|
|
4
|
-
import * as ThreadsAPI from "./threads/threads.js";
|
|
5
|
-
export declare class Components extends APIResource {
|
|
6
|
-
generate(body: ComponentGenerateParams, options?: Core.RequestOptions): Core.APIPromise<ComponentGenerateResponse>;
|
|
7
|
-
generateStream(body: ComponentGenerateStreamParams, options?: Core.RequestOptions): Core.APIPromise<void>;
|
|
8
|
-
hydrate(body: ComponentHydrateParams, options?: Core.RequestOptions): Core.APIPromise<ComponentHydrateResponse>;
|
|
9
|
-
hydrateStream(body: ComponentHydrateStreamParams, options?: Core.RequestOptions): Core.APIPromise<void>;
|
|
10
|
-
}
|
|
11
|
-
export interface ComponentGenerateResponse {
|
|
12
|
-
message: ThreadsAPI.ThreadMessage;
|
|
13
|
-
}
|
|
14
|
-
export interface ComponentHydrateResponse {
|
|
15
|
-
message: ThreadsAPI.ThreadMessage;
|
|
16
|
-
}
|
|
17
|
-
export interface ComponentGenerateParams {
|
|
18
|
-
availableComponents: Array<Shared.AvailableComponent>;
|
|
19
|
-
content: Array<ThreadsAPI.ChatCompletionContentPart>;
|
|
20
|
-
contextKey?: string;
|
|
21
|
-
threadId?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface ComponentGenerateStreamParams {
|
|
24
|
-
availableComponents: Array<Shared.AvailableComponent>;
|
|
25
|
-
content: Array<ThreadsAPI.ChatCompletionContentPart>;
|
|
26
|
-
contextKey?: string;
|
|
27
|
-
threadId?: string;
|
|
28
|
-
}
|
|
29
|
-
export interface ComponentHydrateParams {
|
|
30
|
-
component: Shared.AvailableComponent;
|
|
31
|
-
threadId: string;
|
|
32
|
-
contextKey?: string;
|
|
33
|
-
toolResponse?: unknown;
|
|
34
|
-
}
|
|
35
|
-
export interface ComponentHydrateStreamParams {
|
|
36
|
-
component: Shared.AvailableComponent;
|
|
37
|
-
threadId: string;
|
|
38
|
-
contextKey?: string;
|
|
39
|
-
toolResponse?: unknown;
|
|
40
|
-
}
|
|
41
|
-
export declare namespace Components {
|
|
42
|
-
export { type ComponentGenerateResponse as ComponentGenerateResponse, type ComponentHydrateResponse as ComponentHydrateResponse, type ComponentGenerateParams as ComponentGenerateParams, type ComponentGenerateStreamParams as ComponentGenerateStreamParams, type ComponentHydrateParams as ComponentHydrateParams, type ComponentHydrateStreamParams as ComponentHydrateStreamParams, };
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=components.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/resources/beta/components.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,UAAW,SAAQ,WAAW;IACzC,QAAQ,CACN,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,yBAAyB,CAAC;IAI7C,cAAc,CAAC,IAAI,EAAE,6BAA6B,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAQzG,OAAO,CACL,IAAI,EAAE,sBAAsB,EAC5B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,wBAAwB,CAAC;IAI5C,aAAa,CAAC,IAAI,EAAE,4BAA4B,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;CAOxG;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,UAAU,CAAC,aAAa,CAAC;CACnC;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,UAAU,CAAC,aAAa,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAEtD,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAErD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,6BAA6B;IAC5C,mBAAmB,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAEtD,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAErD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;IAErC,QAAQ,EAAE,MAAM,CAAC;IAEjB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC;IAErC,QAAQ,EAAE,MAAM,CAAC;IAEjB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAClC,OAAO,EACL,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,4BAA4B,IAAI,4BAA4B,GAClE,CAAC;CACH"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Components = void 0;
|
|
5
|
-
const resource_1 = require("../../resource.js");
|
|
6
|
-
class Components extends resource_1.APIResource {
|
|
7
|
-
generate(body, options) {
|
|
8
|
-
return this._client.post('/components/generate2', { body, ...options });
|
|
9
|
-
}
|
|
10
|
-
generateStream(body, options) {
|
|
11
|
-
return this._client.post('/components/generatestream', {
|
|
12
|
-
body,
|
|
13
|
-
...options,
|
|
14
|
-
headers: { Accept: '*/*', ...options?.headers },
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
hydrate(body, options) {
|
|
18
|
-
return this._client.post('/components/hydrate2', { body, ...options });
|
|
19
|
-
}
|
|
20
|
-
hydrateStream(body, options) {
|
|
21
|
-
return this._client.post('/components/hydratestream', {
|
|
22
|
-
body,
|
|
23
|
-
...options,
|
|
24
|
-
headers: { Accept: '*/*', ...options?.headers },
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.Components = Components;
|
|
29
|
-
//# sourceMappingURL=components.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/resources/beta/components.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAK7C,MAAa,UAAW,SAAQ,sBAAW;IACzC,QAAQ,CACN,IAA6B,EAC7B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,cAAc,CAAC,IAAmC,EAAE,OAA6B;QAC/E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACrD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CACL,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,aAAa,CAAC,IAAkC,EAAE,OAA6B;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE;YACpD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;CACF;AA9BD,gCA8BC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { APIResource } from "../../resource.mjs";
|
|
3
|
-
export class Components extends APIResource {
|
|
4
|
-
generate(body, options) {
|
|
5
|
-
return this._client.post('/components/generate2', { body, ...options });
|
|
6
|
-
}
|
|
7
|
-
generateStream(body, options) {
|
|
8
|
-
return this._client.post('/components/generatestream', {
|
|
9
|
-
body,
|
|
10
|
-
...options,
|
|
11
|
-
headers: { Accept: '*/*', ...options?.headers },
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
hydrate(body, options) {
|
|
15
|
-
return this._client.post('/components/hydrate2', { body, ...options });
|
|
16
|
-
}
|
|
17
|
-
hydrateStream(body, options) {
|
|
18
|
-
return this._client.post('/components/hydratestream', {
|
|
19
|
-
body,
|
|
20
|
-
...options,
|
|
21
|
-
headers: { Accept: '*/*', ...options?.headers },
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=components.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.mjs","sourceRoot":"","sources":["../../src/resources/beta/components.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAKtB,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC,QAAQ,CACN,IAA6B,EAC7B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,cAAc,CAAC,IAAmC,EAAE,OAA6B;QAC/E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACrD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CACL,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,aAAa,CAAC,IAAkC,EAAE,OAA6B;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE;YACpD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Response } from 'node-fetch';
|
|
2
|
-
import { type TamboAI } from '..';
|
|
3
|
-
import * as Core from '../core';
|
|
4
|
-
import { Components as BetaComponents } from '../resources/beta/components';
|
|
5
|
-
import { Components as BaseComponents } from '../resources/components';
|
|
6
|
-
|
|
7
|
-
export async function generateStream(
|
|
8
|
-
client: TamboAI,
|
|
9
|
-
body: BaseComponents.ComponentGenerateParams | BetaComponents.ComponentGenerateParams,
|
|
10
|
-
options?: Core.RequestOptions,
|
|
11
|
-
): Promise<
|
|
12
|
-
AsyncIterable<BaseComponents.ComponentGenerateResponse | BetaComponents.ComponentGenerateResponse>
|
|
13
|
-
> {
|
|
14
|
-
const responsePromise: Core.APIPromise<
|
|
15
|
-
BaseComponents.ComponentGenerateResponse | BetaComponents.ComponentGenerateResponse
|
|
16
|
-
> = client.post('/components/generatestream', {
|
|
17
|
-
body,
|
|
18
|
-
...options,
|
|
19
|
-
headers: {
|
|
20
|
-
...options?.headers,
|
|
21
|
-
Accept: 'text/event-stream',
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
const response = await responsePromise.asResponse();
|
|
25
|
-
|
|
26
|
-
return handleStreamResponse<
|
|
27
|
-
BaseComponents.ComponentGenerateResponse | BetaComponents.ComponentGenerateResponse
|
|
28
|
-
>(response);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function hydrateStream(
|
|
32
|
-
client: TamboAI,
|
|
33
|
-
body: BaseComponents.ComponentHydrateParams | BetaComponents.ComponentHydrateParams,
|
|
34
|
-
options?: Core.RequestOptions,
|
|
35
|
-
): Promise<AsyncIterable<BaseComponents.ComponentHydrateResponse | BetaComponents.ComponentHydrateResponse>> {
|
|
36
|
-
const responsePromise: Core.APIPromise<
|
|
37
|
-
BaseComponents.ComponentHydrateResponse | BetaComponents.ComponentHydrateResponse
|
|
38
|
-
> = client.post('/components/hydratestream', {
|
|
39
|
-
body,
|
|
40
|
-
...options,
|
|
41
|
-
headers: {
|
|
42
|
-
...options?.headers,
|
|
43
|
-
Accept: 'text/event-stream',
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
const response = await responsePromise.asResponse();
|
|
47
|
-
return handleStreamResponse<
|
|
48
|
-
BaseComponents.ComponentHydrateResponse | BetaComponents.ComponentHydrateResponse
|
|
49
|
-
>(response);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function* handleStreamResponse<T>(response: Response): AsyncIterable<T> {
|
|
53
|
-
const decoder = new TextDecoder();
|
|
54
|
-
for await (const chunk of response.body) {
|
|
55
|
-
const text = decoder.decode(chunk as Uint8Array);
|
|
56
|
-
|
|
57
|
-
//handle server-combined events
|
|
58
|
-
const messages = text.split('\n').filter((msg) => msg.trim());
|
|
59
|
-
|
|
60
|
-
for (const msg of messages) {
|
|
61
|
-
if (msg === 'data: DONE') {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
const jsonStr = msg.startsWith('data: ') ? msg.slice(6) : msg;
|
|
65
|
-
if (!jsonStr) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
yield JSON.parse(jsonStr) as T;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|