continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
18.74k stars 1.59k forks source link

Error "Failed to generate embeddings" when using Continue Plugin for Codebase Indexing in Rider, Works Fine in VSCode #2289

Open cr-zhichen opened 1 month ago

cr-zhichen commented 1 month ago

Before submitting your bug report

Relevant environment info

- OS:Windows 10 Pro for Workstations 22H2
- Continue: VSCode: 0.8.52,Rider: 0.0.64
- IDE: Rider 2024.2.4
- Model:BAAI/bge-m3
- config.json:
{
    "completionOptions": {
        "temperature": 0,
        "maxTokens": 4096
    },
    "models": [
        {
            "title": "DeepSeek",
            "provider": "openai",
            "systemMessage": "You are an expert software developer. You give helpful and concise responses.",
            "model": "deepseek-chat",
            "apiBase": "https://xxxxxxx/v1",
            "apiKey": "API_KEY",
            "contextLength": 8192
        }
    ],
    "contextProviders": [
        {
            "name": "codebase",
            "params": {
                "nRetrieve": 25,
                "nFinal": 5,
                "useReranking": false
            }
        },
        {
            "name": "file"
        },
        {
            "name": "code"
        },
        {
            "name": "diff"
        },
        {
            "name": "terminal"
        }
    ],
    "embeddingsProvider": {
        "provider": "openai",
        "model": "BAAI/bge-m3",
        "apiBase": "https://xxxxxxx/v1",
        "apiKey": "API_KEY"
    },
    "tabAutocompleteOptions": {
        "maxPromptTokens": 4096,
        "debounceDelay": 350,
        "multilineCompletions": "always",
        "useCache": true
    },
    "tabAutocompleteModel": {
        "title": "DeepSeek-V2",
        "model": "deepseek-chat",
        "apiKey": "API_KEY",
        "contextLength": 8192,
        "apiBase": "https://xxxxxxx/v1",
        "completionOptions": {
            "maxTokens": 4096,
            "temperature": 0,
            "topP": 1,
            "presencePenalty": 0,
            "frequencyPenalty": 0
        },
        "provider": "openai"
    },
    "customCommands": [
        {
            "name": "Add Comment",
            "prompt": "{{{ input }}}\n\n Please add detailed comments in Chinese to the code.",
            "description": ""
        },
        {
            "name": "Explain Code",
            "prompt": "{{{ input }}}\n\n Please explain the above code in detail in Chinese.",
            "description": ""
        },
        {
            "name": "Refactor Code",
            "prompt": "{{{ input }}}\n\n Please refactor the above code, ensuring it conforms to coding standards, is as concise as possible, uses more advanced syntax, and adds Chinese annotations.",
            "description": ""
        },
        {
            "name": "Defect Detection",
            "prompt": "{{{ input }}}\n\n Please check the code against general programming standards, identifying naming issues, bugs, defects, and areas for optimization.",
            "description": ""
        },
        {
            "name": "Continue Code",
            "prompt": "{{{ input }}}\n\n Please continue writing the above code and add Chinese comments for explanation.",
            "description": ""
        },
        {
            "name": "Write Unit Test",
            "prompt": "{{{ input }}}\n\n Please write unit tests for the above code and add Chinese comments for explanation.",
            "description": ""
        }
    ],
    "experimental": {
        "quickActions": [
            {
                "title": "Generate Comments",
                "prompt": "Generate comments in Chinese that follow language conventions for this code."
            }
        ]
    }
}

Description

I am opening the same project in both VSCode and Rider and using the Continue plugin to index the codebase. The indexing completes successfully in VSCode, but it fails in Rider with the following error:

Error: Failed to generate embeddings for 233 chunks with provider: OpenAIEmbeddingsProvider: BAAI/bge-m3: Error: {"error":{"message":"The parameter is invalid. Please check again. (request id: 2024091810405578781328035296047)","type":"upstream_error","param":"400","code":"bad_response_status_code"}}

To reproduce

  1. Open the same project in both VSCode and Rider.
  2. Use the Continue plugin to index the codebase.
  3. Observe the error message in Rider.

Log output

No response

Patrick-Erichsen commented 1 month ago

Hi @cr-zhichen , adding this to a main thread where we are tracking issues with indexing on JetBrains. Thanks for the +1 here.

https://github.com/continuedev/continue/issues/2320

Patrick-Erichsen commented 1 month ago

Actually I believe this might be more related to the following issue: https://github.com/continuedev/continue/issues/2162

Could you try setting your maxBatchSize like this?


{
  "embeddingsProvider": {
    "maxBatchSize": 32
  },
}