Skip to content

Files

Latest commit

c3febcc · Feb 22, 2025

History

History
260 lines (172 loc) · 15.7 KB

README.EN.md

File metadata and controls

260 lines (172 loc) · 15.7 KB

Developer Assistant

logo

[ 中文 | English ]

Large language models sometimes exhibit the phenomenon of "talking nonsense with a straight face" when generating text, which means fabricating facts,fake information, or giving answers that are inconsistent with facts. This phenomenon is known as the "hallucination" problem of large language models. The "hallucination" problem of large language models can be misleading to developers, especially when developers seek help. If a large language model gives incorrect or false information, it may lead developers to take detours or make incorrect decisions. By strengthening the integration of knowledge bases, improving the model's ability to identify factual information, and developing more effective hallucination detection and suppression technologies, we can effectively reduce the phenomenon of large language models "talking nonsense with a straight face" and improve the quality and reliability of their generated text.

RAG Introduction

RAG (Retrieval-Augmented Generation) is an AI framework that combines information retrieval with large language models (LLM). It improves the accuracy and information content of text generated by LLMs by retrieving relevant information from external knowledge bases and providing it to the LLMs. Simply put, RAG is like equipping LLMs with an "external brain" that allows them to consult external resources at any time when answering questions or generating text, rather than relying solely on the knowledge in their own memory.

The core idea of RAG is "retrieve-augment-generate". First, it retrieves relevant information from an external knowledge base based on the user's question or input; then, it provides the retrieved information as context to the LLM; finally, the LLM uses this information and its own powerful language generation capabilities to generate high-quality text responses or outputs. The advantages of RAG are that it can improve the accuracy of text generated by LLMs, increase the amount of information, and enhance its adaptability. Therefore, it is widely used in question-answering systems, chatbots, text summarization, content creation, and other fields.

Project Introduction

Developer Assistant is an open-source knowledge Q&A service designed to provide developers with fast and accurate technical knowledge answers. The project focuses deeply on the field of software development, building a knowledge base covering a variety of mainstream development languages and technologies, and using advanced large language model technology to provide developers with strong technical support.

Our goal is to create an intelligent assistant that can continuously learn and grow, helping developers solve technical problems more efficiently and improve development efficiency.

Demo Address: http://assistant.geekmaxi.top/

Key Features

  • Extensive Knowledge Base Coverage: Currently covers knowledge of mainstream development languages and technology stacks such as Python, Java, PHP, SQL, MySQL, HTML, JavaScript, CSS, etc., and the breadth and depth of the knowledge base are continuously expanding.
  • Powerful Knowledge Q&A Capability: Based on advanced large language model technology, it can understand various technical questions raised by developers and provide accurate and detailed answers.
  • Multi-Model Platform Support: Supports multiple mainstream large language models, including GPT-3.5, DeepSeek-V3, Llama2-Chinese, Qwen-Max, etc., and is connected to multiple large model platforms, such as Siliconflow and Bailian, to provide users with more flexible and powerful model choices.
  • Vector Database: Uses Weaviate and Chroma vector databases to store and retrieve knowledge vectors, improving knowledge retrieval efficiency and accuracy.
  • Relational Database: Supports SQLite and MySQL relational databases for storing project configurations and user data, etc.
  • Continuous Learning and Evolution: The knowledge base and model capabilities will be continuously updated and optimized to adapt to the rapidly developing technology landscape.
  • Open Source: The project is completely open source. Developers community are welcome to participate in contributions and jointly build a more powerful development assistant.

Technology Stack

This project is mainly developed using the following technology stack:

  • Backend:

    • Python: The main backend development language.
    • FastAPI: A modern web framework for building high-performance APIs.
    • Langchain: A framework for building language model application development.
    • LangServe: A tool for deploying Langchain applications.
    • SQL: For database operations.
    • Poetry: Python dependency management and packaging tool.
  • Frontend:

    • HTML: Building webpage structure.
    • JavaScript (JS): Implementing frontend interaction logic.
    • CSS: For webpage style design.
    • React: A JavaScript library for building user interfaces.
    • npm: Node.js package management tool.
  • Large Language Models:

    • GPT-3.5
    • DeepSeek-V3
    • Llama2-Chinese
    • Qwen-Max
    • ... (Continuously increasing)
  • LLM Platforms:

    • Siliconflow
    • Bailian
    • ... (Continuously increasing)
  • Vector Databases:

    • Weaviate
    • Chroma
  • Relational Databases:

    • SQLite
    • MySQL

Question-Answering Process

Image of Question-Answering Process Flowchart

  1. User Question: User inputs a technical question through the frontend interface.
  2. Getting History: The backend system receives the user's question and retrieves the historical chat records of the user's session.
  3. Information Compression: Based on the user's question and history records, generates a new question that can understand the user's intention without relying on history records.
  4. Multi-angle Question: In order to improve the accuracy of retrieval, generates multiple new questions from different angles based on the original question.
  5. Information Retrieval: Uses multiple new questions from different angles to perform relevance retrieval on the knowledge base respectively.
  6. Information Aggregation: Aggregates questions, knowledge base retrieval results, and multi-angle questions.
  7. Model Inference & Answer Generation: Hands over the aggregated information to the large model for question answering.
  8. Answer Return: The system returns the generated answer to the frontend and displays it to the user.

Environment Configuration

Before you start using Developer Assistant, you need to configure the development environment.

Dependencies

  • Conda: Conda is recommended to manage Python virtual environments. You can download and install Miniconda or Anaconda from Conda Official Website.
  • Python: Python 3.11 and above is recommended. Python will be automatically installed in the Conda environment.
  • Docker: If you need to locally deploy the Weaviate vector database, please ensure that Docker and Docker Compose are installed. You can download and install from Docker Official Website.
  • Node.js and npm: If you need to perform frontend development, please ensure that Node.js and npm are installed. You can download and install from Node.js Official Website.
  • Databases: This project uses SQLite (default) and MySQL as relational databases. If you need to use MySQL, please ensure that the MySQL database service is installed and running.

Environment Variables

In order to ensure the normal operation of the project, you need to create a .env file in the root directory and configure the following environment variables according to the example of the .env.example file:

  • Large Model API Key: Configure the corresponding API key according to the large language model platform you use (such as OpenAI, Siliconflow, Bailian, etc.). For example, OPENAI_API_KEY, SILICONFLOW_API_KEY, BAILIAN_API_KEY, etc. For specific environment variable names, please refer to the official documentation of each platform and model and the .env.example file.
  • Weaviate Configuration: If you use local Docker deployment of Weaviate, you need to configure Weaviate connection information, such as WEAVIATE_HOST, WEAVIATE_PORT, etc. If you use cloud Weaviate service, you need to configure the corresponding connection URL and API key.
  • Database Configuration: If you use MySQL database, you need to configure MySQL database connection information, such as MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, etc. If you use the default SQLite database, you do not need to configure database connection information.

You need to copy the .env.example file in the project root directory and rename it to .env, and then modify the configuration items in the .env file according to your actual situation.

Set PYTHONPATH Environment Variable: In order for Python to correctly find the project code, you need to set the PYTHONPATH environment variable to the root directory of the project. For example, if your project root directory is /path/to/development_assistant, you need to set PYTHONPATH=/path/to/development_assistant.

  • Linux/macOS: You can add export PYTHONPATH=/path/to/development_assistant in the ~/.bashrc or ~/.zshrc file, and then execute source ~/.bashrc or source ~/.zshrc to make the configuration take effect.
  • Windows: You can add the PYTHONPATH variable in "System Environment Variables" and set it to the project root directory.

Installation Instructions

The following are the steps to install and run Developer Assistant locally:

  1. Clone Repository

    Open the terminal and execute the following command to clone the code repository to your local machine:

    git clone [https://github.com/geekmaxi/development_assistant.git](https://github.com/geekmaxi/development_assistant.git)
    cd development_assistant
  2. Create Conda Virtual Environment

    In the project root directory, create and activate a Conda virtual environment (recommended to be named da_venv):

    conda create -n da_venv python=3.11  # Or specify other Python versions
    conda activate da_venv
  3. Install poetry

    curl -sSL [https://install.python-poetry.org](https://install.python-poetry.org) | python3
  4. Install Backend Dependencies

    Enter the project root directory and use poetry to install backend dependencies (for the first installation, you may need to install poetry first, pip install poetry):

    poetry install
  5. Install Frontend Dependencies (If you need to run the frontend)

    Enter the frontend directory and use npm to install frontend dependencies:

    cd frontend
    npm install
  6. Configure .env file

    Copy the .env.example file in the project root directory and rename it to .env. According to the instructions in the Environment Variables section, modify the configuration items in the .env file, such as API keys, database connection information, etc.

  7. Deploy Weaviate (If you need vector database)

    If you need to use local Docker deployment of the Weaviate vector database, please ensure that Docker and Docker Compose are installed. In the project root directory, use docker-compose to start the Weaviate service:

    docker-compose -f weaviate-docker-compose.yml up -d

    If you use cloud Weaviate service, you do not need to deploy Weaviate locally.

  8. Configure Database (If you need MySQL)

    If you need to use a MySQL database, please ensure that the MySQL service is installed and running. According to the MySQL configuration items in the .env file, create a database and user, and authorize access. If you use the default SQLite database, this step is not required.

Project Startup

After completing the installation and configuration, you can start Development Assistant by following these steps:

  1. Start Backend Service

    In the terminal where the Conda virtual environment (da_venv) is activated, enter the project root directory and run the FastAPI application:

    uvicorn da.starter.main:app --port 8888 --reload  # Development mode, with hot reload
    # Or
    # uvicorn da.starter.main:app --port 8888  # Production mode

    Please ensure that you have set the PYTHONPATH environment variable to the project root directory.

  2. Start Frontend Application (If you need to run the frontend)

    In another terminal, enter the frontend directory and start the React application:

    cd frontend
    npm run dev
  3. Access Application

    After successful startup, you can access the frontend application address http://localhost:3000 through your browser to start experiencing Developer Assistant.

Usage

[Image of Project Usage Interface Screenshot, e.g., user question input box, answer display area, knowledge base browsing interface, etc.]

  1. Open Developer Assistant frontend page.
  2. Enter your technical question in the question box, such as "How to use Python decorators?" or "What is the underlying principle of Java HashMap?".
  3. Click the "Ask" or similar button to submit the question.
  4. The system will display the model-generated answer in the answer display area.
  5. Refer to the answer content for learning, and you can provide feedback on the answer to help the system continuously optimize.

Contributing

You are welcome to contribute to the Developer Assistant project! You can participate in contributions in the following ways:

  • Submit Issue: If you find a bug or have feature suggestions, please submit an Issue on the GitHub Issue Page.

  • Submit Pull Request (PR): If you want to contribute code, fix bugs, or add new features, please Fork this project, create your branch, and submit a Pull Request.

    Please note when submitting PR:

    • Follow the code style specifications of the project.
    • Submit clear Commit messages.
    • If necessary, please write corresponding test cases.
    • Clearly describe your modifications and purposes in the PR description.
  • Participate in Community Discussions: You are welcome to join our community, participate in discussions, and share your ideas and suggestions. You can participate in discussions through the GitHub Discussions Page.

  • Improve Knowledge Base: The construction of the project knowledge base is very important. You are welcome to contribute new knowledge entries or improve existing knowledge entries to improve the quality and coverage of the knowledge base.

Roadmap

  1. RAGAS Evaluation
  2. Dialogue Management
  3. Token Consumption Statistics
  4. ...

License

Apache License @ 2025 GeeMaxi

This project uses the Apache License open source license.

For specific license content, please refer to the LICENSE file in the project root directory.

Contact

If you have any questions or suggestions, please feel free to contact us through the following methods:

Thank you for using Developer Assistant! We look forward to your participation and feedback!


[Project Name: Developer Assistant]

[Version Number: v1.0.0]

[Update Date: 2025/2/18]