Skip to content

claude-3.5-sonnet returns 500 on some special unicode characters #464

@quentin-lpr

Description

@quentin-lpr

When i set model = "claude-3.5-sonnet" and select my whole buffer or set context = "buffers" and ask something to Copilot while having claude as selected model, i have this error that appears :

Failed to parse response: "Expected value but found invalid token at character 1"
Internal Server Error

Debug logs :

[CopilotChat.nvim] [DEBUG 00:41:04]
~/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/context.lua:239: Got 1 embeddings 

[CopilotChat.nvim] [DEBUG 00:41:05]
~/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:499: Temperature: 0.1 

[CopilotChat.nvim] [DEBUG 00:41:08]
~/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:513: Tokenizer: o200k_base

[CopilotChat.nvim] [INFO  00:41:08]
~/.local/share/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/copilot.lua:468: Claude enabled 

[CopilotChat.nvim]
Internal Server Error

Here is my current CopilotChat config :

{
    "CopilotC-Nvim/CopilotChat.nvim",
    event = "BufReadPre",
    branch = "canary",
    dependencies = {
        { "github/copilot.vim" },
        { "nvim-lua/plenary.nvim" },
    },
    build = "make tiktoken",
    opts = {
        debug = true,
        window = {
            layout = "float",
            border = "rounded",
            title = "Copilot Chat",
        },
        model = "claude-3.5-sonnet",
        question_header = "  User ",
        answer_header = "  Copilot ",
        error_header = "  Error ",
        auto_insert_mode = true,
        insert_at_end = true,
        context = "buffers",
        highlight_selection = false,
    },
    config = function(_, opts)
        local chat = require("CopilotChat")
        chat.setup(opts)

        local wk = require("which-key")
        wk.add({
            {
                group = "Copilot",
                "<leader>g",
                { "<leader>cc", chat.toggle, mode = { "n", "v" }, desc = "Toggle Copilot Chat", icon = { icon = "󰠠", color = "white" } },
                { "<leader>ca", ask_copilot, mode = { "n", "v" }, desc = "Ask Copilot", icon = { icon = "󰠠", color = "white" } },
                icon = { icon = "󰠠", color = "white" },
            },
        })
    end,
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstream

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions