Coder Social home page Coder Social logo

aronneburg / codeassistant-vscode-endpoint-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dahlker/codeassistant-vscode-endpoint-server

0.0 0.0 0.0 90 KB

LLM based code assistant endpoint server for tabnine/huggingface-vscode extensions

License: Apache License 2.0

Python 97.71% Dockerfile 2.29%

codeassistant-vscode-endpoint-server's Introduction

Hugging Face VSCode Endpoint Server

A server for huggingface-vscode custom endpoints using LLMs.

This fork properly handles multiple client requests, adds Bearer-token authentication and supports https.

Currently, we are not using batches for inference

  • for a single client, it's not required
  • multi-client use may benefit

Usage

Install pipenv Then run

pipenv install
CUDA_VISIBLE_DEVICES=<devices> pipenv run python -m app.main --api-type=code --pretrained=<model> --auth-prefix=<token> --port 8004

Use http://localhost:8000/api/generate/ as Hugging Face Code > Model ID or Endpoint in VSCode.

In VS code:

  • "Hugging Face Code: Set API token" (type Ctrl + Shift + P)
  • Set it according to the option: --auth-prefix, which defaults to "<secret-key>"

API

curl -X POST http://localhost:8000/api/generate/ -d '{"inputs": "def fib(n):", "parameters": {"max_new_tokens": "10"}}' -H "Authorization: Bearer <secret-key>"
# response = {"generated_text": "def fib(n):\n    if n == 0:\n        return"}

Completion triggers

The extension triggers, whenever one of the keys listed below gets typed.

If the IDE does not show a suggestion after you typed key, you can retrigger it by typing DEL + key. As the server caches previous completions, this is more efficient than continuing to type.

export const COMPLETION_TRIGGERS = [
  " ",
  ".",
  "(",
  ")",
  "{",
  "}",
  "[",
  "]",
  ",",
  ":",
  "'",
  '"',
  "=",
  "<",
  ">",
  "/",
  "\\",
  "+",
  "-",
  "|",
  "&",
  "*",
  "%",
  "=",
  "$",
  "#",
  "@",
  "!",
];

The source for the list of keys is consts.ts.

codeassistant-vscode-endpoint-server's People

Contributors

svenrohrtng avatar dahlker avatar lucienshui avatar aronneburg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.