@razzium/piece-aimw-api 0.0.17 → 0.0.19

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,7 @@
1
+ # pieces-aimw
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-aimw` to build the library.
package/package.json CHANGED
@@ -1,7 +1,5 @@
1
1
  {
2
2
  "name": "@razzium/piece-aimw-api",
3
- "version": "0.0.17",
4
- "dependencies": {
5
- "tiktoken": "1.0.11"
6
- }
3
+ "version": "0.0.19",
4
+ "dependencies": {}
7
5
  }
@@ -1,5 +1,3 @@
1
- // tiktoken est importé dynamiquement dans calculateTokensFromString pour éviter crash à l'import
2
-
3
1
  export const baseUrl = 'https://rekto.dashboard.aimw.ai/api';
4
2
 
5
3
  export const Languages = [
@@ -84,20 +82,9 @@ export const streamToBuffer = (stream: any) => {
84
82
  });
85
83
  };
86
84
 
87
- export const calculateTokensFromString = (string: string, model: string) => {
88
- try {
89
- // Import dynamique pour éviter crash à l'import du module
90
- // eslint-disable-next-line @typescript-eslint/no-var-requires
91
- const tiktoken = require('tiktoken');
92
- const encoder = tiktoken.encoding_for_model(model as any);
93
- const tokens = encoder.encode(string);
94
- encoder.free();
95
-
96
- return tokens.length;
97
- } catch (e) {
98
- // Tiktoken non disponible ou model non supporté - fallback: ~4 chars par token
99
- return Math.round(string.length / 4);
100
- }
85
+ export const calculateTokensFromString = (string: string, _model: string) => {
86
+ // Estimation simple: ~4 caractères par token
87
+ return Math.round(string.length / 4);
101
88
  };
102
89
 
103
90
  export const calculateMessagesTokenSize = async (