ak-gemini 1.0.51 → 1.0.52

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.
Files changed (3) hide show
  1. package/index.js +7 -0
  2. package/package.json +3 -3
  3. package/types.ts +0 -68
package/index.js CHANGED
@@ -64,9 +64,16 @@ const DEFAULT_CHAT_CONFIG = {
64
64
  safetySettings: DEFAULT_SAFETY_SETTINGS
65
65
  };
66
66
 
67
+ /**
68
+ * @typedef {import('./types').AITransformer}
69
+ */
70
+
71
+
72
+
67
73
  /**
68
74
  * main export class for AI Transformer
69
75
  * @class AITransformer
76
+ * @type {AITransformer}
70
77
  * @description A class that provides methods to initialize, seed, transform, and manage AI-based transformations using Google Gemini API.
71
78
  * @implements {ExportedAPI}
72
79
  */
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "ak-gemini",
3
3
  "author": "ak@mixpanel.com",
4
4
  "description": "AK's Generative AI Helper for doing... transforms",
5
- "version": "1.0.51",
5
+ "version": "1.0.52",
6
6
  "main": "index.js",
7
7
  "files": [
8
8
  "index.js",
@@ -10,7 +10,7 @@
10
10
  "types.ts",
11
11
  "logger.js"
12
12
  ],
13
- "types": "types.ts",
13
+ "types": "types.d.ts",
14
14
  "exports": {
15
15
  ".": {
16
16
  "import": "./index.js",
@@ -59,4 +59,4 @@
59
59
  "jest": "^29.7.0",
60
60
  "nodemon": "^3.1.10"
61
61
  }
62
- }
62
+ }
package/types.ts DELETED
@@ -1,68 +0,0 @@
1
- import type { GoogleGenAI } from '@google/genai';
2
-
3
- export interface SafetySetting {
4
- category: string; // The harm category
5
- threshold: string; // The blocking threshold
6
- }
7
-
8
- export interface ChatConfig {
9
- responseMimeType?: string; // MIME type for responses
10
- temperature?: number; // Controls randomness (0.0 to 1.0)
11
- topP?: number; // Controls diversity via nucleus sampling
12
- topK?: number; // Controls diversity by limiting top-k tokens
13
- systemInstruction?: string; // System instruction for the model
14
- safetySettings?: SafetySetting[]; // Safety settings array
15
- responseSchema?: Object; // Schema for validating model responses
16
- }
17
-
18
- export interface AITransformerContext {
19
- modelName?: string;
20
- systemInstructions?: string;
21
- chatConfig?: ChatConfig;
22
- genAI?: any;
23
- chat?: any;
24
- examplesFile?: string | null;
25
- exampleData?: TransformationExample[] | null;
26
- promptKey?: string;
27
- answerKey?: string;
28
- contextKey?: string;
29
- maxRetries?: number;
30
- retryDelay?: number;
31
- init?: () => Promise<void>; // Initialization function
32
- seed?: () => Promise<void>; // Function to seed the transformer with examples
33
- message?: (payload: Record<string, unknown>) => Promise<Record<string, unknown>>; // Function to send messages to the model
34
- genAIClient?: GoogleGenAI; // Google GenAI client instance
35
-
36
- }
37
-
38
- export interface TransformationExample {
39
- CONTEXT?: Record<string, unknown>; // optional context for the transformation
40
- PROMPT?: Record<string, unknown>; // what the user provides as input
41
- ANSWER?: Record<string, unknown>; // what the model should return as output
42
- }
43
-
44
- export interface ExampleFileContent {
45
- examples: TransformationExample[];
46
- }
47
-
48
- export interface AITransformerOptions {
49
- modelName?: string; // The Gemini model to use
50
- systemInstructions?: string; // Custom system instructions for the model
51
- chatConfig?: ChatConfig; // Configuration object for the chat session
52
- examplesFile?: string; // Path to JSON file containing transformation examples
53
- exampleData?: TransformationExample[]; // Inline examples to seed the transformer
54
- sourceKey?: string; // Key name for source data in examples
55
- targetKey?: string; // Key name for target data in examples
56
- contextKey?: string; // Key name for context data in examples
57
- maxRetries?: number; // Maximum retry attempts for auto-retry functionality
58
- retryDelay?: number; // Initial retry delay in milliseconds
59
- // ? https://ai.google.dev/gemini-api/docs/structured-output
60
- responseSchema?: Object; // Schema for validating model responses
61
- apiKey?: string; // API key for Google GenAI
62
- }
63
-
64
- // Async validator function type
65
- export type AsyncValidatorFunction = (payload: Record<string, unknown>) => Promise<Record<string, unknown>>;
66
-
67
-
68
- export declare class AITransformer implements AITransformerContext {}