@rimori/client 2.5.28-next.4 → 2.5.28-next.6

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/README.md CHANGED
@@ -140,7 +140,7 @@ Helpers:
140
140
  The `client.ai` controller surfaces AI capabilities:
141
141
 
142
142
  - `getText(messages, tools?)` – chat completion (string result).
143
- - `getSteamedText(messages, onMessage, tools?)` – streamed responses.
143
+ - `getStreamedText(messages, onMessage, tools?)` – streamed responses.
144
144
  - `getObject(request)` – structured JSON generation.
145
145
  - `getVoice(text, voice?, speed?, language?)` – text-to-speech (returns `Blob`).
146
146
  - `getTextFromVoice(file)` – speech-to-text transcription.
@@ -1,4 +1,4 @@
1
- import { ThirdPartyModule, i18n as i18nType } from 'i18next';
1
+ import { ThirdPartyModule, TOptions } from 'i18next';
2
2
  import { AIModule } from '../plugin/module/AIModule';
3
3
  /**
4
4
  * Translator class for handling internationalization
@@ -32,7 +32,7 @@ export declare class Translator {
32
32
  * @param options - Translation options
33
33
  * @returns Translated string
34
34
  */
35
- t(...args: Parameters<i18nType['t']>): string;
35
+ t(key: string, options?: TOptions): string;
36
36
  /**
37
37
  * Get current language
38
38
  */
@@ -130,11 +130,12 @@ export class Translator {
130
130
  * @param options - Translation options
131
131
  * @returns Translated string
132
132
  */
133
- t(...args) {
133
+ t(key, options) {
134
134
  if (!this.i18n) {
135
135
  throw new Error('Translator is not initialized');
136
136
  }
137
- return this.i18n.t(...args);
137
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
138
+ return this.i18n.t(key, options);
138
139
  }
139
140
  /**
140
141
  * Get current language
@@ -88,24 +88,43 @@ export declare class AIModule {
88
88
  setOnRateLimited(cb: (exercisesRemaining: number) => void): void;
89
89
  /**
90
90
  * Generate text from messages using AI.
91
- * @param messages The messages to generate text from.
92
- * @param tools Optional tools to use for generation.
93
- * @param cache Whether to cache the result (default: false).
94
- * @param model The model to use for generation.
91
+ * @param params.messages The messages to generate text from.
92
+ * @param params.tools Optional tools to use for generation.
93
+ * @param params.cache Whether to cache the result (default: false).
94
+ * @param params.model The model to use for generation.
95
+ * @param params.prompt Server-side prompt name (e.g. 'writing.analysis').
96
+ * @param params.variables Variables for the server-side prompt template.
95
97
  * @returns The generated text.
96
98
  */
97
- getText(messages: Message[], tools?: Tool[], cache?: boolean, model?: string): Promise<string>;
99
+ getText(params: {
100
+ messages: Message[];
101
+ tools?: Tool[];
102
+ cache?: boolean;
103
+ model?: string;
104
+ prompt?: string;
105
+ variables?: Record<string, any>;
106
+ }): Promise<string>;
98
107
  /**
99
108
  * Stream text generation from messages using AI.
100
- * @param messages The messages to generate text from.
101
- * @param onMessage Callback for each message chunk.
102
- * @param tools Optional tools to use for generation.
103
- * @param cache Whether to cache the result (default: false).
104
- * @param model The model to use for generation.
109
+ * @param params.messages The messages to generate text from.
110
+ * @param params.onMessage Callback for each message chunk.
111
+ * @param params.tools Optional tools to use for generation.
112
+ * @param params.cache Whether to cache the result (default: false).
113
+ * @param params.model The model to use for generation.
114
+ * @param params.prompt Server-side prompt name (e.g. 'writing.analysis').
115
+ * @param params.variables Variables for the server-side prompt template.
105
116
  */
106
- getSteamedText(messages: Message[], onMessage: OnLLMResponse, tools?: Tool[], cache?: boolean, model?: string,
107
- /** @deprecated Use uuid variable with resolver 'knowledgeEntry' in prompt definitions instead. */
108
- knowledgeId?: string, prompt?: string, variables?: Record<string, any>): Promise<string>;
117
+ getStreamedText(params: {
118
+ messages: Message[];
119
+ onMessage: OnLLMResponse;
120
+ tools?: Tool[];
121
+ cache?: boolean;
122
+ model?: string;
123
+ /** @deprecated Use uuid variable with resolver 'knowledgeEntry' in prompt definitions instead. */
124
+ knowledgeId?: string;
125
+ prompt?: string;
126
+ variables?: Record<string, any>;
127
+ }): Promise<string>;
109
128
  /**
110
129
  * Generate voice audio from text using AI.
111
130
  * @param text The text to convert to voice.
@@ -75,35 +75,41 @@ export class AIModule {
75
75
  }
76
76
  /**
77
77
  * Generate text from messages using AI.
78
- * @param messages The messages to generate text from.
79
- * @param tools Optional tools to use for generation.
80
- * @param cache Whether to cache the result (default: false).
81
- * @param model The model to use for generation.
78
+ * @param params.messages The messages to generate text from.
79
+ * @param params.tools Optional tools to use for generation.
80
+ * @param params.cache Whether to cache the result (default: false).
81
+ * @param params.model The model to use for generation.
82
+ * @param params.prompt Server-side prompt name (e.g. 'writing.analysis').
83
+ * @param params.variables Variables for the server-side prompt template.
82
84
  * @returns The generated text.
83
85
  */
84
- getText(messages_1, tools_1) {
85
- return __awaiter(this, arguments, void 0, function* (messages, tools, cache = false, model) {
86
+ getText(params) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const { messages, tools, cache = false, model, prompt, variables } = params;
86
89
  const { result } = yield this.streamObject({
87
90
  cache,
88
91
  tools,
89
92
  model,
90
93
  messages,
94
+ prompt,
95
+ variables,
91
96
  });
92
97
  return result;
93
98
  });
94
99
  }
95
100
  /**
96
101
  * Stream text generation from messages using AI.
97
- * @param messages The messages to generate text from.
98
- * @param onMessage Callback for each message chunk.
99
- * @param tools Optional tools to use for generation.
100
- * @param cache Whether to cache the result (default: false).
101
- * @param model The model to use for generation.
102
+ * @param params.messages The messages to generate text from.
103
+ * @param params.onMessage Callback for each message chunk.
104
+ * @param params.tools Optional tools to use for generation.
105
+ * @param params.cache Whether to cache the result (default: false).
106
+ * @param params.model The model to use for generation.
107
+ * @param params.prompt Server-side prompt name (e.g. 'writing.analysis').
108
+ * @param params.variables Variables for the server-side prompt template.
102
109
  */
103
- getSteamedText(messages_1, onMessage_1, tools_1) {
104
- return __awaiter(this, arguments, void 0, function* (messages, onMessage, tools, cache = false, model,
105
- /** @deprecated Use uuid variable with resolver 'knowledgeEntry' in prompt definitions instead. */
106
- knowledgeId, prompt, variables) {
110
+ getStreamedText(params) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ const { messages, onMessage, tools, cache = false, model, knowledgeId, prompt, variables, } = params;
107
113
  const messageId = Math.random().toString(36).substring(3);
108
114
  const { result } = yield this.streamObject({
109
115
  cache,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.5.28-next.4",
3
+ "version": "2.5.28-next.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {