Skip to content

JSON error when getting response #28

@phatlewt

Description

@phatlewt

Not sure why I'm getting this error when I haven't specified a JSON schema:

SyntaxError: Unexpected non-whitespace character after JSON at position 124 (line 2 column 1)
at JSON.parse ()
at parseJSONFromBytes (node:internal/deps/undici/undici:5852:19)
at successSteps (node:internal/deps/undici/undici:5833:27)
at fullyReadBody (node:internal/deps/undici/undici:4725:9)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async consumeBody (node:internal/deps/undici/undici:5842:7)
at async z.send (node_modules/@themaximalist/llm.js/dist/index.mjs:1612:17)
at async z.chat (node_modules/@themaximalist/llm.js/dist/index.mjs:1589:29)

Code:

import LLM from "@themaximalist/llm.js"
const llm = new LLM(
{
    service: "ollama",
    stream: false,
});
llm.system("You are an excel expert. Answer questions about excel.");
llm.model = "llama3.1:8b";
llm.temperature = 0.7;
llm.options = 
{
    stream: true,
    extended: true,
};
streamTest();
async function streamTest()
{
    const stream = await llm.chat("what can you do?", {stream: true});
    for await (const part of stream)
    {
        console.log(part);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions