📝 updating reference for models

This commit is contained in:
Nate Sesti 2023-11-15 00:42:09 -08:00
parent 35e08e5f9b
commit ef42d7604d
31 changed files with 327 additions and 395 deletions

View file

@ -2,17 +2,17 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
# AnthropicLLM
Import the `AnthropicLLM` class and set it as the default model:
To setup Anthropic, add the following to your `config.json` file:
```python title="~/.continue/config.py"
from continuedev.libs.llm.anthropic import AnthropicLLM
config = ContinueConfig(
...
models=Models(
default=AnthropicLLM(api_key="<API_KEY>", model="claude-2")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Anthropic",
"provider": "anthropic",
"model": "claude-2",
"api_key": "YOUR_API_KEY"
}]
}
```
Claude 2 is not yet publicly released. You can request early access [here](https://www.anthropic.com/earlyaccess).

View file

@ -4,19 +4,17 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
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.
Once the model is running on localhost:8000, change `~/.continue/config.py` to look like this:
Once the model is running on localhost:8000, change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.libs.llm.ggml import GGML
config = ContinueConfig(
...
models=Models(
default=GGML(
max_context_length=2048,
server_url="http://localhost:8000")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "GGML",
"provider": "openai-aiohttp",
"model": "MODEL_NAME",
"api_base": "http://localhost:8000"
}]
}
```
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/ggml.py)

View file

@ -2,20 +2,17 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
# GooglePaLMAPI
The Google PaLM API is currently in public preview, so production applications are not supported yet. However, you can [create an API key in Google MakerSuite](https://makersuite.google.com/u/2/app/apikey) and begin trying out the `chat-bison-001` model. Change `~/.continue/config.py` to look like this:
The Google PaLM API is currently in public preview, so production applications are not supported yet. However, you can [create an API key in Google MakerSuite](https://makersuite.google.com/u/2/app/apikey) and begin trying out the `chat-bison-001` model. Change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.core.models import Models
from continuedev.libs.llm.hf_inference_api import GooglePaLMAPI
config = ContinueConfig(
...
models=Models(
default=GooglePaLMAPI(
model="chat-bison-001"
api_key="<MAKERSUITE_API_KEY>",
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Chat Bison",
"provider": "google-palm",
"model": "chat-bison-001",
"api_key": "YOUR_API_KEY"
}]
}
```
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/google_palm_api.py)

View file

@ -2,20 +2,18 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
# HuggingFaceInferenceAPI
Hugging Face Inference API is a great option for newly released language models. Sign up for an account and add billing [here](https://huggingface.co/settings/billing), access the Inference Endpoints [here](https://ui.endpoints.huggingface.co), click on “New endpoint”, and fill out the form (e.g. select a model like [WizardCoder-Python-34B-V1.0](https://huggingface.co/WizardLM/WizardCoder-Python-34B-V1.0)), and then deploy your model by clicking “Create Endpoint”. Change `~/.continue/config.py` to look like this:
Hugging Face Inference API is a great option for newly released language models. Sign up for an account and add billing [here](https://huggingface.co/settings/billing), access the Inference Endpoints [here](https://ui.endpoints.huggingface.co), click on “New endpoint”, and fill out the form (e.g. select a model like [WizardCoder-Python-34B-V1.0](https://huggingface.co/WizardLM/WizardCoder-Python-34B-V1.0)), and then deploy your model by clicking “Create Endpoint”. Change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.core.models import Models
from continuedev.libs.llm.hf_inference_api import HuggingFaceInferenceAPI
config = ContinueConfig(
...
models=Models(
default=HuggingFaceInferenceAPI(
endpoint_url="<INFERENCE_API_ENDPOINT_URL>",
hf_token="<HUGGING_FACE_TOKEN>",
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Hugging Face Inference API",
"provider": "huggingface-inference-api",
"model": "MODEL_NAME",
"api_key": "YOUR_HF_TOKEN",
"api_base": "INFERENCE_API_ENDPOINT_URL"
}]
}
```
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/hf_inference_api.py)

View file

@ -8,19 +8,17 @@ Run the llama.cpp server binary to start the API server. If running on a remote
.\server.exe -c 4096 --host 0.0.0.0 -t 16 --mlock -m models\meta\llama\codellama-7b-instruct.Q8_0.gguf
```
After it's up and running, change `~/.continue/config.py` to look like this:
After it's up and running, change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.libs.llm.llamacpp import LlamaCpp
config = ContinueConfig(
...
models=Models(
default=LlamaCpp(
max_context_length=4096,
server_url="http://localhost:8080")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Llama CPP",
"provider": "llama.cpp",
"model": "MODEL_NAME",
"api_base": "http://localhost:8080"
}]
}
```
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/llamacpp.py)

View file

@ -4,15 +4,14 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
[Ollama](https://ollama.ai/) is an application for Mac and Linux that makes it easy to locally run open-source models, including Llama-2. Download the app from the website, and it will walk you through setup in a couple of minutes. You can also read more in their [README](https://github.com/jmorganca/ollama). Continue can then be configured to use the `Ollama` LLM class:
```python title="~/.continue/config.py"
from continuedev.libs.llm.ollama import Ollama
config = ContinueConfig(
...
models=Models(
default=Ollama(model="llama2")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Ollama",
"provider": "ollama",
"model": "llama2-7b",
}]
}
```
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/ollama.py)

View file

@ -4,21 +4,18 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
The OpenAI class can be used to access OpenAI models like gpt-4 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` in the `OpenAI` class like this:
If you are locally serving a model that uses an OpenAI-compatible server, you can simply change the `api_base` like this:
```python title="~/.continue/config.py"
from continuedev.libs.llm.openai import OpenAI
config = ContinueConfig(
...
models=Models(
default=OpenAI(
api_key="EMPTY",
model="<MODEL_NAME>",
api_base="http://localhost:8000", # change to your server
)
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "OpenAI-compatible server",
"provider": "openai",
"model": "MODEL_NAME",
"api_key": "EMPTY",
"api_base": "http://localhost:8000"
}]
}
```
Options for serving models locally with an OpenAI-compatible server include:

View file

@ -7,24 +7,32 @@ With the `OpenAIFreeTrial` `LLM`, new users can try out Continue with GPT-4 usin
Once you are using Continue regularly though, you will need to add an OpenAI API key that has access to GPT-4 by following these steps:
1. Copy your API key from https://platform.openai.com/account/api-keys
2. Open `~/.continue/config.py`. You can do this by using the '/config' command in Continue
2. Open `~/.continue/config.json`. You can do this by using the '/config' command in Continue
3. Change the default LLMs to look like this:
```python title="~/.continue/config.py"
API_KEY = "<API_KEY>"
config = ContinueConfig(
...
models=Models(
default=OpenAIFreeTrial(model="gpt-4", api_key=API_KEY),
summarize=OpenAIFreeTrial(model="gpt-3.5-turbo", api_key=API_KEY)
)
)
```json title="~/.continue/config.json"
{
"models": [
{
"title": "GPT-4",
"provider": "openai",
"model": "gpt-4",
"api_key": "YOUR_API_KEY"
},
{
"title": "GPT-3.5-Turbo",
"provider": "openai",
"model": "gpt-3.5-turbo",
"api_key": "YOUR_API_KEY"
}
],
"model_roles": {
"default": "GPT-4",
"summarize": "GPT-3.5-Turbo"
}
}
```
The `OpenAIFreeTrial` class will automatically switch to using your API key instead of ours. If you'd like to explicitly use one or the other, you can use the `ProxyServer` or `OpenAI` classes instead.
These classes support any models available through the OpenAI API, assuming your API key has access, including "gpt-4", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", and "gpt-4-32k".
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/openai_free_trial.py)
## Properties

View file

@ -2,20 +2,17 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
# ReplicateLLM
Replicate is a great option for newly released language models or models that you've deployed through their platform. Sign up for an account [here](https://replicate.ai/), copy your API key, and then select any model from the [Replicate Streaming List](https://replicate.com/collections/streaming-language-models). Change `~/.continue/config.py` to look like this:
Replicate is a great option for newly released language models or models that you've deployed through their platform. Sign up for an account [here](https://replicate.ai/), copy your API key, and then select any model from the [Replicate Streaming List](https://replicate.com/collections/streaming-language-models). Change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.core.models import Models
from continuedev.libs.llm.replicate import ReplicateLLM
config = ContinueConfig(
...
models=Models(
default=ReplicateLLM(
model="replicate/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b",
api_key="my-replicate-api-key")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Replicate CodeLLama",
"provider": "replicate",
"model": "codellama-13b",
"api_key": "YOUR_API_KEY"
}]
}
```
If you don't specify the `model` parameter, it will default to `replicate/llama-2-70b-chat:58d078176e02c219e11eb4da5a02a7830a283b14cf8f94537af893ccff5ee781`.

View file

@ -4,17 +4,14 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
TextGenWebUI is a comprehensive, open-source language model UI and local server. You can set it up with an OpenAI-compatible server plugin, but if for some reason that doesn't work, you can use this class like so:
```python title="~/.continue/config.py"
from continuedev.libs.llm.text_gen_webui import TextGenWebUI
config = ContinueConfig(
...
models=Models(
default=TextGenWebUI(
model="<MODEL_NAME>",
)
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Text Generation WebUI",
"provider": "text-gen-webui",
"model": "MODEL_NAME"
}]
}
```
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/text_gen_webui.py)

View file

@ -2,21 +2,17 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
# TogetherLLM
The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/models-inference). Change `~/.continue/config.py` to look like this:
The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/models-inference). Change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.core.models import Models
from continuedev.libs.llm.together import TogetherLLM
config = ContinueConfig(
...
models=Models(
default=TogetherLLM(
api_key="<API_KEY>",
model="togethercomputer/llama-2-13b-chat"
)
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Together CodeLlama",
"provider": "together",
"model": "codellama-13b",
"api_key": "YOUR_API_KEY"
}]
}
```
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/together.py)

View file

@ -1,6 +1,6 @@
import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
# SerializedContinueConfig
# Configuration Options
@ -18,11 +18,11 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
<ClassPropertyRef name='custom_commands' details='{&quot;title&quot;: &quot;Custom Commands&quot;, &quot;description&quot;: &quot;An array of custom commands that allow you to reuse prompts. Each has name, description, and prompt properties. When you enter /&lt;name&gt; in the text input, it will act as a shortcut to the prompt.&quot;, &quot;default&quot;: [{&quot;name&quot;: &quot;test&quot;, &quot;prompt&quot;: &quot;Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don&#x27;t edit any file.&quot;, &quot;description&quot;: &quot;This is an example custom command. Use /config to edit it and create more&quot;}], &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: {&quot;$ref&quot;: &quot;#/definitions/CustomCommand&quot;}}' required={false} default="[{&#x27;name&#x27;: &#x27;test&#x27;, &#x27;prompt&#x27;: &quot;Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don&#x27;t edit any file.&quot;, &#x27;description&#x27;: &#x27;This is an example custom command. Use /config to edit it and create more&#x27;}]"/>
<ClassPropertyRef name='context_providers' details='{&quot;title&quot;: &quot;Context Providers&quot;, &quot;description&quot;: &quot;A list of ContextProvider objects that can be used to provide context to the LLM by typing &#x27;@&#x27;. Read more about ContextProviders in the documentation.&quot;, &quot;default&quot;: [], &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: {&quot;$ref&quot;: &quot;#/definitions/ContextProviderWithParams&quot;}}' required={false} default="[]"/>
<ClassPropertyRef name='user_token' details='{&quot;title&quot;: &quot;User Token&quot;, &quot;description&quot;: &quot;An optional token to identify the user.&quot;, &quot;type&quot;: &quot;string&quot;}' required={false} default=""/>
<ClassPropertyRef name='data_server_url' details='{&quot;title&quot;: &quot;Data Server Url&quot;, &quot;description&quot;: &quot;The URL of the server where development data is sent. No data is sent unless a valid user token is provided.&quot;, &quot;default&quot;: &quot;https://us-west1-autodebug.cloudfunctions.net&quot;, &quot;type&quot;: &quot;string&quot;}' required={false} default="https://us-west1-autodebug.cloudfunctions.net"/>
<ClassPropertyRef name='data_server_url' details='{&quot;title&quot;: &quot;Data Server Url&quot;, &quot;description&quot;: &quot;The URL of the server where development data is sent. No data is sent unless you have explicitly set the `user_token` property to a valid token that we have shared.&quot;, &quot;default&quot;: &quot;https://us-west1-autodebug.cloudfunctions.net&quot;, &quot;type&quot;: &quot;string&quot;}' required={false} default="https://us-west1-autodebug.cloudfunctions.net"/>
<ClassPropertyRef name='disable_summaries' details='{&quot;title&quot;: &quot;Disable Summaries&quot;, &quot;description&quot;: &quot;If set to `True`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.&quot;, &quot;default&quot;: false, &quot;type&quot;: &quot;boolean&quot;}' required={false} default="False"/>
<ClassPropertyRef name='disable_indexing' details='{&quot;title&quot;: &quot;Disable Indexing&quot;, &quot;description&quot;: &quot;If set to `True`, Continue will not index the codebase. This is mainly used for debugging purposes.&quot;, &quot;default&quot;: false, &quot;type&quot;: &quot;boolean&quot;}' required={false} default="False"/>
<ClassPropertyRef name='retrieval_settings' details='{&quot;title&quot;: &quot;Retrieval Settings&quot;, &quot;description&quot;: &quot;Settings for the retrieval system. Read more about the retrieval system in the documentation.&quot;, &quot;default&quot;: {&quot;n_retrieve&quot;: 50, &quot;n_final&quot;: 10, &quot;use_reranking&quot;: true, &quot;rerank_group_size&quot;: 5, &quot;ignore_files&quot;: [], &quot;openai_api_key&quot;: null, &quot;api_base&quot;: null, &quot;api_type&quot;: null, &quot;api_version&quot;: null, &quot;organization_id&quot;: null}, &quot;allOf&quot;: [{&quot;$ref&quot;: &quot;#/definitions/RetrievalSettings&quot;}]}' required={false} default="{&#x27;n_retrieve&#x27;: 50, &#x27;n_final&#x27;: 10, &#x27;use_reranking&#x27;: True, &#x27;rerank_group_size&#x27;: 5, &#x27;ignore_files&#x27;: [], &#x27;openai_api_key&#x27;: None, &#x27;api_base&#x27;: None, &#x27;api_type&#x27;: None, &#x27;api_version&#x27;: None, &#x27;organization_id&#x27;: None}"/>
### Inherited Properties

View file

@ -4,7 +4,6 @@ description: Continue collects anonymous usage information
keywords: [telemetry, anonymous, usage info, opt out]
---
# 🦔 Telemetry
## Overview
@ -25,13 +24,13 @@ All data is anonymous and cleaned of PII before being sent to PostHog.
## How to opt out
The `~/.continue` directory contains a `config.py` file that looks like this:
The `~/.continue` directory contains a `config.json` file that looks like this:
```python
config = ContinueConfig(
allow_anonymous_telemetry=True,
```json title="~/.continue/config.json"
{
"allow_anonymous_telemetry": true,
...
)
}
```
You can turn off anonymous telemetry by changing the value of `allow_anonymous_telemetry` to `False`.
You can turn off anonymous telemetry by changing the value of `allow_anonymous_telemetry` to `false`.

View file

@ -8,20 +8,15 @@ keywords: [talk, embeddings, codebase, experimental]
Continue indexes your codebase so that when you input a message using Command+Enter, it can automatically pull in the most relevant context from throughout your workspace. This is done via a combination of embeddings-based retrieval and keyword search. By default, all embeddings are calculated locally with `all-MiniLM-L6-v2` and stored locally in `~/.continue/embeddings`.
The codebase retrieval feature allows the following customization options by editing `config.py` as follows:
The codebase retrieval feature allows the following customization options by editing `config.json` as follows:
```python
from continuedev.core.config import RetrievalSettings
...
config = ContinueConfig(
...
retrieval_settings=RetrievalSettings(
n_retrieve=100,
```json title="~/.continue/config.json"
{
"retrieval_settings": {
"n_retrieve": 100,
...
)
)
}
}
```
### `n_retrieve`

View file

@ -14,80 +14,72 @@ If you haven't already installed Continue, you can do that [here](https://market
1. Create an account [here](https://api.together.xyz/signup)
2. Copy your API key that appears on the welcome screen
3. Click the "play" button on Code Llama Instruct (13B) on the [Together Models list](https://docs.together.ai/docs/models-inference)
4. Update your Continue config file to look like this:
3. Update your Continue config file like this:
```python
from continuedev.core.models import Models
from continuedev.libs.llm.together import TogetherLLM
config = ContinueConfig(
...
models=Models(
default=TogetherLLM(
api_key="<API_KEY>",
model="togethercomputer/CodeLlama-13b-Instruct"
)
)
)
```json title="~/.continue/config.json"
{
"models": [
{
"title": "Code Llama",
"provider": "together",
"model": "togethercomputer/CodeLlama-13b-Instruct",
"api_key": "<API_KEY>"
}
]
}
```
## Ollama
1. Download Ollama [here](https://ollama.ai/) (it should walk you through the rest of these steps)
2. Open a terminal and run `ollama run codellama`\*
3. Change your Continue config file to look like this:
2. Open a terminal and run `ollama run codellama`
3. Change your Continue config file like this:
```python
from continuedev.libs.llm.ollama import Ollama
config = ContinueConfig(
...
models=Models(
default=Ollama(model="codellama")
)
)
```json title="~/.continue/config.json"
{
"models": [
{
"title": "Code Llama",
"provider": "ollama",
"model": "codellama-7b"
}
]
}
```
5. Reload the VS Code window for changes to take effect
\*Only the 7b model is available right now. The others will be ready later today or tomorrow.
## Replicate
1. Get your Replicate API key [here](https://replicate.ai/)
2. Change your Continue config file to look like this:
2. Change your Continue config file like this:
```python
from continuedev.core.models import Models
from continuedev.libs.llm.replicate import ReplicateLLM
config = ContinueConfig(
...
models=Models(
default=ReplicateLLM(
model="replicate/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b",
api_key="<MY_REPLICATE_API_KEY>")
)
)
```json title="~/.continue/config.json"
{
"models": [
{
"title": "Code Llama",
"provider": "replicate",
"model": "codellama-7b",
"api_key": "<API_KEY>"
}
]
}
```
3. Reload the VS Code window for changes to take effect
## FastChat API
1. Setup the FastChat API (https://github.com/lm-sys/FastChat) to use one of the Codellama models on Hugging Face (e.g: codellama/CodeLlama-7b-Instruct-hf).
2. Start the OpenAI compatible API (ref: https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md).
3. Change your Continue config file to look like this:
3. Change your Continue config file like this:
```python
config = ContinueConfig(
...
models=Models(default=OpenAI(
model="CodeLlama-7b-Instruct-hf",
api_base="http://localhost:8000/v1"
))
)
```json title="~/.continue/config.json"
{
"models": [
{
"title": "Code Llama",
"provider": "openai",
"model": "codellama-7b",
"api_base": "http://localhost:8000/v1"
}
]
}
```
4. Reload the VS Code window for changes to take effect.

View file

@ -4,7 +4,6 @@ description: How to run Continue without Internet
keywords: [no internet, air-gapped, local model]
---
# Running Continue without Internet
Continue can be run even on an air-gapped computer if you use a local model. You'll have to make a few adjustments for this to work.
@ -12,6 +11,6 @@ Continue can be run even on an air-gapped computer if you use a local model. You
1. Download the latest .vsix file from the [Open VSX Registry](https://open-vsx.org/extension/Continue/continue) and [install it to VS Code](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix).
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.py` and set `allow_anonymous_telemetry=False`. This will stop Continue from attempting requests to PostHog.
5. Also in `config.py`, set the default model to a local model. You can read about the available options [here](../customization/models.md).
6. Restart VS Code for changes to `config.py` to take effect.
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).
6. Restart VS Code to ensure that the changes to `config.json` take effect.

View file

@ -1,24 +1,23 @@
from typing import Any, Callable, Coroutine, Optional
from typing import Any, Coroutine, Optional
from anthropic import AI_PROMPT, HUMAN_PROMPT, AsyncAnthropic
from .base import LLM, CompletionOptions
from .prompts.chat import anthropic_template_messages
class AnthropicLLM(LLM):
"""
Import the `AnthropicLLM` class and set it as the default model:
To setup Anthropic, add the following to your `config.json` file:
```python title="~/.continue/config.py"
from continuedev.libs.llm.anthropic import AnthropicLLM
config = ContinueConfig(
...
models=Models(
default=AnthropicLLM(api_key="<API_KEY>", model="claude-2")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Anthropic",
"provider": "anthropic",
"model": "claude-2",
"api_key": "YOUR_API_KEY"
}]
}
```
Claude 2 is not yet publicly released. You can request early access [here](https://www.anthropic.com/earlyaccess).

View file

@ -1,5 +1,5 @@
import json
from typing import Any, Callable, Coroutine, Dict, List, Literal, Optional
from typing import Any, Coroutine, List, Literal, Optional
from pydantic import Field, validator
@ -7,27 +7,23 @@ from ...core.main import ChatMessage, ContinueCustomException
from ..util.logging import logger
from .base import LLM, CompletionOptions
from .openai import CHAT_MODELS
from .prompts.chat import llama2_template_messages
from .prompts.edit import codellama_edit_prompt
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.
Once the model is running on localhost:8000, change `~/.continue/config.py` to look like this:
Once the model is running on localhost:8000, change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.libs.llm.ggml import GGML
config = ContinueConfig(
...
models=Models(
default=GGML(
max_context_length=2048,
server_url="http://localhost:8000")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "GGML",
"provider": "openai-aiohttp",
"model": "MODEL_NAME",
"api_base": "http://localhost:8000"
}]
}
```
"""
@ -96,7 +92,7 @@ class GGML(LLM):
**args,
},
headers=self.get_headers(),
proxy=self.proxy,
proxy=self.request_options.proxy,
) as resp:
if resp.status != 200:
raise Exception(
@ -135,7 +131,7 @@ class GGML(LLM):
self.get_full_server_url(endpoint="chat/completions"),
json={"messages": messages, "stream": True, **args},
headers=self.get_headers(),
proxy=self.proxy,
proxy=self.request_options.proxy,
) as resp:
if resp.status != 200:
detail = (
@ -196,7 +192,7 @@ class GGML(LLM):
**args,
},
headers=self.get_headers(),
proxy=self.proxy,
proxy=self.request_options.proxy,
) as resp:
if resp.status != 200:
raise Exception(

View file

@ -9,20 +9,17 @@ from .base import LLM
class GooglePaLMAPI(LLM):
"""
The Google PaLM API is currently in public preview, so production applications are not supported yet. However, you can [create an API key in Google MakerSuite](https://makersuite.google.com/u/2/app/apikey) and begin trying out the `chat-bison-001` model. Change `~/.continue/config.py` to look like this:
The Google PaLM API is currently in public preview, so production applications are not supported yet. However, you can [create an API key in Google MakerSuite](https://makersuite.google.com/u/2/app/apikey) and begin trying out the `chat-bison-001` model. Change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.core.models import Models
from continuedev.libs.llm.hf_inference_api import GooglePaLMAPI
config = ContinueConfig(
...
models=Models(
default=GooglePaLMAPI(
model="chat-bison-001"
api_key="<MAKERSUITE_API_KEY>",
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Chat Bison",
"provider": "google-palm",
"model": "chat-bison-001",
"api_key": "YOUR_API_KEY"
}]
}
```
"""

View file

@ -1,29 +1,25 @@
from typing import Callable, Dict, List, Optional, Union
from typing import Optional
from huggingface_hub import InferenceClient
from pydantic import Field
from .base import LLM, CompletionOptions
from .prompts.chat import llama2_template_messages
from .prompts.edit import codellama_edit_prompt
class HuggingFaceInferenceAPI(LLM):
"""
Hugging Face Inference API is a great option for newly released language models. Sign up for an account and add billing [here](https://huggingface.co/settings/billing), access the Inference Endpoints [here](https://ui.endpoints.huggingface.co), click on “New endpoint”, and fill out the form (e.g. select a model like [WizardCoder-Python-34B-V1.0](https://huggingface.co/WizardLM/WizardCoder-Python-34B-V1.0)), and then deploy your model by clicking “Create Endpoint”. Change `~/.continue/config.py` to look like this:
Hugging Face Inference API is a great option for newly released language models. Sign up for an account and add billing [here](https://huggingface.co/settings/billing), access the Inference Endpoints [here](https://ui.endpoints.huggingface.co), click on “New endpoint”, and fill out the form (e.g. select a model like [WizardCoder-Python-34B-V1.0](https://huggingface.co/WizardLM/WizardCoder-Python-34B-V1.0)), and then deploy your model by clicking “Create Endpoint”. Change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.core.models import Models
from continuedev.libs.llm.hf_inference_api import HuggingFaceInferenceAPI
config = ContinueConfig(
...
models=Models(
default=HuggingFaceInferenceAPI(
endpoint_url="<INFERENCE_API_ENDPOINT_URL>",
hf_token="<HUGGING_FACE_TOKEN>",
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Hugging Face Inference API",
"provider": "huggingface-inference-api",
"model": "MODEL_NAME",
"api_key": "YOUR_HF_TOKEN",
"api_base": "INFERENCE_API_ENDPOINT_URL"
}]
}
```
"""

View file

@ -1,13 +1,10 @@
import json
from typing import Any, Callable, List, Optional
from typing import Any, Optional
from pydantic import Field, validator
from ...core.main import ChatMessage
from ..util.count_tokens import DEFAULT_MAX_TOKENS
from .base import LLM, CompletionOptions
from .prompts.chat import llama2_template_messages
from .prompts.edit import codellama_edit_prompt
class HuggingFaceTGI(LLM):
@ -43,7 +40,7 @@ class HuggingFaceTGI(LLM):
f"{self.api_base}/generate_stream",
json={"inputs": prompt, "parameters": args},
headers={"Content-Type": "application/json"},
proxy=self.proxy,
proxy=self.request_options.proxy,
) as resp:
async for line in resp.content.iter_any():
if line:

View file

@ -1,19 +0,0 @@
# TODO: This class is far out of date
from transformers import AutoModelForCausalLM, AutoTokenizer
from .llm import LLM
class HuggingFace(LLM):
def __init__(self, model_path: str = "Salesforce/codegen-2B-mono"):
self.model_path = model_path
self.tokenizer = AutoTokenizer.from_pretrained(model_path)
self.model = AutoModelForCausalLM.from_pretrained(model_path)
def complete(self, prompt: str, **kwargs):
args = {"max_tokens": 100}
args.update(kwargs)
input_ids = self.tokenizer(prompt, return_tensors="pt").input_ids
generated_ids = self.model.generate(input_ids, max_length=args["max_tokens"])
return self.tokenizer.decode(generated_ids[0], skip_special_tokens=True)

View file

@ -1,11 +1,9 @@
import json
from typing import Any, Callable, Dict, Optional
from typing import Any, Dict, Optional
from pydantic import Field, validator
from .base import LLM
from .prompts.chat import llama2_template_messages
from .prompts.edit import codellama_edit_prompt
class LlamaCpp(LLM):
@ -16,19 +14,17 @@ class LlamaCpp(LLM):
.\server.exe -c 4096 --host 0.0.0.0 -t 16 --mlock -m models\meta\llama\codellama-7b-instruct.Q8_0.gguf
```
After it's up and running, change `~/.continue/config.py` to look like this:
After it's up and running, change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.libs.llm.llamacpp import LlamaCpp
config = ContinueConfig(
...
models=Models(
default=LlamaCpp(
max_context_length=4096,
server_url="http://localhost:8080")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Llama CPP",
"provider": "llama.cpp",
"model": "MODEL_NAME",
"api_base": "http://localhost:8080"
}]
}
```
"""

View file

@ -1,5 +1,5 @@
import json
from typing import Any, Callable, Dict, Optional
from typing import Any, Dict, Optional
from pydantic import Field, validator
@ -12,15 +12,14 @@ class Ollama(LLM):
"""
[Ollama](https://ollama.ai/) is an application for Mac and Linux that makes it easy to locally run open-source models, including Llama-2. Download the app from the website, and it will walk you through setup in a couple of minutes. You can also read more in their [README](https://github.com/jmorganca/ollama). Continue can then be configured to use the `Ollama` LLM class:
```python title="~/.continue/config.py"
from continuedev.libs.llm.ollama import Ollama
config = ContinueConfig(
...
models=Models(
default=Ollama(model="llama2")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Ollama",
"provider": "ollama",
"model": "llama2-7b",
}]
}
```
"""

View file

@ -41,21 +41,18 @@ class OpenAI(LLM):
"""
The OpenAI class can be used to access OpenAI models like gpt-4 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` in the `OpenAI` class like this:
If you are locally serving a model that uses an OpenAI-compatible server, you can simply change the `api_base` like this:
```python title="~/.continue/config.py"
from continuedev.libs.llm.openai import OpenAI
config = ContinueConfig(
...
models=Models(
default=OpenAI(
api_key="EMPTY",
model="<MODEL_NAME>",
api_base="http://localhost:8000", # change to your server
)
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "OpenAI-compatible server",
"provider": "openai",
"model": "MODEL_NAME",
"api_key": "EMPTY",
"api_base": "http://localhost:8000"
}]
}
```
Options for serving models locally with an OpenAI-compatible server include:

View file

@ -1,9 +1,9 @@
from typing import List, Optional
from ..util.count_tokens import CONTEXT_LENGTH_FOR_MODEL
from pydantic import validator
from ...core.main import ChatMessage
from ..util.count_tokens import CONTEXT_LENGTH_FOR_MODEL
from .base import LLM
from .openai import OpenAI
from .proxy_server import ProxyServer
@ -16,23 +16,31 @@ class OpenAIFreeTrial(LLM):
Once you are using Continue regularly though, you will need to add an OpenAI API key that has access to GPT-4 by following these steps:
1. Copy your API key from https://platform.openai.com/account/api-keys
2. Open `~/.continue/config.py`. You can do this by using the '/config' command in Continue
2. Open `~/.continue/config.json`. You can do this by using the '/config' command in Continue
3. Change the default LLMs to look like this:
```python title="~/.continue/config.py"
API_KEY = "<API_KEY>"
config = ContinueConfig(
...
models=Models(
default=OpenAIFreeTrial(model="gpt-4", api_key=API_KEY),
summarize=OpenAIFreeTrial(model="gpt-3.5-turbo", api_key=API_KEY)
)
)
```json title="~/.continue/config.json"
{
"models": [
{
"title": "GPT-4",
"provider": "openai",
"model": "gpt-4",
"api_key": "YOUR_API_KEY"
},
{
"title": "GPT-3.5-Turbo",
"provider": "openai",
"model": "gpt-3.5-turbo",
"api_key": "YOUR_API_KEY"
}
],
"model_roles": {
"default": "GPT-4",
"summarize": "GPT-3.5-Turbo"
}
}
```
The `OpenAIFreeTrial` class will automatically switch to using your API key instead of ours. If you'd like to explicitly use one or the other, you can use the `ProxyServer` or `OpenAI` classes instead.
These classes support any models available through the OpenAI API, assuming your API key has access, including "gpt-4", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", and "gpt-4-32k".
"""
llm: Optional[LLM] = None

View file

@ -6,25 +6,21 @@ from pydantic import Field
from ...core.main import ChatMessage
from .base import LLM
from .prompts.edit import codellama_edit_prompt
class ReplicateLLM(LLM):
"""
Replicate is a great option for newly released language models or models that you've deployed through their platform. Sign up for an account [here](https://replicate.ai/), copy your API key, and then select any model from the [Replicate Streaming List](https://replicate.com/collections/streaming-language-models). Change `~/.continue/config.py` to look like this:
Replicate is a great option for newly released language models or models that you've deployed through their platform. Sign up for an account [here](https://replicate.ai/), copy your API key, and then select any model from the [Replicate Streaming List](https://replicate.com/collections/streaming-language-models). Change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.core.models import Models
from continuedev.libs.llm.replicate import ReplicateLLM
config = ContinueConfig(
...
models=Models(
default=ReplicateLLM(
model="replicate/codellama-13b-instruct:da5676342de1a5a335b848383af297f592b816b950a43d251a0a9edd0113604b",
api_key="my-replicate-api-key")
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Replicate CodeLLama",
"provider": "replicate",
"model": "codellama-13b",
"api_key": "YOUR_API_KEY"
}]
}
```
If you don't specify the `model` parameter, it will default to `replicate/llama-2-70b-chat:58d078176e02c219e11eb4da5a02a7830a283b14cf8f94537af893ccff5ee781`.

View file

@ -12,17 +12,14 @@ class TextGenWebUI(LLM):
"""
TextGenWebUI is a comprehensive, open-source language model UI and local server. You can set it up with an OpenAI-compatible server plugin, but if for some reason that doesn't work, you can use this class like so:
```python title="~/.continue/config.py"
from continuedev.libs.llm.text_gen_webui import TextGenWebUI
config = ContinueConfig(
...
models=Models(
default=TextGenWebUI(
model="<MODEL_NAME>",
)
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Text Generation WebUI",
"provider": "text-gen-webui",
"model": "MODEL_NAME"
}]
}
```
"""

View file

@ -11,21 +11,17 @@ from .base import LLM
class TogetherLLM(LLM):
"""
The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/models-inference). Change `~/.continue/config.py` to look like this:
The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/models-inference). Change `~/.continue/config.json` to look like this:
```python title="~/.continue/config.py"
from continuedev.core.models import Models
from continuedev.libs.llm.together import TogetherLLM
config = ContinueConfig(
...
models=Models(
default=TogetherLLM(
api_key="<API_KEY>",
model="togethercomputer/llama-2-13b-chat"
)
)
)
```json title="~/.continue/config.json"
{
"models": [{
"title": "Together CodeLlama",
"provider": "together",
"model": "codellama-13b",
"api_key": "YOUR_API_KEY"
}]
}
```
"""

View file

@ -85,7 +85,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
{properties}
### Inherited Properties
{"### Inherited Properties" if inherited_properties else ""}
{inherited_properties}"""
)
@ -109,6 +109,7 @@ for module_name, module_title in LLM_MODULES:
config_module = importlib.import_module("continuedev.core.config")
config_obj = getattr(config_module, "SerializedContinueConfig")
schema = config_obj.schema()
schema["title"] = "Configuration Options"
markdown_docs = docs_from_schema(schema, "core/config.py")
with open("docs/docs/reference/config.md", "w") as f:
f.write(markdown_docs)

View file

@ -11,7 +11,7 @@ from ..libs.index.build_index import build_index
from ..libs.util.create_async_task import create_async_task
from ..libs.util.devdata import dev_data_logger
from ..libs.util.logging import logger
from ..libs.util.paths import getConfigFilePath, getDiffsFolderPath
from ..libs.util.paths import getConfigFilePath, getDiffsFolderPath, migration
from ..libs.util.telemetry import posthog_logger
from ..plugins.context_providers.file import FileContextProvider
from ..plugins.context_providers.highlighted_code import HighlightedCodeContextProvider
@ -89,6 +89,12 @@ class Window:
async def load(
self, config: Optional[ContinueConfig] = None, only_reloading: bool = False
):
async with migration("config_json_001"):
if self.ide is not None:
await self.ide.showMessage(
f"Continue has migrated to using a JSON config file (config.json). To learn more, visit https://continue.dev/docs/config-file-migration."
)
# Need a non-step way of sending a notification to the GUI. Fine to be displayed similarly
# formatted_err = "\n".join(traceback.format_exception(e, e, e.__traceback__))