unified-ai-router 3.3.5 → 3.3.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/main.js CHANGED
@@ -50,22 +50,29 @@ class AIRouter
50
50
  {
51
51
  for await ( const chunk of responseStream )
52
52
  {
53
- const content = chunk.choices[0]?.delta?.content;
54
- const reasoning = chunk.choices[0]?.delta?.reasoning;
55
- const tool_calls_delta = chunk.choices[0]?.delta?.tool_calls;
56
- if ( content !== null )
53
+ try
57
54
  {
58
- chunk.content = content
55
+ const content = chunk.choices[0]?.delta?.content;
56
+ const reasoning = chunk.choices[0]?.delta?.reasoning;
57
+ const tool_calls_delta = chunk.choices[0]?.delta?.tool_calls;
58
+ if ( content !== null )
59
+ {
60
+ chunk.content = content
61
+ }
62
+ if ( reasoning !== null )
63
+ {
64
+ chunk.reasoning = reasoning
65
+ }
66
+ if ( tool_calls_delta !== null )
67
+ {
68
+ chunk.tool_calls_delta = tool_calls_delta;
69
+ }
70
+ yield chunk;
59
71
  }
60
- if ( reasoning !== null )
72
+ catch ( error )
61
73
  {
62
- chunk.reasoning = reasoning
74
+ console.log( error );
63
75
  }
64
- if ( tool_calls_delta !== null )
65
- {
66
- chunk.tool_calls_delta = tool_calls_delta;
67
- }
68
- yield chunk;
69
76
  }
70
77
  })();
71
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unified-ai-router",
3
- "version": "3.3.5",
3
+ "version": "3.3.6",
4
4
  "description": "A unified interface for multiple LLM providers with automatic fallback. This project includes an OpenAI-compatible server and a deployable Telegram bot with a Mini App interface. It supports major providers like OpenAI, Google, Grok, and more, ensuring reliability and flexibility for your AI applications.",
5
5
  "license": "ISC",
6
6
  "author": "mlibre",
package/provider.js CHANGED
@@ -17,7 +17,6 @@ module.exports = [
17
17
  model: "gpt-oss-120b",
18
18
  apiUrl: "https://api.cerebras.ai/v1",
19
19
  },
20
-
21
20
  {
22
21
  name: "cerebras",
23
22
  apiKey: process.env.CEREBRAS_API_KEY,
package/tests/chat.js CHANGED
@@ -20,7 +20,7 @@ async function getResponse ()
20
20
 
21
21
  for await ( const chunk of stream )
22
22
  {
23
- process.stdout.write( chunk.reasoning || chunk.content );
23
+ console.log( chunk.reasoning || chunk.content );
24
24
  }
25
25
  }
26
26
  catch ( error )