@botpress/cognitive 0.1.44 → 0.1.45
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/.turbo/turbo-build.log +7 -7
- package/dist/index.cjs +19 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +12 -4
- package/dist/index.mjs +19 -2
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/cognitive@0.1.
|
|
2
|
+
> @botpress/cognitive@0.1.45 build /home/runner/work/botpress/botpress/packages/cognitive
|
|
3
3
|
> pnpm build:type && pnpm build:neutral && size-limit
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @botpress/cognitive@0.1.
|
|
6
|
+
> @botpress/cognitive@0.1.45 build:type /home/runner/work/botpress/botpress/packages/cognitive
|
|
7
7
|
> tsup --tsconfig tsconfig.build.json ./src/index.ts --dts-resolve --dts-only --clean
|
|
8
8
|
|
|
9
9
|
CLI Building entry: ./src/index.ts
|
|
10
10
|
CLI Using tsconfig: tsconfig.build.json
|
|
11
11
|
CLI tsup v8.0.2
|
|
12
12
|
DTS Build start
|
|
13
|
-
DTS ⚡️ Build success in
|
|
14
|
-
DTS dist/index.d.ts 625.
|
|
13
|
+
DTS ⚡️ Build success in 9468ms
|
|
14
|
+
DTS dist/index.d.ts 625.92 KB
|
|
15
15
|
|
|
16
|
-
> @botpress/cognitive@0.1.
|
|
16
|
+
> @botpress/cognitive@0.1.45 build:neutral /home/runner/work/botpress/botpress/packages/cognitive
|
|
17
17
|
> ts-node -T ./build.ts --neutral
|
|
18
18
|
|
|
19
19
|
Done
|
|
20
20
|
|
|
21
21
|
[1mdist/index.cjs[22m
|
|
22
22
|
Size limit: [32m[1m50 kB[22m[39m
|
|
23
|
-
Size: [32m[1m14.
|
|
23
|
+
Size: [32m[1m14.55 kB[22m[39m [90mbrotlied[39m
|
|
24
24
|
|
|
25
25
|
[1mdist/index.mjs[22m
|
|
26
26
|
Size limit: [32m[1m50 kB[22m[39m
|
|
27
|
-
Size: [32m[1m14.
|
|
27
|
+
Size: [32m[1m14.43 kB[22m[39m [90mbrotlied[39m
|
|
28
28
|
|
package/dist/index.cjs
CHANGED
|
@@ -1742,12 +1742,13 @@ var defaultModel = {
|
|
|
1742
1742
|
|
|
1743
1743
|
// src/cognitive-v2/index.ts
|
|
1744
1744
|
var isBrowser = () => typeof window !== "undefined" && typeof window.fetch === "function";
|
|
1745
|
-
var CognitiveBeta = class {
|
|
1745
|
+
var CognitiveBeta = class _CognitiveBeta {
|
|
1746
1746
|
_axiosClient;
|
|
1747
1747
|
_apiUrl;
|
|
1748
1748
|
_timeout;
|
|
1749
1749
|
_withCredentials;
|
|
1750
1750
|
_headers;
|
|
1751
|
+
_debug = false;
|
|
1751
1752
|
constructor(props) {
|
|
1752
1753
|
this._apiUrl = props.apiUrl || "https://api.botpress.cloud";
|
|
1753
1754
|
this._timeout = props.timeout || 60001;
|
|
@@ -1759,12 +1760,25 @@ var CognitiveBeta = class {
|
|
|
1759
1760
|
if (props.token) {
|
|
1760
1761
|
this._headers["Authorization"] = `Bearer ${props.token}`;
|
|
1761
1762
|
}
|
|
1763
|
+
if (props.debug) {
|
|
1764
|
+
this._debug = true;
|
|
1765
|
+
this._headers["X-Debug"] = "1";
|
|
1766
|
+
}
|
|
1762
1767
|
this._axiosClient = import_axios.default.create({
|
|
1763
1768
|
headers: this._headers,
|
|
1764
1769
|
withCredentials: this._withCredentials,
|
|
1765
1770
|
baseURL: this._apiUrl
|
|
1766
1771
|
});
|
|
1767
1772
|
}
|
|
1773
|
+
clone() {
|
|
1774
|
+
return new _CognitiveBeta({
|
|
1775
|
+
apiUrl: this._apiUrl,
|
|
1776
|
+
timeout: this._timeout,
|
|
1777
|
+
withCredentials: this._withCredentials,
|
|
1778
|
+
headers: this._headers,
|
|
1779
|
+
debug: this._debug
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1768
1782
|
async generateText(input, options = {}) {
|
|
1769
1783
|
const signal = options.signal ?? AbortSignal.timeout(this._timeout);
|
|
1770
1784
|
const { data } = await this._withServerRetry(
|
|
@@ -2156,6 +2170,7 @@ var Cognitive = class _Cognitive {
|
|
|
2156
2170
|
_provider;
|
|
2157
2171
|
_downtimes = [];
|
|
2158
2172
|
_useBeta = false;
|
|
2173
|
+
_debug = false;
|
|
2159
2174
|
_events = createNanoEvents();
|
|
2160
2175
|
constructor(props) {
|
|
2161
2176
|
this._client = getExtendedClient(props.client);
|
|
@@ -2172,7 +2187,9 @@ var Cognitive = class _Cognitive {
|
|
|
2172
2187
|
client: this._client.clone(),
|
|
2173
2188
|
provider: this._provider,
|
|
2174
2189
|
timeout: this._timeoutMs,
|
|
2175
|
-
maxRetries: this._maxRetries
|
|
2190
|
+
maxRetries: this._maxRetries,
|
|
2191
|
+
__debug: this._debug,
|
|
2192
|
+
__experimental_beta: this._useBeta
|
|
2176
2193
|
});
|
|
2177
2194
|
copy._models = [...this._models];
|
|
2178
2195
|
copy._preferences = this._preferences ? { ...this._preferences } : null;
|