DevChat: AI intelligent programming assistant based on large models in VSCode

Which #AI programming assistant is the best? DevChat is “really” easy to use#

1 Introduction

  DevChat is an AI intelligent programming assistant carefully built by Merico. It leverages state-of-the-art large language model technology to understand requirements as efficiently as human developers and provide the best code and project implementation. DevChat can provide multiple supports such as intelligent completion, error correction, code specification checking, and code comment generation, which greatly improves developers' work efficiency. This allows developers to say goodbye to dirty work and do more valuable work. The product is pragmatic and efficient, and was recently unveiled at the 2023 QCon Global Software Conference, winning praise from many developers in the industry.

  As a comprehensive AI intelligent programming assistant, it can not only complete code writing, but also complete unit testing, debugging, code documentation writing and efficient summary. While ensuring coding quality, DevChat also attaches great importance to user privacy and data security. DevChat supports the Microsoft Azure platform, the world's top data privacy protection, and is more secure to use than the OpenAI interface.

  DevChat provides interfaces for large models such as GPT-3.5, GPT-4, XINGHUO-2, CLAUDE-2, LLAMA-2-13B-CHAT, etc. Users can choose the most suitable large model according to their actual needs, thereby maximizing the Increase work efficiency. For example, GPT-4 can be the first choice for complex tasks, and other tasks can also be solved using low-cost models, and the combination can achieve the best performance.

  DevChat AI auxiliary tool is so powerful, what are the advantages? It contains a total of eight major advantages, as follows:

  • Precise contextual control
  • Choose from a variety of large models: GPT-4 is the best choice for complex tasks, and low-cost models for simple tasks, which provide the best performance when used in combination
  • Precise "context" management; add any code segment to the conversation, do not rely on AI's guessing, and return control to the user
  • Simple and scalable prompt word catalog: Open prompt word extension, Prompts as Code, to meet the customized needs of teams and individuals
  • Flexible Prompt template management, ask-code function answers various questions in the code base
  • Product design is pragmatic and iterative feedback is fast
  • Code and documentation are freely generated rather than simply completed
  • Connected to Microsoft Azure services for reliable enterprise-level data security

  After using the DevChat intelligent programming assistant in depth, my biggest feeling is that it is simple and easy to use. It is very suitable for programmers of different levels to solve problems of different difficulties. It can not only help novices write mature codes, but also Help the project team improve work efficiency. So it is strongly recommended that everyone try it out. The access address is: Official website link.
Insert image description here

2. Installation

  In order to take care of the vast majority of students, the steps in this section are more detailed. I hope everyone can follow the steps below to successfully complete the installation of DevChat.

2.1 Register new user

  Click to enterOfficial website link, then click to log in, as shown below:

Insert image description here
  Click Sign Up in the picture below to start the registration of new users:

Insert image description here

  Then enter your username and email address in the picture below (it is OK to test your QQ mailbox yourself), complete the real-person test of I am human, and finally click Sign up to complete the registration of the new user. It should be noted that at this time, the mailbox will receive an email containing the Access Key, and the Access Key will be saved locally for subsequent use.
Insert image description here

  Then enter the email you just registered with and click Send Code. You will receive an email containing the verification code. Then enter it into the input box of Veification Code and click Sign In to log in, as shown in the figure below:
Insert image description here

2.2 Install the DevChat plug-in in VSCode

  First open VSCode, click the configuration button (gear-shaped) on the lower left, and then click Extensions, as shown below:
Insert image description here
  Then enter it in the search boxDevChat, click Install to install, as shown below:
Insert image description here

2.3 Set Access Key

  Click the settings button in the lower left corner and select Command Palette, as shown in the figure below:

Insert image description here
  Click DevChat: Input DevChat Access Key in the pop-up command panel, as shown in the figure below:
Insert image description here
  Copy the previously saved Access Key into the input box in the figure below. and press the Enter key.
Insert image description here
  After completing the input, you can see that api key status: has valid access key appears in the log below, which means that the Access Key configuration is successful, as shown in the following figure:
Insert image description here

3. Practical use

3.1 Code writing

  First, let’s take the simplest test example, which is to let DevChat complete Python’s quick sorting. The screenshot and code are as follows:

Insert image description here

def quick sort(arr): 
    if len(arr) <= 1:
        return arr 
    pivot = arr[len(arr) /1 2] # 选择个基准元素
    left = [x for x in arr if x < pivot] # 小于基准元素的部分
    middle = [x for x in arr if x == pivot] # 等于基准元素的部分
    right = [x for x in arr if x > pivot] # 大于基准元素的部分
    # 递归排序左右两部分
    return quick sort(left) + middle + quick sort(right)

3.2 Project creation

  In addition to being able to write algorithm questions, can DevChat create a Python project? Here we take the Python Django project as an example. First, enter how to create a Django project in the input box, as shown in the figure below:
Insert image description here
  Then DevChat gives detailed creation steps, as shown in the figure below. Let’s see if we can complete the creation of the Django project under its guidance?
Insert image description here
  First enter the command line and use the pip command to install the django library. When you see Successfully installed, the installation is successful. The specific steps and screenshots are as follows:
Insert image description here
  Then create the Django project in the command. The specific operation command is also consistent with the steps given by DevChat, as shown in the following figure:
Insert image description here
  When you see The install worked successfully! Congratulations!, it means the Django project has been created. It was successful, as shown in the figure below:

Insert image description here

3.3 Code explanation

  DevChat can not only help us complete code writing and project creation, but also help us explain the code, which greatly improves the efficiency of reading code.

  First, use the mouse box to select the specified code segment, then right-click the mouse and click Add to DevChat, as shown in the figure below:
Insert image description here
  Then select the corresponding model in the menu bar , since the context length of CLAUDE-2 is 100K (the longest in the model list), this model was selected to complete this task.
Insert image description here
  Input in the dialog box: Please help me explain the code, as shown below.
Insert image description here
  DevChat’s answer is as follows:

这段代码使用 OpenAI 的 Completion API 来生成文本。主要逻辑如下:

1. 在一个无限循环中尝试生成文本。

2. 使用 model_name、batch_decoding_args 和 decoding_kwargs 构建请求参数。

3. 调用 Completion.create() 生成文本。

4. 如果遇到 OpenAIError,处理不同的错误:

   - 如果是 "Please reduce your prompt" 错误,调整 max_tokens 参数重试。

   - 如果是请求频率限制错误,等待一段时间后重试。

5. 获取结果 choices,记录 tokens 用量,添加到 completions 列表中。

6. 成功后退出循环。

这种机制可以自动处理 OpenAI API 的错误和限制,不断尝试请求直到成功生成文本为止。max_tokens 参数可以动态调整来适应 prompt 长度限制。整体来说,这是一种优雅的方式来反复调用 OpenAI API 直到成功。

4. Summary

  After personally experiencing DevChat, it is indeed a very smart AI programming assistant. Not only can it complete intelligent code completion, error correction and code specification checking, but it can also complete project creation under its precise guidance. It is really powerful and easy to use, so I strongly recommend everyone to install it and use it. In the new era of AI, only by constantly learning and using the latest AI tools can we remain invincible.

Guess you like

Origin blog.csdn.net/herosunly/article/details/134111430