Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 27cef60900 | |||
| 2b00e36b02 | |||
| 8eb3111e7e | |||
| d296a1b676 | |||
| f74d1cf2ba | |||
| b29d7f5df3 |
12
changelog.md
12
changelog.md
@@ -1,5 +1,17 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-01-20 - 0.13.3 - fix()
|
||||||
|
no changes detected
|
||||||
|
|
||||||
|
- No files changed in the provided diff.
|
||||||
|
- No version bump required.
|
||||||
|
|
||||||
|
## 2026-01-20 - 0.13.2 - fix(repo)
|
||||||
|
no changes detected in diff; nothing to commit
|
||||||
|
|
||||||
|
- Git diff reported no changes — no files modified
|
||||||
|
- No code or dependency updates detected, so no version bump required
|
||||||
|
|
||||||
## 2026-01-20 - 0.13.1 - fix()
|
## 2026-01-20 - 0.13.1 - fix()
|
||||||
no changes detected; no release required
|
no changes detected; no release required
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartai",
|
"name": "@push.rocks/smartai",
|
||||||
"version": "0.13.1",
|
"version": "0.13.3",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "SmartAi is a versatile TypeScript library designed to facilitate integration and interaction with various AI models, offering functionalities for chat, audio generation, document processing, and vision tasks.",
|
"description": "SmartAi is a versatile TypeScript library designed to facilitate integration and interaction with various AI models, offering functionalities for chat, audio generation, document processing, and vision tasks.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartai',
|
name: '@push.rocks/smartai',
|
||||||
version: '0.13.1',
|
version: '0.13.3',
|
||||||
description: 'SmartAi is a versatile TypeScript library designed to facilitate integration and interaction with various AI models, offering functionalities for chat, audio generation, document processing, and vision tasks.'
|
description: 'SmartAi is a versatile TypeScript library designed to facilitate integration and interaction with various AI models, offering functionalities for chat, audio generation, document processing, and vision tasks.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import * as plugins from './plugins.js';
|
|||||||
import { AnthropicProvider } from './provider.anthropic.js';
|
import { AnthropicProvider } from './provider.anthropic.js';
|
||||||
import { ElevenLabsProvider } from './provider.elevenlabs.js';
|
import { ElevenLabsProvider } from './provider.elevenlabs.js';
|
||||||
import { MistralProvider } from './provider.mistral.js';
|
import { MistralProvider } from './provider.mistral.js';
|
||||||
import { OllamaProvider } from './provider.ollama.js';
|
import { OllamaProvider, type IOllamaModelOptions } from './provider.ollama.js';
|
||||||
import { OpenAiProvider } from './provider.openai.js';
|
import { OpenAiProvider } from './provider.openai.js';
|
||||||
import { PerplexityProvider } from './provider.perplexity.js';
|
import { PerplexityProvider } from './provider.perplexity.js';
|
||||||
import { ExoProvider } from './provider.exo.js';
|
import { ExoProvider } from './provider.exo.js';
|
||||||
@@ -32,16 +32,7 @@ export interface ISmartAiOptions {
|
|||||||
baseUrl?: string;
|
baseUrl?: string;
|
||||||
model?: string;
|
model?: string;
|
||||||
visionModel?: string;
|
visionModel?: string;
|
||||||
defaultOptions?: {
|
defaultOptions?: IOllamaModelOptions;
|
||||||
num_ctx?: number;
|
|
||||||
temperature?: number;
|
|
||||||
top_k?: number;
|
|
||||||
top_p?: number;
|
|
||||||
repeat_penalty?: number;
|
|
||||||
num_predict?: number;
|
|
||||||
stop?: string[];
|
|
||||||
seed?: number;
|
|
||||||
};
|
|
||||||
defaultTimeout?: number;
|
defaultTimeout?: number;
|
||||||
};
|
};
|
||||||
elevenlabs?: {
|
elevenlabs?: {
|
||||||
|
|||||||
@@ -345,9 +345,9 @@ export class OllamaProvider extends MultiModalModel {
|
|||||||
const timeout = optionsArg.timeout || this.defaultTimeout;
|
const timeout = optionsArg.timeout || this.defaultTimeout;
|
||||||
const modelOptions = { ...this.defaultOptions, ...optionsArg.options };
|
const modelOptions = { ...this.defaultOptions, ...optionsArg.options };
|
||||||
|
|
||||||
// Format history messages with optional images and reasoning
|
// Format history messages with optional images, reasoning, and tool_calls
|
||||||
const historyMessages = optionsArg.messageHistory.map((msg) => {
|
const historyMessages = optionsArg.messageHistory.map((msg) => {
|
||||||
const formatted: { role: string; content: string; images?: string[]; reasoning?: string } = {
|
const formatted: { role: string; content: string; images?: string[]; reasoning?: string; tool_calls?: any[] } = {
|
||||||
role: msg.role,
|
role: msg.role,
|
||||||
content: msg.content,
|
content: msg.content,
|
||||||
};
|
};
|
||||||
@@ -357,6 +357,11 @@ export class OllamaProvider extends MultiModalModel {
|
|||||||
if (msg.reasoning) {
|
if (msg.reasoning) {
|
||||||
formatted.reasoning = msg.reasoning;
|
formatted.reasoning = msg.reasoning;
|
||||||
}
|
}
|
||||||
|
// CRITICAL: Include tool_calls in history for native tool calling
|
||||||
|
// Without this, the model doesn't know it already called a tool and may call it again
|
||||||
|
if ((msg as any).tool_calls && Array.isArray((msg as any).tool_calls)) {
|
||||||
|
formatted.tool_calls = (msg as any).tool_calls;
|
||||||
|
}
|
||||||
return formatted;
|
return formatted;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -494,7 +499,7 @@ export class OllamaProvider extends MultiModalModel {
|
|||||||
const timeout = optionsArg.timeout || this.defaultTimeout;
|
const timeout = optionsArg.timeout || this.defaultTimeout;
|
||||||
const modelOptions = { ...this.defaultOptions, ...optionsArg.options };
|
const modelOptions = { ...this.defaultOptions, ...optionsArg.options };
|
||||||
|
|
||||||
// Format history messages with optional images, reasoning, and tool role
|
// Format history messages with optional images, reasoning, tool_calls, and tool role
|
||||||
const historyMessages = optionsArg.messageHistory.map((msg) => {
|
const historyMessages = optionsArg.messageHistory.map((msg) => {
|
||||||
// Handle tool result messages
|
// Handle tool result messages
|
||||||
if ((msg as any).role === 'tool') {
|
if ((msg as any).role === 'tool') {
|
||||||
@@ -505,7 +510,7 @@ export class OllamaProvider extends MultiModalModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatted: { role: string; content: string; images?: string[]; reasoning?: string } = {
|
const formatted: { role: string; content: string; images?: string[]; reasoning?: string; tool_calls?: any[] } = {
|
||||||
role: msg.role,
|
role: msg.role,
|
||||||
content: msg.content,
|
content: msg.content,
|
||||||
};
|
};
|
||||||
@@ -515,6 +520,11 @@ export class OllamaProvider extends MultiModalModel {
|
|||||||
if (msg.reasoning) {
|
if (msg.reasoning) {
|
||||||
formatted.reasoning = msg.reasoning;
|
formatted.reasoning = msg.reasoning;
|
||||||
}
|
}
|
||||||
|
// CRITICAL: Include tool_calls in history for native tool calling
|
||||||
|
// Without this, the model doesn't know it already called a tool and may call it again
|
||||||
|
if ((msg as any).tool_calls && Array.isArray((msg as any).tool_calls)) {
|
||||||
|
formatted.tool_calls = (msg as any).tool_calls;
|
||||||
|
}
|
||||||
return formatted;
|
return formatted;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user