@xapp/stentor-service-generative-ai 1.77.2 → 1.78.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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
2
|
+
/**
|
|
3
|
+
* Get the number of tokens in a prompt using the GPT tokenizer.
|
|
4
|
+
*
|
|
5
|
+
* @param prompt - The input string to tokenize.
|
|
6
|
+
* @returns The number of tokens in the prompt.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTokens(prompt: string): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getTokens = getTokens;
|
|
5
|
+
const gpt_tokenizer_1 = require("gpt-tokenizer");
|
|
6
|
+
/**
|
|
7
|
+
* Get the number of tokens in a prompt using the GPT tokenizer.
|
|
8
|
+
*
|
|
9
|
+
* @param prompt - The input string to tokenize.
|
|
10
|
+
* @returns The number of tokens in the prompt.
|
|
11
|
+
*/
|
|
12
|
+
function getTokens(prompt) {
|
|
13
|
+
// Use the GPT tokenizer to encode the prompt and return the number of tokens
|
|
14
|
+
const encoded = (0, gpt_tokenizer_1.encode)(prompt);
|
|
15
|
+
return encoded.length;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=getTokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTokens.js","sourceRoot":"","sources":["../../src/utils/getTokens.ts"],"names":[],"mappings":";AAAA,kCAAkC;;AAUlC,8BAIC;AAZD,iDAAuC;AAEvC;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,MAAc;IACpC,6EAA6E;IAC7E,MAAM,OAAO,GAAG,IAAA,sBAAM,EAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,OAAO,CAAC,MAAM,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.78.0",
|
|
8
8
|
"description": "Generative AI Service",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dotenv": "17.3.1",
|
|
23
23
|
"mocha": "11.7.5",
|
|
24
24
|
"stentor-logger": "1.71.0",
|
|
25
|
-
"stentor-models": "1.
|
|
25
|
+
"stentor-models": "1.72.0",
|
|
26
26
|
"stentor-service-fetch": "1.71.0",
|
|
27
27
|
"stentor-utils": "1.71.0",
|
|
28
28
|
"ts-node": "10.9.2",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\"",
|
|
47
47
|
"ftest": "mocha --recursive -r ts-node/register \"./src/**/*.ftest.ts\""
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "7ad5a86334ecb7ae383da1aef801375cb9af71af"
|
|
50
50
|
}
|