Merge branch 'main' into preview

This commit is contained in:
Nate Sesti 2023-11-30 17:52:15 -08:00
commit 2aa2d5d012
22 changed files with 153 additions and 42 deletions

View file

@ -10,7 +10,7 @@ Continue can be deeply customized by editing `~/.continue/config.json` (`%userpr
Currently, you can customize the following:
- [Models](./models.md) - Use Continue with any LLM, including local models, Azure OpenAI service, any OpenAI-compatible API, and more.
- [Models](../model-setup/select-model.md) and [proivders](../model-setup/select-provider.md)
- [Context Providers](./context-providers.md) - Just type '@' to easily add attachments to your prompt. Define which sources you want to easily reference, including GitHub Issues, terminal output, and preset URLs.
- [Slash Commands](./slash-commands.md) - Call custom prompts or programs written with our SDK by typing `/`.
- [Other Configuration](./other-configuration.md) - Configure other settings like the system message and temperature.
- [Other Configuration](./other-configuration.md) - Configure other settings like the system message and temperature.

View file

@ -1,33 +1,10 @@
---
title: Models
description: Swap out different LLM providers
keywords: [openai, anthropic, PaLM, ollama, ggml]
title: Configuration
description: Configure your LLM and model provider
keywords: [configure, llm, provider]
---
# Models
Continue makes it easy to swap out different LLM providers. You can either click the "+" button next to the model dropdown to configure in the UI or manually add them to your `config.json`. Once you've done this, you will be able to switch between them with the model selection dropdown.
Commercial Models
- [OpenAIFreeTrial](../reference/Models/openaifreetrial.md) (default) - Use gpt-4 or gpt-3.5-turbo free with our API key, or with your API key. gpt-4 is probably the most capable model of all options.
- [OpenAI](../reference/Models/openai.md) - Use any OpenAI model with your own key. Can also change the base URL if you have a server that uses the OpenAI API format, including using the Azure OpenAI service, LocalAI, etc.
- [AnthropicLLM](../reference/Models/anthropicllm.md) - Use claude-2 with your Anthropic API key. Claude 2 is also highly capable, and has a 100,000 token context window.
- [GooglePaLMAPI](../reference/Models/googlepalmapi.md) - Try out the `chat-bison-001` model, which is currently in public preview, after creating an API key in [Google MakerSuite](https://makersuite.google.com/u/2/app/apikey)
Local Models
- [Ollama](../reference/Models/ollama.md) - If you are on Mac or Linux, Ollama is the simplest way to run open-source models like Code Llama.
- [OpenAI](../reference/Models/openai.md) - If you have access to an OpenAI-compatible server (e.g. llama-cpp-python, LocalAI, FastChat, TextGenWebUI, etc.), you can use the `OpenAI` class and just change the base URL.
- [GGML](../reference/Models/ggml.md) - An alternative way to connect to OpenAI-compatible servers. Will use `aiohttp` directly instead of the `openai` Python package.
- [LlamaCpp](../reference/Models/llamacpp.md) - Build llama.cpp from source and use its built-in API server.
- [Llamafile](../reference/Models/llamafile.md) - Use a self-contained llamafile
Open-Source Models (not local)
- [TogetherLLM](../reference/Models/togetherllm.md) - Use any model from the [Together Models list](https://docs.together.ai/docs/inference-models) with your Together API key.
- [ReplicateLLM](../reference/Models/replicatellm.md) - Use any open-source model from the [Replicate Streaming List](https://replicate.com/collections/streaming-language-models) with your Replicate API key.
- [HuggingFaceInferenceAPI](../reference/Models/huggingfaceinferenceapi.md) - Use any open-source model from the [Hugging Face Inference API](https://huggingface.co/inference-api) with your Hugging Face token.
# Configuration
## Change the default LLM
@ -98,7 +75,7 @@ If by chance the provider has the exact same API interface as OpenAI, the `OpenA
Most open-source models expect a specific chat format, for example llama2 and codellama expect the input to look like `"[INST] How do I write bubble sort in Rust? [/INST]"`. Continue will automatically attempt to detect the correct prompt format based on the `model`value that you provide, but if you are receiving nonsense responses, you can use the`template`property to explicitly set the format that you expect. The options are:`["llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml"]`.
If you want to create an entirely new chat template, this can be done in [config.py](./code-config.md) by defining a function and adding it to the `template_messages` property of your `LLM`. Here is an example of `template_messages` for the Alpaca/Vicuna format:
If you want to create an entirely new chat template, this can be done in [config.py](../customization/code-config.md) by defining a function and adding it to the `template_messages` property of your `LLM`. Here is an example of `template_messages` for the Alpaca/Vicuna format:
```python
def template_alpaca_messages(msgs: List[Dict[str, str]]) -> str:

View file

@ -0,0 +1,45 @@
---
title: Select model
description: Swap out different LLMs
keywords: [gpt-4, codellama, claude-2, wizardcoder, wizardcoder]
---
# Select a Large Language Model
Continue makes it easy to swap out different LLMs. You can either click the "+" button next to the model dropdown to configure in the GUI or manually add them to your `config.json`. Once you've done this, you will be able to switch between them in the model selection dropdown.
**In addition to selecting a LLM, you will need to figure out [what model provider to use](./select-provider.md).**
## Open-source LLMs
Models available for configuration in the GUI:
- [Code Llama-Instruct-7B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#1-code-llama)
- [Code Llama-Instruct-13B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#1-code-llama)
- [Code Llama-Instruct-34B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#1-code-llama)
- [WizardCoder-7B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#2-wizardcoder)
- [WizardCoder-13B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#2-wizardcoder)
- [WizardCoder-34B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#2-wizardcoder)
- [Phind-CodeLlama-34B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#3-phind-codellama)
- [Mistral-Instruct-7B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#4-mistral)
- [StarCoder-15B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#5-starcoder)
- [Deepseek-Coder-1.3b-Instruct](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#6-deepseek-coder)
- [Deepseek-Coder-6.7b-Instruct](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#6-deepseek-coder)
- [Deepseek-Coder-33b-Instruct](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#6-deepseek-coder)
- [Llama2-Chat-7B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#7-llama2)
- [Llama2-Chat-13B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#7-llama2)
- [Llama2-Chat-70B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#7-llama2)
- [CodeUp-13B](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf)
- [Zephyr-7B](https://huggingface.co/huggingfaceh4/zephyr-7b-beta)
**You can also use other open-source models**, but you will need to manually add them to your `config.json`.
## Commercial LLMs
Models available for configuration in the GUI:
- [GPT-4](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#1-gpt-4)
- [GPT-4-Turbo](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#2-gpt-4-turbo)
- [GPT-3.5-Turbo](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#3-gpt-35-turbo)
- [Claude-2](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#4-claude-2)
- [PaLM-2](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#5-palm-2)
**You can also use other commercial models**, but you will need to manually add them to your `config.json`.

View file

@ -0,0 +1,53 @@
---
title: Select a provider
description: Swap out different LLM providers
keywords: [openai, anthropic, PaLM, ollama, ggml]
---
# Select a model provider
Continue makes it easy to swap out different LLM providers. You can either click the "+" button next to the model dropdown to configure in the GUI or manually add them to your `config.json`. Once you've done this, you will be able to switch between them in the model selection dropdown.
**In addition to selecting a model provider, you will need to figure out [what LLM to use](./select-model.md).**
## Local
You can run a model on your local computer using:
- [Ollama](../reference/Model%20Providers/ollama.md)
- [LM Studio](../reference/Model%20Providers/ggml.md)
- [Llama.cpp](../reference/Model%20Providers/llamacpp.md)
- [LocalAI](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
- [Text generation web UI](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
- [FastChat](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
- [llama-cpp-python](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
Once you have it running, you will need to configure it in the GUI or manually add it to your `config.json`.
## Cloud
You can deploy a model in your [AWS](https://github.com/continuedev/deploy-os-code-llm#aws), [GCP](https://github.com/continuedev/deploy-os-code-llm#gcp), [Azure](https://github.com/continuedev/deploy-os-code-llm#azure), or [other clouds](https://github.com/continuedev/deploy-os-code-llm#others-2) using:
- [HuggingFace TGI](https://github.com/continuedev/deploy-os-code-llm#tgi)
- [vLLM](https://github.com/continuedev/deploy-os-code-llm#vllm)
- [SkyPilot](https://github.com/continuedev/deploy-os-code-llm#skypilot)
- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) (OpenAI compatible API)
Once you have it deloyed, you will need to wire up a new LLM class and manually add it to your `config.json`. This requires you to implement the `stream_complete`, `complete`, and `stream_chat` methods. You can see examples in [`server/continuedev/libs/llm`](https://github.com/continuedev/continue/tree/main/server/continuedev/libs/llm). However, if the provider has the exact same API interface as OpenAI, the `OpenAI` class will work for you. You will just need to change the `api_base` parameter.
## SaaS
### Open-source LLMs
You can deploy open-source LLMs on a service using:
- [Together](../reference/Model%20Providers/togetherllm.md)
- [HuggingFace Inference Endpoints](../reference/Model%20Providers/huggingfaceinferenceapi.md)
- [Anyscale Endpoints](../reference/Model%20Providers/openai.md) (OpenAI compatible API)
- [Replicate](../reference/Model%20Providers/replicatellm.md)
### Commercial LLMs
You can use commercial LLMs via APIs using:
- [OpenAI API](../reference/Model%20Providers/openai.md)
- [Azure OpenAI Service](../reference/Model%20Providers/openai.md) (OpenAI compatible API)
- [Anthrophic API](../reference/Model%20Providers/anthropicllm.md)
- [Google PaLM API](../reference/Model%20Providers/googlepalmapi.md)
- [OpenAI free trial](../reference/Model%20Providers/openaifreetrial.md)

View file

@ -12,5 +12,5 @@ Continue can be run even on an air-gapped computer if you use a local model. You
2. In VS Code settings, search "continue" and check the box that says "Manually Running Server". This will stop Continue from trying to kill and redownload the server binary.
3. Follow instructions to [run Continue manually](./manually-run-continue.md).
4. Open `~/.continue/config.json` and set `"allow_anonymous_telemetry": false`. This will stop Continue from attempting requests to PostHog.
5. Also in `config.json`, set the default model to a local model. You can read about the available options [here](../customization/models.md).
5. Also in `config.json`, set the default model to a local model. You can read about the available options [here](../model-setup/select-model.md).
6. Restart VS Code to ensure that the changes to `config.json` take effect.

View file

@ -18,6 +18,17 @@ const sidebars = {
"quickstart",
"how-to-use-continue",
"how-continue-works",
{
type: "category",
label: "🌉 Model setup",
collapsible: true,
collapsed: true,
items: [
"model-setup/select-provider",
"model-setup/select-model",
"model-setup/configuration",
],
},
{
type: "category",
label: "🎨 Customization",
@ -25,7 +36,6 @@ const sidebars = {
collapsed: true,
items: [
"customization/overview",
"customization/models",
"customization/context-providers",
"customization/slash-commands",
"customization/other-configuration",

View file

@ -13,6 +13,8 @@ class GGML(LLM):
"""
See our [5 minute quickstart](https://github.com/continuedev/ggml-server-example) to run any model locally with ggml. While these models don't yet perform as well, they are free, entirely private, and run offline.
You can also use this class for [LM Studio](https://lmstudio.ai).
Once the model is running on localhost:8000, change `~/.continue/config.json` to look like this:
```json title="~/.continue/config.json"

View file

@ -39,14 +39,45 @@ NON_CHAT_MODELS = {
class OpenAI(LLM):
"""
The OpenAI class can be used to access OpenAI models like gpt-4 and gpt-3.5-turbo.
The OpenAI class can be used to access OpenAI models like GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo.
If you are locally serving a model that uses an OpenAI-compatible server, you can simply change the `api_base` like this:
### Azure OpenAI Service
If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant. After applying for access [here](https://azure.microsoft.com/en-us/products/ai-services/openai-service), you will typically hear back within only a few days. Once you have access, set up a model in `config.json` like so:
```json
"models": [{
"title": "Azure OpenAI",
"provider": "openai",
"model": "gpt-4",
"api_base": "https://my-azure-openai-instance.openai.azure.com/",
"engine": "my-azure-openai-deployment",
"api_version": "2023-07-01-preview",
"api_type": "azure",
"api_key": "<MY_API_KEY>"
}]
```
The easiest way to find this information is from the chat playground in the Azure OpenAI portal. Under the "Chat Session" section, click "View Code" to see each of these parameters.
### OpenAI compatible servers / APIs
OpenAI compatible servers
- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation)
- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md)
- [LocalAI](https://localai.io/basics/getting_started/)
- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
OpenAI compatible APIs
- [Anyscale Endpoints](https://github.com/continuedev/deploy-os-code-llm#others)
- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints)
If you are [using an OpenAI compatible server / API](../model-setup/select-provider#local), you can change the `api_base` like this:
```json title="~/.continue/config.json"
{
"models": [{
"title": "OpenAI-compatible server",
"title": "OpenAI-compatible server / API",
"provider": "openai",
"model": "MODEL_NAME",
"api_key": "EMPTY",
@ -54,13 +85,6 @@ class OpenAI(LLM):
}]
}
```
Options for serving models locally with an OpenAI-compatible server include:
- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation)
- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md)
- [LocalAI](https://localai.io/basics/getting_started/)
- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
"""
api_key: str = Field(