gemini-wrapper-ashes 1.0.0 → 1.0.1

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 (2) hide show
  1. package/README.md +40 -16
  2. package/package.json +11 -3
package/README.md CHANGED
@@ -1,19 +1,21 @@
1
1
  # gemini-wrapper-ashes
2
2
 
3
- A lightweight, TypeScript-first wrapper around the Google Gemini API that simplifies model configuration, system instructions, and response handling.
3
+ A lightweight, **TypeScript-first** wrapper around the Google Gemini API that simplifies model configuration, system instructions, and response handling.
4
4
 
5
5
  ---
6
6
 
7
7
  ## Requirements
8
8
 
9
- - Node.js 18 or later
10
- - A valid Google Gemini API key
9
+ - **Node.js**: 18 or later
10
+ - **API Key**: A valid Google Gemini API key
11
11
 
12
12
  ---
13
13
 
14
14
  ## Installation
15
15
 
16
+ ```bash
16
17
  npm install gemini-wrapper-ashes
18
+ ```
17
19
 
18
20
  ---
19
21
 
@@ -21,51 +23,73 @@ npm install gemini-wrapper-ashes
21
23
 
22
24
  ### Create a Client
23
25
 
26
+ Initialize the client with your API key and default settings.
27
+
28
+ ```typescript
24
29
  import { GeminiClient } from "gemini-wrapper-ashes";
25
30
 
26
31
  const gemini = new GeminiClient({
27
32
  apiKey: process.env.GEMINI_API_KEY,
28
- model: "gemini-1.5-flash",
33
+ model: "gemini-2.5-flash",
29
34
  instruction: "You are a senior software engineer"
30
35
  });
31
-
32
- ---
36
+ ```
33
37
 
34
38
  ### Ask a Question
35
39
 
40
+ Send a prompt to the model and await the text response.
41
+
42
+ ```typescript
36
43
  const response = await gemini.ask("Explain closures in JavaScript");
37
44
  console.log(response);
38
-
39
- ---
45
+ ```
40
46
 
41
47
  ### Change System Instruction
42
48
 
43
- gemini.setInstruction("You are a strict technical interviewer");
49
+ Update the system prompt (persona) dynamically without re-initializing the client.
44
50
 
45
- ---
51
+ ```typescript
52
+ gemini.setInstruction("You are a strict technical interviewer");
53
+ ```
46
54
 
47
55
  ### Change Model
48
56
 
49
- gemini.setModel("gemini-1.5-pro");
57
+ Switch the active model string.
58
+
59
+ ```typescript
60
+ gemini.setModel("gemini-2.5-pro");
61
+ ```
50
62
 
51
- Any valid Gemini model string is supported. Model validation is delegated to the Gemini API.
63
+ > **Note:** Any valid Gemini model string is supported. Model validation is delegated directly to the Gemini API.
52
64
 
53
65
  ---
54
66
 
55
- ### Error Handling
67
+ ## Error Handling
56
68
 
69
+ The package exports a `GeminiError` class for handling API-specific exceptions (e.g., authentication errors, quota limits).
70
+
71
+ ```typescript
57
72
  import { GeminiError } from "gemini-wrapper-ashes";
58
73
 
59
74
  try {
60
75
  await gemini.ask("Hello");
61
76
  } catch (error) {
62
77
  if (error instanceof GeminiError) {
63
- console.error(error.message);
64
- console.error(error.code);
65
- console.error(error.status);
78
+ console.error("Error Message:", error.message);
79
+ console.error("Error Code:", error.code);
80
+ console.error("HTTP Status:", error.status);
66
81
  }
67
82
  }
83
+ ```
68
84
 
69
85
  ---
70
86
 
87
+ ## API Summary
88
+
89
+ | Method | Description |
90
+ | :--- | :--- |
91
+ | `ask(prompt: string)` | Sends a user prompt to the API and returns the text response. |
92
+ | `setInstruction(text: string)` | Updates the system instruction (context) for future requests. |
93
+ | `setModel(modelName: string)` | Updates the target model version (e.g., `gemini-2.5-flash`). |
71
94
 
95
+ ---
package/package.json CHANGED
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "name": "gemini-wrapper-ashes",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A simple and clean wrapper around Google Gemini API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "files": ["dist"],
7
+ "files": [
8
+ "dist"
9
+ ],
8
10
  "scripts": {
9
11
  "build": "tsc",
10
12
  "prepublishOnly": "npm run build"
11
13
  },
12
- "keywords": ["gemini", "ai", "llm", "google", "wrapper"],
14
+ "keywords": [
15
+ "gemini",
16
+ "ai",
17
+ "llm",
18
+ "google",
19
+ "wrapper"
20
+ ],
13
21
  "author": "Ashes",
14
22
  "license": "MIT",
15
23
  "dependencies": {