@ooneex/ai 1.1.4 → 1.1.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/dist/index.js CHANGED
@@ -1,20 +1,678 @@
1
1
  // @bun
2
- var Q=function(T,C,H,N){var Y=arguments.length,_=Y<3?C:N===null?N=Object.getOwnPropertyDescriptor(C,H):N,R;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")_=Reflect.decorate(T,C,H,N);else for(var L=T.length-1;L>=0;L--)if(R=T[L])_=(Y<3?R(_):Y>3?R(C,H,_):R(C,H))||_;return Y>3&&_&&Object.defineProperty(C,H,_),_},S=(T,C)=>(H,N)=>C(H,N,T),U=(T,C)=>{if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(T,C)};import{Exception as K}from"@ooneex/exception";import{HttpStatus as G}from"@ooneex/http-status";class z extends K{constructor(T,C={}){super(T,{status:G.Code.InternalServerError,data:C});this.name="AiException"}}import{AppEnv as h}from"@ooneex/app-env";import{inject as d}from"@ooneex/container";import{createAnthropicChat as r}from"@tanstack/ai-anthropic";import{jsonSchemaToTypeString as E}from"@ooneex/validation";import{chat as $}from"@tanstack/ai";import{type as b}from"arktype";class D{buildPrompt(T,C){let H=[C?.prompt||T];if(C?.context)H.push(`Context:
3
- ${C.context}`);if(C?.wordCount)H.push(`Target approximately ${C.wordCount} words.`);if(C?.tone)H.push(`Use a ${C.tone} tone.`);if(C?.language)H.push(`Respond in ${C.language} language.`);return H.push(`${C?.context?"Use the provided context to inform your response. ":""}Respond with only the transformed text. Do not include explanations or additional commentary.`),H.join(`
4
- `)}toMessages(T){return T.map((C)=>({role:C.role,content:C.content}))}async executeChat(T,C,H){let N=this.createChatAdapter(H),Y=H?.messages?this.toMessages(H.messages):[],_={role:"user",content:`${C}
2
+ var __legacyDecorateClassTS = function(decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
5
+ r = Reflect.decorate(decorators, target, key, desc);
6
+ else
7
+ for (var i = decorators.length - 1;i >= 0; i--)
8
+ if (d = decorators[i])
9
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
11
+ };
12
+ var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
13
+ var __legacyMetadataTS = (k, v) => {
14
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
15
+ return Reflect.metadata(k, v);
16
+ };
17
+
18
+ // src/AiException.ts
19
+ import { Exception } from "@ooneex/exception";
20
+ import { HttpStatus } from "@ooneex/http-status";
21
+
22
+ class AiException extends Exception {
23
+ constructor(message, data = {}) {
24
+ super(message, {
25
+ status: HttpStatus.Code.InternalServerError,
26
+ data
27
+ });
28
+ this.name = "AiException";
29
+ }
30
+ }
31
+ // src/AnthropicAi.ts
32
+ import { AppEnv } from "@ooneex/app-env";
33
+ import { inject } from "@ooneex/container";
34
+ import { createAnthropicChat } from "@tanstack/ai-anthropic";
35
+
36
+ // src/BaseAi.ts
37
+ import { jsonSchemaToTypeString } from "@ooneex/validation";
38
+ import { chat } from "@tanstack/ai";
39
+ import { type } from "arktype";
40
+ class BaseAi {
41
+ buildPrompt(instruction, config) {
42
+ const parts = [config?.prompt || instruction];
43
+ if (config?.context) {
44
+ parts.push(`Context:
45
+ ${config.context}`);
46
+ }
47
+ if (config?.wordCount) {
48
+ parts.push(`Target approximately ${config.wordCount} words.`);
49
+ }
50
+ if (config?.tone) {
51
+ parts.push(`Use a ${config.tone} tone.`);
52
+ }
53
+ if (config?.language) {
54
+ parts.push(`Respond in ${config.language} language.`);
55
+ }
56
+ parts.push(`${config?.context ? "Use the provided context to inform your response. " : ""}Respond with only the transformed text. Do not include explanations or additional commentary.`);
57
+ return parts.join(`
58
+ `);
59
+ }
60
+ toMessages(messages) {
61
+ return messages.map((msg) => ({ role: msg.role, content: msg.content }));
62
+ }
63
+ async executeChat(content, systemPrompt, config) {
64
+ const adapter = this.createChatAdapter(config);
65
+ const baseMessages = config?.messages ? this.toMessages(config.messages) : [];
66
+ const userMessage = { role: "user", content: `${systemPrompt}
5
67
 
6
68
  Text to process:
7
- ${T}`},R=[...Y,_];return(await $({adapter:N,messages:R,stream:!1})).trim()}async makeShorter(T,C){let H=this.buildPrompt("Condense the following text while preserving its core meaning and key information. Remove redundancies and unnecessary details.",C);return this.executeChat(T,H,C)}async makeLonger(T,C){let H=this.buildPrompt("Expand the following text by adding relevant details, examples, and explanations while maintaining coherence and the original message.",C);return this.executeChat(T,H,C)}async summarize(T,C){let H=this.buildPrompt("Provide a clear and comprehensive summary of the following text, capturing all essential points and main ideas.",C);return this.executeChat(T,H,C)}async concise(T,C){let H=this.buildPrompt("Rewrite the following text in the most concise form possible without losing essential meaning.",C);return this.executeChat(T,H,C)}async paragraph(T,C){let H=this.buildPrompt("Transform the following text into well-structured paragraph format with clear topic sentences and logical flow.",C);return this.executeChat(T,H,C)}async bulletPoints(T,C){let H=this.buildPrompt("Convert the following text into a clear, organized list of bullet points highlighting the key information.",C);return this.executeChat(T,H,C)}async rephrase(T,C){let H=this.buildPrompt("Rephrase the following text using different words and sentence structures while preserving the original meaning.",C);return this.executeChat(T,H,C)}async simplify(T,C){let H=this.buildPrompt("Simplify the following text by using plain language, shorter sentences, and avoiding jargon. Make it accessible to a general audience.",C);return this.executeChat(T,H,C)}async changeTone(T,C,H){let N=this.buildPrompt(`Rewrite the following text in a ${C} tone while maintaining clarity.`,H);return this.executeChat(T,N,H)}async proofread(T,C){let H=this.buildPrompt("Proofread and correct the following text for grammar, spelling, punctuation, and clarity issues. Return the corrected version.",C);return this.executeChat(T,H,C)}async translate(T,C){let H=C?.language??"en",N=this.buildPrompt(`Translate the following text accurately into ${H}, preserving the original meaning, tone, and nuance.`,C);return this.executeChat(T,N,C)}async explain(T,C){let H=this.buildPrompt("Provide a clear explanation of the following text, breaking down complex concepts and clarifying the meaning.",C);return this.executeChat(T,H,C)}async expandIdeas(T,C){let H=this.buildPrompt("Expand on the ideas presented in the following text by exploring related concepts, implications, and additional perspectives.",C);return this.executeChat(T,H,C)}async fixGrammar(T,C){let H=this.buildPrompt("Fix all grammatical errors in the following text, including subject-verb agreement, tense consistency, and sentence structure.",C);return this.executeChat(T,H,C)}async generateTitle(T,C){let H=this.buildPrompt("Generate a compelling, descriptive title for the following text that captures its main theme and engages readers.",C);return this.executeChat(T,H,C)}async extractKeywords(T,C){let H=C?.count,N=H?` Return exactly ${H} keywords.`:"",Y=this.buildPrompt(`Extract the most important keywords and key phrases from the following text. Return only the keywords as a comma-separated list without numbering, brackets, or additional formatting.${N}`,C),R=(await this.executeChat(T,Y,C)).split(",").map((L)=>L.trim()).filter((L)=>L.length>0);return H?R.slice(0,H):R}async extractCategories(T,C){let H=C?.count,N=H?` Return exactly ${H} categories.`:"",Y=this.buildPrompt(`Identify the most relevant categories or topics that best describe the following text. Return only the categories as a comma-separated list without numbering, brackets, or additional formatting.${N}`,C),R=(await this.executeChat(T,Y,C)).split(",").map((L)=>L.trim()).filter((L)=>L.length>0);return H?R.slice(0,H):R}async extractTopics(T,C){let H=C?.count,N=H?` Return at most ${H} topics.`:"",Y=this.buildPrompt(`Extract the main topics discussed in the following text. Return only the topics as a comma-separated list without numbering, brackets, or additional formatting.${N}`,C),R=(await this.executeChat(T,Y,C)).split(",").map((L)=>L.trim()).filter((L)=>L.length>0);return H?R.slice(0,H):R}async generateCaseQuestion(T,C,H){let N=C?.questionCount??3,Y=C?.choiceCount,_=Math.min(100,Math.max(1,C?.difficulty??50)),R=Y?[`Each question must have exactly ${Y} choices.`,"Exactly 1 of the choices must be correct.","For each choice (both correct and wrong), provide an explanation in approximately 50 words."]:[],L=Y?'{"title":"...","presentation":"...","questions":[{"text":"...","answer":"...","explanation":"...","choices":[{"text":"...","isCorrect":true/false,"explanation":"..."},...]},...]}':'{"title":"...","presentation":"...","questions":[{"text":"...","answer":"...","explanation":"..."},...]}',W=this.buildPrompt(["Generate a clinical case study with questions about the following subject.",`Difficulty level: ${_}/100. At easy difficulty (1-25), present straightforward cases with classic presentations. At medium difficulty (26-50), include cases requiring differential diagnosis and standard management. At hard difficulty (51-75), present atypical presentations or cases with complicating factors. At expert difficulty (76-100), present rare conditions, complex multi-system cases, or cases requiring nuanced clinical reasoning.`,...C?.similarCase?[`Generate a case similar in style and topic to: "${C.similarCase}". The new case must be different but cover a closely related clinical scenario.`]:[],"Create a detailed clinical presentation with patient demographics, symptoms, history, and relevant findings.",`Generate exactly ${N} questions about the case, numbered sequentially.`,"Each question must have a direct answer and a detailed explanation.",...R,"Respond ONLY with valid JSON in this exact format:",L].join(`
8
- `),H),X=(await this.executeChat(T,W,H)).replace(/```json\n?|\n?```/g,"").trim();return JSON.parse(X)}async generateFlashcard(T,C,H){let N=Math.min(100,Math.max(1,C?.difficulty??50)),Y=this.buildPrompt(["Generate a flashcard about the following subject.",`Difficulty level: ${N}/100. At easy difficulty (1-25), cover basic definitions and simple facts. At medium difficulty (26-50), cover concepts requiring understanding and application. At hard difficulty (51-75), cover analysis and connections between concepts. At expert difficulty (76-100), cover nuanced details, edge cases, and advanced reasoning.`,...C?.similarFlashcard?[`Generate a flashcard similar in style and topic to: "${C.similarFlashcard}". The new flashcard must be different but cover a closely related concept.`]:[],"The front should be a clear, concise question or prompt.","The back should be a direct answer.","The explanation should provide additional context in approximately 50 words.","Respond ONLY with valid JSON in this exact format:",'{"front":"...","back":"...","explanation":"..."}'].join(`
9
- `),H),R=(await this.executeChat(T,Y,H)).replace(/```json\n?|\n?```/g,"").trim();return JSON.parse(R)}async generateQuestion(T,C,H){let N=C?.choiceCount??5,Y=C?.correctChoiceCount??1,_=Math.min(100,Math.max(1,C?.difficulty??50)),R=this.buildPrompt(["Generate a multiple-choice question (MCQ) about the following subject.",`Difficulty level: ${_}/100. At easy difficulty (1-25), ask basic recall questions with obviously wrong distractors. At medium difficulty (26-50), require understanding and application with plausible distractors. At hard difficulty (51-75), test analysis and synthesis with closely related distractors that require careful reasoning. At expert difficulty (76-100), test deep analysis, edge cases, and subtle distinctions where wrong choices are very close to being correct.`,`The question must have exactly ${N} choices.`,`Exactly ${Y} of the choices must be correct.`,...C?.similarQuestion?[`Generate a question similar in style and topic to: "${C.similarQuestion}". The new question must be different but cover a closely related concept.`]:[],"For each choice (both correct and wrong), provide an explanation in approximately 50 words.","Respond ONLY with valid JSON in this exact format:",'{"question":"...","choices":[{"text":"...","isCorrect":true/false,"explanation":"..."},...]}'].join(`
10
- `),H),W=(await this.executeChat(T,R,H)).replace(/```json\n?|\n?```/g,"").trim();return JSON.parse(W)}async imageToMarkdown(T,C){let H=this.createChatAdapter(C),N=this.buildPrompt("Convert the content of the provided image into well-structured Markdown. Preserve the document structure including headings, lists, tables, code blocks, and formatting. Transcribe all visible text accurately.",C),Y=C?.messages?this.toMessages(C.messages):[],_={role:"user",content:[{type:"text",content:N},{type:"image",source:T}]},R=[...Y,_];return(await $({adapter:H,messages:R,stream:!1})).trim()}async run(T,C){let H=this.createRunAdapter(C),N="Process the following request and respond appropriately. If the request asks for structured data, return valid JSON.";if(C?.output){let Z=C.output.toJsonSchema(),A=E(Z);N+=`
69
+ ${content}` };
70
+ const messages = [...baseMessages, userMessage];
71
+ const result = await chat({
72
+ adapter,
73
+ messages,
74
+ stream: false
75
+ });
76
+ return result.trim();
77
+ }
78
+ async makeShorter(content, config) {
79
+ const prompt = this.buildPrompt("Condense the following text while preserving its core meaning and key information. Remove redundancies and unnecessary details.", config);
80
+ return this.executeChat(content, prompt, config);
81
+ }
82
+ async makeLonger(content, config) {
83
+ const prompt = this.buildPrompt("Expand the following text by adding relevant details, examples, and explanations while maintaining coherence and the original message.", config);
84
+ return this.executeChat(content, prompt, config);
85
+ }
86
+ async summarize(content, config) {
87
+ const prompt = this.buildPrompt("Provide a clear and comprehensive summary of the following text, capturing all essential points and main ideas.", config);
88
+ return this.executeChat(content, prompt, config);
89
+ }
90
+ async concise(content, config) {
91
+ const prompt = this.buildPrompt("Rewrite the following text in the most concise form possible without losing essential meaning.", config);
92
+ return this.executeChat(content, prompt, config);
93
+ }
94
+ async paragraph(content, config) {
95
+ const prompt = this.buildPrompt("Transform the following text into well-structured paragraph format with clear topic sentences and logical flow.", config);
96
+ return this.executeChat(content, prompt, config);
97
+ }
98
+ async bulletPoints(content, config) {
99
+ const prompt = this.buildPrompt("Convert the following text into a clear, organized list of bullet points highlighting the key information.", config);
100
+ return this.executeChat(content, prompt, config);
101
+ }
102
+ async rephrase(content, config) {
103
+ const prompt = this.buildPrompt("Rephrase the following text using different words and sentence structures while preserving the original meaning.", config);
104
+ return this.executeChat(content, prompt, config);
105
+ }
106
+ async simplify(content, config) {
107
+ const prompt = this.buildPrompt("Simplify the following text by using plain language, shorter sentences, and avoiding jargon. Make it accessible to a general audience.", config);
108
+ return this.executeChat(content, prompt, config);
109
+ }
110
+ async changeTone(content, tone, config) {
111
+ const prompt = this.buildPrompt(`Rewrite the following text in a ${tone} tone while maintaining clarity.`, config);
112
+ return this.executeChat(content, prompt, config);
113
+ }
114
+ async proofread(content, config) {
115
+ const prompt = this.buildPrompt("Proofread and correct the following text for grammar, spelling, punctuation, and clarity issues. Return the corrected version.", config);
116
+ return this.executeChat(content, prompt, config);
117
+ }
118
+ async translate(content, config) {
119
+ const targetLanguage = config?.language ?? "en";
120
+ const prompt = this.buildPrompt(`Translate the following text accurately into ${targetLanguage}, preserving the original meaning, tone, and nuance.`, config);
121
+ return this.executeChat(content, prompt, config);
122
+ }
123
+ async explain(content, config) {
124
+ const prompt = this.buildPrompt("Provide a clear explanation of the following text, breaking down complex concepts and clarifying the meaning.", config);
125
+ return this.executeChat(content, prompt, config);
126
+ }
127
+ async expandIdeas(content, config) {
128
+ const prompt = this.buildPrompt("Expand on the ideas presented in the following text by exploring related concepts, implications, and additional perspectives.", config);
129
+ return this.executeChat(content, prompt, config);
130
+ }
131
+ async fixGrammar(content, config) {
132
+ const prompt = this.buildPrompt("Fix all grammatical errors in the following text, including subject-verb agreement, tense consistency, and sentence structure.", config);
133
+ return this.executeChat(content, prompt, config);
134
+ }
135
+ async generateTitle(content, config) {
136
+ const prompt = this.buildPrompt("Generate a compelling, descriptive title for the following text that captures its main theme and engages readers.", config);
137
+ return this.executeChat(content, prompt, config);
138
+ }
139
+ async extractKeywords(content, config) {
140
+ const count = config?.count;
141
+ const countInstruction = count ? ` Return exactly ${count} keywords.` : "";
142
+ const prompt = this.buildPrompt(`Extract the most important keywords and key phrases from the following text. Return only the keywords as a comma-separated list without numbering, brackets, or additional formatting.${countInstruction}`, config);
143
+ const result = await this.executeChat(content, prompt, config);
144
+ const items = result.split(",").map((keyword) => keyword.trim()).filter((keyword) => keyword.length > 0);
145
+ return count ? items.slice(0, count) : items;
146
+ }
147
+ async extractCategories(content, config) {
148
+ const count = config?.count;
149
+ const countInstruction = count ? ` Return exactly ${count} categories.` : "";
150
+ const prompt = this.buildPrompt(`Identify the most relevant categories or topics that best describe the following text. Return only the categories as a comma-separated list without numbering, brackets, or additional formatting.${countInstruction}`, config);
151
+ const result = await this.executeChat(content, prompt, config);
152
+ const items = result.split(",").map((category) => category.trim()).filter((category) => category.length > 0);
153
+ return count ? items.slice(0, count) : items;
154
+ }
155
+ async extractTopics(content, config) {
156
+ const count = config?.count;
157
+ const countInstruction = count ? ` Return at most ${count} topics.` : "";
158
+ const prompt = this.buildPrompt(`Extract the main topics discussed in the following text. Return only the topics as a comma-separated list without numbering, brackets, or additional formatting.${countInstruction}`, config);
159
+ const result = await this.executeChat(content, prompt, config);
160
+ const items = result.split(",").map((topic) => topic.trim()).filter((topic) => topic.length > 0);
161
+ return count ? items.slice(0, count) : items;
162
+ }
163
+ async generateCaseQuestion(subject, options, config) {
164
+ const questionCount = options?.questionCount ?? 3;
165
+ const choiceCount = options?.choiceCount;
166
+ const difficulty = Math.min(100, Math.max(1, options?.difficulty ?? 50));
167
+ const choiceInstructions = choiceCount ? [
168
+ `Each question must have exactly ${choiceCount} choices.`,
169
+ "Exactly 1 of the choices must be correct.",
170
+ "For each choice (both correct and wrong), provide an explanation in approximately 50 words."
171
+ ] : [];
172
+ const jsonFormat = choiceCount ? `{"title":"...","presentation":"...","questions":[{"text":"...","answer":"...","explanation":"...","choices":[{"text":"...","isCorrect":true/false,"explanation":"..."},...]},...]}` : `{"title":"...","presentation":"...","questions":[{"text":"...","answer":"...","explanation":"..."},...]}`;
173
+ const prompt = this.buildPrompt([
174
+ "Generate a clinical case study with questions about the following subject.",
175
+ `Difficulty level: ${difficulty}/100. At easy difficulty (1-25), present straightforward cases with classic presentations. At medium difficulty (26-50), include cases requiring differential diagnosis and standard management. At hard difficulty (51-75), present atypical presentations or cases with complicating factors. At expert difficulty (76-100), present rare conditions, complex multi-system cases, or cases requiring nuanced clinical reasoning.`,
176
+ ...options?.similarCase ? [
177
+ `Generate a case similar in style and topic to: "${options.similarCase}". The new case must be different but cover a closely related clinical scenario.`
178
+ ] : [],
179
+ "Create a detailed clinical presentation with patient demographics, symptoms, history, and relevant findings.",
180
+ `Generate exactly ${questionCount} questions about the case, numbered sequentially.`,
181
+ "Each question must have a direct answer and a detailed explanation.",
182
+ ...choiceInstructions,
183
+ "Respond ONLY with valid JSON in this exact format:",
184
+ jsonFormat
185
+ ].join(`
186
+ `), config);
187
+ const result = await this.executeChat(subject, prompt, config);
188
+ const cleaned = result.replace(/```json\n?|\n?```/g, "").trim();
189
+ const parsed = JSON.parse(cleaned);
190
+ return parsed;
191
+ }
192
+ async generateFlashcard(subject, options, config) {
193
+ const difficulty = Math.min(100, Math.max(1, options?.difficulty ?? 50));
194
+ const prompt = this.buildPrompt([
195
+ "Generate a flashcard about the following subject.",
196
+ `Difficulty level: ${difficulty}/100. At easy difficulty (1-25), cover basic definitions and simple facts. At medium difficulty (26-50), cover concepts requiring understanding and application. At hard difficulty (51-75), cover analysis and connections between concepts. At expert difficulty (76-100), cover nuanced details, edge cases, and advanced reasoning.`,
197
+ ...options?.similarFlashcard ? [
198
+ `Generate a flashcard similar in style and topic to: "${options.similarFlashcard}". The new flashcard must be different but cover a closely related concept.`
199
+ ] : [],
200
+ "The front should be a clear, concise question or prompt.",
201
+ "The back should be a direct answer.",
202
+ "The explanation should provide additional context in approximately 50 words.",
203
+ "Respond ONLY with valid JSON in this exact format:",
204
+ `{"front":"...","back":"...","explanation":"..."}`
205
+ ].join(`
206
+ `), config);
207
+ const result = await this.executeChat(subject, prompt, config);
208
+ const cleaned = result.replace(/```json\n?|\n?```/g, "").trim();
209
+ const parsed = JSON.parse(cleaned);
210
+ return parsed;
211
+ }
212
+ async generateQuestion(subject, options, config) {
213
+ const choiceCount = options?.choiceCount ?? 5;
214
+ const correctChoiceCount = options?.correctChoiceCount ?? 1;
215
+ const difficulty = Math.min(100, Math.max(1, options?.difficulty ?? 50));
216
+ const prompt = this.buildPrompt([
217
+ "Generate a multiple-choice question (MCQ) about the following subject.",
218
+ `Difficulty level: ${difficulty}/100. At easy difficulty (1-25), ask basic recall questions with obviously wrong distractors. At medium difficulty (26-50), require understanding and application with plausible distractors. At hard difficulty (51-75), test analysis and synthesis with closely related distractors that require careful reasoning. At expert difficulty (76-100), test deep analysis, edge cases, and subtle distinctions where wrong choices are very close to being correct.`,
219
+ `The question must have exactly ${choiceCount} choices.`,
220
+ `Exactly ${correctChoiceCount} of the choices must be correct.`,
221
+ ...options?.similarQuestion ? [
222
+ `Generate a question similar in style and topic to: "${options.similarQuestion}". The new question must be different but cover a closely related concept.`
223
+ ] : [],
224
+ "For each choice (both correct and wrong), provide an explanation in approximately 50 words.",
225
+ "Respond ONLY with valid JSON in this exact format:",
226
+ `{"question":"...","choices":[{"text":"...","isCorrect":true/false,"explanation":"..."},...]}`
227
+ ].join(`
228
+ `), config);
229
+ const result = await this.executeChat(subject, prompt, config);
230
+ const cleaned = result.replace(/```json\n?|\n?```/g, "").trim();
231
+ const parsed = JSON.parse(cleaned);
232
+ return parsed;
233
+ }
234
+ async imageToMarkdown(source, config) {
235
+ const adapter = this.createChatAdapter(config);
236
+ const systemPrompt = this.buildPrompt("Convert the content of the provided image into well-structured Markdown. Preserve the document structure including headings, lists, tables, code blocks, and formatting. Transcribe all visible text accurately.", config);
237
+ const baseMessages = config?.messages ? this.toMessages(config.messages) : [];
238
+ const userMessage = {
239
+ role: "user",
240
+ content: [
241
+ { type: "text", content: systemPrompt },
242
+ { type: "image", source }
243
+ ]
244
+ };
245
+ const messages = [...baseMessages, userMessage];
246
+ const result = await chat({
247
+ adapter,
248
+ messages,
249
+ stream: false
250
+ });
251
+ return result.trim();
252
+ }
253
+ async run(prompt, config) {
254
+ const adapter = this.createRunAdapter(config);
255
+ let defaultPrompt = "Process the following request and respond appropriately. If the request asks for structured data, return valid JSON.";
256
+ if (config?.output) {
257
+ const schema = config.output.toJsonSchema();
258
+ const outputType = jsonSchemaToTypeString(schema);
259
+ defaultPrompt += `
11
260
 
12
- Output Type: ${A}`}let Y=this.buildPrompt(N,C),_=C?.messages?this.toMessages(C.messages):[],R={role:"user",content:`${Y}
261
+ Output Type: ${outputType}`;
262
+ }
263
+ const systemPrompt = this.buildPrompt(defaultPrompt, config);
264
+ const baseMessages = config?.messages ? this.toMessages(config.messages) : [];
265
+ const userMessage = { role: "user", content: `${systemPrompt}
13
266
 
14
267
  Request:
15
- ${T}`},L=[..._,R],V=(await $({adapter:H,messages:L,stream:!1})).trim(),X;try{let Z=V.replace(/```json\n?|\n?```/g,"").trim();X=JSON.parse(Z)}catch{X=V}if(C?.output){let Z=C.output(X);if(Z instanceof b.errors)throw new z(`Output validation failed: ${Z.summary}`)}return X}async*runStream(T,C){let H=this.createRunAdapter(C),N="Process the following request and respond appropriately.",Y=this.buildPrompt("Process the following request and respond appropriately.",C),_=C?.messages?this.toMessages(C.messages):[],R={role:"user",content:`${Y}
268
+ ${prompt}` };
269
+ const messages = [...baseMessages, userMessage];
270
+ const result = await chat({
271
+ adapter,
272
+ messages,
273
+ stream: false
274
+ });
275
+ const trimmed = result.trim();
276
+ let parsed;
277
+ try {
278
+ const cleaned = trimmed.replace(/```json\n?|\n?```/g, "").trim();
279
+ parsed = JSON.parse(cleaned);
280
+ } catch {
281
+ parsed = trimmed;
282
+ }
283
+ if (config?.output) {
284
+ const validation = config.output(parsed);
285
+ if (validation instanceof type.errors) {
286
+ throw new AiException(`Output validation failed: ${validation.summary}`);
287
+ }
288
+ }
289
+ return parsed;
290
+ }
291
+ async* runStream(prompt, config) {
292
+ const adapter = this.createRunAdapter(config);
293
+ const defaultPrompt = "Process the following request and respond appropriately.";
294
+ const systemPrompt = this.buildPrompt(defaultPrompt, config);
295
+ const baseMessages = config?.messages ? this.toMessages(config.messages) : [];
296
+ const userMessage = { role: "user", content: `${systemPrompt}
16
297
 
17
298
  Request:
18
- ${T}`},L=[..._,R],W=$({adapter:H,messages:L,stream:!0});for await(let V of W)if(V.type==="content")yield V.content}}import{container as y,EContainerScope as l}from"@ooneex/container";var J={ai:(T=l.Singleton)=>{return(C)=>{y.add(C,T)}}};class F extends D{env;constructor(T){super();this.env=T}getApiKey(T){let C=T?.apiKey||this.env.ANTHROPIC_API_KEY;if(!C)throw new z("Anthropic API key is required. Provide an API key through config options or set the ANTHROPIC_API_KEY environment variable.");return C}createChatAdapter(T){let C=this.getApiKey(T),H=T?.model??"claude-sonnet-4-5";return r(H,C)}createRunAdapter(T){return this.createChatAdapter(T)}}F=Q([J.ai(),S(0,d(h)),U("design:paramtypes",[typeof h==="undefined"?Object:h])],F);import{AppEnv as w}from"@ooneex/app-env";import{inject as O}from"@ooneex/container";import{generateImage as u,generateSpeech as m}from"@tanstack/ai";import{createGeminiChat as P,createGeminiImage as a,createGeminiSpeech as f}from"@tanstack/ai-gemini";class I extends D{env;constructor(T){super();this.env=T}getApiKey(T){let C=T?.apiKey||this.env.GEMINI_API_KEY;if(!C)throw new z("Gemini API key is required. Provide an API key through config options or set the GEMINI_API_KEY environment variable.");return C}createChatAdapter(T){let C=this.getApiKey(T),H=T?.model??"gemini-2.0-flash";return P(H,C)}createRunAdapter(T){let C=this.getApiKey(T),H=T?.model??"gemini-2.5-pro";return P(H,C)}async textToSpeech(T,C){let H=this.getApiKey(C),N=C?.model??"gemini-2.5-flash-preview-tts",Y=f(N,H),_={};if(C?.voice)_.voiceConfig={prebuiltVoiceConfig:{voiceName:C.voice}};if(C?.instructions)_.systemInstruction=C.instructions;if(C?.language)_.languageCode=C.language;let R={adapter:Y,text:T};if(C?.format)R.format=C.format;if(C?.speed)R.speed=C.speed;if(Object.keys(_).length>0)R.modelOptions=_;return m(R)}async generateImage(T,C){let H=this.getApiKey(C),N=C?.model??"imagen-4.0-generate-001",_={adapter:a(N,H),prompt:T};if(C?.numberOfImages)_.numberOfImages=C.numberOfImages;if(C?.size)_.size=C.size;let R={};if(C?.aspectRatio)R.aspectRatio=C.aspectRatio;if(C?.personGeneration)R.personGeneration=C.personGeneration;if(C?.negativePrompt)R.negativePrompt=C.negativePrompt;if(C?.addWatermark!==void 0)R.addWatermark=C.addWatermark;if(C?.outputMimeType)R.outputMimeType=C.outputMimeType;if(Object.keys(R).length>0)_.modelOptions=R;return u(_)}}I=Q([J.ai(),S(0,O(w)),U("design:paramtypes",[typeof w==="undefined"?Object:w])],I);import{AppEnv as q}from"@ooneex/app-env";import{inject as g}from"@ooneex/container";import{createGroqText as e}from"@tanstack/ai-groq";class M extends D{env;constructor(T){super();this.env=T}getApiKey(T){let C=T?.apiKey||this.env.GROQ_API_KEY;if(!C)throw new z("Groq API key is required. Provide an API key through config options or set the GROQ_API_KEY environment variable.");return C}createChatAdapter(T){let C=this.getApiKey(T),H=T?.model??"llama-3.3-70b-versatile";return e(H,C)}createRunAdapter(T){return this.createChatAdapter(T)}async textToSpeech(T,C){let H=this.getApiKey(C),N=C?.model??"canopylabs/orpheus-v1-english",Y=C?.voice??"autumn",_=C?.format??"wav",R={model:N,input:T,voice:Y,response_format:_};if(C?.sampleRate)R.sample_rate=C.sampleRate;let L=await fetch("https://api.groq.com/openai/v1/audio/speech",{method:"POST",headers:{Authorization:`Bearer ${H}`,"Content-Type":"application/json"},body:JSON.stringify(R)});if(!L.ok){let X=await L.text();throw new z(`Groq TTS request failed (${L.status}): ${X}`)}let W=await L.arrayBuffer(),V=Buffer.from(W).toString("base64");return{id:L.headers.get("x-request-id")??crypto.randomUUID(),model:N,audio:V,format:_}}}M=Q([J.ai(),S(0,g(q)),U("design:paramtypes",[typeof q==="undefined"?Object:q])],M);import{AppEnv as j}from"@ooneex/app-env";import{inject as c}from"@ooneex/container";import{createOllamaChat as p}from"@tanstack/ai-ollama";class B extends D{env;constructor(T){super();this.env=T}getHost(T){return T?.host||this.env.OLLAMA_HOST||"http://localhost:11434"}createChatAdapter(T){let C=this.getHost(T),H=T?.model??"llama3";return p(H,C)}createRunAdapter(T){return this.createChatAdapter(T)}}B=Q([J.ai(),S(0,c(j)),U("design:paramtypes",[typeof j==="undefined"?Object:j])],B);import{AppEnv as k}from"@ooneex/app-env";import{inject as s}from"@ooneex/container";import{generateImage as t,generateSpeech as i,generateTranscription as n}from"@tanstack/ai";import{createOpenaiChat as x,createOpenaiImage as o,createOpenaiSpeech as CC,createOpenaiTranscription as TC}from"@tanstack/ai-openai";class v extends D{env;constructor(T){super();this.env=T}getApiKey(T){let C=T?.apiKey||this.env.OPENAI_API_KEY;if(!C)throw new z("OpenAI API key is required. Provide an API key through config options or set the OPENAI_API_KEY environment variable.");return C}createChatAdapter(T){let C=this.getApiKey(T),H=T?.model??"gpt-4o-mini";return x(H,C)}createRunAdapter(T){let C=this.getApiKey(T),H=T?.model??"gpt-4o";return x(H,C)}async textToSpeech(T,C){let H=this.getApiKey(C),N=C?.model??"tts-1",_={adapter:CC(N,H),text:T};if(C?.voice)_.voice=C.voice;if(C?.format)_.format=C.format;if(C?.speed)_.speed=C.speed;let R=[];if(C?.language)R.push(`Speak in ${C.language}.`);if(C?.instructions)R.push(C.instructions);if(R.length>0)_.modelOptions={instructions:R.join(" ")};return i(_)}async speechToText(T,C){let H=this.getApiKey(C),N=C?.model??"gpt-4o-transcribe",_={adapter:TC(N,H),audio:T};if(C?.language)_.language=C.language;if(C?.prompt)_.prompt=C.prompt;if(C?.responseFormat)_.responseFormat=C.responseFormat;if(C?.modelOptions)_.modelOptions=C.modelOptions;return n(_)}async generateImage(T,C){let H=this.getApiKey(C),N=C?.model??"dall-e-3",_={adapter:o(N,H),prompt:T};if(C?.numberOfImages)_.numberOfImages=C.numberOfImages;if(C?.size)_.size=C.size;let R={};if(C?.quality)R.quality=C.quality;if(C?.background)R.background=C.background;if(C?.outputFormat)R.output_format=C.outputFormat;if(C?.moderation)R.moderation=C.moderation;if(C?.style)R.style=C.style;if(Object.keys(R).length>0)_.modelOptions=R;return t(_)}}v=Q([J.ai(),S(0,s(k)),U("design:paramtypes",[typeof k==="undefined"?Object:k])],v);export{J as decorator,v as OpenAi,B as OllamaAi,M as GroqAi,I as GeminiAi,D as BaseAi,F as AnthropicAi,z as AiException};
299
+ ${prompt}` };
300
+ const messages = [...baseMessages, userMessage];
301
+ const stream = chat({
302
+ adapter,
303
+ messages,
304
+ stream: true
305
+ });
306
+ for await (const chunk of stream) {
307
+ if (chunk.type === "content") {
308
+ yield chunk.content;
309
+ }
310
+ }
311
+ }
312
+ }
313
+
314
+ // src/decorators.ts
315
+ import { container, EContainerScope } from "@ooneex/container";
316
+ var decorator = {
317
+ ai: (scope = EContainerScope.Singleton) => {
318
+ return (target) => {
319
+ container.add(target, scope);
320
+ };
321
+ }
322
+ };
323
+
324
+ // src/AnthropicAi.ts
325
+ class AnthropicAi extends BaseAi {
326
+ env;
327
+ constructor(env) {
328
+ super();
329
+ this.env = env;
330
+ }
331
+ getApiKey(config) {
332
+ const apiKey = config?.apiKey || this.env.ANTHROPIC_API_KEY;
333
+ if (!apiKey) {
334
+ throw new AiException("Anthropic API key is required. Provide an API key through config options or set the ANTHROPIC_API_KEY environment variable.");
335
+ }
336
+ return apiKey;
337
+ }
338
+ createChatAdapter(config) {
339
+ const apiKey = this.getApiKey(config);
340
+ const model = config?.model ?? "claude-sonnet-4-5";
341
+ return createAnthropicChat(model, apiKey);
342
+ }
343
+ createRunAdapter(config) {
344
+ return this.createChatAdapter(config);
345
+ }
346
+ }
347
+ AnthropicAi = __legacyDecorateClassTS([
348
+ decorator.ai(),
349
+ __legacyDecorateParamTS(0, inject(AppEnv)),
350
+ __legacyMetadataTS("design:paramtypes", [
351
+ typeof AppEnv === "undefined" ? Object : AppEnv
352
+ ])
353
+ ], AnthropicAi);
354
+ // src/GeminiAi.ts
355
+ import { AppEnv as AppEnv2 } from "@ooneex/app-env";
356
+ import { inject as inject2 } from "@ooneex/container";
357
+ import { generateImage, generateSpeech } from "@tanstack/ai";
358
+ import { createGeminiChat, createGeminiImage, createGeminiSpeech } from "@tanstack/ai-gemini";
359
+ class GeminiAi extends BaseAi {
360
+ env;
361
+ constructor(env) {
362
+ super();
363
+ this.env = env;
364
+ }
365
+ getApiKey(config) {
366
+ const apiKey = config?.apiKey || this.env.GEMINI_API_KEY;
367
+ if (!apiKey) {
368
+ throw new AiException("Gemini API key is required. Provide an API key through config options or set the GEMINI_API_KEY environment variable.");
369
+ }
370
+ return apiKey;
371
+ }
372
+ createChatAdapter(config) {
373
+ const apiKey = this.getApiKey(config);
374
+ const model = config?.model ?? "gemini-2.0-flash";
375
+ return createGeminiChat(model, apiKey);
376
+ }
377
+ createRunAdapter(config) {
378
+ const apiKey = this.getApiKey(config);
379
+ const model = config?.model ?? "gemini-2.5-pro";
380
+ return createGeminiChat(model, apiKey);
381
+ }
382
+ async textToSpeech(text, options) {
383
+ const apiKey = this.getApiKey(options);
384
+ const model = options?.model ?? "gemini-2.5-flash-preview-tts";
385
+ const adapter = createGeminiSpeech(model, apiKey);
386
+ const modelOptions = {};
387
+ if (options?.voice) {
388
+ modelOptions.voiceConfig = {
389
+ prebuiltVoiceConfig: {
390
+ voiceName: options.voice
391
+ }
392
+ };
393
+ }
394
+ if (options?.instructions) {
395
+ modelOptions.systemInstruction = options.instructions;
396
+ }
397
+ if (options?.language) {
398
+ modelOptions.languageCode = options.language;
399
+ }
400
+ const speechOptions = { adapter, text };
401
+ if (options?.format) {
402
+ speechOptions.format = options.format;
403
+ }
404
+ if (options?.speed) {
405
+ speechOptions.speed = options.speed;
406
+ }
407
+ if (Object.keys(modelOptions).length > 0) {
408
+ speechOptions.modelOptions = modelOptions;
409
+ }
410
+ return generateSpeech(speechOptions);
411
+ }
412
+ async generateImage(prompt, options) {
413
+ const apiKey = this.getApiKey(options);
414
+ const model = options?.model ?? "imagen-4.0-generate-001";
415
+ const adapter = createGeminiImage(model, apiKey);
416
+ const imageOptions = { adapter, prompt };
417
+ if (options?.numberOfImages) {
418
+ imageOptions.numberOfImages = options.numberOfImages;
419
+ }
420
+ if (options?.size) {
421
+ imageOptions.size = options.size;
422
+ }
423
+ const modelOptions = {};
424
+ if (options?.aspectRatio) {
425
+ modelOptions.aspectRatio = options.aspectRatio;
426
+ }
427
+ if (options?.personGeneration) {
428
+ modelOptions.personGeneration = options.personGeneration;
429
+ }
430
+ if (options?.negativePrompt) {
431
+ modelOptions.negativePrompt = options.negativePrompt;
432
+ }
433
+ if (options?.addWatermark !== undefined) {
434
+ modelOptions.addWatermark = options.addWatermark;
435
+ }
436
+ if (options?.outputMimeType) {
437
+ modelOptions.outputMimeType = options.outputMimeType;
438
+ }
439
+ if (Object.keys(modelOptions).length > 0) {
440
+ imageOptions.modelOptions = modelOptions;
441
+ }
442
+ return generateImage(imageOptions);
443
+ }
444
+ }
445
+ GeminiAi = __legacyDecorateClassTS([
446
+ decorator.ai(),
447
+ __legacyDecorateParamTS(0, inject2(AppEnv2)),
448
+ __legacyMetadataTS("design:paramtypes", [
449
+ typeof AppEnv2 === "undefined" ? Object : AppEnv2
450
+ ])
451
+ ], GeminiAi);
452
+ // src/GroqAi.ts
453
+ import { AppEnv as AppEnv3 } from "@ooneex/app-env";
454
+ import { inject as inject3 } from "@ooneex/container";
455
+ import { createGroqText } from "@tanstack/ai-groq";
456
+ class GroqAi extends BaseAi {
457
+ env;
458
+ constructor(env) {
459
+ super();
460
+ this.env = env;
461
+ }
462
+ getApiKey(config) {
463
+ const apiKey = config?.apiKey || this.env.GROQ_API_KEY;
464
+ if (!apiKey) {
465
+ throw new AiException("Groq API key is required. Provide an API key through config options or set the GROQ_API_KEY environment variable.");
466
+ }
467
+ return apiKey;
468
+ }
469
+ createChatAdapter(config) {
470
+ const apiKey = this.getApiKey(config);
471
+ const model = config?.model ?? "llama-3.3-70b-versatile";
472
+ return createGroqText(model, apiKey);
473
+ }
474
+ createRunAdapter(config) {
475
+ return this.createChatAdapter(config);
476
+ }
477
+ async textToSpeech(text, options) {
478
+ const apiKey = this.getApiKey(options);
479
+ const model = options?.model ?? "canopylabs/orpheus-v1-english";
480
+ const voice = options?.voice ?? "autumn";
481
+ const format = options?.format ?? "wav";
482
+ const body = {
483
+ model,
484
+ input: text,
485
+ voice,
486
+ response_format: format
487
+ };
488
+ if (options?.sampleRate) {
489
+ body.sample_rate = options.sampleRate;
490
+ }
491
+ const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
492
+ method: "POST",
493
+ headers: {
494
+ Authorization: `Bearer ${apiKey}`,
495
+ "Content-Type": "application/json"
496
+ },
497
+ body: JSON.stringify(body)
498
+ });
499
+ if (!response.ok) {
500
+ const error = await response.text();
501
+ throw new AiException(`Groq TTS request failed (${response.status}): ${error}`);
502
+ }
503
+ const arrayBuffer = await response.arrayBuffer();
504
+ const audio = Buffer.from(arrayBuffer).toString("base64");
505
+ return {
506
+ id: response.headers.get("x-request-id") ?? crypto.randomUUID(),
507
+ model,
508
+ audio,
509
+ format
510
+ };
511
+ }
512
+ }
513
+ GroqAi = __legacyDecorateClassTS([
514
+ decorator.ai(),
515
+ __legacyDecorateParamTS(0, inject3(AppEnv3)),
516
+ __legacyMetadataTS("design:paramtypes", [
517
+ typeof AppEnv3 === "undefined" ? Object : AppEnv3
518
+ ])
519
+ ], GroqAi);
520
+ // src/OllamaAi.ts
521
+ import { AppEnv as AppEnv4 } from "@ooneex/app-env";
522
+ import { inject as inject4 } from "@ooneex/container";
523
+ import { createOllamaChat } from "@tanstack/ai-ollama";
524
+ class OllamaAi extends BaseAi {
525
+ env;
526
+ constructor(env) {
527
+ super();
528
+ this.env = env;
529
+ }
530
+ getHost(config) {
531
+ return config?.host || this.env.OLLAMA_HOST || "http://localhost:11434";
532
+ }
533
+ createChatAdapter(config) {
534
+ const host = this.getHost(config);
535
+ const model = config?.model ?? "llama3";
536
+ return createOllamaChat(model, host);
537
+ }
538
+ createRunAdapter(config) {
539
+ return this.createChatAdapter(config);
540
+ }
541
+ }
542
+ OllamaAi = __legacyDecorateClassTS([
543
+ decorator.ai(),
544
+ __legacyDecorateParamTS(0, inject4(AppEnv4)),
545
+ __legacyMetadataTS("design:paramtypes", [
546
+ typeof AppEnv4 === "undefined" ? Object : AppEnv4
547
+ ])
548
+ ], OllamaAi);
549
+ // src/OpenAi.ts
550
+ import { AppEnv as AppEnv5 } from "@ooneex/app-env";
551
+ import { inject as inject5 } from "@ooneex/container";
552
+ import { generateImage as generateImage2, generateSpeech as generateSpeech2, generateTranscription } from "@tanstack/ai";
553
+ import {
554
+ createOpenaiChat,
555
+ createOpenaiImage,
556
+ createOpenaiSpeech,
557
+ createOpenaiTranscription
558
+ } from "@tanstack/ai-openai";
559
+ class OpenAi extends BaseAi {
560
+ env;
561
+ constructor(env) {
562
+ super();
563
+ this.env = env;
564
+ }
565
+ getApiKey(config) {
566
+ const apiKey = config?.apiKey || this.env.OPENAI_API_KEY;
567
+ if (!apiKey) {
568
+ throw new AiException("OpenAI API key is required. Provide an API key through config options or set the OPENAI_API_KEY environment variable.");
569
+ }
570
+ return apiKey;
571
+ }
572
+ createChatAdapter(config) {
573
+ const apiKey = this.getApiKey(config);
574
+ const model = config?.model ?? "gpt-4o-mini";
575
+ return createOpenaiChat(model, apiKey);
576
+ }
577
+ createRunAdapter(config) {
578
+ const apiKey = this.getApiKey(config);
579
+ const model = config?.model ?? "gpt-4o";
580
+ return createOpenaiChat(model, apiKey);
581
+ }
582
+ async textToSpeech(text, options) {
583
+ const apiKey = this.getApiKey(options);
584
+ const model = options?.model ?? "tts-1";
585
+ const adapter = createOpenaiSpeech(model, apiKey);
586
+ const speechOptions = { adapter, text };
587
+ if (options?.voice) {
588
+ speechOptions.voice = options.voice;
589
+ }
590
+ if (options?.format) {
591
+ speechOptions.format = options.format;
592
+ }
593
+ if (options?.speed) {
594
+ speechOptions.speed = options.speed;
595
+ }
596
+ const instructionParts = [];
597
+ if (options?.language) {
598
+ instructionParts.push(`Speak in ${options.language}.`);
599
+ }
600
+ if (options?.instructions) {
601
+ instructionParts.push(options.instructions);
602
+ }
603
+ if (instructionParts.length > 0) {
604
+ speechOptions.modelOptions = { instructions: instructionParts.join(" ") };
605
+ }
606
+ return generateSpeech2(speechOptions);
607
+ }
608
+ async speechToText(audio, options) {
609
+ const apiKey = this.getApiKey(options);
610
+ const model = options?.model ?? "gpt-4o-transcribe";
611
+ const adapter = createOpenaiTranscription(model, apiKey);
612
+ const transcriptionOptions = { adapter, audio };
613
+ if (options?.language) {
614
+ transcriptionOptions.language = options.language;
615
+ }
616
+ if (options?.prompt) {
617
+ transcriptionOptions.prompt = options.prompt;
618
+ }
619
+ if (options?.responseFormat) {
620
+ transcriptionOptions.responseFormat = options.responseFormat;
621
+ }
622
+ if (options?.modelOptions) {
623
+ transcriptionOptions.modelOptions = options.modelOptions;
624
+ }
625
+ return generateTranscription(transcriptionOptions);
626
+ }
627
+ async generateImage(prompt, options) {
628
+ const apiKey = this.getApiKey(options);
629
+ const model = options?.model ?? "dall-e-3";
630
+ const adapter = createOpenaiImage(model, apiKey);
631
+ const imageOptions = { adapter, prompt };
632
+ if (options?.numberOfImages) {
633
+ imageOptions.numberOfImages = options.numberOfImages;
634
+ }
635
+ if (options?.size) {
636
+ imageOptions.size = options.size;
637
+ }
638
+ const modelOptions = {};
639
+ if (options?.quality) {
640
+ modelOptions.quality = options.quality;
641
+ }
642
+ if (options?.background) {
643
+ modelOptions.background = options.background;
644
+ }
645
+ if (options?.outputFormat) {
646
+ modelOptions.output_format = options.outputFormat;
647
+ }
648
+ if (options?.moderation) {
649
+ modelOptions.moderation = options.moderation;
650
+ }
651
+ if (options?.style) {
652
+ modelOptions.style = options.style;
653
+ }
654
+ if (Object.keys(modelOptions).length > 0) {
655
+ imageOptions.modelOptions = modelOptions;
656
+ }
657
+ return generateImage2(imageOptions);
658
+ }
659
+ }
660
+ OpenAi = __legacyDecorateClassTS([
661
+ decorator.ai(),
662
+ __legacyDecorateParamTS(0, inject5(AppEnv5)),
663
+ __legacyMetadataTS("design:paramtypes", [
664
+ typeof AppEnv5 === "undefined" ? Object : AppEnv5
665
+ ])
666
+ ], OpenAi);
667
+ export {
668
+ decorator,
669
+ OpenAi,
670
+ OllamaAi,
671
+ GroqAi,
672
+ GeminiAi,
673
+ BaseAi,
674
+ AnthropicAi,
675
+ AiException
676
+ };
19
677
 
20
- //# debugId=E9459E4A7DD8E6F064756E2164756E21
678
+ //# debugId=229E1B95C503141B64756E2164756E21
package/dist/index.js.map CHANGED
@@ -11,7 +11,7 @@
11
11
  "import { AppEnv } from \"@ooneex/app-env\";\nimport { inject } from \"@ooneex/container\";\nimport { createOllamaChat } from \"@tanstack/ai-ollama\";\nimport { BaseAi } from \"./BaseAi\";\nimport { decorator } from \"./decorators\";\nimport type { OllamaConfigType, OllamaModelType } from \"./types\";\n\n@decorator.ai()\nexport class OllamaAi extends BaseAi<OllamaConfigType> {\n constructor(@inject(AppEnv) private readonly env: AppEnv) {\n super();\n }\n\n private getHost(config?: OllamaConfigType): string {\n return config?.host || this.env.OLLAMA_HOST || \"http://localhost:11434\";\n }\n\n protected createChatAdapter(config?: OllamaConfigType) {\n const host = this.getHost(config);\n const model: OllamaModelType = config?.model ?? \"llama3\";\n return createOllamaChat(model, host);\n }\n\n protected createRunAdapter(config?: OllamaConfigType) {\n return this.createChatAdapter(config);\n }\n}\n",
12
12
  "import { AppEnv } from \"@ooneex/app-env\";\nimport { inject } from \"@ooneex/container\";\nimport type { ImageGenerationResult, TranscriptionResult, TTSResult } from \"@tanstack/ai\";\nimport { generateImage, generateSpeech, generateTranscription } from \"@tanstack/ai\";\nimport {\n createOpenaiChat,\n createOpenaiImage,\n createOpenaiSpeech,\n createOpenaiTranscription,\n} from \"@tanstack/ai-openai\";\nimport { AiException } from \"./AiException\";\nimport { BaseAi } from \"./BaseAi\";\nimport { decorator } from \"./decorators\";\nimport type {\n OpenAiConfigType,\n OpenAiGenerateImageOptionsType,\n OpenAiModelType,\n OpenAiSpeechToTextOptionsType,\n OpenAiTextToSpeechOptionsType,\n} from \"./types\";\n\n@decorator.ai()\nexport class OpenAi extends BaseAi<OpenAiConfigType> {\n constructor(@inject(AppEnv) private readonly env: AppEnv) {\n super();\n }\n\n private getApiKey(config?: { apiKey?: string }): string {\n const apiKey = config?.apiKey || this.env.OPENAI_API_KEY;\n\n if (!apiKey) {\n throw new AiException(\n \"OpenAI API key is required. Provide an API key through config options or set the OPENAI_API_KEY environment variable.\",\n );\n }\n\n return apiKey;\n }\n\n protected createChatAdapter(config?: OpenAiConfigType) {\n const apiKey = this.getApiKey(config);\n const model: OpenAiModelType = config?.model ?? \"gpt-4o-mini\";\n return createOpenaiChat(model, apiKey);\n }\n\n protected createRunAdapter(config?: OpenAiConfigType) {\n const apiKey = this.getApiKey(config);\n const model: OpenAiModelType = config?.model ?? \"gpt-4o\";\n return createOpenaiChat(model, apiKey);\n }\n\n public async textToSpeech(text: string, options?: OpenAiTextToSpeechOptionsType): Promise<TTSResult> {\n const apiKey = this.getApiKey(options);\n const model = options?.model ?? \"tts-1\";\n const adapter = createOpenaiSpeech(model, apiKey);\n\n // biome-ignore lint/suspicious/noExplicitAny: exactOptionalPropertyTypes requires careful handling\n const speechOptions: Record<string, any> = { adapter, text };\n\n if (options?.voice) {\n speechOptions.voice = options.voice;\n }\n if (options?.format) {\n speechOptions.format = options.format;\n }\n if (options?.speed) {\n speechOptions.speed = options.speed;\n }\n const instructionParts: string[] = [];\n if (options?.language) {\n instructionParts.push(`Speak in ${options.language}.`);\n }\n if (options?.instructions) {\n instructionParts.push(options.instructions);\n }\n if (instructionParts.length > 0) {\n speechOptions.modelOptions = { instructions: instructionParts.join(\" \") };\n }\n\n return generateSpeech(speechOptions as Parameters<typeof generateSpeech>[0]) as Promise<TTSResult>;\n }\n\n public async speechToText(\n audio: string | File | Blob | ArrayBuffer,\n options?: OpenAiSpeechToTextOptionsType,\n ): Promise<TranscriptionResult> {\n const apiKey = this.getApiKey(options);\n const model = options?.model ?? \"gpt-4o-transcribe\";\n const adapter = createOpenaiTranscription(model, apiKey);\n\n // biome-ignore lint/suspicious/noExplicitAny: exactOptionalPropertyTypes requires careful handling\n const transcriptionOptions: Record<string, any> = { adapter, audio };\n\n if (options?.language) {\n transcriptionOptions.language = options.language;\n }\n if (options?.prompt) {\n transcriptionOptions.prompt = options.prompt;\n }\n if (options?.responseFormat) {\n transcriptionOptions.responseFormat = options.responseFormat;\n }\n if (options?.modelOptions) {\n transcriptionOptions.modelOptions = options.modelOptions;\n }\n\n return generateTranscription(\n transcriptionOptions as Parameters<typeof generateTranscription>[0],\n ) as Promise<TranscriptionResult>;\n }\n\n public async generateImage(prompt: string, options?: OpenAiGenerateImageOptionsType): Promise<ImageGenerationResult> {\n const apiKey = this.getApiKey(options);\n const model = options?.model ?? \"dall-e-3\";\n const adapter = createOpenaiImage(model, apiKey);\n\n // biome-ignore lint/suspicious/noExplicitAny: exactOptionalPropertyTypes requires careful handling\n const imageOptions: Record<string, any> = { adapter, prompt };\n\n if (options?.numberOfImages) {\n imageOptions.numberOfImages = options.numberOfImages;\n }\n if (options?.size) {\n imageOptions.size = options.size;\n }\n\n const modelOptions: Record<string, unknown> = {};\n if (options?.quality) {\n modelOptions.quality = options.quality;\n }\n if (options?.background) {\n modelOptions.background = options.background;\n }\n if (options?.outputFormat) {\n modelOptions.output_format = options.outputFormat;\n }\n if (options?.moderation) {\n modelOptions.moderation = options.moderation;\n }\n if (options?.style) {\n modelOptions.style = options.style;\n }\n if (Object.keys(modelOptions).length > 0) {\n imageOptions.modelOptions = modelOptions;\n }\n\n return generateImage(imageOptions as Parameters<typeof generateImage>[0]) as Promise<ImageGenerationResult>;\n }\n}\n"
13
13
  ],
14
- "mappings": ";8cAAA,oBAAS,0BACT,qBAAS,4BAEF,MAAM,UAAoB,CAAU,CACzC,WAAW,CAAC,EAAiB,EAAgC,CAAC,EAAG,CAC/D,MAAM,EAAS,CACb,OAAQ,EAAW,KAAK,oBACxB,MACF,CAAC,EACD,KAAK,KAAO,cAEhB,CCXA,iBAAS,wBACT,iBAAS,0BACT,8BAAS,+BCFT,iCAAS,2BACT,eAAiC,qBACjC,eAAS,gBAgBF,MAAe,CAAiE,CAM3E,WAAW,CAAC,EAAqB,EAA0B,CACnE,IAAM,EAAkB,CAAC,GAAQ,QAAU,CAAW,EAEtD,GAAI,GAAQ,QACV,EAAM,KAAK;AAAA,EAAa,EAAO,SAAS,EAG1C,GAAI,GAAQ,UACV,EAAM,KAAK,wBAAwB,EAAO,kBAAkB,EAG9D,GAAI,GAAQ,KACV,EAAM,KAAK,SAAS,EAAO,YAAY,EAGzC,GAAI,GAAQ,SACV,EAAM,KAAK,cAAc,EAAO,oBAAoB,EAOtD,OAJA,EAAM,KACJ,GAAG,GAAQ,QAAU,qDAAuD,iGAC9E,EAEO,EAAM,KAAK;AAAA,CAAI,EAGd,UAAU,CAAC,EAA2C,CAC9D,OAAO,EAAS,IAAI,CAAC,KAAS,CAAE,KAAM,EAAI,KAAuC,QAAS,EAAI,OAAQ,EAAE,OAG1F,YAAW,CAAC,EAAiB,EAAsB,EAAmC,CACpG,IAAM,EAAU,KAAK,kBAAkB,CAAM,EAEvC,EAA+B,GAAQ,SAAW,KAAK,WAAW,EAAO,QAAQ,EAAI,CAAC,EACtF,EAA4B,CAAE,KAAM,OAAQ,QAAS,GAAG;AAAA;AAAA;AAAA,EAAqC,GAAU,EAEvG,EAAW,CAAC,GAAG,EAAc,CAA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AmD;AAAA;AAE5E;AA9Ha,SAAN;AAAA,EADN,UAAU,GAAG;AAAA,EAEC,mCAAO,OAAM;AAAA,EADrB;AAAA;AAAA;AAAA,GAAM;",
15
+ "debugId": "229E1B95C503141B64756E2164756E21",
16
16
  "names": []
17
17
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ooneex/ai",
3
3
  "description": "Multi-provider AI toolkit for TypeScript — seamlessly integrate OpenAI, Anthropic Claude, Google Gemini, Groq, and Ollama with a unified API for text generation, streaming, and content transformation",
4
- "version": "1.1.4",
4
+ "version": "1.1.6",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",