Giter VIP home page Giter VIP logo

adaptivecodeassistant's Introduction

Adaptive Code Assistant

Overview

This Adaptive Code Assistant is designed to facilitate querying within large codebases through a natural language processing system. It leverages a combination of machine learning models and indexing technologies to parse, index, and retrieve code snippets efficiently, responding to user queries through a conversational interface.

System Components

  1. File Reading and Indexing: The system scans specified directories for source code files (specifically .cpp,.c,.h,.hpp,.pdf,.md files (supports other file formats)), reading and indexing them to create a searchable dataset.

  2. Embedding Generation: Utilizing the SentenceTransformer model, the script generates embeddings for each line of code. These embeddings capture the semantic meaning of the code, allowing for efficient similarity-based retrieval.

  3. FAISS Index Creation: The embeddings are then used to create a FAISS index, which facilitates fast and efficient similarity searches within the dataset.

  4. Conversational Interface: The application uses Streamlit to create a chat-style interface, where users can input their queries and receive responses. The responses are generated by a language model, which uses the indexed data to provide relevant and context-aware answers.

  5. Language Model Integration: At the core of the response generation is a language model from the CTransformers class, configured to handle conversational queries about the code. This model is integrated into a LangChain workflow that combines retrieval and generative capabilities.

Usage

Adaptive Code Assistant (ACA) Project Drive Link

Access all necessary files for the ACA project via the following Google Drive link:
ACA Project Files

Change the Target Path

Modify the target_path in the file /AdaptiveCodeAssistant/src/ui/adaptive_code_assistant.py at line 128. Change it from:

target_path = os.path.join(root_directory, 'dataset')

to:

target_path = "C:/x/x"

Activate Virtual Environment

To activate the virtual environment, either double-click or run the following PowerShell script from the command line:

C:/XX/XX/AdaptiveCodeAssistant/Scripts/Activate.ps1

Initialize the Project

Start the project by running the following command:

streamlit run C:/XX/XX/AdaptiveCodeAssistant/src/ui/adaptive_code_assistant.py

Note: If you download the project from the provided Drive link, no additional steps are necessary.

Requirements

  • Python 3.8+
  • Libraries: streamlit, transformers, faiss, numpy, torch, sentence-transformers, langchain
  • Adequate storage for embeddings and index files, depending on the size of the codebase.

Installation

Install the required Python packages using pip:

pip install streamlit transformers faiss-cpu numpy torch sentence-transformers langchain

Running the Application

To run the application, execute the following command from the terminal:

streamlit run adaptive_code_assistant.py

adaptivecodeassistant's People

Contributors

huseyinnates avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.