DevChat Documentation

repository·main·Indexed 18 days ago

https://github.com/devchat-ai/devchat

DevChat is an open-source AI-driven development tool (v0.3.0) that implements a 'Prompt-Centric Software Development' (PCSD) model. It allows developers to automate workflows using natural language, personalized AI agents, and knowledge engineering via integrated knowledge graphs. It is available as a Python library, a CLI, and as extensions for Visual Studio Code and the IntelliJ Platform. Key features include ChatMark for interactive chat widgets and a flexible configuration system for managing AI providers and models.

Tokens
7K
Snippets
24
Records
37
Agent score
64%

What's inside DevChat

  1. Leverage private knowledge through Knowledge Engineering

    main

    DevChat uses Knowledge Engineering to help AI understand your specific software development context and private domain knowledge. Key capabilities include:

    • Knowledge Graph Integration: Supports diverse semantic queries using a combination of static pre-construction and dynamic query-time construction for optimal performance.
    • Scenario-based Knowledge Classification: Categorizes knowledge to enhance AI generation. For example, by analyzing relationships between API endpoints, parameters, and functions, the AI can autonomously compose multiple APIs to generate accurate test cases and scripts.
  2. Core Concepts: Knowledge Engineering for Private Knowledge

    main

    DevChat uses integrated knowledge graph capabilities to help AI understand your private codebase and documentation. This is achieved through:

    • Semantic Queries: Supports diverse semantic queries using both static pre-construction and dynamic construction to balance performance and effectiveness.
    • Scenario-specific Classification: Knowledge can be classified for specific tasks. For example, by analyzing API interfaces, parameters, and relationships, the AI can autonomously generate high-quality test cases using multiple APIs.
  3. Core Concepts: Simplified Personalization and Custom Workflows

    main

    DevChat allows you to create custom AI workflows using natural language instead of rigid drag-and-drop interfaces. You can generate intelligent workflows by providing a few sentences of description.

    Common use cases include:

    • Submitting standardized GitLab Merge Requests (MRs).
    • Generating automated API test cases.
    • Providing progress updates via voice notifications.

    The ecosystem includes a collection of plugins for IDE context and various autonomous agents.

  4. Use the chatmark_example workflow in DevChat

    main

    To use the chatmark_example workflow, you must manually place the example folder into your DevChat workflow directory and define a command configuration. This allows you to trigger the example via the DevChat VS Code plugin.

    Setup Steps

    1. Copy the folder: Copy the chatmark_example folder to your local DevChat workflow directory at ~/.chat/workflow/org.
    2. Configure the command: Create a command.yml file inside ~/.chat/workflow/org/chatmark_example/ with the following content to define how the workflow executes:
    description: chatmark examples
    steps:
      - run: $command_python $command_path/main.py
    1. Execute: Open the DevChat VS Code plugin and run the command /chatmark_example in the chat interface.
  5. Use DevChat for API testing and code generation

    main

    DevChat provides several specialized features for developers:

    • Autonomous API Testing: Upload API documentation to automatically generate executable test cases and scripts. The AI handles multi-interface linkage, data validation, and complex scenario construction with minimal human intervention.
    • Standard IDE Features: Includes code generation, auto-completion, code understanding/editing assistance, and efficient AI Q&A within the project context.
    • Model Support: Compatible with major global models including GPT-4o/o1, Claude 3.5/3.7 Sonnet, DeepSeek-V3/R1, Llama 3.3 (70B), and Qwen2.5-Turbo.
  6. The Prompt class abstraction

    main

    The Prompt class is an abstract base class (ABC) used to represent a single round of conversation with an AI model. It encapsulates the model metadata, user information, the current request, the generated responses, and the conversation history.

    Because it is an abstract class, you must implement a concrete subclass that defines how messages are formatted for specific APIs and how token counts are calculated.

    Key responsibilities of a Prompt implementation include:

    • Managing request and responses (as Message objects).
    • Handling new_context (contextual messages).
    • Managing conversation history via prepend_history.
    • Calculating token usage via _count_response_tokens.
    • Generating a unique hash for the prompt state using finalize_hash.
  7. Overview of DevChat

    main

    DevChat is an open-source intelligent IDE plugin designed to bridge the gap between general AI capabilities and specific software development workflows. It focuses on two primary pillars:

    1. Natural Language Workflow Generation: Instead of using rigid
  8. Create custom workflows with natural language

    main
    DevChat allows you to create specialized intelligent workflows using only a few sentences of natural language description. This replaces the need for manual
  9. Implement a concrete Prompt subclass

    main

    To use Prompt in your own implementation, you must subclass it and implement the following abstract methods:

    • _count_response_tokens() -> int: Calculate the number of tokens used in the responses.
    • messages() -> List[dict]: Return the list of messages formatted specifically for your target Chat API.
    • input_messages(messages: List[dict]): Logic to ingest messages from an API into the prompt's internal new_messages and history_messages structures.
    • append_new(message_type: str, content: str, available_tokens: int = sys.maxsize) -> bool: Append a user-provided message.
    • prepend_history(prompt: "Prompt", token_limit: int = sys.maxsize) -> bool: Add a previous prompt to the history.
    • set_request(content: str): Set the primary request content.
    • set_response(response_str: str): Parse a JSON-formatted response string from an API.
    • append_response(delta_str: str) -> str: Handle streaming responses by appending deltas and returning the extracted content.
  10. Store a prompt with `store_prompt()`

    main

    Use store_prompt(prompt) to persist a Prompt object. This method performs several operations:

    1. Finalizes the prompt's hash.
    2. Inserts the prompt data into the TinyDB database.
    3. Updates the chat history graph (the _chat_lists). If the prompt has a parent, it is appended to the existing chat list; otherwise, a new chat list is started.
    4. Updates the topics table with metadata like user, date, request (truncated), and responses (truncated).

    Returns:

    • str: The hash of the root prompt for the current topic/chat list.
    topic_hash = store.store_prompt(prompt_object)