continue icon indicating copy to clipboard operation
continue copied to clipboard

Unable to obtain context from other files for tab autocomplete feature

Open vedants03 opened this issue 1 year ago • 0 comments

Before submitting your bug report

Relevant environment info

- OS: Windows 11 23H2
- Continue: v0.8.45
- IDE: VSCode 1.92.0
- Model:
   - Chat: Deepseek-6.7b-instruct
   - Tab Autocomplete: Deepseek-6.7b-instruct

- config.json:
  
{
  "models": [
    {
      "title": "deepseek-6.7b",
      "provider": "openai",
      "model": "deepseek-ai/deepseek-coder-6.7b-instruct",
      "apiBase": "BASE_URL",
      "apiKey": "API_KEY",
      "systemMessage": "You are an expert software developer. You give helpful and concise responses.",
      "template": "deepseek"
    }
  ],
  "customCommands": [
    {
      "name": "test",
      "prompt": "{{{ input }}}\n\nWrite a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.",
      "description": "Write unit tests for highlighted code"
    }
  ],
  "tabAutocompleteModel": {
    "title": "Tab Autocomplete",
    "provider": "openai",
    "apiBase": "BASE_URL",
    "model": "deepseek-ai/deepseek-coder-6.7b-instruct",
    "apiKey": "API_KEY"
  },
  "tabAutocompleteOptions": {
    "useOtherFiles": true,
    "multilineCompletions": "always",
    "useFileSuffix": true,
    "maxPromptTokens": 4096,
    "useImports": true,
    "useRecentlyEdited": true,
    "recentlyEditedSimilarityThreshold": 0
  },
  "contextProviders": [
    {
      "name": "code",
      "params": {}
    },
    {
      "name": "docs",
      "params": {}
    },
    {
      "name": "diff",
      "params": {}
    },
    {
      "name": "terminal",
      "params": {}
    },
    {
      "name": "problems",
      "params": {}
    },
    {
      "name": "folder",
      "params": {}
    },
    {
      "name": "codebase",
      "params": {
        "nRetrieve": 20,
        "nFinal": 10,
        "useReranking": true
      }
    }
  ],
  "slashCommands": [
    {
      "name": "edit",
      "description": "Edit selected code"
    },
    {
      "name": "comment",
      "description": "Write comments for the selected code"
    },
    {
      "name": "share",
      "description": "Export the current chat session to markdown"
    },
    {
      "name": "cmd",
      "description": "Generate a shell command"
    },
    {
      "name": "commit",
      "description": "Generate a git commit message"
    }
  ],
  "embeddingsProvider": {
    "provider": "ollama",
    "model": "Losspost/stella_en_1.5b_v5:latest",
    "apiBase": "BASE_URL"
  },
  "reranker": {
    "name": "llm",
    "params": {
      "modelTitle": "deepseek-6.7b"
    }
  },
  "allowAnonymousTelemetry": false,
  "docs": []
}

Description

I am having trouble getting context from other files while using the tab autocomplete feature. The completion requests for fill-in-the-middle tasks only consist of the prefix and suffix from the current file, without referencing any data from other files in the codebase. For my use case, I need to reference other files as well for autocomplete. I even tried using OpenAI GPT models for embeddings and autocomplete, but it still isn't working. I am unsure if I am doing something wrong or if this is a bug.

To reproduce

No response

Log output

==========================================================================
==========================================================================
Settings:
contextLength: 4096
model: deepseek-ai/deepseek-coder-6.7b-instruct
maxTokens: 1024
temperature: 0.01
stop: <|fim▁begin|>,<|fim▁hole|>,<|fim▁end|>,//,<|end▁of▁sentence|>,

,

,/src/,#- coding: utf-8,,
def,
class,
"""#
raw: true
log: undefined

############################################

<|fim▁begin|>from azure.core.credentials import AzureKeyCredential
from azure.search.documents.indexes import SearchIndexClient
from azure.core.exceptions import ResourceNotFoundError
from azure.search.documents import SearchClient

from threading import Lock

from config import Config
import logging
from routes.docs_summary.create_index import create_or_update_index

index_clients_summary = {}
index_locks_summary = {}
global_lock_summary = Lock()


def get_lock(project_id):

    global global_lock_summary, index_locks_summary
    # Ensure thread safety while accessing the index_locks dictionary
    with global_lock_summary:
        if project_id not in index_locks_summary:
            index_locks_summary[project_id] = Lock()
        return index_locks_summary[project_id]
    
def get_index_client(project_id):
    """
    This function retrieves the search index client for the specified project ID.
    """
    try:
        with get_lock(project_id):
            # Check if the index client already exists
            if project_id in index_clients_summary:
                return index_clients_summary[project_id]

            try:
                # Get the search service endpoint and key from the environment
                service_endpoint = Config.AZURE_SEARCH_SERVICE_ENDPOINT
                key = Config.AZURE_SEARCH_API_KEY
                <|fim▁hole|>

                # Create the search index client
                client = SearchIndexClient(service_endpoint, AzureKeyCredential(key))
                client.get_index(project_id)
            except ResourceNotFoundError:
                # Create the index if it does not exist
                create_or_update_index(project_id)

            index_client = SearchClient(service_endpoint, project_id, AzureKeyCredential(key))
            index_clients_summary[project_id] = index_client
            return index_client
    except Exception as e:
        print(f"Error retrieving search index client: {e}")
        raise
        return None<|fim▁end|>==========================================================================
==========================================================================
Completion:

logging.info(f"Connecting to Azure Search Service at {service_endpoint}")
                logging.info(f"Using API Key: {key}")


==========================================================================
==========================================================================
Settings:
contextLength: 4096
model: deepseek-ai/deepseek-coder-6.7b-instruct
maxTokens: 1024
temperature: 0.01
stop: <|fim▁begin|>,<|fim▁hole|>,<|fim▁end|>,//,<|end▁of▁sentence|>,

,

,/src/,#- coding: utf-8,```,
def,
class,
"""#
raw: true
log: undefined

############################################

<|fim▁begin|>import sys
import subprocess
import re

def convert_to(folder, source, timeout=None):
    args = [libreoffice_exec(), '--headless', '--convert-to', 'pdf', '--outdir', folder, source]
    if timeout is None:<|fim▁hole|>
    process = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout)
    filename = re.search('-> (.*?) using filter', process.stdout.decode())

    return filename.group(1)


def libreoffice_exec():
    #  Provide support for more platforms
    if sys.platform == 'linux' :
        return '/usr/bin/libreoffice'
    return 'libreoffice'<|fim▁end|>==========================================================================
==========================================================================
Completion:


        timeout = 60

vedants03 avatar Aug 07 '24 09:08 vedants03