Skip to content

atet/copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

.img/copilot_logo.png

Artificial Intelligence Copilot to Help You Code...and More!

Setup and some basic examples to get you started in less than 10 minutes; programming will never be the same for you after this...

In this short tutorial, you will:

  • Get a Free AI access key
  • Set up Visual Studio Code
  • Configure your new AI copilot
  • Perform five AI-assisted actions

I developed this tutorial on Windows 10; Windows 11 and MacOS should be very similar steps.

Google Gemini Access

If you have your own locally hosted models, you can skip steps #1-4 and on step #12, see Next Steps for specific instructions

You have to get programmatic (i.e., API) access to use Google Gemini outside of their web-based, chat offering. Don't worry, this is completely free and no credit card is required!

  1. Go to Google AI Studio and sign in with your Google account at https://aistudio.google.com/welcome
  2. After signing in, click on "Get API key"
  3. It may take up to 30 seonds to generate an API key, copy the key down for a later step, do not share your API key

.img/copilot_fig1.png

Visual Studio Code Setup

You can use VSCode without installing it by just downloading the "portable" *.zip version.

  1. Download the *.zip version here: https://code.visualstudio.com/download
  2. Extract the file, may take a few minutes
  3. Within the extracted directory, add a new folder named "data"
  4. Click on Code.exe to start up VSCode
  5. Once VSCode is running, click on the Extensions tab in the left side menu (or use keyboard shortcut CTRL+SHIFT+X)

.img/copilot_fig2.png

AI Copilot Setup

We will use the Continue extension to leverage Google Gemini within VSCode.

  1. Search for "Continue" in the Extensions search bar
  2. Install the Continue extension from continue.dev
  3. Once the install completes, click on the Continue icon in the left side menu
  4. Click on "Select Model" and then "Add Chat Model"
  5. This will open a window that will allow you to select Gemini (see Next Steps for local models):
    • Provider: "Google Gemini API"
    • Model: "Gemini 2.0 Flash"
    • API key: "<ENTER YOUR API KEY FROM STEP #3>"
  6. Click on Connect and now you can ask questions like, "Hi Gemini, what is my API usage rate limit?" (Note that your results will likely be different than mine)

.img/copilot_fig3.png

Additional Data for Specific Context

It looks like Gemini's general knowledgebase doesn't have specific information about its own API rate limits! So let's add a data source that will help out.

  1. Type an ampersand ("@") and click on Docs in the menu that pops up
  2. Scroll to the bottom of the Docs list and choose "+ Add Docs"
  3. In the window that pops up, let's add a web link to Google's documentation on Gemini API limits:
  4. When you click add, Continue will upload the information from the URL you entered, depending on the amount of data, this can take >5 minutes to finish indexing; you can come back to this later and see that asking the same question again with the @Gemini tag will result in a much better answer

.img/copilot_fig4.png

Programming with an AI Copilot

  1. Close any tabs in the main body to the right, right-click and select "New Text File" (or CTRL+N)

  2. Copy and paste the following incomplete Python function into the new text file:

    def add(x, y):
       # DO SOMETHING
    
    add(1, 1) # Should print "2"
  3. Highlight what you just pasted in the text file and right click on it, you'll see a menu option for "Continue" and then select "Fix this Code"

  4. When you click on "Fix this Code," after a few moments, you'll see that Gemini basically filled in the incomplete function for you!

  5. Go ahead and click on "Accept" with any changes Gemini suggests (Note that your results will likely be different than mine)

.img/copilot_fig5.png

Documentation and More with an AI Copilot

If your results are similar to mine, Gemini got rid of all the comments we had; let's see about Gemini automatically adding comments back for us.

  1. Highlight the new code, right click, select "Continue" → "Write Comments for this Code"
  2. You can accept what Gemini documented for you or reject and try again for a slightly different result
  3. Highlight the code again and select "Continue" → "Add Highlighted Code to Context" (or CTRL+L) to move the selected code into the chat window
  4. Now you can have a focused discussion with Gemini to do things like changing the code (e.g., "Change this function so that it subtracts instead"), asking for a detailed explanation of what's going on, and even trying something like "ELI5" for dense and complex code

.img/copilot_fig6.png

Conclusion and Next Steps

There you have it, your own personal AI assistant for programming and more. I hope that these past 10 minutes gave you an excellent impression of what's to come with this state-of-the-art technology, motivating you to integrate this into your routine and achieve great things!

As far as next steps:

  • Continue (😅) to work through code examples and chat with Gemini in VSCode, get comfortable with this new AI copilot experience
  • The VSCode you just set up was not configured to execute any code, especially the simple Python code we had earlier; if you would like a live development environment, click here to install Python for VSCode
  • If you have your own locally-hosted large language models:

.img/copilot_fig7.jpg

Back to Top


Troubleshooting

Issue Solution
"Explain Like I'm 5 (ELI5)" Large language models like Gemini will never get tired or frustrated by questions; don't be afraid to continue to dive further into topics and have it explained in as many different ways as necessary to be understood
"My local model isn't connecting" • "apiBase" is case sensitive
• You may only need the IP address and port number, no need for .../v1/completions or anything else
"The models are starting to forget things from earlier in the conversation" These models have a limited amount of conversational memory (i.e., "context length") and can be worked around by starting a new conversation that is more focused on your specific topic of interest
"The quality of the responses from my local model isn't as good as Gemini's" It is highly likely that Google's model is better than most free, open-source models that can be hosted on a home computer or even a professional workstation
"It's not working!" This concise tutorial has distilled hours of sweat, tears, and troubleshooting; it can't not work

Back to Top


Other Resources

Description URL Link
Continue's 90-second feature trailer https://youtu.be/V3Yq6w9QaxI
Atet's Local Large Language Model Tutorial https://github.com/atet/llm
Google Gemini Web-Based Functionality (this is different than programmatic API access) https://gemini.google.com/app
Motivation "AI won't take your job. It's somebody using AI that will take your job." — Richard Baldwin

Back to Top


Copyright © 2025-∞ Athit Kao, Terms and Conditions

About

AI Copilot to Help You Code...and More!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published