Comments (25)
https://github.com/Venthe/vscode-fauxpilot
This is a (very) basic implementation; as I've just hacked around. It is NOT published, but it does work :)
@moyix if I would wish to publish it and work on it; can I use the name Fauxpilot? Or would you rather prefer for me not to use that name?
e: https://github.com/Venthe/vscode-fauxpilot/releases/tag/0.0.1 here you have the release. It is not tested (as I did this in dev mode only). I will spend some time on it tomorrow, gotta go back to work!
e2: Just confirmed working from VSIX, have fun!
e3: v 0.0.2 released. Including expanded prompt, enable/disable, delay and fixed annoying bug with completion not being shown
from fauxpilot.
Hello all. The comments above have been very helpful in setting up the Copilot extension. I managed to get it to work with my instance and figured I would combine the steps I used (this is for Windows. Linux installation is similar, just different locations):
-
Go through the standard Fauxpilot server setup. If the docker containers are running and are query-able with curl, move ahead. I used @Frederisk's fauxpilot-windows fork for the launch.ps1 and setup.ps1 scripts. More or less, it's the same. (source: https://github.com/Frederisk/fauxpilot-windows)
-
Install GitHub Copilot into VSCode (we will defang some of this later).
-
Add the GitHub copilot overrides to the settings.json file. These steps are outlined for this in https://github.com/fauxpilot/fauxpilot/blob/main/documentation/client.md (Copilot Plugin).
-
@petronny has some steps for getting VIM to work with Fauxpilot (#72). We will use these steps to fix the VSCode version. Find and replace the following strings in the "%userprofile%.vscode\extensions\github.copilot-#.##.####\dist\extension.js" file:
- https://api.github.com/copilot_internal -> http://127.0.0.1:5000/copilot_internal
- https://copilot-proxy.githubusercontent.com -> http://127.0.0.1:5000
This is essentially a manual override for the GitHub token retrieval to use our local instance instead.
-
Not all telemetry is removed from the extension. Removal of all the telemetry may violate the TOS for Copilot. Do so at your own discretion. It will, however, not send your code to Microsoft.
-
Make sure your extensions are not set to automatically update or the extension.js changes will be reverted when GitHub Copilot updates.
-
Copilot should behave as usual, but is now using Fauxpilot's docker setup for token generation instead. There are occasional issues with token amount as mentioned above, but these are the steps I used to get it at least running.
from fauxpilot.
After some modifications to the VSCode plugin; I've managed to bypass the token and have a SINGLE autocompletion. And I couldn't manage to repeat that ever since :(
from fauxpilot.
I think this vs code extension could be modified easily for fauxpilot.
from fauxpilot.
Sure, feel free to use the name!
from fauxpilot.
Do you mean it doesn't work without having a valid token for Copilot? Or is something going wrong after that too?
Yes, I also have trouble to use the Copilot vscode plugin.
from fauxpilot.
Hi @shadowwider, where is the attached js? I also want to use GitHub copilot extension with fauxpilot server.
https://github.com/shadowwider/brook/releases/download/v1/extension.js
you can try this
from fauxpilot.
[INFO] [auth] [2022-08-03T06:47:46.784Z] Invalid copilot token: missing token: 403
[ERROR] [default] [2022-08-03T06:47:46.787Z] GitHub Copilot could not connect to server. Extension activation failed: "User not authorized"
I can help with this since this error also appears in the official vim plugin.
The plugin uses https://api.github.com/copilot_internal/v2/token
to get a token.
So we can hack the address to http://localhost:5000/copilot_internal/v2/token
to bypass this step.
It should return a json string with token
, expires_at
and refresh_in
. But I don't know the format of expires_at
since I have no subscription to copilot.
Updated: I've tried out the minimal output of https://api.github.com/copilot_internal/v2/token
. See #72 .
from fauxpilot.
It appears so unfortunately! It is probably possible to bypass this by changing the code of the extension, but that's going a bit beyond what I'm comfortable with.
You may want to check out this extension developed by some of my colleagues, which also talks to the OpenAI API, and so should be easy to use with FauxPilot:
https://github.com/synoet/Pincer/tree/main/extension
However, it needs a bit of updating now that the InlineCompletions API has been finalized (it was originally written for the VSCode beta). You'll probably also want to tear out the telemetry that we added for our user study.
from fauxpilot.
I should have a barebones extension (code, I dunno how to upload it to marketplace) in a few hours, just teaching myself how to do so
from fauxpilot.
Can we update this plugin in the readme, the vscode for github copilot just does not work.
from fauxpilot.
Do you mean it doesn't work without having a valid token for Copilot? Or is something going wrong after that too?
from fauxpilot.
@Venthe what does max token and suggestion delay mean in your plugin? These are not very clear in the Readme.
And default max token is 4, is pretty weird, I think code snippet need at least 200 token.
from fauxpilot.
Do you mean it doesn't work without having a valid token for Copilot? Or is something going wrong after that too?
Yes, I also have trouble to use the Copilot vscode plugin.
I will try to find some time to test again with the most recent Copilot. Last time I checked there were issues with the tokenizers between Copilot and CodeGen being slightly different, so Copilot sometimes makes requests that are too long for CodeGen – I think this can be fixed by replacing the vocab.bpe
and tokenizer.json
files in the VSCode plugin directory with the CodeGen versions found here: https://github.com/moyix/fauxpilot/tree/main/copilot_proxy/cgtok/openai_format
I have not tested this though, just very short on time now that school is back in session :(
from fauxpilot.
The next release of the GitLab VS code extension will have support for FauxPilot. Welcoming contributions 😄
Extension:
https://gitlab.com/gitlab-org/gitlab-vscode-extension
Merge Request:
https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/merge_requests/648
from fauxpilot.
@Venthe what does max token and suggestion delay mean in your plugin? These are not very clear in the Readme.
And default max token is 4, is pretty weird, I think code snippet need at least 200 token.
Hey, sorry for missing this comment. To be completely honest, I do not remember why I've set it this way. This is / was a rough implementation only; just to have something working.
Delay: This sets the time for the debounce-like mechanism
Max token: I do not know, but see https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them
. As for the value 4, it seems low indeed; I'll update the defaults
from fauxpilot.
After testing several extensions I ended up going with github copilot. It seems more faster,more features and smarter ,like set different stopwords in different situations.
And I find a way to use it without subscribe, you can try. Like moyix said we must to rewrite raw extensions code for skip the boring authentication process.
- set github copilot extension config
"github.copilot.advanced": {
"model": "fastertransformer",
"debug.overrideEngine": "codegen",
"debug.testOverrideProxyUrl": "http://192.168.1.161:5000",
"debug.overrideProxyUrl": "http://192.168.1.161:5000"
},
- Use the attached js file to override copilot raw file on
~\.vscode\extensions\github.copilot-1.54.7077\dist\extension.js
(you can do it by youself, the file I provided only for version 1.54.7077 ) - Set copilot to Ignore updates or you will lost the Hack code
Another thing is I must change this to yield f'{json.dumps(completion)}
. Seems stream fomart are different.
from fauxpilot.
Hi @shadowwider, where is the attached js? I also want to use GitHub copilot extension with fauxpilot server.
from fauxpilot.
I encounter this error while using the copilot plugin [ERROR] [streamChoices] Error parsing JSON stream data.
Is there anything that I missing?
from fauxpilot.
The Copilot extension needs well formatted streaming response, but the copilot_proxy code seems to return badly formatted data. Here's an example of the streamed response:
data: data: {"id": "cmpl-6TMRfgynXT3wpdrNOVZgS4is5DadC", "model": "codegen", "object": "text_completion", "created": 1671816259, "choices": [{"text": ",\n )\n return self._s", "index": 0, "finish_reason": "length", "logprobs": null}], "usage": {"completion_tokens": 10, "prompt_tokens": 1, "total_tokens": 11}}
data:
data:
data: data: [DONE]
data:
data:
As you can see, there's data: data: {..actual_json_stuff..}
, whereas it should just be data: {..actual_json_stuff..}
. I'm unable to determine what's adding the first "data:". The second "data:" is coming from code in utils/code_gen.py. Removing the data:
prefix there seems to fix this issue -- I do see inline suggestions.
However, I think we need to make some more changes on the backend (preferrably in the fastertransformer backend, otherwise at least in the proxy) for better integration with the Copilot extension (if that's desired).
For instance, currently the "stop tokens" logic is not correct ( #85 ), because of which the client gets an overly long response. In my case, 500 tokens were being returned, including logprobs. The client then just trims the result with appropriate stop tokens. This results in wasted compute and poor latency. Ideally, the stopword logic would be correctly handled in the fastertransformer backend itself, however that's not happening.
from fauxpilot.
@Venthe First of all thanks for making the plugin! It worked for me. I was looking at the source code for your plugin. I was wondering how much of the plugin you have adapted from Open AI Co-pilot plugin. The reason I was asking this is merely coz I want to make sure that there is no way that the extension can contact the OpenAI servers due to security policy of being able to use it at work.
For example, even when we set the server address to the local codegen one using config in the OpenAI co-pilot plugin ( that is used for recommendation generation) , there were traces of code responsible for token handling that were contacting Github.
I'm gonna try to read more about VSCode plugins in the meantime. Again, thanks for your plugin.
from fauxpilot.
@Venthe First of all thanks for making the plugin! It worked for me. I was looking at the source code for your plugin. I was wondering how much of the plugin you have adapted from Open AI Co-pilot plugin. The reason I was asking this is merely coz I want to make sure that there is no way that the extension can contact the OpenAI servers due to security policy of being able to use it at work.
For example, even when we set the server address to the local codegen one using config in the OpenAI co-pilot plugin ( that is used for recommendation generation) , there were traces of code responsible for token handling that were contacting Github.
I'm gonna try to read more about VSCode plugins in the meantime. Again, thanks for your plugin.
Not at all, happy to provide.
It was - and is - basically a hack done in few hours (and my first plugin for vscode); and the only parts that I've been "using" from the other repo was the actual API call. At the time there was no option to use fauxpilot in Code without severe tinkering with original copilot plugin (basically removing the token handling and more as far as I remember).
At this point the plug-in for me is done as it is working fine; I'm only improving it as per feature requests though considering that Gitlab has made their own version of fauxpilot client, i believe that mine is quite obsolete at this point
from fauxpilot.
Hi @Venthe
At this point the plug-in for me is done as it is working fine; I'm only improving it as per feature requests though considering that Gitlab has made their own version of fauxpilot client, i believe that mine is quite obsolete at this point
GitLab actually (very unfortunately) dropped support for FauxPilot https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/merge_requests/697
It might be worth adopting some of the mechanisms from that plugin such as the debounce mechanism, yours doesn't actually work as intended. I think it would be a good idea to adopt your plugin into the FauxPilot organization since you have the plugin already published on the marketplace. WDYT?
But to answer @mithandir's question, ideally the plugin for FauxPilot should adopt the interface from OpenAI in the bare bones setup so we are 100% sure no data is send to OpenAI (now or in the future).
from fauxpilot.
Sourcegraph recently open-sourced their client Cody (https://github.com/sourcegraph/sourcegraph/blob/main/client/cody/src/completions/index.ts). They're still building it, but that's also a good opportunity to contribute early enough so that there's support for FauxPilot.
from fauxpilot.
GitLab actually (very unfortunately) dropped support for FauxPilot https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/merge_requests/697
Good to know, thanks
It might be worth adopting some of the mechanisms from that plugin such as the debounce mechanism, yours doesn't actually work as intended.
Hahah, yeah, it does not. I've cobbled a dirty solution because the only library that I've worked with that had debounce was heavy, and I needed it to "at least" work. I knew that it will catch up to me:)
I think it would be a good idea to adopt your plugin into the FauxPilot organization since you have the plugin already published on the marketplace. WDYT?
No problem with that; I can keep it in my namespace or move it to org; but this is not ultimately question for me I believe. My only "requirement" is for it to stay MIT or similar license.
(...) ideally the plugin for FauxPilot should adopt the interface from OpenAI
Please bear in mind; that I have zero understanding about the API - that's why I've specifically noted that it was a quick job, the plug-in. I'm happy to contribute, but I'll need at least some guidance in that regard.
from fauxpilot.
Related Issues (20)
- `nvidia-docker` really required? HOT 2
- fauxpilot in cuda 11.7 HOT 1
- Minimum required gpu config HOT 3
- fastertransformer not available HOT 7
- "[StatusCode.UNIMPLEMENTED] Received http2 header with status: 404" from fauxpilot-copilot_proxy-1 HOT 1
- Do you have a client plugin for idea? HOT 2
- Can i add some other models to fauxpilot except codegen series, like gpt-neo. HOT 3
- Does fauxpilot support adding our own data set for finetuning? Thank you! HOT 3
- I try to use VSCode Copilot plugin by edit settings.json, but it seems that no requests have been sent to my local server HOT 6
- Python backend - fauxpilot-copilot_proxy failed to connect to all addresses HOT 8
- Support for the new replit-code-v1-3b model
- Support for StarCoder HOT 1
- CodeGen2 compatibility HOT 9
- CodeT5+ as the next model for FauxPilot? HOT 2
- can I launch fauxpilot without docker installation in notebook? HOT 1
- could Fauxpilot help to generate unit test for java code?
- Is it normal so much time to build? HOT 4
- Infinite time to (load?) and then it doen't even work?? HOT 4
- [bug] docker(version 20.10.21) version parse error in launch.sh HOT 1
- Support arm64 to minimize cost
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fauxpilot.