@razzium/piece-aimw-api 0.0.16 → 0.0.18

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/package.json CHANGED
@@ -1,7 +1,5 @@
1
1
  {
2
2
  "name": "@razzium/piece-aimw-api",
3
- "version": "0.0.16",
4
- "dependencies": {
5
- "tiktoken": "1.0.11"
6
- }
3
+ "version": "0.0.18",
4
+ "dependencies": {}
7
5
  }
@@ -1,5 +1,3 @@
1
- import { encoding_for_model } from 'tiktoken';
2
-
3
1
  export const baseUrl = 'https://rekto.dashboard.aimw.ai/api';
4
2
 
5
3
  export const Languages = [
@@ -84,17 +82,9 @@ export const streamToBuffer = (stream: any) => {
84
82
  });
85
83
  };
86
84
 
87
- export const calculateTokensFromString = (string: string, model: string) => {
88
- try {
89
- const encoder = encoding_for_model(model as any);
90
- const tokens = encoder.encode(string);
91
- encoder.free();
92
-
93
- return tokens.length;
94
- } catch (e) {
95
- // Model not supported by tiktoken, every 4 chars is a token
96
- return Math.round(string.length / 4);
97
- }
85
+ export const calculateTokensFromString = (string: string, _model: string) => {
86
+ // Estimation simple: ~4 caractères par token
87
+ return Math.round(string.length / 4);
98
88
  };
99
89
 
100
90
  export const calculateMessagesTokenSize = async (