llm-interface
Advanced tools
Comparing version 2.0.143 to 2.0.144
{ | ||
"name": "llm-interface", | ||
"version": "2.0.143", | ||
"version": "2.0.144", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "description": "A simple, unified NPM-based interface for interacting with multiple Large Language Model (LLM) APIs, including OpenAI, AI21 Studio, Anthropic, Cloudflare AI, Cohere, Fireworks AI, Google Gemini, Goose AI, Groq, Hugging Face, Mistral AI, Perplexity, Reka AI, watsonx.ai, and LLaMA.cpp.", |
@@ -5,3 +5,3 @@ # llm-interface | ||
![Version 2.0.142](https://img.shields.io/badge/Version-2.0.142-blue) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Built with Node.js](https://img.shields.io/badge/Built%20with-Node.js-green)](https://nodejs.org/) | ||
![Version 2.0.144](https://img.shields.io/badge/Version-2.0.144-blue) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Built with Node.js](https://img.shields.io/badge/Built%20with-Node.js-green)](https://nodejs.org/) | ||
@@ -40,2 +40,6 @@ ## Introduction | ||
**v2.0.14** | ||
- **Recovery Mode (Beta)**: Automatically repair invalid JSON objects in response errors. Currently, this feature is only available with Groq. | ||
**v2.0.11** | ||
@@ -42,0 +46,0 @@ |
@@ -11,3 +11,3 @@ /** | ||
const { getConfig, loadProviderConfig } = require('../utils/configManager.js'); | ||
const log = require('loglevel'); | ||
const interfaceName = 'groq'; | ||
@@ -26,3 +26,5 @@ | ||
if (error.response?.data?.error?.failed_generation) { | ||
return decodeURIComponent(error.response?.data?.error?.failed_generation); | ||
return this.unescapeString( | ||
error.response?.data?.error?.failed_generation, | ||
); | ||
} | ||
@@ -32,4 +34,21 @@ | ||
} | ||
/** | ||
* Unescapes common escape sequences in a string. | ||
* @param {string} str - The string with escape sequences. | ||
* @returns {string} - The unescaped string. | ||
*/ | ||
unescapeString(str) { | ||
return str | ||
.replace(/\\n/g, '\n') | ||
.replace(/\\t/g, '\t') | ||
.replace(/\\r/g, '\r') | ||
.replace(/\\f/g, '\f') | ||
.replace(/\\b/g, '\b') | ||
.replace(/\\v/g, '\v') | ||
.replace(/\\'/g, "'") | ||
.replace(/\\"/g, '"') | ||
.replace(/\\\\/g, '\\'); | ||
} | ||
} | ||
module.exports = Groq; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
182675
4299
188