hai-api 1.1.2 → 1.1.4

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export interface HSeekResponse {
1
+ export interface HAIResponse {
2
2
  text: string;
3
3
  thinking_text: string;
4
4
  search_text: string;
@@ -50,7 +50,7 @@ export interface ChatOptions {
50
50
  /** Model to use (e.g., 'deepseek', 'gemini-nano-banana'). */
51
51
  model?: string;
52
52
  /** Callback function called once streaming is complete. */
53
- onDone?: (response: HSeekResponse) => void;
53
+ onDone?: (response: HAIResponse) => void;
54
54
  }
55
55
  interface SessionData {
56
56
  chatSessionId: string | null;
@@ -70,7 +70,7 @@ interface SessionData {
70
70
  * console.log(res.text);
71
71
  * ```
72
72
  */
73
- export declare class HSeekClient {
73
+ export declare class HAIClient {
74
74
  private apiKey;
75
75
  private baseUrl;
76
76
  private memory;
@@ -80,11 +80,11 @@ export declare class HSeekClient {
80
80
  /**
81
81
  * Stream a response in real-time, yielding chunks as they arrive.
82
82
  */
83
- streamChat(prompt: string, options?: ChatOptions): AsyncGenerator<HSeekResponse, void, unknown>;
83
+ streamChat(prompt: string, options?: ChatOptions): AsyncGenerator<HAIResponse, void, unknown>;
84
84
  /**
85
85
  * Send a message and get the full response at once (non-streaming).
86
86
  */
87
- chat(prompt: string, options?: ChatOptions): Promise<HSeekResponse>;
87
+ chat(prompt: string, options?: ChatOptions): Promise<HAIResponse>;
88
88
  /**
89
89
  * Export the full conversation history for a session.
90
90
  */
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.HSeekClient = void 0;
36
+ exports.HAIClient = void 0;
37
37
  const dotenv = __importStar(require("dotenv"));
38
38
  dotenv.config();
39
39
  // ========================
@@ -100,7 +100,7 @@ async function fetchYouTubeTranscript(videoId) {
100
100
  }
101
101
  }
102
102
  // ========================
103
- // Main HSeekClient
103
+ // Main HAIClient
104
104
  // ========================
105
105
  /**
106
106
  * HSeekClient — The official client for the hAI private AI.
@@ -112,7 +112,7 @@ async function fetchYouTubeTranscript(videoId) {
112
112
  * console.log(res.text);
113
113
  * ```
114
114
  */
115
- class HSeekClient {
115
+ class HAIClient {
116
116
  apiKey;
117
117
  baseUrl;
118
118
  memory;
@@ -327,4 +327,4 @@ class HSeekClient {
327
327
  this.memory.clear(sessionId);
328
328
  }
329
329
  }
330
- exports.HSeekClient = HSeekClient;
330
+ exports.HAIClient = HAIClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hai-api",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "The official Node.js SDK for hAI Private AI.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "dependencies": {
14
14
  "dotenv": "^16.4.5",
15
- "hseek-api": "^1.0.0"
15
+ "hai-api": "^1.1.3"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "^20.12.7",
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@ dotenv.config();
6
6
  // Types & Interfaces
7
7
  // ========================
8
8
 
9
- export interface HSeekResponse {
9
+ export interface HAIResponse {
10
10
  text: string;
11
11
  thinking_text: string;
12
12
  search_text: string;
@@ -59,7 +59,7 @@ export interface ChatOptions {
59
59
  /** Model to use (e.g., 'deepseek', 'gemini-nano-banana'). */
60
60
  model?: string;
61
61
  /** Callback function called once streaming is complete. */
62
- onDone?: (response: HSeekResponse) => void;
62
+ onDone?: (response: HAIResponse) => void;
63
63
  }
64
64
 
65
65
  interface SessionData {
@@ -135,7 +135,7 @@ async function fetchYouTubeTranscript(videoId: string): Promise<string> {
135
135
  }
136
136
 
137
137
  // ========================
138
- // Main HSeekClient
138
+ // Main HAIClient
139
139
  // ========================
140
140
 
141
141
  /**
@@ -148,7 +148,7 @@ async function fetchYouTubeTranscript(videoId: string): Promise<string> {
148
148
  * console.log(res.text);
149
149
  * ```
150
150
  */
151
- export class HSeekClient {
151
+ export class HAIClient {
152
152
  private apiKey: string;
153
153
  private baseUrl: string;
154
154
  private memory: MemoryStore;
@@ -215,8 +215,8 @@ export class HSeekClient {
215
215
  return payload;
216
216
  }
217
217
 
218
- private createResponse(): HSeekResponse {
219
- const r: HSeekResponse = {
218
+ private createResponse(): HAIResponse {
219
+ const r: HAIResponse = {
220
220
  text: "",
221
221
  thinking_text: "",
222
222
  search_text: "",
@@ -250,7 +250,7 @@ export class HSeekClient {
250
250
  /**
251
251
  * Stream a response in real-time, yielding chunks as they arrive.
252
252
  */
253
- async *streamChat(prompt: string, options: ChatOptions = {}): AsyncGenerator<HSeekResponse, void, unknown> {
253
+ async *streamChat(prompt: string, options: ChatOptions = {}): AsyncGenerator<HAIResponse, void, unknown> {
254
254
  const { sessionId, youtube, retries = 3, onDone } = options;
255
255
 
256
256
  // Handle YouTube
@@ -345,8 +345,8 @@ export class HSeekClient {
345
345
  /**
346
346
  * Send a message and get the full response at once (non-streaming).
347
347
  */
348
- async chat(prompt: string, options: ChatOptions = {}): Promise<HSeekResponse> {
349
- let finalResponse: HSeekResponse | null = null;
348
+ async chat(prompt: string, options: ChatOptions = {}): Promise<HAIResponse> {
349
+ let finalResponse: HAIResponse | null = null;
350
350
  for await (const chunk of this.streamChat(prompt, options)) {
351
351
  finalResponse = chunk;
352
352
  }