@gringow/gringow 0.0.7 → 0.0.8
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/dist/config.d.mts +23 -3
- package/dist/config.mjs +1 -1
- package/dist/config.test.d.mts +2 -0
- package/dist/config.test.mjs +18651 -0
- package/dist/{default-config.d.mts → constants/default-config.d.mts} +1 -1
- package/dist/{default-config.mjs → constants/default-config.mjs} +1 -1
- package/dist/data/check-cache.d.mts +1 -1
- package/dist/data/check-cache.mjs +37 -15
- package/dist/data/clear-cache.d.mts +9 -0
- package/dist/data/clear-cache.mjs +1 -1
- package/dist/data/create-cache-dir.mjs +1 -1
- package/dist/data/delete-cache-item.d.mts +1 -1
- package/dist/data/delete-cache-item.mjs +1 -1
- package/dist/data/get-cache.d.mts +10 -0
- package/dist/data/get-cache.mjs +1 -1
- package/dist/data/get-or-create-cache.d.mts +1 -1
- package/dist/data/get-or-create-cache.mjs +1 -1
- package/dist/data/save-cache.d.mts +7 -1
- package/dist/data/save-cache.mjs +1 -1
- package/dist/data/write-cache-to-disk.d.mts +1 -1
- package/dist/data/write-cache-to-disk.mjs +1 -1
- package/dist/flat-template-string.test.mjs +1 -1
- package/dist/gringow.d.mts +1 -1
- package/dist/gringow.mjs +42 -20
- package/dist/index.d.mts +25 -3
- package/dist/index.mjs +42 -20
- package/dist/io/anthropic/ask.d.mts +6 -0
- package/dist/io/anthropic/ask.mjs +1 -1
- package/dist/io/anthropic/commit-response.d.mts +7 -1
- package/dist/io/anthropic/index.d.mts +1 -1
- package/dist/io/anthropic/index.mjs +1 -1
- package/dist/io/anthropic/parse.d.mts +7 -1
- package/dist/io/ask-llm.d.mts +7 -1
- package/dist/io/ask-llm.mjs +6 -6
- package/dist/io/gemini/ask.d.mts +6 -0
- package/dist/io/gemini/ask.mjs +1 -1
- package/dist/io/gemini/commit-response.d.mts +6 -0
- package/dist/io/gemini/index.d.mts +1 -1
- package/dist/io/gemini/index.mjs +1 -1
- package/dist/io/gemini/parse.d.mts +7 -1
- package/dist/io/huggingface/ask.d.mts +1 -1
- package/dist/io/huggingface/ask.mjs +1 -1
- package/dist/io/huggingface/commit-response.d.mts +13 -1
- package/dist/io/huggingface/index.d.mts +1 -1
- package/dist/io/huggingface/index.mjs +1 -1
- package/dist/io/huggingface/languagesMap.d.mts +5 -0
- package/dist/io/huggingface/parse.d.mts +7 -1
- package/dist/logger.d.mts +6 -20
- package/dist/logger.mjs +36 -14
- package/dist/logger.test.d.mts +2 -0
- package/dist/logger.test.mjs +18683 -0
- package/dist/schemas/config.shcema.d.mts +12 -12
- package/dist/types/index.d.mts +1 -1
- package/package.json +9 -10
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { GenerateContentResult } from '@google/generative-ai';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Commits the response from the Gemini model.
|
|
5
|
+
*
|
|
6
|
+
* @param response - The response from the model.
|
|
7
|
+
* @returns The committed response.
|
|
8
|
+
*/
|
|
3
9
|
declare function commitResponseGemini(response: GenerateContentResult): string;
|
|
4
10
|
|
|
5
11
|
export { commitResponseGemini };
|
|
@@ -4,7 +4,7 @@ export { parseGemini } from './parse.mjs';
|
|
|
4
4
|
import '@google/generative-ai';
|
|
5
5
|
import '../../index.mjs';
|
|
6
6
|
import '../../config.mjs';
|
|
7
|
-
import '../../default-config.mjs';
|
|
7
|
+
import '../../constants/default-config.mjs';
|
|
8
8
|
import 'zod';
|
|
9
9
|
import '../../schemas/config.shcema.mjs';
|
|
10
10
|
import '../../data/clear-cache.mjs';
|
package/dist/io/gemini/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GringowCacheItem } from '../../index.mjs';
|
|
2
2
|
import { CommitResponse } from '../../types/index.mjs';
|
|
3
3
|
import '../../config.mjs';
|
|
4
|
-
import '../../default-config.mjs';
|
|
4
|
+
import '../../constants/default-config.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../../schemas/config.shcema.mjs';
|
|
7
7
|
import '../../data/clear-cache.mjs';
|
|
@@ -9,6 +9,12 @@ import '../../data/create-cache-id.mjs';
|
|
|
9
9
|
import '../../data/get-cache.mjs';
|
|
10
10
|
import '../../flat-template-string.mjs';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Parses the response from the Gemini model.
|
|
14
|
+
*
|
|
15
|
+
* @param unparsed - The unparsed response from the model.
|
|
16
|
+
* @returns The parsed response.
|
|
17
|
+
*/
|
|
12
18
|
declare function parseGemini(unparsed: CommitResponse): GringowCacheItem;
|
|
13
19
|
|
|
14
20
|
export { parseGemini };
|
|
@@ -4,7 +4,7 @@ import '../../types/index.mjs';
|
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '../../index.mjs';
|
|
6
6
|
import '../../config.mjs';
|
|
7
|
-
import '../../default-config.mjs';
|
|
7
|
+
import '../../constants/default-config.mjs';
|
|
8
8
|
import '../../schemas/config.shcema.mjs';
|
|
9
9
|
import '../../data/clear-cache.mjs';
|
|
10
10
|
import '../../data/create-cache-id.mjs';
|
|
@@ -4,13 +4,19 @@ import './parse.mjs';
|
|
|
4
4
|
import 'zod';
|
|
5
5
|
import '../../index.mjs';
|
|
6
6
|
import '../../config.mjs';
|
|
7
|
-
import '../../default-config.mjs';
|
|
7
|
+
import '../../constants/default-config.mjs';
|
|
8
8
|
import '../../schemas/config.shcema.mjs';
|
|
9
9
|
import '../../data/clear-cache.mjs';
|
|
10
10
|
import '../../data/create-cache-id.mjs';
|
|
11
11
|
import '../../data/get-cache.mjs';
|
|
12
12
|
import '../../flat-template-string.mjs';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Commits the response from the Hugging Face model.
|
|
16
|
+
*
|
|
17
|
+
* @param response - The response from the model.
|
|
18
|
+
* @returns The committed response.
|
|
19
|
+
*/
|
|
14
20
|
declare function commitResponseHuggingface(response: AskHuggingfaceResponse): CommitResponse;
|
|
15
21
|
|
|
16
22
|
type AskHuggingfaceResponseTranslation = TranslationSingle & {
|
|
@@ -22,6 +28,12 @@ type AskHuggingfaceResponse = {
|
|
|
22
28
|
};
|
|
23
29
|
type AskHuggingfaceResult = string;
|
|
24
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Asks the Hugging Face model for a response.
|
|
33
|
+
*
|
|
34
|
+
* @param original - The original string.
|
|
35
|
+
* @returns The response from the pipeline.
|
|
36
|
+
*/
|
|
25
37
|
declare function askHuggingface(original: string): Promise<AskHuggingfaceResponse>;
|
|
26
38
|
|
|
27
39
|
export { type AskHuggingfaceResponseTranslation as A, type AskHuggingfaceResponse as a, type AskHuggingfaceResult as b, askHuggingface as c, commitResponseHuggingface };
|
|
@@ -5,7 +5,7 @@ import '../../types/index.mjs';
|
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../../index.mjs';
|
|
7
7
|
import '../../config.mjs';
|
|
8
|
-
import '../../default-config.mjs';
|
|
8
|
+
import '../../constants/default-config.mjs';
|
|
9
9
|
import '../../schemas/config.shcema.mjs';
|
|
10
10
|
import '../../data/clear-cache.mjs';
|
|
11
11
|
import '../../data/create-cache-id.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GringowCacheItem } from '../../index.mjs';
|
|
2
2
|
import { CommitResponse } from '../../types/index.mjs';
|
|
3
3
|
import '../../config.mjs';
|
|
4
|
-
import '../../default-config.mjs';
|
|
4
|
+
import '../../constants/default-config.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../../schemas/config.shcema.mjs';
|
|
7
7
|
import '../../data/clear-cache.mjs';
|
|
@@ -9,6 +9,12 @@ import '../../data/create-cache-id.mjs';
|
|
|
9
9
|
import '../../data/get-cache.mjs';
|
|
10
10
|
import '../../flat-template-string.mjs';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Parses the response from the Hugging Face model.
|
|
14
|
+
*
|
|
15
|
+
* @param unparsed - The unparsed response from the model.
|
|
16
|
+
* @returns The parsed response.
|
|
17
|
+
*/
|
|
12
18
|
declare function parseHuggingface(unparsed: CommitResponse): GringowCacheItem;
|
|
13
19
|
|
|
14
20
|
export { parseHuggingface };
|
package/dist/logger.d.mts
CHANGED
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
declare const logger: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
9
|
-
};
|
|
10
|
-
info: {
|
|
11
|
-
(...data: any[]): void;
|
|
12
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
13
|
-
};
|
|
14
|
-
debug: {
|
|
15
|
-
(...data: any[]): void;
|
|
16
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
17
|
-
};
|
|
18
|
-
trace: {
|
|
19
|
-
(...data: any[]): void;
|
|
20
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
21
|
-
};
|
|
2
|
+
debug(...params: unknown[]): void;
|
|
3
|
+
trace(...params: unknown[]): void;
|
|
4
|
+
info(...params: unknown[]): void;
|
|
5
|
+
warn(...params: unknown[]): void;
|
|
6
|
+
error(...params: unknown[]): void;
|
|
7
|
+
verbose(...params: unknown[]): void;
|
|
22
8
|
};
|
|
23
9
|
|
|
24
10
|
export { logger as default };
|
package/dist/logger.mjs
CHANGED
|
@@ -1,20 +1,42 @@
|
|
|
1
1
|
// src/logger.ts
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var Dim = "\x1B[2m";
|
|
3
|
+
var FgGreen = "\x1B[32m";
|
|
4
|
+
var FgYellow = "\x1B[33m";
|
|
5
|
+
var FgCyan = "\x1B[36m";
|
|
6
|
+
var FgWhite = "\x1B[37m";
|
|
7
|
+
var BgRed = "\x1B[41m";
|
|
8
|
+
var Clear = "\x1B[0m";
|
|
9
|
+
var Colors = {
|
|
10
|
+
debug: `${Dim}${FgGreen}`,
|
|
11
|
+
trace: `${Dim}${FgCyan}`,
|
|
12
|
+
info: `${FgCyan}`,
|
|
13
|
+
error: `${BgRed}${FgWhite}`,
|
|
14
|
+
warn: `${FgYellow}`,
|
|
15
|
+
verbose: `${FgWhite}`
|
|
8
16
|
};
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
var isProd = process.env.NODE_ENV === "production";
|
|
18
|
+
function log(level, ...params) {
|
|
19
|
+
console.log(`${!isProd ? Colors[level] : ""}${String(level).toUpperCase()} `, ...params, `${!isProd ? Clear : ""}`);
|
|
20
|
+
}
|
|
12
21
|
var logger = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
debug(...params) {
|
|
23
|
+
return log("debug", ...params);
|
|
24
|
+
},
|
|
25
|
+
trace(...params) {
|
|
26
|
+
return log("trace", ...params);
|
|
27
|
+
},
|
|
28
|
+
info(...params) {
|
|
29
|
+
return log("info", ...params);
|
|
30
|
+
},
|
|
31
|
+
warn(...params) {
|
|
32
|
+
return log("warn", ...params);
|
|
33
|
+
},
|
|
34
|
+
error(...params) {
|
|
35
|
+
return log("error", ...params);
|
|
36
|
+
},
|
|
37
|
+
verbose(...params) {
|
|
38
|
+
return log("verbose", ...params);
|
|
39
|
+
}
|
|
18
40
|
};
|
|
19
41
|
var logger_default = logger;
|
|
20
42
|
|