ollama icon indicating copy to clipboard operation
ollama copied to clipboard

Unnecessary quotes when calling a tool

Open napa3um opened this issue 1 year ago • 0 comments

What is the issue?

I'm using mistral-nemo:12b-instruct-2407-q4_1

I'm trying to reproduce this example - https://github.com/ollama/ollama-js/blob/main/examples/tools/tools.ts

tools: [
            {
                type: 'function',
                function: {
                    name: 'eval',
                    description: 'Вычисляет арифметическое выражение в формате JS-функции eval. Используется тогда, когда нужен калькулятор.',
                    parameters: {
                        type: 'object',
                        properties: {
                            expression: {
                                type: 'string',
                                description: 'Арифметическое выражение',
                            }
                        },
                        required: ['expression'],
                    },
                },
            },
        ],

Everything works, but sometimes I get (without a space between the quotes):

The model didn't use the function. Its response was:
``⠀`
{
  "jsonrpc": "2.0",
  "method": "eval",
  "params": {
    "expression": "5234 / 6453 * 23456"
  }
}
``⠀`

That is, sometimes the model wraps JSON in triple quotes, and Ollama interprets this as a text response rather than a tool call.

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

0.3.0

napa3um avatar Jul 26 '24 08:07 napa3um