@lynxflow/seo-engine 1.8.14 → 1.8.15

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
@@ -8512,7 +8512,7 @@ class LynxRateLimitedTranslator2 {
8512
8512
  const apiKey = config.apiKey || process.env.GOOGLE_TRANSLATE_API_KEY;
8513
8513
  let translatedChunks = [];
8514
8514
  if (config.runpodEndpointId && config.runpodApiKey) {
8515
- translatedChunks = await this.callRunPodVllmServerless(textsToTranslate, targetLang, sourceLang, config.runpodEndpointId, config.runpodApiKey);
8515
+ translatedChunks = await this.callRunPodVllmServerless(textsToTranslate, targetLang, sourceLang, config.runpodEndpointId, config.runpodApiKey, config.vllmModel);
8516
8516
  } else if (config.huggingFaceEndpoint && config.huggingFaceApiKey) {
8517
8517
  translatedChunks = await this.callHuggingFaceInferenceEndpoint(textsToTranslate, targetLang, sourceLang, config.huggingFaceEndpoint, config.huggingFaceApiKey);
8518
8518
  } else if (apiKey) {
@@ -8529,10 +8529,10 @@ class LynxRateLimitedTranslator2 {
8529
8529
  });
8530
8530
  return results;
8531
8531
  }
8532
- static async callRunPodVllmServerless(contents, target, source, endpointId, apiKey) {
8532
+ static async callRunPodVllmServerless(contents, target, source, endpointId, apiKey, vllmModel = "Qwen/Qwen2.5-7B-Instruct") {
8533
8533
  const url = `https://api.runpod.ai/v2/${endpointId}/openai/v1/chat/completions`;
8534
8534
  try {
8535
- const prompt = `Translate the following JSON array of sentences from ${source} to ${target}. Return ONLY the JSON array of translated strings with no explanations: ${JSON.stringify(contents)}`;
8535
+ const prompt = `You are a professional multilingual SEO transcreator. Translate the following JSON array of sentences from ${source} to ${target}. Preserve all technical terms, brand names, and placeholders. Return ONLY the valid JSON array of translated strings with no explanations: ${JSON.stringify(contents)}`;
8536
8536
  const response = await fetch(url, {
8537
8537
  method: "POST",
8538
8538
  headers: {
@@ -8540,7 +8540,7 @@ class LynxRateLimitedTranslator2 {
8540
8540
  Authorization: `Bearer ${apiKey}`
8541
8541
  },
8542
8542
  body: JSON.stringify({
8543
- model: "facebook/nllb-200-3.3B",
8543
+ model: vllmModel,
8544
8544
  messages: [{ role: "user", content: prompt }],
8545
8545
  temperature: 0.1
8546
8546
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynxflow/seo-engine",
3
- "version": "1.8.14",
3
+ "version": "1.8.15",
4
4
  "description": "High-Performance Multilingual Programmatic SEO & AI Search Engine SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,6 +20,7 @@ export interface GoogleTranslateConfig {
20
20
  runpodApiKey?: string;
21
21
  huggingFaceEndpoint?: string;
22
22
  huggingFaceApiKey?: string;
23
+ vllmModel?: string; // Default: "Qwen/Qwen2.5-7B-Instruct" | "deepseek-ai/DeepSeek-V3" | "Qwen/Qwen2.5-14B-Instruct"
23
24
  }
24
25
 
25
26
  export interface BatchTranslationResult {
@@ -68,7 +69,7 @@ export class LynxRateLimitedTranslator {
68
69
 
69
70
  // 2. Routing logic based on config
70
71
  if (config.runpodEndpointId && config.runpodApiKey) {
71
- translatedChunks = await this.callRunPodVllmServerless(textsToTranslate, targetLang, sourceLang, config.runpodEndpointId, config.runpodApiKey);
72
+ translatedChunks = await this.callRunPodVllmServerless(textsToTranslate, targetLang, sourceLang, config.runpodEndpointId, config.runpodApiKey, config.vllmModel);
72
73
  } else if (config.huggingFaceEndpoint && config.huggingFaceApiKey) {
73
74
  translatedChunks = await this.callHuggingFaceInferenceEndpoint(textsToTranslate, targetLang, sourceLang, config.huggingFaceEndpoint, config.huggingFaceApiKey);
74
75
  } else if (apiKey) {
@@ -100,12 +101,13 @@ export class LynxRateLimitedTranslator {
100
101
  target: string,
101
102
  source: string,
102
103
  endpointId: string,
103
- apiKey: string
104
+ apiKey: string,
105
+ vllmModel = "Qwen/Qwen2.5-7B-Instruct"
104
106
  ): Promise<string[]> {
105
107
  const url = `https://api.runpod.ai/v2/${endpointId}/openai/v1/chat/completions`;
106
108
 
107
109
  try {
108
- const prompt = `Translate the following JSON array of sentences from ${source} to ${target}. Return ONLY the JSON array of translated strings with no explanations: ${JSON.stringify(contents)}`;
110
+ const prompt = `You are a professional multilingual SEO transcreator. Translate the following JSON array of sentences from ${source} to ${target}. Preserve all technical terms, brand names, and placeholders. Return ONLY the valid JSON array of translated strings with no explanations: ${JSON.stringify(contents)}`;
109
111
 
110
112
  const response = await fetch(url, {
111
113
  method: "POST",
@@ -114,7 +116,7 @@ export class LynxRateLimitedTranslator {
114
116
  Authorization: `Bearer ${apiKey}`,
115
117
  },
116
118
  body: JSON.stringify({
117
- model: "facebook/nllb-200-3.3B",
119
+ model: vllmModel,
118
120
  messages: [{ role: "user", content: prompt }],
119
121
  temperature: 0.1,
120
122
  }),