@ooneex/ai 1.0.1 → 1.1.0
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 +15 -0
- package/dist/index.js +10 -10
- package/dist/index.js.map +7 -7
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Exception } from "@ooneex/exception";
|
|
|
2
2
|
declare class AiException extends Exception {
|
|
3
3
|
constructor(message: string, data?: Record<string, unknown>);
|
|
4
4
|
}
|
|
5
|
+
import { AppEnv } from "@ooneex/app-env";
|
|
5
6
|
import { ModelMessage } from "@tanstack/ai";
|
|
6
7
|
import { LocaleType } from "@ooneex/translation";
|
|
7
8
|
import { AssertType } from "@ooneex/validation";
|
|
@@ -225,6 +226,8 @@ declare abstract class BaseAi<TConfig extends AiConfigType> implements IAiChat<T
|
|
|
225
226
|
runStream(prompt: string, config?: Omit<TConfig, "prompt" | "output">): AsyncGenerator<string, void, unknown>;
|
|
226
227
|
}
|
|
227
228
|
declare class AnthropicAi extends BaseAi<AnthropicConfigType> {
|
|
229
|
+
private readonly env;
|
|
230
|
+
constructor(env: AppEnv);
|
|
228
231
|
private getApiKey;
|
|
229
232
|
protected createChatAdapter(config?: AnthropicConfigType);
|
|
230
233
|
protected createRunAdapter(config?: AnthropicConfigType);
|
|
@@ -233,28 +236,40 @@ import { EContainerScope } from "@ooneex/container";
|
|
|
233
236
|
declare const decorator: {
|
|
234
237
|
ai: (scope?: EContainerScope) => (target: AiClassType) => void;
|
|
235
238
|
};
|
|
239
|
+
import { AppEnv as AppEnv2 } from "@ooneex/app-env";
|
|
236
240
|
import { ImageGenerationResult as ImageGenerationResult2, TTSResult as TTSResult2 } from "@tanstack/ai";
|
|
237
241
|
declare class GeminiAi extends BaseAi<GeminiConfigType> {
|
|
242
|
+
private readonly env;
|
|
243
|
+
constructor(env: AppEnv2);
|
|
238
244
|
private getApiKey;
|
|
239
245
|
protected createChatAdapter(config?: GeminiConfigType);
|
|
240
246
|
protected createRunAdapter(config?: GeminiConfigType);
|
|
241
247
|
textToSpeech(text: string, options?: GeminiTextToSpeechOptionsType): Promise<TTSResult2>;
|
|
242
248
|
generateImage(prompt: string, options?: GeminiGenerateImageOptionsType): Promise<ImageGenerationResult2>;
|
|
243
249
|
}
|
|
250
|
+
import { AppEnv as AppEnv3 } from "@ooneex/app-env";
|
|
244
251
|
import { TTSResult as TTSResult3 } from "@tanstack/ai";
|
|
245
252
|
declare class GroqAi extends BaseAi<GroqConfigType> {
|
|
253
|
+
private readonly env;
|
|
254
|
+
constructor(env: AppEnv3);
|
|
246
255
|
private getApiKey;
|
|
247
256
|
protected createChatAdapter(config?: GroqConfigType);
|
|
248
257
|
protected createRunAdapter(config?: GroqConfigType);
|
|
249
258
|
textToSpeech(text: string, options?: GroqTextToSpeechOptionsType): Promise<TTSResult3>;
|
|
250
259
|
}
|
|
260
|
+
import { AppEnv as AppEnv4 } from "@ooneex/app-env";
|
|
251
261
|
declare class OllamaAi extends BaseAi<OllamaConfigType> {
|
|
262
|
+
private readonly env;
|
|
263
|
+
constructor(env: AppEnv4);
|
|
252
264
|
private getHost;
|
|
253
265
|
protected createChatAdapter(config?: OllamaConfigType);
|
|
254
266
|
protected createRunAdapter(config?: OllamaConfigType);
|
|
255
267
|
}
|
|
268
|
+
import { AppEnv as AppEnv5 } from "@ooneex/app-env";
|
|
256
269
|
import { ImageGenerationResult as ImageGenerationResult3, TranscriptionResult as TranscriptionResult2, TTSResult as TTSResult4 } from "@tanstack/ai";
|
|
257
270
|
declare class OpenAi extends BaseAi<OpenAiConfigType> {
|
|
271
|
+
private readonly env;
|
|
272
|
+
constructor(env: AppEnv5);
|
|
258
273
|
private getApiKey;
|
|
259
274
|
protected createChatAdapter(config?: OpenAiConfigType);
|
|
260
275
|
protected createRunAdapter(config?: OpenAiConfigType);
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
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
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
|
|
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}
|
|
5
5
|
|
|
6
6
|
Text to process:
|
|
7
|
-
${T}`},R=[...
|
|
8
|
-
`),H),
|
|
9
|
-
`),H),R=(await this.executeChat(T,
|
|
10
|
-
`),H),
|
|
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:{type:T.type,value:T.value}}]},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+=`
|
|
11
11
|
|
|
12
|
-
Output Type: ${
|
|
12
|
+
Output Type: ${A}`}let Y=this.buildPrompt(N,C),_=C?.messages?this.toMessages(C.messages):[],R={role:"user",content:`${Y}
|
|
13
13
|
|
|
14
14
|
Request:
|
|
15
|
-
${T}`},
|
|
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}
|
|
16
16
|
|
|
17
17
|
Request:
|
|
18
|
-
${T}`},
|
|
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};
|
|
19
19
|
|
|
20
|
-
//# debugId=
|
|
20
|
+
//# debugId=EE4593273440F29764756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"sources": ["src/AiException.ts", "src/AnthropicAi.ts", "src/BaseAi.ts", "src/decorators.ts", "src/GeminiAi.ts", "src/GroqAi.ts", "src/OllamaAi.ts", "src/OpenAi.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import { Exception } from \"@ooneex/exception\";\nimport { HttpStatus } from \"@ooneex/http-status\";\n\nexport class AiException extends Exception {\n constructor(message: string, data: Record<string, unknown> = {}) {\n super(message, {\n status: HttpStatus.Code.InternalServerError,\n data,\n });\n this.name = \"AiException\";\n }\n}\n",
|
|
6
|
-
"import { createAnthropicChat } from \"@tanstack/ai-anthropic\";\nimport { AiException } from \"./AiException\";\nimport { BaseAi } from \"./BaseAi\";\nimport { decorator } from \"./decorators\";\nimport type { AnthropicConfigType, AnthropicModelType } from \"./types\";\n\n@decorator.ai()\nexport class AnthropicAi extends BaseAi<AnthropicConfigType> {\n private getApiKey(config?: AnthropicConfigType): string {\n const apiKey = config?.apiKey ||
|
|
6
|
+
"import { AppEnv } from \"@ooneex/app-env\";\nimport { inject } from \"@ooneex/container\";\nimport { createAnthropicChat } from \"@tanstack/ai-anthropic\";\nimport { AiException } from \"./AiException\";\nimport { BaseAi } from \"./BaseAi\";\nimport { decorator } from \"./decorators\";\nimport type { AnthropicConfigType, AnthropicModelType } from \"./types\";\n\n@decorator.ai()\nexport class AnthropicAi extends BaseAi<AnthropicConfigType> {\n constructor(@inject(AppEnv) private readonly env: AppEnv) {\n super();\n }\n\n private getApiKey(config?: AnthropicConfigType): string {\n const apiKey = config?.apiKey || this.env.ANTHROPIC_API_KEY;\n\n if (!apiKey) {\n throw new AiException(\n \"Anthropic API key is required. Provide an API key through config options or set the ANTHROPIC_API_KEY environment variable.\",\n );\n }\n\n return apiKey;\n }\n\n protected createChatAdapter(config?: AnthropicConfigType) {\n const apiKey = this.getApiKey(config);\n const model = (config?.model ?? \"claude-sonnet-4-5\") as AnthropicModelType;\n return createAnthropicChat(model, apiKey);\n }\n\n protected createRunAdapter(config?: AnthropicConfigType) {\n return this.createChatAdapter(config);\n }\n}\n",
|
|
7
7
|
"import { jsonSchemaToTypeString } from \"@ooneex/validation\";\nimport { chat, type ModelMessage } from \"@tanstack/ai\";\nimport { type } from \"arktype\";\nimport { AiException } from \"./AiException\";\nimport type {\n AiConfigType,\n AiImageSourceType,\n AiMessageType,\n AiToneType,\n GenerateCaseQuestionOptionsType,\n GenerateCaseQuestionResultType,\n GenerateFlashcardOptionsType,\n GenerateFlashcardResultType,\n GenerateQuestionOptionsType,\n GenerateQuestionResultType,\n IAiChat,\n} from \"./types\";\n\nexport abstract class BaseAi<TConfig extends AiConfigType> implements IAiChat<TConfig> {\n // biome-ignore lint/suspicious/noExplicitAny: adapter type varies by provider\n protected abstract createChatAdapter(config?: TConfig): any;\n // biome-ignore lint/suspicious/noExplicitAny: adapter type varies by provider\n protected abstract createRunAdapter(config?: TConfig): any;\n\n protected buildPrompt(instruction: string, config?: TConfig): string {\n const parts: string[] = [config?.prompt || instruction];\n\n if (config?.context) {\n parts.push(`Context:\\n${config.context}`);\n }\n\n if (config?.wordCount) {\n parts.push(`Target approximately ${config.wordCount} words.`);\n }\n\n if (config?.tone) {\n parts.push(`Use a ${config.tone} tone.`);\n }\n\n if (config?.language) {\n parts.push(`Respond in ${config.language} language.`);\n }\n\n parts.push(\n `${config?.context ? \"Use the provided context to inform your response. \" : \"\"}Respond with only the transformed text. Do not include explanations or additional commentary.`,\n );\n\n return parts.join(\"\\n\");\n }\n\n protected toMessages(messages: AiMessageType[]): ModelMessage[] {\n return messages.map((msg) => ({ role: msg.role as \"user\" | \"assistant\" | \"tool\", content: msg.content }));\n }\n\n protected async executeChat(content: string, systemPrompt: string, config?: TConfig): Promise<string> {\n const adapter = this.createChatAdapter(config);\n\n const baseMessages: ModelMessage[] = config?.messages ? this.toMessages(config.messages) : [];\n const userMessage: ModelMessage = { role: \"user\", content: `${systemPrompt}\\n\\nText to process:\\n${content}` };\n\n const messages = [...baseMessages, userMessage];\n const result = await chat({\n adapter,\n messages: messages as unknown as NonNullable<\n Parameters<typeof chat<typeof adapter, undefined, false>>[0][\"messages\"]\n >,\n stream: false,\n });\n\n return result.trim();\n }\n\n public async makeShorter(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Condense the following text while preserving its core meaning and key information. Remove redundancies and unnecessary details.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async makeLonger(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Expand the following text by adding relevant details, examples, and explanations while maintaining coherence and the original message.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async summarize(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Provide a clear and comprehensive summary of the following text, capturing all essential points and main ideas.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async concise(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Rewrite the following text in the most concise form possible without losing essential meaning.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async paragraph(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Transform the following text into well-structured paragraph format with clear topic sentences and logical flow.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async bulletPoints(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Convert the following text into a clear, organized list of bullet points highlighting the key information.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async rephrase(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Rephrase the following text using different words and sentence structures while preserving the original meaning.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async simplify(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Simplify the following text by using plain language, shorter sentences, and avoiding jargon. Make it accessible to a general audience.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async changeTone(\n content: string,\n tone: AiToneType,\n config?: Omit<TConfig, \"tone\" | \"output\">,\n ): Promise<string> {\n const prompt = this.buildPrompt(\n `Rewrite the following text in a ${tone} tone while maintaining clarity.`,\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async proofread(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Proofread and correct the following text for grammar, spelling, punctuation, and clarity issues. Return the corrected version.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async translate(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const targetLanguage = config?.language ?? \"en\";\n const prompt = this.buildPrompt(\n `Translate the following text accurately into ${targetLanguage}, preserving the original meaning, tone, and nuance.`,\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async explain(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Provide a clear explanation of the following text, breaking down complex concepts and clarifying the meaning.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async expandIdeas(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Expand on the ideas presented in the following text by exploring related concepts, implications, and additional perspectives.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async fixGrammar(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Fix all grammatical errors in the following text, including subject-verb agreement, tense consistency, and sentence structure.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async generateTitle(content: string, config?: Omit<TConfig, \"output\">): Promise<string> {\n const prompt = this.buildPrompt(\n \"Generate a compelling, descriptive title for the following text that captures its main theme and engages readers.\",\n config as TConfig,\n );\n return this.executeChat(content, prompt, config as TConfig);\n }\n\n public async extractKeywords(content: string, config?: Omit<TConfig, \"output\">): Promise<string[]> {\n const count = config?.count;\n const countInstruction = count ? ` Return exactly ${count} keywords.` : \"\";\n const prompt = this.buildPrompt(\n `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}`,\n config as TConfig,\n );\n\n const result = await this.executeChat(content, prompt, config as TConfig);\n\n const items = result\n .split(\",\")\n .map((keyword) => keyword.trim())\n .filter((keyword) => keyword.length > 0);\n\n return count ? items.slice(0, count) : items;\n }\n\n public async extractCategories(content: string, config?: Omit<TConfig, \"output\">): Promise<string[]> {\n const count = config?.count;\n const countInstruction = count ? ` Return exactly ${count} categories.` : \"\";\n const prompt = this.buildPrompt(\n `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}`,\n config as TConfig,\n );\n\n const result = await this.executeChat(content, prompt, config as TConfig);\n\n const items = result\n .split(\",\")\n .map((category) => category.trim())\n .filter((category) => category.length > 0);\n\n return count ? items.slice(0, count) : items;\n }\n\n public async extractTopics(content: string, config?: Omit<TConfig, \"output\">): Promise<string[]> {\n const count = config?.count;\n const countInstruction = count ? ` Return at most ${count} topics.` : \"\";\n const prompt = this.buildPrompt(\n `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}`,\n config as TConfig,\n );\n\n const result = await this.executeChat(content, prompt, config as TConfig);\n\n const items = result\n .split(\",\")\n .map((topic) => topic.trim())\n .filter((topic) => topic.length > 0);\n\n return count ? items.slice(0, count) : items;\n }\n\n public async generateCaseQuestion(\n subject: string,\n options?: GenerateCaseQuestionOptionsType,\n config?: TConfig,\n ): Promise<GenerateCaseQuestionResultType> {\n const questionCount = options?.questionCount ?? 3;\n const choiceCount = options?.choiceCount;\n const difficulty = Math.min(100, Math.max(1, options?.difficulty ?? 50));\n\n const choiceInstructions = choiceCount\n ? [\n `Each question must have exactly ${choiceCount} choices.`,\n \"Exactly 1 of the choices must be correct.\",\n \"For each choice (both correct and wrong), provide an explanation in approximately 50 words.\",\n ]\n : [];\n\n const jsonFormat = choiceCount\n ? `{\"title\":\"...\",\"presentation\":\"...\",\"questions\":[{\"text\":\"...\",\"answer\":\"...\",\"explanation\":\"...\",\"choices\":[{\"text\":\"...\",\"isCorrect\":true/false,\"explanation\":\"...\"},...]},...]}`\n : `{\"title\":\"...\",\"presentation\":\"...\",\"questions\":[{\"text\":\"...\",\"answer\":\"...\",\"explanation\":\"...\"},...]}`;\n\n const prompt = this.buildPrompt(\n [\n \"Generate a clinical case study with questions about the following subject.\",\n `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.`,\n ...(options?.similarCase\n ? [\n `Generate a case similar in style and topic to: \"${options.similarCase}\". The new case must be different but cover a closely related clinical scenario.`,\n ]\n : []),\n \"Create a detailed clinical presentation with patient demographics, symptoms, history, and relevant findings.\",\n `Generate exactly ${questionCount} questions about the case, numbered sequentially.`,\n \"Each question must have a direct answer and a detailed explanation.\",\n ...choiceInstructions,\n \"Respond ONLY with valid JSON in this exact format:\",\n jsonFormat,\n ].join(\"\\n\"),\n config,\n );\n\n const result = await this.executeChat(subject, prompt, config);\n\n const cleaned = result.replace(/```json\\n?|\\n?```/g, \"\").trim();\n const parsed = JSON.parse(cleaned) as GenerateCaseQuestionResultType;\n\n return parsed;\n }\n\n public async generateFlashcard(\n subject: string,\n options?: GenerateFlashcardOptionsType,\n config?: TConfig,\n ): Promise<GenerateFlashcardResultType> {\n const difficulty = Math.min(100, Math.max(1, options?.difficulty ?? 50));\n\n const prompt = this.buildPrompt(\n [\n \"Generate a flashcard about the following subject.\",\n `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.`,\n ...(options?.similarFlashcard\n ? [\n `Generate a flashcard similar in style and topic to: \"${options.similarFlashcard}\". The new flashcard must be different but cover a closely related concept.`,\n ]\n : []),\n \"The front should be a clear, concise question or prompt.\",\n \"The back should be a direct answer.\",\n \"The explanation should provide additional context in approximately 50 words.\",\n \"Respond ONLY with valid JSON in this exact format:\",\n `{\"front\":\"...\",\"back\":\"...\",\"explanation\":\"...\"}`,\n ].join(\"\\n\"),\n config,\n );\n\n const result = await this.executeChat(subject, prompt, config);\n\n const cleaned = result.replace(/```json\\n?|\\n?```/g, \"\").trim();\n const parsed = JSON.parse(cleaned) as GenerateFlashcardResultType;\n\n return parsed;\n }\n\n public async generateQuestion(\n subject: string,\n options?: GenerateQuestionOptionsType,\n config?: TConfig,\n ): Promise<GenerateQuestionResultType> {\n const choiceCount = options?.choiceCount ?? 5;\n const correctChoiceCount = options?.correctChoiceCount ?? 1;\n const difficulty = Math.min(100, Math.max(1, options?.difficulty ?? 50));\n\n const prompt = this.buildPrompt(\n [\n \"Generate a multiple-choice question (MCQ) about the following subject.\",\n `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.`,\n `The question must have exactly ${choiceCount} choices.`,\n `Exactly ${correctChoiceCount} of the choices must be correct.`,\n ...(options?.similarQuestion\n ? [\n `Generate a question similar in style and topic to: \"${options.similarQuestion}\". The new question must be different but cover a closely related concept.`,\n ]\n : []),\n \"For each choice (both correct and wrong), provide an explanation in approximately 50 words.\",\n \"Respond ONLY with valid JSON in this exact format:\",\n `{\"question\":\"...\",\"choices\":[{\"text\":\"...\",\"isCorrect\":true/false,\"explanation\":\"...\"},...]}`,\n ].join(\"\\n\"),\n config,\n );\n\n const result = await this.executeChat(subject, prompt, config);\n\n const cleaned = result.replace(/```json\\n?|\\n?```/g, \"\").trim();\n const parsed = JSON.parse(cleaned) as GenerateQuestionResultType;\n\n return parsed;\n }\n\n public async imageToMarkdown(source: AiImageSourceType, config?: Omit<TConfig, \"output\">): Promise<string> {\n const adapter = this.createChatAdapter(config as TConfig);\n\n const systemPrompt = this.buildPrompt(\n \"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.\",\n config as TConfig,\n );\n\n const baseMessages: ModelMessage[] = config?.messages ? this.toMessages(config.messages) : [];\n const userMessage: ModelMessage = {\n role: \"user\",\n content: [\n { type: \"text\", content: systemPrompt },\n { type: \"image\", source: { type: source.type, value: source.value } },\n ],\n };\n\n const messages = [...baseMessages, userMessage];\n const result = await chat({\n adapter,\n messages: messages as unknown as NonNullable<\n Parameters<typeof chat<typeof adapter, undefined, false>>[0][\"messages\"]\n >,\n stream: false,\n });\n\n return result.trim();\n }\n\n public async run<T>(prompt: string, config?: Omit<TConfig, \"prompt\">): Promise<T> {\n const adapter = this.createRunAdapter(config as TConfig);\n\n let defaultPrompt =\n \"Process the following request and respond appropriately. If the request asks for structured data, return valid JSON.\";\n\n if (config?.output) {\n const schema = config.output.toJsonSchema();\n const outputType = jsonSchemaToTypeString(schema);\n defaultPrompt += `\\n\\nOutput Type: ${outputType}`;\n }\n\n const systemPrompt = this.buildPrompt(defaultPrompt, config as TConfig);\n\n const baseMessages = config?.messages ? this.toMessages(config.messages) : [];\n const userMessage: ModelMessage = { role: \"user\", content: `${systemPrompt}\\n\\nRequest:\\n${prompt}` };\n\n const messages = [...baseMessages, userMessage];\n const result = await chat({\n adapter,\n messages: messages as unknown as NonNullable<\n Parameters<typeof chat<typeof adapter, undefined, false>>[0][\"messages\"]\n >,\n stream: false,\n });\n\n const trimmed = result.trim();\n\n let parsed: T;\n try {\n const cleaned = trimmed.replace(/```json\\n?|\\n?```/g, \"\").trim();\n parsed = JSON.parse(cleaned) as T;\n } catch {\n parsed = trimmed as T;\n }\n\n if (config?.output) {\n const validation = config.output(parsed);\n if (validation instanceof type.errors) {\n throw new AiException(`Output validation failed: ${validation.summary}`);\n }\n }\n\n return parsed;\n }\n\n public async *runStream(\n prompt: string,\n config?: Omit<TConfig, \"prompt\" | \"output\">,\n ): AsyncGenerator<string, void, unknown> {\n const adapter = this.createRunAdapter(config as TConfig);\n\n const defaultPrompt = \"Process the following request and respond appropriately.\";\n const systemPrompt = this.buildPrompt(defaultPrompt, config as TConfig);\n\n const baseMessages: ModelMessage[] = config?.messages ? this.toMessages(config.messages) : [];\n const userMessage: ModelMessage = { role: \"user\", content: `${systemPrompt}\\n\\nRequest:\\n${prompt}` };\n\n const messages = [...baseMessages, userMessage];\n const stream = chat({\n adapter,\n messages: messages as unknown as NonNullable<\n Parameters<typeof chat<typeof adapter, undefined, true>>[0][\"messages\"]\n >,\n stream: true,\n });\n\n for await (const chunk of stream) {\n if (chunk.type === \"content\") {\n yield chunk.content;\n }\n }\n }\n}\n",
|
|
8
8
|
"import { container, EContainerScope } from \"@ooneex/container\";\nimport type { AiClassType } from \"./types\";\n\nexport const decorator = {\n ai: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: AiClassType): void => {\n container.add(target, scope);\n };\n },\n};\n",
|
|
9
|
-
"import type { ImageGenerationResult, TTSResult } from \"@tanstack/ai\";\nimport { generateImage, generateSpeech } from \"@tanstack/ai\";\nimport { createGeminiChat, createGeminiImage, createGeminiSpeech } from \"@tanstack/ai-gemini\";\nimport { AiException } from \"./AiException\";\nimport { BaseAi } from \"./BaseAi\";\nimport { decorator } from \"./decorators\";\nimport type {\n GeminiConfigType,\n GeminiGenerateImageOptionsType,\n GeminiModelType,\n GeminiTextToSpeechOptionsType,\n} from \"./types\";\n\n@decorator.ai()\nexport class GeminiAi extends BaseAi<GeminiConfigType> {\n private getApiKey(config?: { apiKey?: string }): string {\n const apiKey = config?.apiKey ||
|
|
10
|
-
"import type { TTSResult } from \"@tanstack/ai\";\nimport { createGroqText } from \"@tanstack/ai-groq\";\nimport { AiException } from \"./AiException\";\nimport { BaseAi } from \"./BaseAi\";\nimport { decorator } from \"./decorators\";\nimport type { GroqConfigType, GroqModelType, GroqTextToSpeechOptionsType } from \"./types\";\n\n@decorator.ai()\nexport class GroqAi extends BaseAi<GroqConfigType> {\n private getApiKey(config?: { apiKey?: string }): string {\n const apiKey = config?.apiKey ||
|
|
11
|
-
"import { 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 private getHost(config?: OllamaConfigType): string {\n return config?.host ||
|
|
12
|
-
"import 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 private getApiKey(config?: { apiKey?: string }): string {\n const apiKey = config?.apiKey ||
|
|
9
|
+
"import { AppEnv } from \"@ooneex/app-env\";\nimport { inject } from \"@ooneex/container\";\nimport type { ImageGenerationResult, TTSResult } from \"@tanstack/ai\";\nimport { generateImage, generateSpeech } from \"@tanstack/ai\";\nimport { createGeminiChat, createGeminiImage, createGeminiSpeech } from \"@tanstack/ai-gemini\";\nimport { AiException } from \"./AiException\";\nimport { BaseAi } from \"./BaseAi\";\nimport { decorator } from \"./decorators\";\nimport type {\n GeminiConfigType,\n GeminiGenerateImageOptionsType,\n GeminiModelType,\n GeminiTextToSpeechOptionsType,\n} from \"./types\";\n\n@decorator.ai()\nexport class GeminiAi extends BaseAi<GeminiConfigType> {\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.GEMINI_API_KEY;\n\n if (!apiKey) {\n throw new AiException(\n \"Gemini API key is required. Provide an API key through config options or set the GEMINI_API_KEY environment variable.\",\n );\n }\n\n return apiKey;\n }\n\n protected createChatAdapter(config?: GeminiConfigType) {\n const apiKey = this.getApiKey(config);\n const model: GeminiModelType = config?.model ?? \"gemini-2.0-flash\";\n return createGeminiChat(model, apiKey);\n }\n\n protected createRunAdapter(config?: GeminiConfigType) {\n const apiKey = this.getApiKey(config);\n const model: GeminiModelType = config?.model ?? \"gemini-2.5-pro\";\n return createGeminiChat(model, apiKey);\n }\n\n public async textToSpeech(text: string, options?: GeminiTextToSpeechOptionsType): Promise<TTSResult> {\n const apiKey = this.getApiKey(options);\n const model = options?.model ?? \"gemini-2.5-flash-preview-tts\";\n const adapter = createGeminiSpeech(model, apiKey);\n\n const modelOptions: Record<string, unknown> = {};\n\n if (options?.voice) {\n modelOptions.voiceConfig = {\n prebuiltVoiceConfig: {\n voiceName: options.voice,\n },\n };\n }\n\n if (options?.instructions) {\n modelOptions.systemInstruction = options.instructions;\n }\n\n if (options?.language) {\n modelOptions.languageCode = options.language;\n }\n\n // biome-ignore lint/suspicious/noExplicitAny: exactOptionalPropertyTypes requires careful handling\n const speechOptions: Record<string, any> = { adapter, text };\n\n if (options?.format) {\n speechOptions.format = options.format;\n }\n\n if (options?.speed) {\n speechOptions.speed = options.speed;\n }\n\n if (Object.keys(modelOptions).length > 0) {\n speechOptions.modelOptions = modelOptions;\n }\n\n return generateSpeech(speechOptions as Parameters<typeof generateSpeech>[0]);\n }\n\n public async generateImage(prompt: string, options?: GeminiGenerateImageOptionsType): Promise<ImageGenerationResult> {\n const apiKey = this.getApiKey(options);\n const model = options?.model ?? \"imagen-4.0-generate-001\";\n const adapter = createGeminiImage(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?.aspectRatio) {\n modelOptions.aspectRatio = options.aspectRatio;\n }\n if (options?.personGeneration) {\n modelOptions.personGeneration = options.personGeneration;\n }\n if (options?.negativePrompt) {\n modelOptions.negativePrompt = options.negativePrompt;\n }\n if (options?.addWatermark !== undefined) {\n modelOptions.addWatermark = options.addWatermark;\n }\n if (options?.outputMimeType) {\n modelOptions.outputMimeType = options.outputMimeType;\n }\n if (Object.keys(modelOptions).length > 0) {\n imageOptions.modelOptions = modelOptions;\n }\n\n return generateImage(imageOptions as Parameters<typeof generateImage>[0]);\n }\n}\n",
|
|
10
|
+
"import { AppEnv } from \"@ooneex/app-env\";\nimport { inject } from \"@ooneex/container\";\nimport type { TTSResult } from \"@tanstack/ai\";\nimport { createGroqText } from \"@tanstack/ai-groq\";\nimport { AiException } from \"./AiException\";\nimport { BaseAi } from \"./BaseAi\";\nimport { decorator } from \"./decorators\";\nimport type { GroqConfigType, GroqModelType, GroqTextToSpeechOptionsType } from \"./types\";\n\n@decorator.ai()\nexport class GroqAi extends BaseAi<GroqConfigType> {\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.GROQ_API_KEY;\n\n if (!apiKey) {\n throw new AiException(\n \"Groq API key is required. Provide an API key through config options or set the GROQ_API_KEY environment variable.\",\n );\n }\n\n return apiKey;\n }\n\n protected createChatAdapter(config?: GroqConfigType) {\n const apiKey = this.getApiKey(config);\n const model = (config?.model ?? \"llama-3.3-70b-versatile\") as GroqModelType;\n return createGroqText(model, apiKey);\n }\n\n protected createRunAdapter(config?: GroqConfigType) {\n return this.createChatAdapter(config);\n }\n\n public async textToSpeech(text: string, options?: GroqTextToSpeechOptionsType): Promise<TTSResult> {\n const apiKey = this.getApiKey(options);\n const model = options?.model ?? \"canopylabs/orpheus-v1-english\";\n const voice = options?.voice ?? \"autumn\";\n const format = options?.format ?? \"wav\";\n\n // biome-ignore lint/suspicious/noExplicitAny: exactOptionalPropertyTypes requires careful handling\n const body: Record<string, any> = {\n model,\n input: text,\n voice,\n response_format: format,\n };\n\n if (options?.sampleRate) {\n body.sample_rate = options.sampleRate;\n }\n\n const response = await fetch(\"https://api.groq.com/openai/v1/audio/speech\", {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new AiException(`Groq TTS request failed (${response.status}): ${error}`);\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const audio = Buffer.from(arrayBuffer).toString(\"base64\");\n\n return {\n id: response.headers.get(\"x-request-id\") ?? crypto.randomUUID(),\n model,\n audio,\n format,\n };\n }\n}\n",
|
|
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
|
+
"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]);\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(transcriptionOptions as Parameters<typeof generateTranscription>[0]);\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]);\n }\n}\n"
|
|
13
13
|
],
|
|
14
|
-
"mappings": ";0UAAA,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,8BAAS,+BCAT,iCAAS,2BACT,eAAS,qBACT,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,KA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,KACX,EAAa,KAAO,EAAQ,KAG9B,IAAM,EAAwC,CAAC,EAC/C,GAAI,GAAS,QACX,EAAa,QAAU,EAAQ,QAEjC,GAAI,GAAS,WACX,EAAa,WAAa,EAAQ,WAEpC,GAAI,GAAS,aACX,EAAa,cAAgB,EAAQ,aAEvC,GAAI,GAAS,WACX,EAAa,WAAa,EAAQ,WAEpC,GAAI,GAAS,MACX,EAAa,MAAQ,EAAQ,MAE/B,GAAI,OAAO,KAAK,CAAY,EAAE,OAAS,EACrC,EAAa,aAAe,EAG9B,OAAO,EAAc,CAAmD,EAE5E,CA5Ha,EAAN,GADN,EAAU,GAAG,EAEC,MAAO,CAAM,GADrB,0DAAM",
|
|
15
|
+
"debugId": "EE4593273440F29764756E2164756E21",
|
|
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.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -28,19 +28,20 @@
|
|
|
28
28
|
"test": "bun test tests"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ooneex/
|
|
32
|
-
"@ooneex/
|
|
33
|
-
"@ooneex/
|
|
34
|
-
"@ooneex/
|
|
31
|
+
"@ooneex/app-env": "1.1.0",
|
|
32
|
+
"@ooneex/container": "1.1.0",
|
|
33
|
+
"@ooneex/exception": "1.1.0",
|
|
34
|
+
"@ooneex/http-status": "1.1.0",
|
|
35
|
+
"@ooneex/validation": "1.1.0",
|
|
35
36
|
"@tanstack/ai": "^0.2.0",
|
|
36
37
|
"@tanstack/ai-anthropic": "^0.2.0",
|
|
37
38
|
"@tanstack/ai-gemini": "^0.2.0",
|
|
38
39
|
"@tanstack/ai-groq": "^0.1.2",
|
|
39
40
|
"@tanstack/ai-ollama": "^0.2.0",
|
|
40
|
-
"@tanstack/ai-openai": "^0.
|
|
41
|
+
"@tanstack/ai-openai": "^0.7.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@ooneex/translation": "1.0
|
|
44
|
+
"@ooneex/translation": "1.1.0"
|
|
44
45
|
},
|
|
45
46
|
"keywords": [
|
|
46
47
|
"ai",
|