Merge branch 'nate/jsonnnnn' into preview
This commit is contained in:
commit
f9d2378b54
113 changed files with 5399 additions and 2326 deletions
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
|
|
@ -51,6 +51,14 @@
|
|||
"module": "server.continuedev.models.reference.generate",
|
||||
"justMyCode": true
|
||||
},
|
||||
{
|
||||
"name": "Schema",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "continuedev.models.generate_json_schema",
|
||||
"justMyCode": true,
|
||||
"cwd": "${workspaceFolder}/server"
|
||||
},
|
||||
{
|
||||
"name": "Server",
|
||||
"type": "python",
|
||||
|
|
|
|||
25
docs/docs/config-file-migration.md
Normal file
25
docs/docs/config-file-migration.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Continue Configuration File Formats
|
||||
|
||||
On November 15, 2023, we migrated to using JSON as the primary config file format. If you previously used Continue, we will have attempted to automatically translate your existing config.py into a config.json file. If this fails, we will fallback to a default config.json.
|
||||
|
||||
The JSON format provides stronger guiderails, making it easier to write a valid config, while still allowing Intellisense in VS Code.
|
||||
|
||||
If you need any help migrating, please reach out to us on Discord.
|
||||
|
||||
## Configuration as Code
|
||||
|
||||
For configuration that requires code, we now provide a simpler interface that works alongside config.json. In the same folder, `~/.continue`, create a file named `config.py` (the same name as before) and add a function called `modify_config`. This function should take a `ContinueConfig` object as its only argument, and return a `ContinueConfig` object. This allows you to modify the initial configuration object defined in your `config.json`. Here's an example that cuts the temperature in half:
|
||||
|
||||
```python
|
||||
from continuedev.core.config import ContinueConfig
|
||||
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.completion_options.temperature /= 2
|
||||
return config
|
||||
```
|
||||
|
||||
To summarize, these are the steps taken to load your configuration:
|
||||
|
||||
1. Load `~/.continue/config.json`
|
||||
2. Convert this into a `ContinueConfig` object
|
||||
3. If `~/.continue/config.py` exists and has defined `modify_config` correctly, call `modify_config` with the `ContinueConfig` object to generate the final configuration
|
||||
19
docs/docs/customization/code-config.md
Normal file
19
docs/docs/customization/code-config.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Code Configuration
|
||||
|
||||
To allow added flexibility and eventually support an entire plugin ecosystem, Continue can be configured programmatically in a Python file, `~/.continue/config.py`.
|
||||
|
||||
Whenever Continue loads, it carries out the following steps:
|
||||
|
||||
1. Load `~/.continue/config.json`
|
||||
2. Convert this into a `ContinueConfig` object
|
||||
3. If `~/.continue/config.py` exists and has defined `modify_config` correctly, call `modify_config` with the `ContinueConfig` object to generate the final configuration
|
||||
|
||||
Defining a `modify_config` function allows you to make any final modifications to your initial `config.json`. Here's an example that cuts the temperature in half:
|
||||
|
||||
```python title="~/.continue/config.py"
|
||||
from continuedev.core.config import ContinueConfig
|
||||
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.completion_options.temperature /= 2
|
||||
return config
|
||||
```
|
||||
|
|
@ -16,88 +16,67 @@ When you enter your next input, Continue will see the full contents of each of t
|
|||
|
||||
## Built-in Context Providers
|
||||
|
||||
To use any of the built-in context providers, open `~/.continue/config.py` (can do this with the '/config' slash command). For each context provider, you will
|
||||
|
||||
1. Import the context provider at the top of the file
|
||||
2. Add it to the `context_providers` list in the `ContinueConfig` object
|
||||
|
||||
Setup instructions are below for each (showing the import and config object). You can also see examples by opening `~/.continue/config.py`.
|
||||
To use any of the built-in context providers, open `~/.continue/config.json` (can do this with the '/config' slash command) and add it to the `context_providers` list.
|
||||
|
||||
### GitHub
|
||||
|
||||
Type '@issue' to reference the title and contents of a GitHub issue.
|
||||
|
||||
```python
|
||||
from continuedev.plugins.context_providers.github import GitHubIssuesContextProvider
|
||||
```
|
||||
|
||||
```python
|
||||
GitHubIssuesContextProvider(
|
||||
repo_name="continuedev/continue", # change to whichever repo you want to use
|
||||
auth_token="<my_github_auth_token>",
|
||||
)
|
||||
```json
|
||||
{
|
||||
"name": "github",
|
||||
"params": {
|
||||
// Change to whichever repo you want to use
|
||||
"repo_name": "continuedev/continue",
|
||||
"auth_token": "<my_github_auth_token>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Codebase Search
|
||||
|
||||
Type '@search' to reference the results of codebase search, just like the results you would get from VS Code search.
|
||||
|
||||
```python
|
||||
from continuedev.plugins.context_providers.search import SearchContextProvider
|
||||
```
|
||||
|
||||
```python
|
||||
SearchContextProvider() # No arguments necessary
|
||||
```json
|
||||
{ "name": "search" }
|
||||
```
|
||||
|
||||
### URLs
|
||||
|
||||
Type '@url' to reference the contents of a URL. You can either reference preset URLs, or reference one dynamically by typing '@url https://example.com'. The text contents of the page will be fetched and used as context.
|
||||
|
||||
```python
|
||||
from continuedev.plugins.context_providers.url import URLContextProvider
|
||||
```
|
||||
|
||||
```python
|
||||
URLContextProvider(preset_urls=["https://continue.dev/docs/customization"])
|
||||
```json
|
||||
{
|
||||
"name": "url",
|
||||
"params": { "preset_urls": ["https://continue.dev/docs/customization"] }
|
||||
}
|
||||
```
|
||||
|
||||
### Git Diff
|
||||
|
||||
Type '@diff' to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing.
|
||||
|
||||
```python
|
||||
from continuedev.plugins.context_providers.diff import DiffContextProvider
|
||||
```
|
||||
|
||||
```python
|
||||
DiffContextProvider()
|
||||
```json
|
||||
{ "name": "diff" }
|
||||
```
|
||||
|
||||
### File Tree
|
||||
|
||||
Type '@tree' to reference the contents of your current workspace. The LLM will be able to see the nested directory structure of your project.
|
||||
|
||||
```python
|
||||
from continuedev.plugins.context_providers.filetree import FileTreeContextProvider
|
||||
```
|
||||
|
||||
```python
|
||||
FileTreeContextProvider()
|
||||
```json
|
||||
{ "name": "tree" }
|
||||
```
|
||||
|
||||
### Google
|
||||
|
||||
Type '@google' to reference the results of a Google search. For example, type "@google python tutorial" if you want to search and discuss ways of learning Python.
|
||||
|
||||
```python
|
||||
from continuedev.plugins.context_providers.google import GoogleContextProvider
|
||||
```
|
||||
|
||||
```python
|
||||
GoogleContextProvider(
|
||||
serper_api_key="<your serper.dev api key>"
|
||||
)
|
||||
```json
|
||||
{
|
||||
"name": "google",
|
||||
"params": { "serper_api_key": "<your serper.dev api key>" }
|
||||
}
|
||||
```
|
||||
|
||||
Note: You can get an API key for free at [serper.dev](https://serper.dev).
|
||||
|
|
@ -106,12 +85,8 @@ Note: You can get an API key for free at [serper.dev](https://serper.dev).
|
|||
|
||||
Type '@terminal' to reference the contents of your IDE's terminal.
|
||||
|
||||
```python
|
||||
from continuedev.plugins.context_providers.terminal import TerminalContextProvider
|
||||
```
|
||||
|
||||
```python
|
||||
TerminalContextProvider()
|
||||
```json
|
||||
{ "name": "terminal" }
|
||||
```
|
||||
|
||||
### Requesting Context Providers
|
||||
|
|
@ -156,16 +131,13 @@ class GitHubIssuesContextProvider(ContextProvider):
|
|||
|
||||
It can then be set in the `ContinueConfig` like so:
|
||||
|
||||
```python
|
||||
config = ContinueConfig(
|
||||
...
|
||||
context_providers=[
|
||||
GitHubIssuesContextProvider(
|
||||
```python title="~/.continue/config.py"
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.context_providers.append(GitHubIssuesContextProvider(
|
||||
repo_name="my-github-username-or-org/my-github-repo",
|
||||
auth_token="my-github-auth-token"
|
||||
)
|
||||
]
|
||||
)
|
||||
))
|
||||
return config
|
||||
```
|
||||
|
||||
This example is a situation where you request all of the data (issues in this case) beforehand, and store them in the ContextProvider.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ keywords: [openai, anthropic, PaLM, ollama, ggml]
|
|||
|
||||
# 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.py`. Once you've done this, you will be able to switch between them with the model selection dropdown.
|
||||
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
|
||||
|
||||
|
|
@ -30,61 +30,64 @@ Open-Source Models (not local)
|
|||
|
||||
## Change the default LLM
|
||||
|
||||
In `config.py`, you'll find the `models` property:
|
||||
In `config.json`, you'll find the `models` property, a list of the models that you have saved to use with Continue:
|
||||
|
||||
```python
|
||||
from continuedev.core.models import Models
|
||||
|
||||
config = ContinueConfig(
|
||||
...
|
||||
models=Models(
|
||||
default=OpenAIFreeTrial(model="gpt-4"),
|
||||
summarize=OpenAIFreeTrial(model="gpt-3.5-turbo")
|
||||
)
|
||||
)
|
||||
```json
|
||||
"models": [
|
||||
{
|
||||
"title": "Smart Model",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-4"
|
||||
},
|
||||
{
|
||||
"title": "Fast Model",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-3.5-turbo"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
The `default` and `summarize` properties are different _model roles_. This allows different models to be used for different tasks. The available roles are `default`, `summarize`, `edit`, and `chat`. `edit` is used when you use the '/edit' slash command, `chat` is used for all chat responses, and `summarize` is used for summarizing. If not set, all roles will fall back to `default`. The values of these fields must be of the [`LLM`](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/__init__.py) class, which implements methods for retrieving and streaming completions from an LLM.
|
||||
Also in `config.json` is the `model_roles` property. This is optional, but allows you to specify different models to be used for different tasks. The available roles are `default`, `summarize`, `edit`, and `chat`. `edit` is used when you use the '/edit' slash command, `chat` is used for all chat responses, and `summarize` is used for summarizing. If not set, all roles will fall back to `default`. The values of each role must match the `title` property of one of the models in `models`.
|
||||
|
||||
Below, we describe the `LLM` classes available in the Continue core library, and how they can be used.
|
||||
```json
|
||||
"model_roles": {
|
||||
"default": "Smart Model",
|
||||
"summarize": "Fast Model"
|
||||
}
|
||||
```
|
||||
|
||||
## Self-hosting an open-source model
|
||||
|
||||
If you want to self-host on Colab, RunPod, HuggingFace, Haven, or another hosting provider, you will need to wire up a new LLM class. It only needs to implement 3 primary methods: `stream_complete`, `complete`, and `stream_chat`, and you can see examples in `server/continuedev/libs/llm`.
|
||||
|
||||
If by chance the provider has the exact same API interface as OpenAI, the `OpenAI` class will work for you out of the box, after changing only the `api_base` parameter.
|
||||
Just by specifying the `model` and `provider` properties, we will automatically detect prompt templates and other important information, but if you're looking to do something beyond this basic setup, we'll explain a few other options below.
|
||||
|
||||
## 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, instantiate the model like so:
|
||||
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:
|
||||
|
||||
```python
|
||||
from continuedev.libs.llm.openai import OpenAI
|
||||
|
||||
config = ContinueConfig(
|
||||
...
|
||||
models=Models(
|
||||
default=OpenAI(
|
||||
api_key="my-api-key",
|
||||
model="gpt-3.5-turbo",
|
||||
api_base="https://my-azure-openai-instance.openai.azure.com/",
|
||||
engine="my-azure-openai-deployment",
|
||||
api_version="2023-07-01-preview",
|
||||
api_type="azure"
|
||||
)
|
||||
)
|
||||
)
|
||||
```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. Finally, find one of your Azure OpenAI keys and enter it in the VS Code settings under `continue.OPENAI_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.
|
||||
|
||||
Note that you can also use these parameters for uses other than Azure, such as self-hosting a model.
|
||||
## Self-hosting an open-source model
|
||||
|
||||
If you want to self-host on Colab, RunPod, HuggingFace, Haven, or another hosting provider, you will need to wire up a new LLM class. It only needs to implement 3 primary methods: `stream_complete`, `complete`, and `stream_chat`, and you can see examples in [`server/continuedev/libs/llm`](https://github.com/continuedev/continue/tree/main/server/continuedev/libs/llm).
|
||||
|
||||
If by chance the provider has the exact same API interface as OpenAI, the `OpenAI` class will work for you out of the box, after changing only the `api_base` parameter.
|
||||
|
||||
## Customizing the Chat Template
|
||||
|
||||
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]". Other than for the OpenAI classes, the llama2 chat format is the default, but this is not correct for all models. If you are receiving nonsense responses, you can use the `template_messages` property to set the chat template to match the model you are using. This property is a function that takes a list of `ChatMessage`s and returns a string.
|
||||
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"]`.
|
||||
|
||||
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](./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:
|
||||
|
|
@ -105,26 +108,17 @@ def template_alpaca_messages(msgs: List[Dict[str, str]]) -> str:
|
|||
|
||||
It can then be used like this:
|
||||
|
||||
```python
|
||||
from continuedev.libs.llm.chat import template_alpaca_messages
|
||||
from continuedev.libs.llm.ollama import Ollama
|
||||
...
|
||||
config=ContinueConfig(
|
||||
...
|
||||
models=Models(
|
||||
default=Ollama(
|
||||
model="vicuna",
|
||||
template_messages=template_alpaca_messages
|
||||
)
|
||||
)
|
||||
)
|
||||
```python title="~/.continue/config.py"
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.models[0].template_messages = template_alpaca_messages
|
||||
return config
|
||||
```
|
||||
|
||||
This exact function and a few other default implementations are available in [`continuedev.libs.llm.prompts.chat`](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/prompts/chat.py).
|
||||
|
||||
## Customizing the /edit Prompt
|
||||
|
||||
You also have access to customize the prompt used in the '/edit' slash command. We already have a well-engineered prompt for GPT-4 and a sensible default for less powerful open-source models, but you might wish to play with the prompt and try to find a more reliable alternative if you are for example getting English as well as code in your output.
|
||||
You also have access to customize the prompt used in the '/edit' slash command. We already have a well-engineered prompt for GPT-4 and sensible defaults for less powerful open-source models, but you might wish to play with the prompt and try to find a more reliable alternative if you are for example getting English as well as code in your output.
|
||||
|
||||
To customize the prompt, use the `prompt_templates` property of any `LLM`, which is a dictionary, and set the "edit" key to a template string with Mustache syntax. The 'file_prefix', 'file_suffix', 'code_to_edit', and 'user_input' variables are available in the template. Here is an example (the default for non-GPT-4 models):
|
||||
|
||||
|
|
@ -142,22 +136,12 @@ Output nothing except for the code. No code block, no English explanation, no st
|
|||
"""
|
||||
````
|
||||
|
||||
It can then be used like this:
|
||||
It can then be used like this in `config.py`:
|
||||
|
||||
```python
|
||||
from continuedev.libs.llm.ollama import Ollama
|
||||
...
|
||||
config=ContinueConfig(
|
||||
...
|
||||
models=Models(
|
||||
default=Ollama(
|
||||
model="vicuna",
|
||||
prompt_templates={
|
||||
"edit": "<INSERT_TEMPLATE_HERE>"
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
```python title="~/.continue/config.py"
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.models[0].prompt_templates["edit"] = "<INSERT_TEMPLATE_HERE>"
|
||||
return config
|
||||
```
|
||||
|
||||
A few pre-made templates are available in [`continuedev.libs.llm.prompts.edit`](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/prompts/edit.py).
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Set `temperature` to any value between 0 and 1. Higher values will make the LLM
|
|||
|
||||
Policies can be used to deeply change the behavior of Continue, or to build agents that take longer sequences of actions on their own. The [`DefaultPolicy`](https://github.com/continuedev/continue/blob/main/server/continuedev/plugins/policies/default.py) handles the parsing of slash commands, and otherwise always chooses the `SimpleChatStep`, but you could customize by for example always taking a "review" step after editing code. To do so, create a new `Policy` subclass that implements the `next` method:
|
||||
|
||||
```python
|
||||
```python title="~/.continue/config.py"
|
||||
class ReviewEditsPolicy(Policy):
|
||||
|
||||
default_step: Step = SimpleChatStep()
|
||||
|
|
@ -50,9 +50,9 @@ class ReviewEditsPolicy(Policy):
|
|||
|
||||
Then, in `~/.continue/config.py`, override the default policy:
|
||||
|
||||
```python
|
||||
config=ContinueConfig(
|
||||
...
|
||||
policy_override=ReviewEditsPolicy()
|
||||
)
|
||||
```python title="~/.continue/config.py"
|
||||
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.policy_override = ReviewEditsPolicy()
|
||||
return config
|
||||
```
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ keywords: [custom, slash commands, models, context providers]
|
|||
|
||||
# Overview
|
||||
|
||||
Continue can be deeply customized by editing the `ContinueConfig` object in `~/.continue/config.py` (`%userprofile%\.continue\config.py` for Windows) on your machine. This file is created the first time you run Continue.
|
||||
Continue can be deeply customized by editing `~/.continue/config.json` (`%userprofile%\.continue\config.json` for Windows) and `config.py` on your machine. These files are created the first time you run Continue.
|
||||
|
||||
Currently, you can customize the following:
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ There are two ways to add custom slash commands:
|
|||
|
||||
## "Custom Commands" (Use Natural Language)
|
||||
|
||||
You can add custom slash commands by adding a `CustomCommand` object to the `custom_commands` property. Each `CustomCommand` has
|
||||
You can add custom slash commands by adding to the `custom_commands` property in `config.json`.
|
||||
|
||||
- `name`: the name of the command, which will be invoked with `/name`
|
||||
- `description`: a short description of the command, which will appear in the dropdown
|
||||
|
|
@ -23,32 +23,21 @@ You can add custom slash commands by adding a `CustomCommand` object to the `cus
|
|||
|
||||
Custom commands are great when you are frequently reusing a prompt. For example, if you've crafted a great prompt and frequently ask the LLM to check for mistakes in your code, you could add a command like this:
|
||||
|
||||
```python
|
||||
config = ContinueConfig(
|
||||
...
|
||||
custom_commands=[
|
||||
CustomCommand(
|
||||
name="check",
|
||||
description="Check for mistakes in my code",
|
||||
prompt=dedent("""\
|
||||
Please read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:
|
||||
- Syntax errors
|
||||
- Logic errors
|
||||
- Security vulnerabilities
|
||||
- Performance issues
|
||||
- Anything else that looks wrong
|
||||
|
||||
Once you find an error, please explain it as clearly as possible, but without using extra words. For example, instead of saying "I think there is a syntax error on line 5", you should say "Syntax error on line 5". Give your answer as one bullet point per mistake found.""")
|
||||
)
|
||||
]
|
||||
)
|
||||
```json title="~/.continue/config.json"
|
||||
custom_commands=[{
|
||||
"name": "check",
|
||||
"description": "Check for mistakes in my code",
|
||||
"prompt": "Please read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:\n- Syntax errors\n- Logic errors\n- Security vulnerabilities\n- Performance issues\n- Anything else that looks wrong\n\nOnce you find an error, please explain it as clearly as possible, but without using extra words. For example, instead of saying 'I think there is a syntax error on line 5', you should say 'Syntax error on line 5'. Give your answer as one bullet point per mistake found."
|
||||
}]
|
||||
```
|
||||
|
||||
## Custom Slash Commands
|
||||
|
||||
If you want to go a step further than writing custom commands with natural language, you can use a `SlashCommand` to run an arbitrary Python function, with access to the Continue SDK. To do this, create a subclass of `Step` with the `run` method implemented, and this is the code that will run when you call the command. For example, here is a step that generates a commit message:
|
||||
If you want to go a step further than writing custom commands with natural language, you can use a `SlashCommand` to run an arbitrary Python function, with access to the Continue SDK. This requires using `config.py` instead of `config.json`, unless you specify a built-in Step name.
|
||||
|
||||
```python
|
||||
To do this, create a subclass of `Step` with the `run` method implemented, and this is the code that will run when you call the command. For example, here is a step that generates a commit message:
|
||||
|
||||
```python title="~/.continue/config.py"
|
||||
class CommitMessageStep(Step):
|
||||
async def run(self, sdk: ContinueSDK):
|
||||
|
||||
|
|
@ -66,15 +55,13 @@ class CommitMessageStep(Step):
|
|||
|
||||
yield SetStep(description=resp) # Updates are yielded so the UI can be incrementally updated
|
||||
|
||||
config=ContinueConfig(
|
||||
...
|
||||
slash_commands=[
|
||||
...
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.slash_commands.append(
|
||||
SlashCommand(
|
||||
name="commit",
|
||||
description="Generate a commit message for the current changes",
|
||||
step=CommitMessageStep,
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
return config
|
||||
```
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
Type '@diff' to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/plugins/context_providers/diff.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/plugins/context_providers/diff.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
The FileContextProvider is a ContextProvider that allows you to search files in the open workspace.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/plugins/context_providers/file.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/plugins/context_providers/file.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
Type '@tree' to reference the contents of your current workspace. The LLM will be able to see the nested directory structure of your project.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/plugins/context_providers/filetree.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/plugins/context_providers/filetree.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
The GitHubIssuesContextProvider is a ContextProvider that allows you to search GitHub issues in a repo. Type '@issue' to reference the title and contents of an issue.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/plugins/context_providers/github.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/plugins/context_providers/github.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
Type '@google' to reference the results of a Google search. For example, type "@google python tutorial" if you want to search and discuss ways of learning Python.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/plugins/context_providers/google.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/plugins/context_providers/google.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
Type '@search' to reference the results of codebase search, just like the results you would get from VS Code search.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/plugins/context_providers/search.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/plugins/context_providers/search.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
Type '@terminal' to reference the contents of your IDE's terminal.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/plugins/context_providers/terminal.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/plugins/context_providers/terminal.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
Type '@url' to reference the contents of a URL. You can either reference preset URLs, or reference one dynamically by typing '@url https://example.com'. The text contents of the page will be fetched and used as context.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/plugins/context_providers/url.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/plugins/context_providers/url.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
|
|||
|
|
@ -2,22 +2,22 @@ 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 the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/libs/llm/anthropic.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/anthropic.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
@ -25,21 +25,13 @@ Claude 2 is not yet publicly released. You can request early access [here](https
|
|||
|
||||
### Inherited Properties
|
||||
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={true} default=""/>
|
||||
<ClassPropertyRef name='title' details='{"title": "Title", "description": "A title that will identify this model in the model selection dropdown", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='unique_id' details='{"title": "Unique Id", "description": "The unique ID of the user.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "claude-2", "type": "string"}' required={false} default="claude-2"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "The base URL of the LLM API.", "type": "string"}' required={false} default=""/>
|
||||
|
|
|
|||
|
|
@ -4,27 +4,23 @@ 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/libs/llm/ggml.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/ggml.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='server_url' details='{"title": "Server Url", "description": "URL of the OpenAI-compatible server where the model is being served", "default": "http://localhost:8000", "type": "string"}' required={false} default="http://localhost:8000"/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "OpenAI API base URL.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_type' details='{"title": "Api Type", "description": "OpenAI API type.", "enum": ["azure", "openai"], "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_version' details='{"title": "Api Version", "description": "OpenAI API version. For use with Azure OpenAI Service.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='engine' details='{"title": "Engine", "description": "OpenAI engine. For use with Azure OpenAI Service.", "type": "string"}' required={false} default=""/>
|
||||
|
|
@ -37,16 +33,8 @@ config = ContinueConfig(
|
|||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to use (optional for the GGML class)", "default": "ggml", "type": "string"}' required={false} default="ggml"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation OR an instance of the PromptTemplate class if you want to control other parameters. See the documentation for more information.", "default": {"edit": {"model": null, "temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": ["[/CODE]"], "max_tokens": 600, "functions": null, "prompt": "[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: \"Rewrite the above code in order to {{{user_input}}}\"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here's the code you requested:\n[CODE]", "raw": true}}, "type": "object"}' required={false} default="{'edit': {'model': None, 'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': ['[/CODE]'], 'max_tokens': 600, 'functions': None, 'prompt': '[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: "Rewrite the above code in order to {{{user_input}}}"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here\'s the code you requested:\n[CODE]', 'raw': True}}"/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "URL of the OpenAI-compatible server where the model is being served", "default": "http://localhost:8000", "type": "string"}' required={false} default="http://localhost:8000"/>
|
||||
|
|
|
|||
|
|
@ -2,23 +2,20 @@ 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/libs/llm/google_palm_api.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/google_palm_api.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
@ -32,15 +29,7 @@ config = ContinueConfig(
|
|||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "chat-bison-001", "type": "string"}' required={false} default="chat-bison-001"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "The base URL of the LLM API.", "type": "string"}' required={false} default=""/>
|
||||
|
|
|
|||
|
|
@ -2,47 +2,35 @@ 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/libs/llm/hf_inference_api.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/hf_inference_api.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='hf_token' details='{"title": "Hf Token", "description": "Your Hugging Face API token", "type": "string"}' required={true} default=""/>
|
||||
<ClassPropertyRef name='endpoint_url' details='{"title": "Endpoint Url", "description": "Your Hugging Face Inference API endpoint URL", "type": "string"}' required={false} default=""/>
|
||||
|
||||
|
||||
### Inherited Properties
|
||||
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "Your Hugging Face API token", "type": "string"}' required={true} default=""/>
|
||||
<ClassPropertyRef name='title' details='{"title": "Title", "description": "A title that will identify this model in the model selection dropdown", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='unique_id' details='{"title": "Unique Id", "description": "The unique ID of the user.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to use (optional for the HuggingFaceInferenceAPI class)", "default": "Hugging Face Inference API", "type": "string"}' required={false} default="Hugging Face Inference API"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation OR an instance of the PromptTemplate class if you want to control other parameters. See the documentation for more information.", "default": {"edit": {"model": null, "temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": ["[/CODE]"], "max_tokens": 600, "functions": null, "prompt": "[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: \"Rewrite the above code in order to {{{user_input}}}\"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here's the code you requested:\n[CODE]", "raw": true}}, "type": "object"}' required={false} default="{'edit': {'model': None, 'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': ['[/CODE]'], 'max_tokens': 600, 'functions': None, 'prompt': '[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: "Rewrite the above code in order to {{{user_input}}}"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here\'s the code you requested:\n[CODE]', 'raw': True}}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "Your Hugging Face Inference API endpoint URL", "type": "string"}' required={false} default=""/>
|
||||
|
|
|
|||
|
|
@ -4,11 +4,10 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/libs/llm/hf_tgi.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/hf_tgi.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='server_url' details='{"title": "Server Url", "description": "URL of your TGI server", "default": "http://localhost:8080", "type": "string"}' required={false} default="http://localhost:8080"/>
|
||||
|
||||
|
||||
### Inherited Properties
|
||||
|
|
@ -18,16 +17,8 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "huggingface-tgi", "type": "string"}' required={false} default="huggingface-tgi"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation OR an instance of the PromptTemplate class if you want to control other parameters. See the documentation for more information.", "default": {"edit": {"model": null, "temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": ["[/CODE]"], "max_tokens": 600, "functions": null, "prompt": "[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: \"Rewrite the above code in order to {{{user_input}}}\"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here's the code you requested:\n[CODE]", "raw": true}}, "type": "object"}' required={false} default="{'edit': {'model': None, 'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': ['[/CODE]'], 'max_tokens': 600, 'functions': None, 'prompt': '[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: "Rewrite the above code in order to {{{user_input}}}"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here\'s the code you requested:\n[CODE]', 'raw': True}}"/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "URL of your TGI server", "default": "http://localhost:8080", "type": "string"}' required={false} default="http://localhost:8080"/>
|
||||
|
|
|
|||
|
|
@ -8,26 +8,23 @@ 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/libs/llm/llamacpp.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/llamacpp.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='server_url' details='{"title": "Server Url", "description": "URL of the server", "default": "http://localhost:8080", "type": "string"}' required={false} default="http://localhost:8080"/>
|
||||
<ClassPropertyRef name='llama_cpp_args' details='{"title": "Llama Cpp Args", "description": "A list of additional arguments to pass to llama.cpp. See [here](https://github.com/ggerganov/llama.cpp/tree/master/examples/server#api-endpoints) for the complete catalog of options.", "default": {"stop": ["[INST]"]}, "type": "object"}' required={false} default="{'stop': ['[INST]']}"/>
|
||||
|
||||
|
||||
|
|
@ -38,16 +35,8 @@ config = ContinueConfig(
|
|||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "llamacpp", "type": "string"}' required={false} default="llamacpp"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation OR an instance of the PromptTemplate class if you want to control other parameters. See the documentation for more information.", "default": {"edit": {"model": null, "temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": ["[/CODE]"], "max_tokens": 600, "functions": null, "prompt": "[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: \"Rewrite the above code in order to {{{user_input}}}\"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here's the code you requested:\n[CODE]", "raw": true}}, "type": "object"}' required={false} default="{'edit': {'model': None, 'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': ['[/CODE]'], 'max_tokens': 600, 'functions': None, 'prompt': '[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: "Rewrite the above code in order to {{{user_input}}}"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here\'s the code you requested:\n[CODE]', 'raw': True}}"/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "URL of the server", "default": "http://localhost:8080", "type": "string"}' required={false} default="http://localhost:8080"/>
|
||||
|
|
|
|||
|
|
@ -4,22 +4,20 @@ 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/libs/llm/ollama.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/ollama.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='server_url' details='{"title": "Server Url", "description": "URL of the Ollama server", "default": "http://localhost:11434", "type": "string"}' required={false} default="http://localhost:11434"/>
|
||||
|
||||
|
||||
### Inherited Properties
|
||||
|
|
@ -29,16 +27,8 @@ config = ContinueConfig(
|
|||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "llama2", "type": "string"}' required={false} default="llama2"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation OR an instance of the PromptTemplate class if you want to control other parameters. See the documentation for more information.", "default": {"edit": {"model": null, "temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": ["[/CODE]"], "max_tokens": 600, "functions": null, "prompt": "[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: \"Rewrite the above code in order to {{{user_input}}}\"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here's the code you requested:\n[CODE]", "raw": true}}, "type": "object"}' required={false} default="{'edit': {'model': None, 'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': ['[/CODE]'], 'max_tokens': 600, 'functions': None, 'prompt': '[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: "Rewrite the above code in order to {{{user_input}}}"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here\'s the code you requested:\n[CODE]', 'raw': True}}"/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "URL of the Ollama server", "default": "http://localhost:11434", "type": "string"}' required={false} default="http://localhost:11434"/>
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
@ -28,15 +25,14 @@ Options for serving models locally with an OpenAI-compatible server include:
|
|||
- [LocalAI](https://localai.io/basics/getting_started/)
|
||||
- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/libs/llm/openai.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/openai.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "OpenAI API base URL.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_type' details='{"title": "Api Type", "description": "OpenAI API type.", "enum": ["azure", "openai"], "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_version' details='{"title": "Api Version", "description": "OpenAI API version. For use with Azure OpenAI Service.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='use_legacy_completions_endpoint' details='{"title": "Use Legacy Completions Endpoint", "description": "Manually specify to use the legacy completions endpoint instead of chat completions.", "default": false, "type": "boolean"}' required={false} default="False"/>
|
||||
<ClassPropertyRef name='engine' details='{"title": "Engine", "description": "OpenAI engine. For use with Azure OpenAI Service.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='use_legacy_completions_endpoint' details='{"title": "Use Legacy Completions Endpoint", "description": "Manually specify to use the legacy completions endpoint instead of chat completions.", "default": false, "type": "boolean"}' required={false} default="False"/>
|
||||
|
||||
|
||||
### Inherited Properties
|
||||
|
|
@ -47,15 +43,7 @@ Options for serving models locally with an OpenAI-compatible server include:
|
|||
<ClassPropertyRef name='unique_id' details='{"title": "Unique Id", "description": "The unique ID of the user.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use for requests.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "OpenAI API base URL.", "type": "string"}' required={false} default=""/>
|
||||
|
|
|
|||
|
|
@ -7,25 +7,33 @@ 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/libs/llm/openai_free_trial.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/openai_free_trial.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
@ -39,16 +47,8 @@ These classes support any models available through the OpenAI API, assuming your
|
|||
<ClassPropertyRef name='unique_id' details='{"title": "Unique Id", "description": "The unique ID of the user.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "The base URL of the LLM API.", "type": "string"}' required={false} default=""/>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ config = ContinueConfig(
|
|||
)
|
||||
```
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/libs/llm/queued.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/queued.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
@ -31,16 +31,8 @@ config = ContinueConfig(
|
|||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "queued", "type": "string"}' required={false} default="queued"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "The base URL of the LLM API.", "type": "string"}' required={false} default=""/>
|
||||
|
|
|
|||
|
|
@ -2,25 +2,22 @@ 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 the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/libs/llm/replicate.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/replicate.py)
|
||||
|
||||
## Properties
|
||||
|
||||
|
|
@ -34,15 +31,7 @@ If you don't specify the `model` parameter, it will default to `replicate/llama-
|
|||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "replicate/llama-2-70b-chat:58d078176e02c219e11eb4da5a02a7830a283b14cf8f94537af893ccff5ee781", "type": "string"}' required={false} default="replicate/llama-2-70b-chat:58d078176e02c219e11eb4da5a02a7830a283b14cf8f94537af893ccff5ee781"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation OR an instance of the PromptTemplate class if you want to control other parameters. See the documentation for more information.", "default": {"edit": {"model": null, "temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": ["[/CODE]"], "max_tokens": 600, "functions": null, "prompt": "[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: \"Rewrite the above code in order to {{{user_input}}}\"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here's the code you requested:\n[CODE]", "raw": true}}, "type": "object"}' required={false} default="{'edit': {'model': None, 'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': ['[/CODE]'], 'max_tokens': 600, 'functions': None, 'prompt': '[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: "Rewrite the above code in order to {{{user_input}}}"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here\'s the code you requested:\n[CODE]', 'raw': True}}"/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "The base URL of the LLM API.", "type": "string"}' required={false} default=""/>
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
||||
|
||||
# TextGenUI
|
||||
|
||||
TextGenUI 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_interface import TextGenUI
|
||||
|
||||
config = ContinueConfig(
|
||||
...
|
||||
models=Models(
|
||||
default=TextGenUI(
|
||||
model="<MODEL_NAME>",
|
||||
)
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/tree/main/server/continuedev/libs/llm/text_gen_interface.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='server_url' details='{"title": "Server Url", "description": "URL of your TextGenUI server", "default": "http://localhost:5000", "type": "string"}' required={false} default="http://localhost:5000"/>
|
||||
<ClassPropertyRef name='streaming_url' details='{"title": "Streaming Url", "description": "URL of your TextGenUI streaming server (separate from main server URL)", "default": "http://localhost:5005", "type": "string"}' required={false} default="http://localhost:5005"/>
|
||||
|
||||
|
||||
### Inherited Properties
|
||||
|
||||
<ClassPropertyRef name='title' details='{"title": "Title", "description": "A title that will identify this model in the model selection dropdown", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='unique_id' details='{"title": "Unique Id", "description": "The unique ID of the user.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "text-gen-ui", "type": "string"}' required={false} default="text-gen-ui"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {"edit": "Here is the code before editing:\n```\n{{{code_to_edit}}}\n```\n\nHere is the edit requested:\n\"{{{user_input}}}\"\n\nHere is the code after editing:"}, "type": "object"}' required={false} default="{'edit': 'Here is the code before editing:\n```\n{{{code_to_edit}}}\n```\n\nHere is the edit requested:\n"{{{user_input}}}"\n\nHere is the code after editing:'}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={false} default=""/>
|
||||
|
|
@ -4,24 +4,20 @@ 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/libs/llm/text_gen_webui.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/text_gen_webui.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='server_url' details='{"title": "Server Url", "description": "URL of your TextGenWebUI server", "default": "http://localhost:5000", "type": "string"}' required={false} default="http://localhost:5000"/>
|
||||
<ClassPropertyRef name='streaming_url' details='{"title": "Streaming Url", "description": "URL of your TextGenWebUI streaming server (separate from main server URL)", "default": "http://localhost:5005", "type": "string"}' required={false} default="http://localhost:5005"/>
|
||||
|
||||
|
||||
|
|
@ -32,16 +28,8 @@ config = ContinueConfig(
|
|||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "text-gen-webui", "type": "string"}' required={false} default="text-gen-webui"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation OR an instance of the PromptTemplate class if you want to control other parameters. See the documentation for more information.", "default": {"edit": "Here is the code before editing:\n```\n{{{code_to_edit}}}\n```\n\nHere is the edit requested:\n\"{{{user_input}}}\"\n\nHere is the code after editing:"}, "type": "object"}' required={false} default="{'edit': 'Here is the code before editing:\n```\n{{{code_to_edit}}}\n```\n\nHere is the edit requested:\n"{{{user_input}}}"\n\nHere is the code after editing:'}"/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_key' details='{"title": "Api Key", "description": "The API key for the LLM provider.", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "URL of your TextGenWebUI server", "default": "http://localhost:5000", "type": "string"}' required={false} default="http://localhost:5000"/>
|
||||
|
|
|
|||
|
|
@ -2,28 +2,23 @@ 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/libs/llm/together.py)
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/together.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='base_url' details='{"title": "Base Url", "description": "The base URL for your Together API instance", "default": "https://api.together.xyz", "type": "string"}' required={false} default="https://api.together.xyz"/>
|
||||
|
||||
|
||||
### Inherited Properties
|
||||
|
|
@ -34,15 +29,7 @@ config = ContinueConfig(
|
|||
<ClassPropertyRef name='model' details='{"title": "Model", "description": "The name of the model to be used (e.g. gpt-4, codellama)", "default": "togethercomputer/RedPajama-INCITE-7B-Instruct", "type": "string"}' required={false} default="togethercomputer/RedPajama-INCITE-7B-Instruct"/>
|
||||
<ClassPropertyRef name='system_message' details='{"title": "System Message", "description": "A system message that will always be followed by the LLM", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='context_length' details='{"title": "Context Length", "description": "The maximum context length of the LLM in tokens, as counted by count_tokens.", "default": 2048, "type": "integer"}' required={false} default="2048"/>
|
||||
<ClassPropertyRef name='stop_tokens' details='{"title": "Stop Tokens", "description": "Tokens that will stop the completion.", "type": "array", "items": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='temperature' details='{"title": "Temperature", "description": "The temperature of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_p' details='{"title": "Top P", "description": "The top_p of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='top_k' details='{"title": "Top K", "description": "The top_k of the completion.", "type": "integer"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='presence_penalty' details='{"title": "Presence Penalty", "description": "The presence penalty Aof the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='frequency_penalty' details='{"title": "Frequency Penalty", "description": "The frequency penalty of the completion.", "type": "number"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='timeout' details='{"title": "Timeout", "description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.", "default": 300, "type": "integer"}' required={false} default="300"/>
|
||||
<ClassPropertyRef name='verify_ssl' details='{"title": "Verify Ssl", "description": "Whether to verify SSL certificates for requests.", "type": "boolean"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='ca_bundle_path' details='{"title": "Ca Bundle Path", "description": "Path to a custom CA bundle to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='proxy' details='{"title": "Proxy", "description": "Proxy URL to use when making the HTTP request", "type": "string"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='headers' details='{"title": "Headers", "description": "Headers to use when making the HTTP request", "type": "object", "additionalProperties": {"type": "string"}}' required={false} default=""/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation OR an instance of the PromptTemplate class if you want to control other parameters. See the documentation for more information.", "default": {"edit": {"model": null, "temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": ["[/CODE]"], "max_tokens": 600, "functions": null, "prompt": "[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: \"Rewrite the above code in order to {{{user_input}}}\"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here's the code you requested:\n[CODE]", "raw": true}}, "type": "object"}' required={false} default="{'edit': {'model': None, 'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': ['[/CODE]'], 'max_tokens': 600, 'functions': None, 'prompt': '[CODE]\n{{{code_to_edit}}}\n[/CODE]\n[INST]\nYou are an expert programmer and personal assistant, here is your task: "Rewrite the above code in order to {{{user_input}}}"\n\nYour answer should start with a [CODE] tag and end with a [/CODE] tag.\n[/INST] Sure! Here\'s the code you requested:\n[CODE]', 'raw': True}}"/>
|
||||
<ClassPropertyRef name='completion_options' details='{"title": "Completion Options", "description": "Options for the completion endpoint. Read more about the completion options in the documentation.", "default": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 600}, "allOf": [{"$ref": "#/definitions/BaseCompletionOptions"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='request_options' details='{"title": "Request Options", "description": "Options for the HTTP request to the LLM.", "default": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}, "allOf": [{"$ref": "#/definitions/RequestOptions"}]}' required={false} default="{'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}"/>
|
||||
<ClassPropertyRef name='prompt_templates' details='{"title": "Prompt Templates", "description": "A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the \"edit\" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.", "default": {}, "type": "object"}' required={false} default="{}"/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "The base URL for your Together API instance", "default": "https://api.together.xyz", "type": "string"}' required={false} default="https://api.together.xyz"/>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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`
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -42,9 +42,12 @@ export default function ClassPropertyRef(props: ClassPropertyRefProps) {
|
|||
{props.default && (
|
||||
<span>
|
||||
{" "}
|
||||
= {details.type === "string" && '"'}
|
||||
{props.default}
|
||||
{details.type === "string" && '"'}
|
||||
={" "}
|
||||
<code>
|
||||
{details.type === "string" && '"'}
|
||||
{props.default}
|
||||
{details.type === "string" && '"'}
|
||||
</code>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
852
extensions/vscode/config_schema.json
Normal file
852
extensions/vscode/config_schema.json
Normal file
|
|
@ -0,0 +1,852 @@
|
|||
{
|
||||
"title": "SerializedContinueConfig",
|
||||
"$ref": "#/definitions/continuedev__core__config__serialized_config__SerializedContinueConfig",
|
||||
"definitions": {
|
||||
"BaseCompletionOptions": {
|
||||
"title": "BaseCompletionOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_p": {
|
||||
"title": "Top P",
|
||||
"description": "The top_p of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_k": {
|
||||
"title": "Top K",
|
||||
"description": "The top_k of the completion.",
|
||||
"type": "integer"
|
||||
},
|
||||
"presence_penalty": {
|
||||
"title": "Presence Penalty",
|
||||
"description": "The presence penalty Aof the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"title": "Frequency Penalty",
|
||||
"description": "The frequency penalty of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"stop": {
|
||||
"title": "Stop",
|
||||
"description": "The stop tokens of the completion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"max_tokens": {
|
||||
"title": "Max Tokens",
|
||||
"description": "The maximum number of tokens to generate.",
|
||||
"default": 600,
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RequestOptions": {
|
||||
"title": "RequestOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
"default": 300,
|
||||
"type": "integer"
|
||||
},
|
||||
"verify_ssl": {
|
||||
"title": "Verify Ssl",
|
||||
"description": "Whether to verify SSL certificates for requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"title": "Ca Bundle Path",
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Proxy URL to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"title": "Headers",
|
||||
"description": "Headers to use when making the HTTP request",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ModelDescription": {
|
||||
"title": "ModelDescription",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"title": "Title",
|
||||
"description": "The title you wish to give your model.",
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"title": "Provider",
|
||||
"description": "The provider of the model. This is used to determine the type of model, and how to interact with it.",
|
||||
"enum": [
|
||||
"openai",
|
||||
"openai-free-trial",
|
||||
"openai-aiohttp",
|
||||
"anthropic",
|
||||
"together",
|
||||
"ollama",
|
||||
"huggingface-tgi",
|
||||
"huggingface-inference-api",
|
||||
"llama.cpp",
|
||||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"title": "Model",
|
||||
"description": "The name of the model. Used to autodetect prompt template.",
|
||||
"type": "string"
|
||||
},
|
||||
"api_key": {
|
||||
"title": "Api Key",
|
||||
"description": "OpenAI, Anthropic, Together, or other API key",
|
||||
"type": "string"
|
||||
},
|
||||
"api_base": {
|
||||
"title": "Api Base",
|
||||
"description": "The base URL of the LLM API.",
|
||||
"type": "string"
|
||||
},
|
||||
"context_length": {
|
||||
"title": "Context Length",
|
||||
"description": "The maximum context length of the LLM in tokens, as counted by count_tokens.",
|
||||
"default": 2048,
|
||||
"type": "integer"
|
||||
},
|
||||
"template": {
|
||||
"title": "Template",
|
||||
"description": "The chat template used to format messages. This is auto-detected for most models, but can be overridden here.",
|
||||
"enum": [
|
||||
"llama2",
|
||||
"alpaca",
|
||||
"zephyr",
|
||||
"phind",
|
||||
"anthropic",
|
||||
"chatml"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
"default": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BaseCompletionOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"system_message": {
|
||||
"title": "System Message",
|
||||
"description": "A system message that will always be followed by the LLM",
|
||||
"type": "string"
|
||||
},
|
||||
"request_options": {
|
||||
"title": "Request Options",
|
||||
"description": "Options for the HTTP request to the LLM.",
|
||||
"default": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RequestOptions"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["title", "provider", "model"],
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "str"
|
||||
}
|
||||
},
|
||||
"not": {
|
||||
"required": ["provider"]
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"gpt-3.5-turbo",
|
||||
"gpt-3.5-turbo-16k",
|
||||
"gpt-4",
|
||||
"gpt-3.5-turbo-0613",
|
||||
"gpt-4-32k",
|
||||
"gpt-4-1106-preview",
|
||||
"mistral-7b",
|
||||
"llama2-7b",
|
||||
"llama2-13b",
|
||||
"codellama-7b",
|
||||
"codellama-13b",
|
||||
"codellama-34b",
|
||||
"phind-codellama-34b",
|
||||
"wizardcoder-7b",
|
||||
"wizardcoder-13b",
|
||||
"wizardcoder-34b",
|
||||
"zephyr-7b",
|
||||
"codeup-13b"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": [
|
||||
"openai",
|
||||
"anthropic",
|
||||
"google-palm",
|
||||
"huggingface-inference-api",
|
||||
"replicate",
|
||||
"together"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"required": ["api_key"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["huggingface-tgi"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": ["api_base"]
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["openai", "openai-aiohttp"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"engine": {
|
||||
"type": "string"
|
||||
},
|
||||
"api_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"api_version": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["openai", "openai-aiohttp"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"gpt-3.5-turbo",
|
||||
"gpt-3.5-turbo-16k",
|
||||
"gpt-4",
|
||||
"gpt-3.5-turbo-0613",
|
||||
"gpt-4-32k",
|
||||
"gpt-4-1106-preview"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["replicate"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"codellama-7b",
|
||||
"codellama-13b",
|
||||
"codellama-34b",
|
||||
"llama2-7b",
|
||||
"llama2-13b"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["openai-free-trial"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": ["gpt-3.5-turbo", "gpt-4"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["openai", "openai-aiohttp"]
|
||||
},
|
||||
"api_type": {
|
||||
"not": {
|
||||
"const": "azure"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"gpt-3.5-turbo",
|
||||
"gpt-3.5-turbo-16k",
|
||||
"gpt-4",
|
||||
"gpt-3.5-turbo-0613",
|
||||
"gpt-4-32k",
|
||||
"gpt-4-1106-preview",
|
||||
"mistral-7b",
|
||||
"llama2-7b",
|
||||
"llama2-13b",
|
||||
"codellama-7b",
|
||||
"codellama-13b",
|
||||
"codellama-34b",
|
||||
"phind-codellama-34b",
|
||||
"wizardcoder-7b",
|
||||
"wizardcoder-13b",
|
||||
"wizardcoder-34b",
|
||||
"zephyr-7b",
|
||||
"codeup-13b"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["anthropic"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": ["claude-2"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["google-palm"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": ["chat-bison-001"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["together"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"mistral-7b",
|
||||
"llama2-7b",
|
||||
"llama2-13b",
|
||||
"codellama-7b",
|
||||
"codellama-13b",
|
||||
"codellama-34b"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": [
|
||||
"ollama",
|
||||
"huggingface-tgi",
|
||||
"huggingface-inference-api",
|
||||
"llama.cpp",
|
||||
"text-gen-webui"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"model": {
|
||||
"enum": [
|
||||
"mistral-7b",
|
||||
"llama2-7b",
|
||||
"llama2-13b",
|
||||
"codellama-7b",
|
||||
"codellama-13b",
|
||||
"codellama-34b",
|
||||
"phind-codellama-34b",
|
||||
"wizardcoder-7b",
|
||||
"wizardcoder-13b",
|
||||
"wizardcoder-34b",
|
||||
"zephyr-7b",
|
||||
"codeup-13b"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"api_type": {
|
||||
"const": "azure"
|
||||
}
|
||||
},
|
||||
"required": ["api_type"]
|
||||
},
|
||||
"then": {
|
||||
"required": ["engine", "api_version", "api_base"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["openai"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"use_legacy_completions_endpoint": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"enum": ["text-gen-webui"]
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"streaming_url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"ModelRoles": {
|
||||
"title": "ModelRoles",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"default": {
|
||||
"title": "Default",
|
||||
"description": "The default model. If other model roles are not set, they will fall back to default.",
|
||||
"type": "string"
|
||||
},
|
||||
"chat": {
|
||||
"title": "Chat",
|
||||
"description": "The model to use for chat. If not set, will fall back to default.",
|
||||
"type": "string"
|
||||
},
|
||||
"edit": {
|
||||
"title": "Edit",
|
||||
"description": "The model to use for editing. If not set, will fall back to default.",
|
||||
"type": "string"
|
||||
},
|
||||
"summarize": {
|
||||
"title": "Summarize",
|
||||
"description": "The model to use for summarization. If not set, will fall back to default.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["default"]
|
||||
},
|
||||
"SlashCommand": {
|
||||
"title": "SlashCommand",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"title": "Description",
|
||||
"type": "string"
|
||||
},
|
||||
"step": {
|
||||
"title": "Step",
|
||||
"enum": [
|
||||
"AnswerQuestionChroma",
|
||||
"GenerateShellCommandStep",
|
||||
"EditHighlightedCodeStep",
|
||||
"ShareSessionStep",
|
||||
"CommentCodeStep",
|
||||
"ClearHistoryStep",
|
||||
"StackOverflowStep",
|
||||
"OpenConfigStep"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"title": "Params",
|
||||
"default": {},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": ["name", "description", "step"]
|
||||
},
|
||||
"CustomCommand": {
|
||||
"title": "CustomCommand",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"type": "string"
|
||||
},
|
||||
"prompt": {
|
||||
"title": "Prompt",
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"title": "Description",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["name", "prompt", "description"]
|
||||
},
|
||||
"ContextProviderWithParams": {
|
||||
"title": "ContextProviderWithParams",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"enum": [
|
||||
"diff",
|
||||
"github",
|
||||
"terminal",
|
||||
"open",
|
||||
"google",
|
||||
"search",
|
||||
"url"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"title": "Params",
|
||||
"default": {},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": ["name"]
|
||||
},
|
||||
"RetrievalSettings": {
|
||||
"title": "RetrievalSettings",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"n_retrieve": {
|
||||
"title": "N Retrieve",
|
||||
"description": "Number of results to initially retrieve from vector database",
|
||||
"default": 50,
|
||||
"type": "integer"
|
||||
},
|
||||
"n_final": {
|
||||
"title": "N Final",
|
||||
"description": "Final number of results to use after re-ranking",
|
||||
"default": 10,
|
||||
"type": "integer"
|
||||
},
|
||||
"use_reranking": {
|
||||
"title": "Use Reranking",
|
||||
"description": "Whether to use re-ranking, which will allow initial selection of n_retrieve results, then will use an LLM to select the top n_final results",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"rerank_group_size": {
|
||||
"title": "Rerank Group Size",
|
||||
"description": "Number of results to group together when re-ranking. Each group will be processed in parallel.",
|
||||
"default": 5,
|
||||
"type": "integer"
|
||||
},
|
||||
"ignore_files": {
|
||||
"title": "Ignore Files",
|
||||
"description": "Files to ignore when indexing the codebase. You can use glob patterns, such as **/*.py. This is useful for directories that contain generated code, or other directories that are not relevant to the codebase.",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"openai_api_key": {
|
||||
"title": "Openai Api Key",
|
||||
"description": "OpenAI API key",
|
||||
"type": "string"
|
||||
},
|
||||
"api_base": {
|
||||
"title": "Api Base",
|
||||
"description": "OpenAI API base URL",
|
||||
"type": "string"
|
||||
},
|
||||
"api_type": {
|
||||
"title": "Api Type",
|
||||
"description": "OpenAI API type",
|
||||
"type": "string"
|
||||
},
|
||||
"api_version": {
|
||||
"title": "Api Version",
|
||||
"description": "OpenAI API version",
|
||||
"type": "string"
|
||||
},
|
||||
"organization_id": {
|
||||
"title": "Organization Id",
|
||||
"description": "OpenAI organization ID",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"continuedev__core__config__serialized_config__SerializedContinueConfig": {
|
||||
"title": "SerializedContinueConfig",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"disallowed_steps": {
|
||||
"title": "Disallowed Steps",
|
||||
"description": "Steps that are not allowed to be run, and will be skipped if attempted",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"allow_anonymous_telemetry": {
|
||||
"title": "Allow Anonymous Telemetry",
|
||||
"description": "If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to False, we will not collect any data.",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"models": {
|
||||
"title": "Models",
|
||||
"default": [
|
||||
{
|
||||
"title": "GPT-4 (trial)",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-4",
|
||||
"api_key": ""
|
||||
}
|
||||
],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ModelDescription"
|
||||
}
|
||||
},
|
||||
"model_roles": {
|
||||
"title": "Model Roles",
|
||||
"description": "Roles for models. Each entry should be the title of a model in the models array.",
|
||||
"default": {
|
||||
"default": "GPT-4 (trial)",
|
||||
"chat": null,
|
||||
"edit": null,
|
||||
"summarize": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ModelRoles"
|
||||
}
|
||||
]
|
||||
},
|
||||
"system_message": {
|
||||
"title": "System Message",
|
||||
"description": "A system message that will always be followed by the LLM",
|
||||
"type": "string"
|
||||
},
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Default options for completion. These will be overriden by any options set for a specific model.",
|
||||
"default": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BaseCompletionOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"slash_commands": {
|
||||
"title": "Slash Commands",
|
||||
"description": "An array of slash commands that let you map custom Steps to a shortcut.",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/SlashCommand"
|
||||
}
|
||||
},
|
||||
"custom_commands": {
|
||||
"title": "Custom Commands",
|
||||
"description": "An array of custom commands that allow you to reuse prompts. Each has name, description, and prompt properties. When you enter /<name> in the text input, it will act as a shortcut to the prompt.",
|
||||
"default": [
|
||||
{
|
||||
"name": "test",
|
||||
"prompt": "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't edit any file.",
|
||||
"description": "This is an example custom command. Use /config to edit it and create more"
|
||||
}
|
||||
],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/CustomCommand"
|
||||
}
|
||||
},
|
||||
"context_providers": {
|
||||
"title": "Context Providers",
|
||||
"description": "A list of ContextProvider objects that can be used to provide context to the LLM by typing '@'. Read more about ContextProviders in the documentation.",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ContextProviderWithParams"
|
||||
}
|
||||
},
|
||||
"user_token": {
|
||||
"title": "User Token",
|
||||
"description": "An optional token to identify the user.",
|
||||
"type": "string"
|
||||
},
|
||||
"data_server_url": {
|
||||
"title": "Data Server Url",
|
||||
"description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.",
|
||||
"default": "https://us-west1-autodebug.cloudfunctions.net",
|
||||
"type": "string"
|
||||
},
|
||||
"disable_summaries": {
|
||||
"title": "Disable Summaries",
|
||||
"description": "If set to `True`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"disable_indexing": {
|
||||
"title": "Disable Indexing",
|
||||
"description": "If set to `True`, Continue will not index the codebase. This is mainly used for debugging purposes.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"retrieval_settings": {
|
||||
"title": "Retrieval Settings",
|
||||
"description": "Settings for the retrieval system. Read more about the retrieval system in the documentation.",
|
||||
"default": {
|
||||
"n_retrieve": 50,
|
||||
"n_final": 10,
|
||||
"use_reranking": true,
|
||||
"rerank_group_size": 5,
|
||||
"ignore_files": [],
|
||||
"openai_api_key": null,
|
||||
"api_base": null,
|
||||
"api_type": null,
|
||||
"api_version": null,
|
||||
"organization_id": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RetrievalSettings"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -275,6 +275,12 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"jsonValidation": [
|
||||
{
|
||||
"fileMatch": "config.json",
|
||||
"url": "./config_schema.json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
|||
68
extensions/vscode/schema/ContinueConfig.d.ts
vendored
68
extensions/vscode/schema/ContinueConfig.d.ts
vendored
|
|
@ -56,9 +56,9 @@ export type SystemMessage1 = string;
|
|||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* Tokens that will stop the completion.
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type StopTokens = string[];
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
|
|
@ -79,6 +79,18 @@ export type PresencePenalty = number;
|
|||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
|
|
@ -99,13 +111,21 @@ export type Proxy = string;
|
|||
* The API key for the LLM provider.
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type Saved = LLM[];
|
||||
export type Temperature1 = number;
|
||||
export type SystemMessage2 = string;
|
||||
/**
|
||||
* The temperature parameter for sampling from the LLM. Higher temperatures will result in more random output, while lower temperatures will result in more predictable output. This value ranges from 0 to 1.
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type Temperature2 = number;
|
||||
export type SystemMessage3 = string;
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type CompletionOptions1 = BaseCompletionOptions;
|
||||
export type Name3 = string;
|
||||
export type Prompt = string;
|
||||
export type Description1 = string;
|
||||
|
|
@ -115,6 +135,15 @@ export type Description1 = string;
|
|||
export type CustomCommands = CustomCommand[];
|
||||
export type Name4 = string;
|
||||
export type Description2 = string;
|
||||
export type Step1 =
|
||||
| "AnswerQuestionChroma"
|
||||
| "GenerateShellCommandStep"
|
||||
| "EditHighlightedCodeStep"
|
||||
| "ShareSessionStep"
|
||||
| "CommentCodeStep"
|
||||
| "ClearHistoryStep"
|
||||
| "StackOverflowStep"
|
||||
| "OpenConfigStep";
|
||||
/**
|
||||
* An array of slash commands that let you map custom Steps to a shortcut.
|
||||
*/
|
||||
|
|
@ -123,10 +152,6 @@ export type SlashCommands = SlashCommand[];
|
|||
* The step that will be run when a traceback is detected (when you use the shortcut cmd+shift+R)
|
||||
*/
|
||||
export type OnTraceback = Step;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage3 = string;
|
||||
/**
|
||||
* A Policy object that can be used to override the default behavior of Continue, for example in order to build custom agents that take multiple steps at a time.
|
||||
*/
|
||||
|
|
@ -213,7 +238,7 @@ export type OpenaiApiKey = string;
|
|||
/**
|
||||
* OpenAI API base URL
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type ApiBase1 = string;
|
||||
/**
|
||||
* OpenAI API type
|
||||
*/
|
||||
|
|
@ -235,11 +260,11 @@ export interface ContinueConfig1 {
|
|||
disallowed_steps?: DisallowedSteps;
|
||||
allow_anonymous_telemetry?: AllowAnonymousTelemetry;
|
||||
models?: Models;
|
||||
temperature?: Temperature2;
|
||||
system_message?: SystemMessage3;
|
||||
completion_options?: CompletionOptions1;
|
||||
custom_commands?: CustomCommands;
|
||||
slash_commands?: SlashCommands;
|
||||
on_traceback?: OnTraceback;
|
||||
system_message?: SystemMessage3;
|
||||
policy_override?: PolicyOverride;
|
||||
context_providers?: ContextProviders;
|
||||
user_token?: UserToken;
|
||||
|
|
@ -291,19 +316,29 @@ export interface LLM {
|
|||
model: Model;
|
||||
system_message?: SystemMessage1;
|
||||
context_length?: ContextLength;
|
||||
stop_tokens?: StopTokens;
|
||||
completion_options?: CompletionOptions;
|
||||
request_options?: RequestOptions;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
|
|
@ -331,9 +366,6 @@ export interface SlashCommand {
|
|||
params?: Params;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Step1 {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Params {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
|
|
@ -398,7 +430,7 @@ export interface RetrievalSettings1 {
|
|||
rerank_group_size?: RerankGroupSize;
|
||||
ignore_files?: IgnoreFiles;
|
||||
openai_api_key?: OpenaiApiKey;
|
||||
api_base?: ApiBase;
|
||||
api_base?: ApiBase1;
|
||||
api_type?: ApiType;
|
||||
api_version?: ApiVersion;
|
||||
organization_id?: OrganizationId;
|
||||
|
|
|
|||
36
extensions/vscode/schema/LLM.d.ts
vendored
36
extensions/vscode/schema/LLM.d.ts
vendored
|
|
@ -27,9 +27,9 @@ export type SystemMessage = string;
|
|||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* Tokens that will stop the completion.
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type StopTokens = string[];
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
|
|
@ -50,6 +50,18 @@ export type PresencePenalty = number;
|
|||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
|
|
@ -70,6 +82,10 @@ export type Proxy = string;
|
|||
* The API key for the LLM provider.
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
|
||||
export interface LLM1 {
|
||||
title?: Title;
|
||||
|
|
@ -77,19 +93,29 @@ export interface LLM1 {
|
|||
model: Model;
|
||||
system_message?: SystemMessage;
|
||||
context_length?: ContextLength;
|
||||
stop_tokens?: StopTokens;
|
||||
completion_options?: CompletionOptions;
|
||||
request_options?: RequestOptions;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
142
extensions/vscode/schema/ModelDescription.d.ts
vendored
Normal file
142
extensions/vscode/schema/ModelDescription.d.ts
vendored
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelDescription = ModelDescription1;
|
||||
/**
|
||||
* The title you wish to give your model.
|
||||
*/
|
||||
export type Title = string;
|
||||
/**
|
||||
* The provider of the model. This is used to determine the type of model, and how to interact with it.
|
||||
*/
|
||||
export type Provider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
export type Model = string;
|
||||
/**
|
||||
* OpenAI, Anthropic, Together, or other API key
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
/**
|
||||
* The maximum context length of the LLM in tokens, as counted by count_tokens.
|
||||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* The chat template used to format messages. This is auto-detected for most models, but can be overridden here.
|
||||
*/
|
||||
export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml";
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
export type Temperature = number;
|
||||
/**
|
||||
* The top_p of the completion.
|
||||
*/
|
||||
export type TopP = number;
|
||||
/**
|
||||
* The top_k of the completion.
|
||||
*/
|
||||
export type TopK = number;
|
||||
/**
|
||||
* The presence penalty Aof the completion.
|
||||
*/
|
||||
export type PresencePenalty = number;
|
||||
/**
|
||||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage = string;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
export type Timeout = number;
|
||||
/**
|
||||
* Whether to verify SSL certificates for requests.
|
||||
*/
|
||||
export type VerifySsl = boolean;
|
||||
/**
|
||||
* Path to a custom CA bundle to use when making the HTTP request
|
||||
*/
|
||||
export type CaBundlePath = string;
|
||||
/**
|
||||
* Proxy URL to use when making the HTTP request
|
||||
*/
|
||||
export type Proxy = string;
|
||||
|
||||
export interface ModelDescription1 {
|
||||
title: Title;
|
||||
provider: Provider;
|
||||
model: Model;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
context_length?: ContextLength;
|
||||
template?: Template;
|
||||
completion_options?: CompletionOptions;
|
||||
system_message?: SystemMessage;
|
||||
request_options?: RequestOptions;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Headers to use when making the HTTP request
|
||||
*/
|
||||
export interface Headers {
|
||||
[k: string]: string;
|
||||
}
|
||||
28
extensions/vscode/schema/ModelName.d.ts
vendored
Normal file
28
extensions/vscode/schema/ModelName.d.ts
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelName =
|
||||
| "gpt-3.5-turbo"
|
||||
| "gpt-3.5-turbo-16k"
|
||||
| "gpt-4"
|
||||
| "gpt-3.5-turbo-0613"
|
||||
| "gpt-4-32k"
|
||||
| "gpt-4-1106-preview"
|
||||
| "mistral-7b"
|
||||
| "llama2-7b"
|
||||
| "llama2-13b"
|
||||
| "codellama-7b"
|
||||
| "codellama-13b"
|
||||
| "codellama-34b"
|
||||
| "phind-codellama-34b"
|
||||
| "wizardcoder-7b"
|
||||
| "wizardcoder-13b"
|
||||
| "wizardcoder-34b"
|
||||
| "zephyr-7b"
|
||||
| "codeup-13b"
|
||||
| "claude-2"
|
||||
| "chat-bison-001";
|
||||
20
extensions/vscode/schema/ModelProvider.d.ts
vendored
Normal file
20
extensions/vscode/schema/ModelProvider.d.ts
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelProvider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
36
extensions/vscode/schema/Models.d.ts
vendored
36
extensions/vscode/schema/Models.d.ts
vendored
|
|
@ -27,9 +27,9 @@ export type SystemMessage = string;
|
|||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* Tokens that will stop the completion.
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type StopTokens = string[];
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
|
|
@ -50,6 +50,18 @@ export type PresencePenalty = number;
|
|||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
|
|
@ -70,6 +82,10 @@ export type Proxy = string;
|
|||
* The API key for the LLM provider.
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type Saved = LLM[];
|
||||
export type Temperature1 = number;
|
||||
export type SystemMessage1 = string;
|
||||
|
|
@ -93,19 +109,29 @@ export interface LLM {
|
|||
model: Model;
|
||||
system_message?: SystemMessage;
|
||||
context_length?: ContextLength;
|
||||
stop_tokens?: StopTokens;
|
||||
completion_options?: CompletionOptions;
|
||||
request_options?: RequestOptions;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
327
extensions/vscode/schema/SerializedContinueConfig.d.ts
vendored
Normal file
327
extensions/vscode/schema/SerializedContinueConfig.d.ts
vendored
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type SerializedContinueConfig = SerializedContinueConfig1;
|
||||
/**
|
||||
* Steps that are not allowed to be run, and will be skipped if attempted
|
||||
*/
|
||||
export type DisallowedSteps = string[];
|
||||
/**
|
||||
* If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to False, we will not collect any data.
|
||||
*/
|
||||
export type AllowAnonymousTelemetry = boolean;
|
||||
/**
|
||||
* The title you wish to give your model.
|
||||
*/
|
||||
export type Title = string;
|
||||
/**
|
||||
* The provider of the model. This is used to determine the type of model, and how to interact with it.
|
||||
*/
|
||||
export type Provider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
export type Model = string;
|
||||
/**
|
||||
* OpenAI, Anthropic, Together, or other API key
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
/**
|
||||
* The maximum context length of the LLM in tokens, as counted by count_tokens.
|
||||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* The chat template used to format messages. This is auto-detected for most models, but can be overridden here.
|
||||
*/
|
||||
export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml";
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
export type Temperature = number;
|
||||
/**
|
||||
* The top_p of the completion.
|
||||
*/
|
||||
export type TopP = number;
|
||||
/**
|
||||
* The top_k of the completion.
|
||||
*/
|
||||
export type TopK = number;
|
||||
/**
|
||||
* The presence penalty Aof the completion.
|
||||
*/
|
||||
export type PresencePenalty = number;
|
||||
/**
|
||||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage = string;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
export type Timeout = number;
|
||||
/**
|
||||
* Whether to verify SSL certificates for requests.
|
||||
*/
|
||||
export type VerifySsl = boolean;
|
||||
/**
|
||||
* Path to a custom CA bundle to use when making the HTTP request
|
||||
*/
|
||||
export type CaBundlePath = string;
|
||||
/**
|
||||
* Proxy URL to use when making the HTTP request
|
||||
*/
|
||||
export type Proxy = string;
|
||||
export type Models = ModelDescription[];
|
||||
/**
|
||||
* Roles for models. Each entry should be the title of a model in the models array.
|
||||
*/
|
||||
export type ModelRoles = ModelRoles1;
|
||||
/**
|
||||
* The default model. If other model roles are not set, they will fall back to default.
|
||||
*/
|
||||
export type Default = string;
|
||||
/**
|
||||
* The model to use for chat. If not set, will fall back to default.
|
||||
*/
|
||||
export type Chat = string;
|
||||
/**
|
||||
* The model to use for editing. If not set, will fall back to default.
|
||||
*/
|
||||
export type Edit = string;
|
||||
/**
|
||||
* The model to use for summarization. If not set, will fall back to default.
|
||||
*/
|
||||
export type Summarize = string;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage1 = string;
|
||||
/**
|
||||
* Default options for completion. These will be overriden by any options set for a specific model.
|
||||
*/
|
||||
export type CompletionOptions1 = BaseCompletionOptions;
|
||||
export type Name = string;
|
||||
export type Description = string;
|
||||
export type Step =
|
||||
| "AnswerQuestionChroma"
|
||||
| "GenerateShellCommandStep"
|
||||
| "EditHighlightedCodeStep"
|
||||
| "ShareSessionStep"
|
||||
| "CommentCodeStep"
|
||||
| "ClearHistoryStep"
|
||||
| "StackOverflowStep"
|
||||
| "OpenConfigStep";
|
||||
/**
|
||||
* An array of slash commands that let you map custom Steps to a shortcut.
|
||||
*/
|
||||
export type SlashCommands = SlashCommand[];
|
||||
export type Name1 = string;
|
||||
export type Prompt = string;
|
||||
export type Description1 = string;
|
||||
/**
|
||||
* An array of custom commands that allow you to reuse prompts. Each has name, description, and prompt properties. When you enter /<name> in the text input, it will act as a shortcut to the prompt.
|
||||
*/
|
||||
export type CustomCommands = CustomCommand[];
|
||||
export type Name2 = "diff" | "github" | "terminal" | "open" | "google" | "search" | "url";
|
||||
/**
|
||||
* A list of ContextProvider objects that can be used to provide context to the LLM by typing '@'. Read more about ContextProviders in the documentation.
|
||||
*/
|
||||
export type ContextProviders = ContextProviderWithParams[];
|
||||
/**
|
||||
* An optional token to identify the user.
|
||||
*/
|
||||
export type UserToken = string;
|
||||
/**
|
||||
* The URL of the server where development data is sent. No data is sent unless a valid user token is provided.
|
||||
*/
|
||||
export type DataServerUrl = string;
|
||||
/**
|
||||
* If set to `True`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.
|
||||
*/
|
||||
export type DisableSummaries = boolean;
|
||||
/**
|
||||
* If set to `True`, Continue will not index the codebase. This is mainly used for debugging purposes.
|
||||
*/
|
||||
export type DisableIndexing = boolean;
|
||||
/**
|
||||
* Settings for the retrieval system. Read more about the retrieval system in the documentation.
|
||||
*/
|
||||
export type RetrievalSettings = RetrievalSettings1;
|
||||
/**
|
||||
* Number of results to initially retrieve from vector database
|
||||
*/
|
||||
export type NRetrieve = number;
|
||||
/**
|
||||
* Final number of results to use after re-ranking
|
||||
*/
|
||||
export type NFinal = number;
|
||||
/**
|
||||
* Whether to use re-ranking, which will allow initial selection of n_retrieve results, then will use an LLM to select the top n_final results
|
||||
*/
|
||||
export type UseReranking = boolean;
|
||||
/**
|
||||
* Number of results to group together when re-ranking. Each group will be processed in parallel.
|
||||
*/
|
||||
export type RerankGroupSize = number;
|
||||
/**
|
||||
* Files to ignore when indexing the codebase. You can use glob patterns, such as ** /*.py. This is useful for directories that contain generated code, or other directories that are not relevant to the codebase.
|
||||
*/
|
||||
export type IgnoreFiles = string[];
|
||||
/**
|
||||
* OpenAI API key
|
||||
*/
|
||||
export type OpenaiApiKey = string;
|
||||
/**
|
||||
* OpenAI API base URL
|
||||
*/
|
||||
export type ApiBase1 = string;
|
||||
/**
|
||||
* OpenAI API type
|
||||
*/
|
||||
export type ApiType = string;
|
||||
/**
|
||||
* OpenAI API version
|
||||
*/
|
||||
export type ApiVersion = string;
|
||||
/**
|
||||
* OpenAI organization ID
|
||||
*/
|
||||
export type OrganizationId = string;
|
||||
|
||||
export interface SerializedContinueConfig1 {
|
||||
disallowed_steps?: DisallowedSteps;
|
||||
allow_anonymous_telemetry?: AllowAnonymousTelemetry;
|
||||
models?: Models;
|
||||
model_roles?: ModelRoles;
|
||||
system_message?: SystemMessage1;
|
||||
completion_options?: CompletionOptions1;
|
||||
slash_commands?: SlashCommands;
|
||||
custom_commands?: CustomCommands;
|
||||
context_providers?: ContextProviders;
|
||||
user_token?: UserToken;
|
||||
data_server_url?: DataServerUrl;
|
||||
disable_summaries?: DisableSummaries;
|
||||
disable_indexing?: DisableIndexing;
|
||||
retrieval_settings?: RetrievalSettings;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface ModelDescription {
|
||||
title: Title;
|
||||
provider: Provider;
|
||||
model: Model;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
context_length?: ContextLength;
|
||||
template?: Template;
|
||||
completion_options?: CompletionOptions;
|
||||
system_message?: SystemMessage;
|
||||
request_options?: RequestOptions;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Headers to use when making the HTTP request
|
||||
*/
|
||||
export interface Headers {
|
||||
[k: string]: string;
|
||||
}
|
||||
export interface ModelRoles1 {
|
||||
default: Default;
|
||||
chat?: Chat;
|
||||
edit?: Edit;
|
||||
summarize?: Summarize;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface SlashCommand {
|
||||
name: Name;
|
||||
description: Description;
|
||||
step: Step;
|
||||
params?: Params;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Params {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface CustomCommand {
|
||||
name: Name1;
|
||||
prompt: Prompt;
|
||||
description: Description1;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface ContextProviderWithParams {
|
||||
name: Name2;
|
||||
params?: Params1;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Params1 {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RetrievalSettings1 {
|
||||
n_retrieve?: NRetrieve;
|
||||
n_final?: NFinal;
|
||||
use_reranking?: UseReranking;
|
||||
rerank_group_size?: RerankGroupSize;
|
||||
ignore_files?: IgnoreFiles;
|
||||
openai_api_key?: OpenaiApiKey;
|
||||
api_base?: ApiBase1;
|
||||
api_type?: ApiType;
|
||||
api_version?: ApiVersion;
|
||||
organization_id?: OrganizationId;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
|
|
@ -92,15 +92,15 @@ class ConfigPyCodeLensProvider implements vscode.CodeLensProvider {
|
|||
|
||||
if (
|
||||
!document.uri.fsPath.endsWith(".continue/config.py") &&
|
||||
!document.uri.fsPath.endsWith(".continue\\config.py")
|
||||
!document.uri.fsPath.endsWith(".continue\\config.py") &&
|
||||
!document.uri.fsPath.endsWith(".continue/config.json") &&
|
||||
!document.uri.fsPath.endsWith(".continue\\config.json")
|
||||
) {
|
||||
return codeLenses;
|
||||
}
|
||||
|
||||
const lines = document.getText().split(os.EOL);
|
||||
const lineOfModels = lines.findIndex((line) =>
|
||||
line.includes("models=Models(")
|
||||
);
|
||||
let lineOfModels = lines.findIndex((line) => line.includes('"models": ['));
|
||||
|
||||
if (lineOfModels >= 0) {
|
||||
const range = new vscode.Range(lineOfModels, 0, lineOfModels + 1, 0);
|
||||
|
|
|
|||
|
|
@ -1091,16 +1091,6 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
{selectedContextItems.length} snippets selected
|
||||
</div>
|
||||
)}
|
||||
{/* {selectedContextItems.length > 0 && (
|
||||
<HeaderButtonWithText
|
||||
onClick={() => {
|
||||
client?.showContextVirtualFile(props.index);
|
||||
}}
|
||||
text="View Current Context"
|
||||
>
|
||||
<MagnifyingGlassIcon width="1.4em" height="1.4em" />
|
||||
</HeaderButtonWithText>
|
||||
)} */}
|
||||
</div>
|
||||
) : (
|
||||
selectedContextItems.length > 0 && (
|
||||
|
|
|
|||
|
|
@ -55,10 +55,11 @@ function FTCDialog() {
|
|||
<Button
|
||||
disabled={!apiKey}
|
||||
onClick={() => {
|
||||
client?.addModelForRole("*", "OpenAI", {
|
||||
client?.addModelForRole("*", {
|
||||
model: "gpt-4",
|
||||
api_key: apiKey,
|
||||
title: "GPT-4",
|
||||
provider: "openai",
|
||||
});
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { ContextItem } from "../schema/ContextItem";
|
||||
import { ContextItemId } from "../schema/ContextItemId";
|
||||
import { ContinueConfig } from "../schema/ContinueConfig";
|
||||
import { ModelDescription } from "../schema/SerializedContinueConfig";
|
||||
|
||||
abstract class AbstractContinueGUIClientProtocol {
|
||||
abstract sendMainInput(input: string): void;
|
||||
|
|
@ -27,8 +28,6 @@ abstract class AbstractContinueGUIClientProtocol {
|
|||
|
||||
abstract toggleAddingHighlightedCode(): void;
|
||||
|
||||
abstract showContextVirtualFile(): void;
|
||||
|
||||
abstract selectContextItem(id: string, query: string): void;
|
||||
|
||||
abstract getContextItem(id: string, query: string): Promise<ContextItem>;
|
||||
|
|
@ -47,11 +46,7 @@ abstract class AbstractContinueGUIClientProtocol {
|
|||
|
||||
abstract setTemperature(temperature: number): void;
|
||||
|
||||
abstract addModelForRole(
|
||||
role: string,
|
||||
model_class: string,
|
||||
model: string
|
||||
): void;
|
||||
abstract addModelForRole(role: string, model: ModelDescription): void;
|
||||
|
||||
abstract saveContextGroup(title: string, contextItems: ContextItem[]): void;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { ContextItem } from "../schema/ContextItem";
|
|||
import { ContextItemId } from "../schema/ContextItemId";
|
||||
import { ContinueConfig } from "../schema/ContinueConfig";
|
||||
import { PersistedSessionInfo } from "../schema/PersistedSessionInfo";
|
||||
import { ModelDescription } from "../schema/SerializedContinueConfig";
|
||||
import { SessionState, StepDescription } from "../schema/SessionState";
|
||||
import { SessionUpdate } from "../schema/SessionUpdate";
|
||||
import AbstractContinueGUIClientProtocol from "./AbstractContinueGUIClientProtocol";
|
||||
|
|
@ -181,10 +182,6 @@ class ContinueGUIClientProtocol extends AbstractContinueGUIClientProtocol {
|
|||
this.messenger?.send("toggle_adding_highlighted_code", {});
|
||||
}
|
||||
|
||||
showContextVirtualFile(index?: number): void {
|
||||
this.messenger?.send("show_context_virtual_file", { index });
|
||||
}
|
||||
|
||||
selectContextItem(id: string, query: string): void {
|
||||
this.messenger?.send("select_context_item", { id, query });
|
||||
}
|
||||
|
|
@ -219,8 +216,8 @@ class ContinueGUIClientProtocol extends AbstractContinueGUIClientProtocol {
|
|||
this.messenger?.send("set_temperature", { temperature });
|
||||
}
|
||||
|
||||
addModelForRole(role: string, model_class: string, model: any): void {
|
||||
this.messenger?.send("add_model_for_role", { role, model, model_class });
|
||||
addModelForRole(role: string, model: ModelDescription): void {
|
||||
this.messenger?.send("add_model_for_role", { role, model });
|
||||
}
|
||||
|
||||
setModelForRoleFromIndex(role: string, index: number): void {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import {
|
|||
MODEL_INFO,
|
||||
MODEL_PROVIDER_TAG_COLORS,
|
||||
ModelInfo,
|
||||
updatedObj,
|
||||
} from "../util/modelData";
|
||||
import { RootStore } from "../redux/store";
|
||||
import StyledMarkdownPreview from "../components/StyledMarkdownPreview";
|
||||
|
|
@ -215,15 +216,17 @@ function ModelConfig() {
|
|||
dimensions={pkg.dimensions}
|
||||
onClick={(e, dimensionChoices) => {
|
||||
if (disableModelCards()) return;
|
||||
const formParams: any = {};
|
||||
let formParams: any = {};
|
||||
for (const d of modelInfo.collectInputFor || []) {
|
||||
formParams[d.key] =
|
||||
d.inputType === "text"
|
||||
? formMethods.watch(d.key)
|
||||
: parseFloat(formMethods.watch(d.key));
|
||||
formParams = updatedObj(formParams, {
|
||||
[d.key]:
|
||||
d.inputType === "text"
|
||||
? formMethods.watch(d.key)
|
||||
: parseFloat(formMethods.watch(d.key)),
|
||||
});
|
||||
}
|
||||
|
||||
client?.addModelForRole("*", modelInfo.class, {
|
||||
client?.addModelForRole("*", {
|
||||
...pkg.params,
|
||||
...modelInfo.params,
|
||||
..._.merge(
|
||||
|
|
@ -236,6 +239,7 @@ function ModelConfig() {
|
|||
}) || [])
|
||||
),
|
||||
...formParams,
|
||||
provider: modelInfo.provider,
|
||||
});
|
||||
navigate("/");
|
||||
}}
|
||||
|
|
@ -255,7 +259,7 @@ function ModelConfig() {
|
|||
: parseFloat(formMethods.watch(d.key));
|
||||
}
|
||||
|
||||
client?.addModelForRole("*", modelInfo.class, {
|
||||
client?.addModelForRole("*", {
|
||||
...modelInfo.packages[0]?.params,
|
||||
...modelInfo.params,
|
||||
...formParams,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ function Models() {
|
|||
description={modelInfo.description}
|
||||
tags={modelInfo.tags}
|
||||
icon={modelInfo.icon}
|
||||
refUrl={`https://continue.dev/docs/reference/Models/${modelInfo.class.toLowerCase()}`}
|
||||
refUrl={`https://continue.dev/docs/reference/Models/${modelInfo.provider.toLowerCase()}`}
|
||||
onClick={(e) => {
|
||||
navigate(`/modelconfig/${name}`);
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -92,8 +92,10 @@ function Settings() {
|
|||
const submitChanges = () => {
|
||||
if (!client) return;
|
||||
|
||||
const systemMessage = formMethods.watch("system_message");
|
||||
const temperature = formMethods.watch("temperature");
|
||||
const systemMessage = formMethods.watch("system_message") as
|
||||
| string
|
||||
| undefined;
|
||||
const temperature = formMethods.watch("temperature") as number | undefined;
|
||||
// const models = formMethods.watch("models");
|
||||
|
||||
client.setSystemMessage(systemMessage || "");
|
||||
|
|
@ -176,8 +178,8 @@ function Settings() {
|
|||
</div>
|
||||
<div className="text-center" style={{ marginTop: "-25px" }}>
|
||||
<p className="text-sm text-gray-500">
|
||||
{formMethods.watch("temperature") ||
|
||||
config.temperature ||
|
||||
{(formMethods.watch("temperature") as number | undefined) ||
|
||||
config.completion_options.temperature ||
|
||||
"-"}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
68
gui/src/schema/ContinueConfig.d.ts
vendored
68
gui/src/schema/ContinueConfig.d.ts
vendored
|
|
@ -56,9 +56,9 @@ export type SystemMessage1 = string;
|
|||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* Tokens that will stop the completion.
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type StopTokens = string[];
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
|
|
@ -79,6 +79,18 @@ export type PresencePenalty = number;
|
|||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
|
|
@ -99,13 +111,21 @@ export type Proxy = string;
|
|||
* The API key for the LLM provider.
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type Saved = LLM[];
|
||||
export type Temperature1 = number;
|
||||
export type SystemMessage2 = string;
|
||||
/**
|
||||
* The temperature parameter for sampling from the LLM. Higher temperatures will result in more random output, while lower temperatures will result in more predictable output. This value ranges from 0 to 1.
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type Temperature2 = number;
|
||||
export type SystemMessage3 = string;
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type CompletionOptions1 = BaseCompletionOptions;
|
||||
export type Name3 = string;
|
||||
export type Prompt = string;
|
||||
export type Description1 = string;
|
||||
|
|
@ -115,6 +135,15 @@ export type Description1 = string;
|
|||
export type CustomCommands = CustomCommand[];
|
||||
export type Name4 = string;
|
||||
export type Description2 = string;
|
||||
export type Step1 =
|
||||
| "AnswerQuestionChroma"
|
||||
| "GenerateShellCommandStep"
|
||||
| "EditHighlightedCodeStep"
|
||||
| "ShareSessionStep"
|
||||
| "CommentCodeStep"
|
||||
| "ClearHistoryStep"
|
||||
| "StackOverflowStep"
|
||||
| "OpenConfigStep";
|
||||
/**
|
||||
* An array of slash commands that let you map custom Steps to a shortcut.
|
||||
*/
|
||||
|
|
@ -123,10 +152,6 @@ export type SlashCommands = SlashCommand[];
|
|||
* The step that will be run when a traceback is detected (when you use the shortcut cmd+shift+R)
|
||||
*/
|
||||
export type OnTraceback = Step;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage3 = string;
|
||||
/**
|
||||
* A Policy object that can be used to override the default behavior of Continue, for example in order to build custom agents that take multiple steps at a time.
|
||||
*/
|
||||
|
|
@ -213,7 +238,7 @@ export type OpenaiApiKey = string;
|
|||
/**
|
||||
* OpenAI API base URL
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type ApiBase1 = string;
|
||||
/**
|
||||
* OpenAI API type
|
||||
*/
|
||||
|
|
@ -235,11 +260,11 @@ export interface ContinueConfig1 {
|
|||
disallowed_steps?: DisallowedSteps;
|
||||
allow_anonymous_telemetry?: AllowAnonymousTelemetry;
|
||||
models?: Models;
|
||||
temperature?: Temperature2;
|
||||
system_message?: SystemMessage3;
|
||||
completion_options?: CompletionOptions1;
|
||||
custom_commands?: CustomCommands;
|
||||
slash_commands?: SlashCommands;
|
||||
on_traceback?: OnTraceback;
|
||||
system_message?: SystemMessage3;
|
||||
policy_override?: PolicyOverride;
|
||||
context_providers?: ContextProviders;
|
||||
user_token?: UserToken;
|
||||
|
|
@ -291,19 +316,29 @@ export interface LLM {
|
|||
model: Model;
|
||||
system_message?: SystemMessage1;
|
||||
context_length?: ContextLength;
|
||||
stop_tokens?: StopTokens;
|
||||
completion_options?: CompletionOptions;
|
||||
request_options?: RequestOptions;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
|
|
@ -331,9 +366,6 @@ export interface SlashCommand {
|
|||
params?: Params;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Step1 {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Params {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
|
|
@ -398,7 +430,7 @@ export interface RetrievalSettings1 {
|
|||
rerank_group_size?: RerankGroupSize;
|
||||
ignore_files?: IgnoreFiles;
|
||||
openai_api_key?: OpenaiApiKey;
|
||||
api_base?: ApiBase;
|
||||
api_base?: ApiBase1;
|
||||
api_type?: ApiType;
|
||||
api_version?: ApiVersion;
|
||||
organization_id?: OrganizationId;
|
||||
|
|
|
|||
36
gui/src/schema/LLM.d.ts
vendored
36
gui/src/schema/LLM.d.ts
vendored
|
|
@ -27,9 +27,9 @@ export type SystemMessage = string;
|
|||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* Tokens that will stop the completion.
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type StopTokens = string[];
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
|
|
@ -50,6 +50,18 @@ export type PresencePenalty = number;
|
|||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
|
|
@ -70,6 +82,10 @@ export type Proxy = string;
|
|||
* The API key for the LLM provider.
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
|
||||
export interface LLM1 {
|
||||
title?: Title;
|
||||
|
|
@ -77,19 +93,29 @@ export interface LLM1 {
|
|||
model: Model;
|
||||
system_message?: SystemMessage;
|
||||
context_length?: ContextLength;
|
||||
stop_tokens?: StopTokens;
|
||||
completion_options?: CompletionOptions;
|
||||
request_options?: RequestOptions;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
142
gui/src/schema/ModelDescription.d.ts
vendored
Normal file
142
gui/src/schema/ModelDescription.d.ts
vendored
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelDescription = ModelDescription1;
|
||||
/**
|
||||
* The title you wish to give your model.
|
||||
*/
|
||||
export type Title = string;
|
||||
/**
|
||||
* The provider of the model. This is used to determine the type of model, and how to interact with it.
|
||||
*/
|
||||
export type Provider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
export type Model = string;
|
||||
/**
|
||||
* OpenAI, Anthropic, Together, or other API key
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
/**
|
||||
* The maximum context length of the LLM in tokens, as counted by count_tokens.
|
||||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* The chat template used to format messages. This is auto-detected for most models, but can be overridden here.
|
||||
*/
|
||||
export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml";
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
export type Temperature = number;
|
||||
/**
|
||||
* The top_p of the completion.
|
||||
*/
|
||||
export type TopP = number;
|
||||
/**
|
||||
* The top_k of the completion.
|
||||
*/
|
||||
export type TopK = number;
|
||||
/**
|
||||
* The presence penalty Aof the completion.
|
||||
*/
|
||||
export type PresencePenalty = number;
|
||||
/**
|
||||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage = string;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
export type Timeout = number;
|
||||
/**
|
||||
* Whether to verify SSL certificates for requests.
|
||||
*/
|
||||
export type VerifySsl = boolean;
|
||||
/**
|
||||
* Path to a custom CA bundle to use when making the HTTP request
|
||||
*/
|
||||
export type CaBundlePath = string;
|
||||
/**
|
||||
* Proxy URL to use when making the HTTP request
|
||||
*/
|
||||
export type Proxy = string;
|
||||
|
||||
export interface ModelDescription1 {
|
||||
title: Title;
|
||||
provider: Provider;
|
||||
model: Model;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
context_length?: ContextLength;
|
||||
template?: Template;
|
||||
completion_options?: CompletionOptions;
|
||||
system_message?: SystemMessage;
|
||||
request_options?: RequestOptions;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Headers to use when making the HTTP request
|
||||
*/
|
||||
export interface Headers {
|
||||
[k: string]: string;
|
||||
}
|
||||
28
gui/src/schema/ModelName.d.ts
vendored
Normal file
28
gui/src/schema/ModelName.d.ts
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelName =
|
||||
| "gpt-3.5-turbo"
|
||||
| "gpt-3.5-turbo-16k"
|
||||
| "gpt-4"
|
||||
| "gpt-3.5-turbo-0613"
|
||||
| "gpt-4-32k"
|
||||
| "gpt-4-1106-preview"
|
||||
| "mistral-7b"
|
||||
| "llama2-7b"
|
||||
| "llama2-13b"
|
||||
| "codellama-7b"
|
||||
| "codellama-13b"
|
||||
| "codellama-34b"
|
||||
| "phind-codellama-34b"
|
||||
| "wizardcoder-7b"
|
||||
| "wizardcoder-13b"
|
||||
| "wizardcoder-34b"
|
||||
| "zephyr-7b"
|
||||
| "codeup-13b"
|
||||
| "claude-2"
|
||||
| "chat-bison-001";
|
||||
20
gui/src/schema/ModelProvider.d.ts
vendored
Normal file
20
gui/src/schema/ModelProvider.d.ts
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type ModelProvider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
36
gui/src/schema/Models.d.ts
vendored
36
gui/src/schema/Models.d.ts
vendored
|
|
@ -27,9 +27,9 @@ export type SystemMessage = string;
|
|||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* Tokens that will stop the completion.
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type StopTokens = string[];
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
|
|
@ -50,6 +50,18 @@ export type PresencePenalty = number;
|
|||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
|
|
@ -70,6 +82,10 @@ export type Proxy = string;
|
|||
* The API key for the LLM provider.
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type Saved = LLM[];
|
||||
export type Temperature1 = number;
|
||||
export type SystemMessage1 = string;
|
||||
|
|
@ -93,19 +109,29 @@ export interface LLM {
|
|||
model: Model;
|
||||
system_message?: SystemMessage;
|
||||
context_length?: ContextLength;
|
||||
stop_tokens?: StopTokens;
|
||||
completion_options?: CompletionOptions;
|
||||
request_options?: RequestOptions;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
327
gui/src/schema/SerializedContinueConfig.d.ts
vendored
Normal file
327
gui/src/schema/SerializedContinueConfig.d.ts
vendored
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
/* eslint-disable */
|
||||
/**
|
||||
* This file was automatically generated by json-schema-to-typescript.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
export type SerializedContinueConfig = SerializedContinueConfig1;
|
||||
/**
|
||||
* Steps that are not allowed to be run, and will be skipped if attempted
|
||||
*/
|
||||
export type DisallowedSteps = string[];
|
||||
/**
|
||||
* If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to False, we will not collect any data.
|
||||
*/
|
||||
export type AllowAnonymousTelemetry = boolean;
|
||||
/**
|
||||
* The title you wish to give your model.
|
||||
*/
|
||||
export type Title = string;
|
||||
/**
|
||||
* The provider of the model. This is used to determine the type of model, and how to interact with it.
|
||||
*/
|
||||
export type Provider =
|
||||
| "openai"
|
||||
| "openai-free-trial"
|
||||
| "openai-aiohttp"
|
||||
| "anthropic"
|
||||
| "together"
|
||||
| "ollama"
|
||||
| "huggingface-tgi"
|
||||
| "huggingface-inference-api"
|
||||
| "llama.cpp"
|
||||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
export type Model = string;
|
||||
/**
|
||||
* OpenAI, Anthropic, Together, or other API key
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
/**
|
||||
* The maximum context length of the LLM in tokens, as counted by count_tokens.
|
||||
*/
|
||||
export type ContextLength = number;
|
||||
/**
|
||||
* The chat template used to format messages. This is auto-detected for most models, but can be overridden here.
|
||||
*/
|
||||
export type Template = "llama2" | "alpaca" | "zephyr" | "phind" | "anthropic" | "chatml";
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
export type CompletionOptions = BaseCompletionOptions;
|
||||
/**
|
||||
* The temperature of the completion.
|
||||
*/
|
||||
export type Temperature = number;
|
||||
/**
|
||||
* The top_p of the completion.
|
||||
*/
|
||||
export type TopP = number;
|
||||
/**
|
||||
* The top_k of the completion.
|
||||
*/
|
||||
export type TopK = number;
|
||||
/**
|
||||
* The presence penalty Aof the completion.
|
||||
*/
|
||||
export type PresencePenalty = number;
|
||||
/**
|
||||
* The frequency penalty of the completion.
|
||||
*/
|
||||
export type FrequencyPenalty = number;
|
||||
/**
|
||||
* The stop tokens of the completion.
|
||||
*/
|
||||
export type Stop = string[];
|
||||
/**
|
||||
* The maximum number of tokens to generate.
|
||||
*/
|
||||
export type MaxTokens = number;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage = string;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
export type RequestOptions = RequestOptions1;
|
||||
/**
|
||||
* Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.
|
||||
*/
|
||||
export type Timeout = number;
|
||||
/**
|
||||
* Whether to verify SSL certificates for requests.
|
||||
*/
|
||||
export type VerifySsl = boolean;
|
||||
/**
|
||||
* Path to a custom CA bundle to use when making the HTTP request
|
||||
*/
|
||||
export type CaBundlePath = string;
|
||||
/**
|
||||
* Proxy URL to use when making the HTTP request
|
||||
*/
|
||||
export type Proxy = string;
|
||||
export type Models = ModelDescription[];
|
||||
/**
|
||||
* Roles for models. Each entry should be the title of a model in the models array.
|
||||
*/
|
||||
export type ModelRoles = ModelRoles1;
|
||||
/**
|
||||
* The default model. If other model roles are not set, they will fall back to default.
|
||||
*/
|
||||
export type Default = string;
|
||||
/**
|
||||
* The model to use for chat. If not set, will fall back to default.
|
||||
*/
|
||||
export type Chat = string;
|
||||
/**
|
||||
* The model to use for editing. If not set, will fall back to default.
|
||||
*/
|
||||
export type Edit = string;
|
||||
/**
|
||||
* The model to use for summarization. If not set, will fall back to default.
|
||||
*/
|
||||
export type Summarize = string;
|
||||
/**
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type SystemMessage1 = string;
|
||||
/**
|
||||
* Default options for completion. These will be overriden by any options set for a specific model.
|
||||
*/
|
||||
export type CompletionOptions1 = BaseCompletionOptions;
|
||||
export type Name = string;
|
||||
export type Description = string;
|
||||
export type Step =
|
||||
| "AnswerQuestionChroma"
|
||||
| "GenerateShellCommandStep"
|
||||
| "EditHighlightedCodeStep"
|
||||
| "ShareSessionStep"
|
||||
| "CommentCodeStep"
|
||||
| "ClearHistoryStep"
|
||||
| "StackOverflowStep"
|
||||
| "OpenConfigStep";
|
||||
/**
|
||||
* An array of slash commands that let you map custom Steps to a shortcut.
|
||||
*/
|
||||
export type SlashCommands = SlashCommand[];
|
||||
export type Name1 = string;
|
||||
export type Prompt = string;
|
||||
export type Description1 = string;
|
||||
/**
|
||||
* An array of custom commands that allow you to reuse prompts. Each has name, description, and prompt properties. When you enter /<name> in the text input, it will act as a shortcut to the prompt.
|
||||
*/
|
||||
export type CustomCommands = CustomCommand[];
|
||||
export type Name2 = "diff" | "github" | "terminal" | "open" | "google" | "search" | "url";
|
||||
/**
|
||||
* A list of ContextProvider objects that can be used to provide context to the LLM by typing '@'. Read more about ContextProviders in the documentation.
|
||||
*/
|
||||
export type ContextProviders = ContextProviderWithParams[];
|
||||
/**
|
||||
* An optional token to identify the user.
|
||||
*/
|
||||
export type UserToken = string;
|
||||
/**
|
||||
* The URL of the server where development data is sent. No data is sent unless a valid user token is provided.
|
||||
*/
|
||||
export type DataServerUrl = string;
|
||||
/**
|
||||
* If set to `True`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.
|
||||
*/
|
||||
export type DisableSummaries = boolean;
|
||||
/**
|
||||
* If set to `True`, Continue will not index the codebase. This is mainly used for debugging purposes.
|
||||
*/
|
||||
export type DisableIndexing = boolean;
|
||||
/**
|
||||
* Settings for the retrieval system. Read more about the retrieval system in the documentation.
|
||||
*/
|
||||
export type RetrievalSettings = RetrievalSettings1;
|
||||
/**
|
||||
* Number of results to initially retrieve from vector database
|
||||
*/
|
||||
export type NRetrieve = number;
|
||||
/**
|
||||
* Final number of results to use after re-ranking
|
||||
*/
|
||||
export type NFinal = number;
|
||||
/**
|
||||
* Whether to use re-ranking, which will allow initial selection of n_retrieve results, then will use an LLM to select the top n_final results
|
||||
*/
|
||||
export type UseReranking = boolean;
|
||||
/**
|
||||
* Number of results to group together when re-ranking. Each group will be processed in parallel.
|
||||
*/
|
||||
export type RerankGroupSize = number;
|
||||
/**
|
||||
* Files to ignore when indexing the codebase. You can use glob patterns, such as ** /*.py. This is useful for directories that contain generated code, or other directories that are not relevant to the codebase.
|
||||
*/
|
||||
export type IgnoreFiles = string[];
|
||||
/**
|
||||
* OpenAI API key
|
||||
*/
|
||||
export type OpenaiApiKey = string;
|
||||
/**
|
||||
* OpenAI API base URL
|
||||
*/
|
||||
export type ApiBase1 = string;
|
||||
/**
|
||||
* OpenAI API type
|
||||
*/
|
||||
export type ApiType = string;
|
||||
/**
|
||||
* OpenAI API version
|
||||
*/
|
||||
export type ApiVersion = string;
|
||||
/**
|
||||
* OpenAI organization ID
|
||||
*/
|
||||
export type OrganizationId = string;
|
||||
|
||||
export interface SerializedContinueConfig1 {
|
||||
disallowed_steps?: DisallowedSteps;
|
||||
allow_anonymous_telemetry?: AllowAnonymousTelemetry;
|
||||
models?: Models;
|
||||
model_roles?: ModelRoles;
|
||||
system_message?: SystemMessage1;
|
||||
completion_options?: CompletionOptions1;
|
||||
slash_commands?: SlashCommands;
|
||||
custom_commands?: CustomCommands;
|
||||
context_providers?: ContextProviders;
|
||||
user_token?: UserToken;
|
||||
data_server_url?: DataServerUrl;
|
||||
disable_summaries?: DisableSummaries;
|
||||
disable_indexing?: DisableIndexing;
|
||||
retrieval_settings?: RetrievalSettings;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface ModelDescription {
|
||||
title: Title;
|
||||
provider: Provider;
|
||||
model: Model;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
context_length?: ContextLength;
|
||||
template?: Template;
|
||||
completion_options?: CompletionOptions;
|
||||
system_message?: SystemMessage;
|
||||
request_options?: RequestOptions;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
temperature?: Temperature;
|
||||
top_p?: TopP;
|
||||
top_k?: TopK;
|
||||
presence_penalty?: PresencePenalty;
|
||||
frequency_penalty?: FrequencyPenalty;
|
||||
stop?: Stop;
|
||||
max_tokens?: MaxTokens;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RequestOptions1 {
|
||||
timeout?: Timeout;
|
||||
verify_ssl?: VerifySsl;
|
||||
ca_bundle_path?: CaBundlePath;
|
||||
proxy?: Proxy;
|
||||
headers?: Headers;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Headers to use when making the HTTP request
|
||||
*/
|
||||
export interface Headers {
|
||||
[k: string]: string;
|
||||
}
|
||||
export interface ModelRoles1 {
|
||||
default: Default;
|
||||
chat?: Chat;
|
||||
edit?: Edit;
|
||||
summarize?: Summarize;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface SlashCommand {
|
||||
name: Name;
|
||||
description: Description;
|
||||
step: Step;
|
||||
params?: Params;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Params {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface CustomCommand {
|
||||
name: Name1;
|
||||
prompt: Prompt;
|
||||
description: Description1;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface ContextProviderWithParams {
|
||||
name: Name2;
|
||||
params?: Params1;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Params1 {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RetrievalSettings1 {
|
||||
n_retrieve?: NRetrieve;
|
||||
n_final?: NFinal;
|
||||
use_reranking?: UseReranking;
|
||||
rerank_group_size?: RerankGroupSize;
|
||||
ignore_files?: IgnoreFiles;
|
||||
openai_api_key?: OpenaiApiKey;
|
||||
api_base?: ApiBase1;
|
||||
api_type?: ApiType;
|
||||
api_version?: ApiVersion;
|
||||
organization_id?: OrganizationId;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
import _ from "lodash";
|
||||
import { ModelProvider } from "../schema/ModelProvider";
|
||||
import { ModelName } from "../schema/ModelName";
|
||||
|
||||
function updatedObj(old: any, pathToValue: { [key: string]: any }) {
|
||||
export function updatedObj(old: any, pathToValue: { [key: string]: any }) {
|
||||
const newObject = _.cloneDeep(old);
|
||||
for (const key in pathToValue) {
|
||||
if (typeof pathToValue[key] === "function") {
|
||||
|
|
@ -55,7 +57,7 @@ const contextLengthInput: InputDescriptor = {
|
|||
};
|
||||
const temperatureInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "temperature",
|
||||
key: "completion_options.temperature",
|
||||
label: "Temperature",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -65,7 +67,7 @@ const temperatureInput: InputDescriptor = {
|
|||
};
|
||||
const topPInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "top_p",
|
||||
key: "completion_options.top_p",
|
||||
label: "Top-P",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -75,7 +77,7 @@ const topPInput: InputDescriptor = {
|
|||
};
|
||||
const topKInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "top_k",
|
||||
key: "completion_options.top_k",
|
||||
label: "Top-K",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -85,7 +87,7 @@ const topKInput: InputDescriptor = {
|
|||
};
|
||||
const presencePenaltyInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "presence_penalty",
|
||||
key: "completion_options.presence_penalty",
|
||||
label: "Presence Penalty",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -95,7 +97,7 @@ const presencePenaltyInput: InputDescriptor = {
|
|||
};
|
||||
const FrequencyPenaltyInput: InputDescriptor = {
|
||||
inputType: CollectInputType.number,
|
||||
key: "frequency_penalty",
|
||||
key: "completion_options.frequency_penalty",
|
||||
label: "Frequency Penalty",
|
||||
defaultValue: undefined,
|
||||
required: false,
|
||||
|
|
@ -112,17 +114,17 @@ const completionParamsInputs = [
|
|||
FrequencyPenaltyInput,
|
||||
];
|
||||
|
||||
const serverUrlInput: InputDescriptor = {
|
||||
const apiBaseInput: InputDescriptor = {
|
||||
inputType: CollectInputType.text,
|
||||
key: "server_url",
|
||||
label: "Server URL",
|
||||
key: "api_base",
|
||||
label: "API Base",
|
||||
placeholder: "e.g. http://localhost:8080",
|
||||
required: false,
|
||||
};
|
||||
|
||||
export interface ModelInfo {
|
||||
title: string;
|
||||
class: string;
|
||||
provider: ModelProvider;
|
||||
description: string;
|
||||
longDescription?: string;
|
||||
icon?: string;
|
||||
|
|
@ -148,7 +150,7 @@ export interface ModelPackage {
|
|||
tags?: ModelProviderTag[];
|
||||
icon?: string;
|
||||
params: {
|
||||
model: string;
|
||||
model: ModelName;
|
||||
template_messages?: string;
|
||||
context_length: number;
|
||||
stop_tokens?: string[];
|
||||
|
|
@ -159,29 +161,15 @@ export interface ModelPackage {
|
|||
dimensions?: PackageDimension[];
|
||||
}
|
||||
|
||||
enum EditPromptTemplates {
|
||||
"codellama" = "codellama_edit_prompt",
|
||||
"alpaca" = "alpaca_edit_prompt",
|
||||
}
|
||||
|
||||
enum ChatTemplates {
|
||||
"alpaca" = "template_alpaca_messages",
|
||||
"llama2" = "llama2_template_messages",
|
||||
"phind" = "phind_template_messages",
|
||||
"sqlcoder" = "sqlcoder_template_messages",
|
||||
"None" = "None",
|
||||
}
|
||||
|
||||
const codeLlamaInstruct: ModelPackage = {
|
||||
title: "CodeLlama Instruct",
|
||||
description:
|
||||
"A model from Meta, fine-tuned for code generation and conversation",
|
||||
refUrl: "",
|
||||
params: {
|
||||
title: "CodeLlama-7b-Instruct",
|
||||
model: "codellama:7b-instruct",
|
||||
title: "CodeLlama-7b",
|
||||
model: "codellama-7b",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.llama2,
|
||||
},
|
||||
icon: "meta.png",
|
||||
dimensions: [
|
||||
|
|
@ -190,16 +178,16 @@ const codeLlamaInstruct: ModelPackage = {
|
|||
description: "The number of parameters in the model",
|
||||
options: {
|
||||
"7b": {
|
||||
model: "codellama:7b-instruct",
|
||||
title: "CodeLlama-7b-Instruct",
|
||||
model: "codellama-7b",
|
||||
title: "CodeLlama-7b",
|
||||
},
|
||||
"13b": {
|
||||
model: "codellama:13b-instruct",
|
||||
title: "CodeLlama-13b-Instruct",
|
||||
model: "codellama-13b",
|
||||
title: "CodeLlama-13b",
|
||||
},
|
||||
"34b": {
|
||||
model: "codellama:34b-instruct",
|
||||
title: "CodeLlama-34b-Instruct",
|
||||
model: "codellama-34b",
|
||||
title: "CodeLlama-34b",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -211,10 +199,9 @@ const llama2Chat: ModelPackage = {
|
|||
description: "The latest Llama model from Meta, fine-tuned for chat",
|
||||
refUrl: "",
|
||||
params: {
|
||||
title: "Llama2-7b-Chat",
|
||||
model: "llama2:7b-chat",
|
||||
title: "Llama2-7b",
|
||||
model: "llama2-7b",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.llama2,
|
||||
},
|
||||
icon: "meta.png",
|
||||
dimensions: [
|
||||
|
|
@ -223,16 +210,16 @@ const llama2Chat: ModelPackage = {
|
|||
description: "The number of parameters in the model",
|
||||
options: {
|
||||
"7b": {
|
||||
model: "llama2:7b-chat",
|
||||
title: "Llama2-7b-Chat",
|
||||
model: "llama2-7b",
|
||||
title: "Llama2-7b",
|
||||
},
|
||||
"13b": {
|
||||
model: "llama2:13b-chat",
|
||||
title: "Llama2-13b-Chat",
|
||||
model: "llama2-13b",
|
||||
title: "Llama2-13b",
|
||||
},
|
||||
"34b": {
|
||||
model: "llama2:34b-chat",
|
||||
title: "Llama2-34b-Chat",
|
||||
model: "llama2-34b",
|
||||
title: "Llama2-34b",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -245,13 +232,9 @@ const wizardCoder: ModelPackage = {
|
|||
"A CodeLlama-based code generation model from WizardLM, focused on Python",
|
||||
refUrl: "",
|
||||
params: {
|
||||
title: "WizardCoder-7b-Python",
|
||||
model: "wizardcoder:7b-python",
|
||||
title: "WizardCoder-7b",
|
||||
model: "wizardcoder-7b",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.alpaca,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.alpaca,
|
||||
},
|
||||
},
|
||||
icon: "wizardlm.png",
|
||||
dimensions: [
|
||||
|
|
@ -260,16 +243,16 @@ const wizardCoder: ModelPackage = {
|
|||
description: "The number of parameters in the model",
|
||||
options: {
|
||||
"7b": {
|
||||
model: "wizardcoder:7b-python",
|
||||
title: "WizardCoder-7b-Python",
|
||||
model: "wizardcoder-7b",
|
||||
title: "WizardCoder-7b",
|
||||
},
|
||||
"13b": {
|
||||
model: "wizardcoder:13b-python",
|
||||
title: "WizardCoder-13b-Python",
|
||||
model: "wizardcoder-13b",
|
||||
title: "WizardCoder-13b",
|
||||
},
|
||||
"34b": {
|
||||
model: "wizardcoder:34b-python",
|
||||
title: "WizardCoder-34b-Python",
|
||||
model: "wizardcoder-34b",
|
||||
title: "WizardCoder-34b",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -281,12 +264,8 @@ const phindCodeLlama: ModelPackage = {
|
|||
description: "A finetune of CodeLlama by Phind",
|
||||
params: {
|
||||
title: "Phind CodeLlama",
|
||||
model: "phind-codellama",
|
||||
model: "phind-codellama-34b",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.phind,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.codellama,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -296,58 +275,19 @@ const mistral: ModelPackage = {
|
|||
"A 7b parameter base model created by Mistral AI, very competent for code generation and other tasks",
|
||||
params: {
|
||||
title: "Mistral",
|
||||
model: "mistral",
|
||||
model: "mistral-7b",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.llama2,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.codellama,
|
||||
},
|
||||
},
|
||||
icon: "mistral.png",
|
||||
};
|
||||
|
||||
const sqlCoder: ModelPackage = {
|
||||
title: "SQLCoder",
|
||||
description:
|
||||
"A finetune of StarCoder by Defog.ai, focused specifically on SQL",
|
||||
params: {
|
||||
title: "SQLCoder",
|
||||
model: "sqlcoder",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.sqlcoder,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.codellama,
|
||||
},
|
||||
},
|
||||
dimensions: [
|
||||
{
|
||||
name: "Parameter Count",
|
||||
description: "The number of parameters in the model",
|
||||
options: {
|
||||
"7b": {
|
||||
model: "sqlcoder:7b",
|
||||
title: "SQLCoder-7b",
|
||||
},
|
||||
"13b": {
|
||||
model: "sqlcoder:15b",
|
||||
title: "SQLCoder-15b",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const codeup: ModelPackage = {
|
||||
title: "CodeUp (13b)",
|
||||
description: "An open-source coding model based on Llama2",
|
||||
params: {
|
||||
title: "CodeUp",
|
||||
model: "codeup",
|
||||
model: "codeup-13b",
|
||||
context_length: 2048,
|
||||
template_messages: ChatTemplates.llama2,
|
||||
prompt_templates: {
|
||||
edit: EditPromptTemplates.alpaca,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -356,7 +296,6 @@ const osModels = [
|
|||
llama2Chat,
|
||||
wizardCoder,
|
||||
phindCodeLlama,
|
||||
sqlCoder,
|
||||
mistral,
|
||||
codeup,
|
||||
];
|
||||
|
|
@ -396,27 +335,10 @@ const gpt35turbo: ModelPackage = {
|
|||
},
|
||||
};
|
||||
|
||||
const OLLAMA_TO_REPLICATE_MODEL_NAMES: { [key: string]: string } = {
|
||||
"codellama:7b-instruct":
|
||||
"meta/codellama-7b-instruct:6527b83e01e41412db37de5110a8670e3701ee95872697481a355e05ce12af0e",
|
||||
"codellama:13b-instruct":
|
||||
"meta/codellama-13b-instruct:1f01a52ff933873dff339d5fb5e1fd6f24f77456836f514fa05e91c1a42699c7",
|
||||
"codellama:34b-instruct":
|
||||
"meta/codellama-34b-instruct:8281a5c610f6e88237ff3ddaf3c33b56f60809e2bdd19fbec2fda742aa18167e",
|
||||
"llama2:7b-chat":
|
||||
"meta/llama-2-7b-chat:8e6975e5ed6174911a6ff3d60540dfd4844201974602551e10e9e87ab143d81e",
|
||||
"llama2:13b-chat":
|
||||
"meta/llama-2-13b-chat:f4e2de70d66816a838a89eeeb621910adffb0dd0baba3976c96980970978018d",
|
||||
};
|
||||
|
||||
function replicateConvertModelName(model: string): string {
|
||||
return OLLAMA_TO_REPLICATE_MODEL_NAMES[model] || model;
|
||||
}
|
||||
|
||||
export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
||||
openai: {
|
||||
title: "OpenAI",
|
||||
class: "OpenAI",
|
||||
provider: "openai",
|
||||
description: "Use gpt-4, gpt-3.5-turbo, or any other OpenAI model",
|
||||
longDescription:
|
||||
"Use gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.",
|
||||
|
|
@ -436,7 +358,7 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
},
|
||||
anthropic: {
|
||||
title: "Anthropic",
|
||||
class: "AnthropicLLM",
|
||||
provider: "anthropic",
|
||||
description:
|
||||
"Claude-2 is a highly capable model with a 100k context length",
|
||||
icon: "anthropic.png",
|
||||
|
|
@ -452,6 +374,10 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
required: true,
|
||||
},
|
||||
...completionParamsInputs,
|
||||
{
|
||||
...contextLengthInput,
|
||||
defaultValue: 100_000,
|
||||
},
|
||||
],
|
||||
packages: [
|
||||
{
|
||||
|
|
@ -467,7 +393,7 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
},
|
||||
ollama: {
|
||||
title: "Ollama",
|
||||
class: "Ollama",
|
||||
provider: "ollama",
|
||||
description:
|
||||
"One of the fastest ways to get started with local models on Mac or Linux",
|
||||
longDescription:
|
||||
|
|
@ -477,12 +403,12 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
packages: osModels,
|
||||
collectInputFor: [
|
||||
...completionParamsInputs,
|
||||
{ ...serverUrlInput, defaultValue: "http://localhost:11434" },
|
||||
{ ...apiBaseInput, defaultValue: "http://localhost:11434" },
|
||||
],
|
||||
},
|
||||
together: {
|
||||
title: "TogetherAI",
|
||||
class: "TogetherLLM",
|
||||
provider: "together",
|
||||
description:
|
||||
"Use the TogetherAI API for extremely fast streaming of open-source models",
|
||||
icon: "together.png",
|
||||
|
|
@ -504,59 +430,16 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
},
|
||||
...completionParamsInputs,
|
||||
],
|
||||
packages: [
|
||||
updatedObj(llama2Chat, {
|
||||
"dimensions[0].options": (options: any) =>
|
||||
_.mapValues(options, (option) => {
|
||||
return _.assign({}, option, {
|
||||
model:
|
||||
"togethercomputer/" +
|
||||
option.model.replace("llama2", "llama-2").replace(":", "-"),
|
||||
});
|
||||
}),
|
||||
}),
|
||||
updatedObj(codeLlamaInstruct, {
|
||||
"dimensions[0].options": (options: any) =>
|
||||
_.mapValues(options, (option) => {
|
||||
return _.assign({}, option, {
|
||||
model:
|
||||
"togethercomputer/" +
|
||||
option.model
|
||||
.replace("codellama", "CodeLlama")
|
||||
.replace(":", "-")
|
||||
.replace("instruct", "Instruct"),
|
||||
});
|
||||
}),
|
||||
}),
|
||||
// Support was dropped recently?
|
||||
// updatedObj(wizardCoder, {
|
||||
// "params.model": "WizardLM/WizardCoder-15B-V1.0",
|
||||
// "params.title": "WizardCoder-15b",
|
||||
// "dimensions[0].options": {
|
||||
// "15b": {
|
||||
// model: "WizardLM/WizardCoder-15B-V1.0",
|
||||
// title: "WizardCoder-15b",
|
||||
// },
|
||||
// "34b (Python)": {
|
||||
// model: "WizardLM/WizardCoder-Python-34B-V1.0",
|
||||
// title: "WizardCoder-34b-Python",
|
||||
// },
|
||||
// },
|
||||
// }),
|
||||
updatedObj(phindCodeLlama, {
|
||||
"params.model": "Phind/Phind-CodeLlama-34B-Python-v1",
|
||||
}),
|
||||
updatedObj(mistral, {
|
||||
"params.model": "mistralai/Mistral-7B-Instruct-v0.1",
|
||||
}),
|
||||
].map((p) => {
|
||||
p.params.context_length = 4096;
|
||||
return p;
|
||||
}),
|
||||
packages: [llama2Chat, codeLlamaInstruct, phindCodeLlama, mistral].map(
|
||||
(p) => {
|
||||
p.params.context_length = 4096;
|
||||
return p;
|
||||
}
|
||||
),
|
||||
},
|
||||
lmstudio: {
|
||||
title: "LM Studio",
|
||||
class: "GGML",
|
||||
provider: "openai-aiohttp",
|
||||
description:
|
||||
"One of the fastest ways to get started with local models on Mac or Windows",
|
||||
longDescription:
|
||||
|
|
@ -565,14 +448,13 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
tags: [ModelProviderTag["Local"], ModelProviderTag["Open-Source"]],
|
||||
params: {
|
||||
server_url: "http://localhost:1234",
|
||||
template_messages: ChatTemplates.None,
|
||||
},
|
||||
packages: osModels,
|
||||
collectInputFor: [...completionParamsInputs],
|
||||
},
|
||||
replicate: {
|
||||
title: "Replicate",
|
||||
class: "ReplicateLLM",
|
||||
provider: "replicate",
|
||||
description: "Use the Replicate API to run open-source models",
|
||||
longDescription: `Replicate is a hosted service that makes it easy to run ML models. To get started with Replicate:\n1. Obtain an API key from [here](https://replicate.com)\n2. Paste below\n3. Select a model preset`,
|
||||
params: {
|
||||
|
|
@ -593,59 +475,11 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = {
|
|||
ModelProviderTag["Requires API Key"],
|
||||
ModelProviderTag["Open-Source"],
|
||||
],
|
||||
packages: [
|
||||
...[codeLlamaInstruct, llama2Chat]
|
||||
.map((p: ModelPackage) => {
|
||||
if (p.title === "Llama2 Chat") {
|
||||
return updatedObj(p, {
|
||||
"dimensions[0].options.34b": undefined,
|
||||
"dimensions[0].options.70b": {
|
||||
model:
|
||||
"meta/llama-2-70b-chat:02e509c789964a7ea8736978a43525956ef40397be9033abf9fd2badfe68c9e3",
|
||||
title: "Llama2-70b-Chat",
|
||||
},
|
||||
});
|
||||
}
|
||||
return p;
|
||||
})
|
||||
.map((p) => {
|
||||
return updatedObj(p, {
|
||||
"params.model": (model: string) => {
|
||||
return replicateConvertModelName(model);
|
||||
},
|
||||
"dimensions[0].options": (options: any) => {
|
||||
const newOptions: any = {};
|
||||
for (const key in options) {
|
||||
newOptions[key] = {
|
||||
...options[key],
|
||||
model: replicateConvertModelName(options[key]?.model),
|
||||
};
|
||||
}
|
||||
return newOptions;
|
||||
},
|
||||
});
|
||||
}),
|
||||
updatedObj(wizardCoder, {
|
||||
title: "WizardCoder (15b)",
|
||||
"params.model":
|
||||
"andreasjansson/wizardcoder-python-34b-v1-gguf:67eed332a5389263b8ede41be3ee7dc119fa984e2bde287814c4abed19a45e54",
|
||||
dimensions: undefined,
|
||||
}),
|
||||
updatedObj(sqlCoder, {
|
||||
dimensions: undefined,
|
||||
title: "SQLCoder (15b)",
|
||||
"params.model":
|
||||
"gregwdata/defog-sqlcoder-q8:0a9abc0d143072fd5d8920ad90b8fbaafaf16b10ffdad24bd897b5bffacfce0b",
|
||||
}),
|
||||
updatedObj(mistral, {
|
||||
"params.model":
|
||||
"a16z-infra/mistral-7b-instruct-v0.1:83b6a56e7c828e667f21fd596c338fd4f0039b46bcfa18d973e8e70e455fda70",
|
||||
}),
|
||||
],
|
||||
packages: [codeLlamaInstruct, llama2Chat, wizardCoder, mistral],
|
||||
},
|
||||
llamacpp: {
|
||||
title: "llama.cpp",
|
||||
class: "LlamaCpp",
|
||||
provider: "llama.cpp",
|
||||
description: "If you are running the llama.cpp server from source",
|
||||
longDescription: `llama.cpp comes with a [built-in server](https://github.com/ggerganov/llama.cpp/tree/master/examples/server#llamacppexampleserver) that can be run from source. To do this:
|
||||
|
||||
|
|
@ -666,7 +500,7 @@ After it's up and running, you can start using Continue.`,
|
|||
},
|
||||
textgenwebui: {
|
||||
title: "text-generation-webui",
|
||||
class: "TextGenWebUI",
|
||||
provider: "text-gen-webui",
|
||||
description: "A popular open-source front-end for serving LLMs locally",
|
||||
longDescription: `text-generation-webui is a comprehensive, open-source language model UI and local server. You can also set it up with an [OpenAI-compatible server extension](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#an-openedai-api-openai-like), but this model provider is made to interface with the built-in server, which has a different format. To setup the text-generation-webui server, take the following steps:
|
||||
|
||||
|
|
@ -687,7 +521,7 @@ After it's up and running, you can start using Continue.`,
|
|||
},
|
||||
palm: {
|
||||
title: "Google PaLM API",
|
||||
class: "GooglePaLMAPI",
|
||||
provider: "google-palm",
|
||||
description:
|
||||
"Try out the Google PaLM API, which is currently in public preview, using an API key from Google Makersuite",
|
||||
longDescription: `To get started with Google Makersuite, obtain your API key from [here](https://developers.generativeai.google/products/makersuite) and paste it below.
|
||||
|
|
@ -717,7 +551,7 @@ After it's up and running, you can start using Continue.`,
|
|||
},
|
||||
hftgi: {
|
||||
title: "HuggingFace TGI",
|
||||
class: "HuggingFaceTGI",
|
||||
provider: "huggingface-tgi",
|
||||
description:
|
||||
"HuggingFace Text Generation Inference is an advanced, highly-performant option for serving open-source models to multiple people",
|
||||
longDescription:
|
||||
|
|
@ -727,12 +561,12 @@ After it's up and running, you can start using Continue.`,
|
|||
packages: osModels,
|
||||
collectInputFor: [
|
||||
...completionParamsInputs,
|
||||
{ ...serverUrlInput, defaultValue: "http://localhost:8080" },
|
||||
{ ...apiBaseInput, defaultValue: "http://localhost:8080" },
|
||||
],
|
||||
},
|
||||
ggml: {
|
||||
title: "Other OpenAI-compatible API",
|
||||
class: "GGML",
|
||||
provider: "openai-aiohttp",
|
||||
description:
|
||||
"If you are using any other OpenAI-compatible API, for example text-gen-webui, FastChat, LocalAI, or llama-cpp-python, you can simply enter your server URL",
|
||||
longDescription: `If you are using any other OpenAI-compatible API, you can simply enter your server URL. If you still need to set up your model server, you can follow a guide below:
|
||||
|
|
@ -746,7 +580,7 @@ After it's up and running, you can start using Continue.`,
|
|||
},
|
||||
collectInputFor: [
|
||||
{
|
||||
...serverUrlInput,
|
||||
...apiBaseInput,
|
||||
defaultValue: "http://localhost:8000",
|
||||
},
|
||||
...completionParamsInputs,
|
||||
|
|
@ -756,8 +590,8 @@ After it's up and running, you can start using Continue.`,
|
|||
packages: osModels,
|
||||
},
|
||||
freetrial: {
|
||||
title: "GPT-4 limited free trial",
|
||||
class: "OpenAIFreeTrial",
|
||||
title: "OpenAI limited free trial",
|
||||
provider: "openai-free-trial",
|
||||
description:
|
||||
"New users can try out Continue for free using a proxy server that securely makes calls to OpenAI using our API key",
|
||||
longDescription:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"title": "ContinueConfig",
|
||||
"$ref": "#/definitions/continuedev__core__config__ContinueConfig",
|
||||
"$ref": "#/definitions/continuedev__core__config__config__ContinueConfig",
|
||||
"definitions": {
|
||||
"FunctionCall": {
|
||||
"title": "FunctionCall",
|
||||
|
|
@ -97,6 +97,86 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"BaseCompletionOptions": {
|
||||
"title": "BaseCompletionOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_p": {
|
||||
"title": "Top P",
|
||||
"description": "The top_p of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_k": {
|
||||
"title": "Top K",
|
||||
"description": "The top_k of the completion.",
|
||||
"type": "integer"
|
||||
},
|
||||
"presence_penalty": {
|
||||
"title": "Presence Penalty",
|
||||
"description": "The presence penalty Aof the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"title": "Frequency Penalty",
|
||||
"description": "The frequency penalty of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"stop": {
|
||||
"title": "Stop",
|
||||
"description": "The stop tokens of the completion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"max_tokens": {
|
||||
"title": "Max Tokens",
|
||||
"description": "The maximum number of tokens to generate.",
|
||||
"default": 600,
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RequestOptions": {
|
||||
"title": "RequestOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
"default": 300,
|
||||
"type": "integer"
|
||||
},
|
||||
"verify_ssl": {
|
||||
"title": "Verify Ssl",
|
||||
"description": "Whether to verify SSL certificates for requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"title": "Ca Bundle Path",
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Proxy URL to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"title": "Headers",
|
||||
"description": "Headers to use when making the HTTP request",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"LLM": {
|
||||
"title": "LLM",
|
||||
"type": "object",
|
||||
|
|
@ -127,67 +207,39 @@
|
|||
"default": 2048,
|
||||
"type": "integer"
|
||||
},
|
||||
"stop_tokens": {
|
||||
"title": "Stop Tokens",
|
||||
"description": "Tokens that will stop the completion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
"default": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BaseCompletionOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_p": {
|
||||
"title": "Top P",
|
||||
"description": "The top_p of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_k": {
|
||||
"title": "Top K",
|
||||
"description": "The top_k of the completion.",
|
||||
"type": "integer"
|
||||
},
|
||||
"presence_penalty": {
|
||||
"title": "Presence Penalty",
|
||||
"description": "The presence penalty Aof the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"title": "Frequency Penalty",
|
||||
"description": "The frequency penalty of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
"default": 300,
|
||||
"type": "integer"
|
||||
},
|
||||
"verify_ssl": {
|
||||
"title": "Verify Ssl",
|
||||
"description": "Whether to verify SSL certificates for requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"title": "Ca Bundle Path",
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Proxy URL to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"title": "Headers",
|
||||
"description": "Headers to use when making the HTTP request",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
"request_options": {
|
||||
"title": "Request Options",
|
||||
"description": "Options for the HTTP request to the LLM.",
|
||||
"default": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RequestOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"prompt_templates": {
|
||||
"title": "Prompt Templates",
|
||||
|
|
@ -199,6 +251,11 @@
|
|||
"title": "Api Key",
|
||||
"description": "The API key for the LLM provider.",
|
||||
"type": "string"
|
||||
},
|
||||
"api_base": {
|
||||
"title": "Api Base",
|
||||
"description": "The base URL of the LLM API.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -279,7 +336,18 @@
|
|||
"type": "string"
|
||||
},
|
||||
"step": {
|
||||
"title": "Step"
|
||||
"title": "Step",
|
||||
"enum": [
|
||||
"AnswerQuestionChroma",
|
||||
"GenerateShellCommandStep",
|
||||
"EditHighlightedCodeStep",
|
||||
"ShareSessionStep",
|
||||
"CommentCodeStep",
|
||||
"ClearHistoryStep",
|
||||
"StackOverflowStep",
|
||||
"OpenConfigStep"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"title": "Params",
|
||||
|
|
@ -484,7 +552,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"continuedev__core__config__ContinueConfig": {
|
||||
"continuedev__core__config__config__ContinueConfig": {
|
||||
"title": "ContinueConfig",
|
||||
"description": "Continue can be deeply customized by editing the `ContinueConfig` object in `~/.continue/config.py` (`%userprofile%\\.continue\\config.py` for Windows) on your machine. This class is instantiated from the config file for every new session.",
|
||||
"type": "object",
|
||||
|
|
@ -521,21 +589,27 @@
|
|||
"title": null,
|
||||
"model": "gpt-4",
|
||||
"system_message": null,
|
||||
"context_length": 2048,
|
||||
"stop_tokens": null,
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null,
|
||||
"context_length": 8192,
|
||||
"completion_options": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"request_options": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"prompt_templates": {},
|
||||
"template_messages": null,
|
||||
"api_key": null,
|
||||
"api_base": null,
|
||||
"llm": null,
|
||||
"class_name": "OpenAIFreeTrial"
|
||||
},
|
||||
|
|
@ -543,21 +617,27 @@
|
|||
"title": null,
|
||||
"model": "gpt-3.5-turbo",
|
||||
"system_message": null,
|
||||
"context_length": 2048,
|
||||
"stop_tokens": null,
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null,
|
||||
"context_length": 4096,
|
||||
"completion_options": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"request_options": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"prompt_templates": {},
|
||||
"template_messages": null,
|
||||
"api_key": null,
|
||||
"api_base": null,
|
||||
"llm": null,
|
||||
"class_name": "OpenAIFreeTrial"
|
||||
},
|
||||
|
|
@ -565,21 +645,27 @@
|
|||
"title": null,
|
||||
"model": "gpt-4",
|
||||
"system_message": null,
|
||||
"context_length": 2048,
|
||||
"stop_tokens": null,
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null,
|
||||
"context_length": 8192,
|
||||
"completion_options": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"request_options": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"prompt_templates": {},
|
||||
"template_messages": null,
|
||||
"api_key": null,
|
||||
"api_base": null,
|
||||
"llm": null,
|
||||
"class_name": "OpenAIFreeTrial"
|
||||
},
|
||||
|
|
@ -587,21 +673,27 @@
|
|||
"title": null,
|
||||
"model": "gpt-4",
|
||||
"system_message": null,
|
||||
"context_length": 2048,
|
||||
"stop_tokens": null,
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null,
|
||||
"context_length": 8192,
|
||||
"completion_options": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"request_options": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"prompt_templates": {},
|
||||
"template_messages": null,
|
||||
"api_key": null,
|
||||
"api_base": null,
|
||||
"llm": null,
|
||||
"class_name": "OpenAIFreeTrial"
|
||||
},
|
||||
|
|
@ -615,11 +707,28 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature parameter for sampling from the LLM. Higher temperatures will result in more random output, while lower temperatures will result in more predictable output. This value ranges from 0 to 1.",
|
||||
"default": 0.5,
|
||||
"type": "number"
|
||||
"system_message": {
|
||||
"title": "System Message",
|
||||
"description": "A system message that will always be followed by the LLM",
|
||||
"type": "string"
|
||||
},
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
"default": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BaseCompletionOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"custom_commands": {
|
||||
"title": "Custom Commands",
|
||||
|
|
@ -654,11 +763,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"system_message": {
|
||||
"title": "System Message",
|
||||
"description": "A system message that will always be followed by the LLM",
|
||||
"type": "string"
|
||||
},
|
||||
"policy_override": {
|
||||
"title": "Policy Override",
|
||||
"description": "A Policy object that can be used to override the default behavior of Continue, for example in order to build custom agents that take multiple steps at a time.",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,86 @@
|
|||
"title": "LLM",
|
||||
"$ref": "#/definitions/continuedev__libs__llm__base__LLM",
|
||||
"definitions": {
|
||||
"BaseCompletionOptions": {
|
||||
"title": "BaseCompletionOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_p": {
|
||||
"title": "Top P",
|
||||
"description": "The top_p of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_k": {
|
||||
"title": "Top K",
|
||||
"description": "The top_k of the completion.",
|
||||
"type": "integer"
|
||||
},
|
||||
"presence_penalty": {
|
||||
"title": "Presence Penalty",
|
||||
"description": "The presence penalty Aof the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"title": "Frequency Penalty",
|
||||
"description": "The frequency penalty of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"stop": {
|
||||
"title": "Stop",
|
||||
"description": "The stop tokens of the completion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"max_tokens": {
|
||||
"title": "Max Tokens",
|
||||
"description": "The maximum number of tokens to generate.",
|
||||
"default": 600,
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RequestOptions": {
|
||||
"title": "RequestOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
"default": 300,
|
||||
"type": "integer"
|
||||
},
|
||||
"verify_ssl": {
|
||||
"title": "Verify Ssl",
|
||||
"description": "Whether to verify SSL certificates for requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"title": "Ca Bundle Path",
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Proxy URL to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"title": "Headers",
|
||||
"description": "Headers to use when making the HTTP request",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"continuedev__libs__llm__base__LLM": {
|
||||
"title": "LLM",
|
||||
"type": "object",
|
||||
|
|
@ -32,67 +112,39 @@
|
|||
"default": 2048,
|
||||
"type": "integer"
|
||||
},
|
||||
"stop_tokens": {
|
||||
"title": "Stop Tokens",
|
||||
"description": "Tokens that will stop the completion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
"default": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BaseCompletionOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_p": {
|
||||
"title": "Top P",
|
||||
"description": "The top_p of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_k": {
|
||||
"title": "Top K",
|
||||
"description": "The top_k of the completion.",
|
||||
"type": "integer"
|
||||
},
|
||||
"presence_penalty": {
|
||||
"title": "Presence Penalty",
|
||||
"description": "The presence penalty Aof the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"title": "Frequency Penalty",
|
||||
"description": "The frequency penalty of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
"default": 300,
|
||||
"type": "integer"
|
||||
},
|
||||
"verify_ssl": {
|
||||
"title": "Verify Ssl",
|
||||
"description": "Whether to verify SSL certificates for requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"title": "Ca Bundle Path",
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Proxy URL to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"title": "Headers",
|
||||
"description": "Headers to use when making the HTTP request",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
"request_options": {
|
||||
"title": "Request Options",
|
||||
"description": "Options for the HTTP request to the LLM.",
|
||||
"default": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RequestOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"prompt_templates": {
|
||||
"title": "Prompt Templates",
|
||||
|
|
@ -104,6 +156,11 @@
|
|||
"title": "Api Key",
|
||||
"description": "The API key for the LLM provider.",
|
||||
"type": "string"
|
||||
},
|
||||
"api_base": {
|
||||
"title": "Api Base",
|
||||
"description": "The base URL of the LLM API.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
|
|||
194
schema/json/ModelDescription.json
Normal file
194
schema/json/ModelDescription.json
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
{
|
||||
"title": "ModelDescription",
|
||||
"$ref": "#/definitions/continuedev__core__config__serialized_config__ModelDescription",
|
||||
"definitions": {
|
||||
"BaseCompletionOptions": {
|
||||
"title": "BaseCompletionOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_p": {
|
||||
"title": "Top P",
|
||||
"description": "The top_p of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_k": {
|
||||
"title": "Top K",
|
||||
"description": "The top_k of the completion.",
|
||||
"type": "integer"
|
||||
},
|
||||
"presence_penalty": {
|
||||
"title": "Presence Penalty",
|
||||
"description": "The presence penalty Aof the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"title": "Frequency Penalty",
|
||||
"description": "The frequency penalty of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"stop": {
|
||||
"title": "Stop",
|
||||
"description": "The stop tokens of the completion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"max_tokens": {
|
||||
"title": "Max Tokens",
|
||||
"description": "The maximum number of tokens to generate.",
|
||||
"default": 600,
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RequestOptions": {
|
||||
"title": "RequestOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
"default": 300,
|
||||
"type": "integer"
|
||||
},
|
||||
"verify_ssl": {
|
||||
"title": "Verify Ssl",
|
||||
"description": "Whether to verify SSL certificates for requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"title": "Ca Bundle Path",
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Proxy URL to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"title": "Headers",
|
||||
"description": "Headers to use when making the HTTP request",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"continuedev__core__config__serialized_config__ModelDescription": {
|
||||
"title": "ModelDescription",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"title": "Title",
|
||||
"description": "The title you wish to give your model.",
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"title": "Provider",
|
||||
"description": "The provider of the model. This is used to determine the type of model, and how to interact with it.",
|
||||
"enum": [
|
||||
"openai",
|
||||
"openai-free-trial",
|
||||
"openai-aiohttp",
|
||||
"anthropic",
|
||||
"together",
|
||||
"ollama",
|
||||
"huggingface-tgi",
|
||||
"huggingface-inference-api",
|
||||
"llama.cpp",
|
||||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"title": "Model",
|
||||
"description": "The name of the model. Used to autodetect prompt template.",
|
||||
"type": "string"
|
||||
},
|
||||
"api_key": {
|
||||
"title": "Api Key",
|
||||
"description": "OpenAI, Anthropic, Together, or other API key",
|
||||
"type": "string"
|
||||
},
|
||||
"api_base": {
|
||||
"title": "Api Base",
|
||||
"description": "The base URL of the LLM API.",
|
||||
"type": "string"
|
||||
},
|
||||
"context_length": {
|
||||
"title": "Context Length",
|
||||
"description": "The maximum context length of the LLM in tokens, as counted by count_tokens.",
|
||||
"default": 2048,
|
||||
"type": "integer"
|
||||
},
|
||||
"template": {
|
||||
"title": "Template",
|
||||
"description": "The chat template used to format messages. This is auto-detected for most models, but can be overridden here.",
|
||||
"enum": [
|
||||
"llama2",
|
||||
"alpaca",
|
||||
"zephyr",
|
||||
"phind",
|
||||
"anthropic",
|
||||
"chatml"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
"default": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BaseCompletionOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"system_message": {
|
||||
"title": "System Message",
|
||||
"description": "A system message that will always be followed by the LLM",
|
||||
"type": "string"
|
||||
},
|
||||
"request_options": {
|
||||
"title": "Request Options",
|
||||
"description": "Options for the HTTP request to the LLM.",
|
||||
"default": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RequestOptions"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"title",
|
||||
"provider",
|
||||
"model"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
26
schema/json/ModelName.json
Normal file
26
schema/json/ModelName.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"title": "ModelName",
|
||||
"enum": [
|
||||
"gpt-3.5-turbo",
|
||||
"gpt-3.5-turbo-16k",
|
||||
"gpt-4",
|
||||
"gpt-3.5-turbo-0613",
|
||||
"gpt-4-32k",
|
||||
"gpt-4-1106-preview",
|
||||
"mistral-7b",
|
||||
"llama2-7b",
|
||||
"llama2-13b",
|
||||
"codellama-7b",
|
||||
"codellama-13b",
|
||||
"codellama-34b",
|
||||
"phind-codellama-34b",
|
||||
"wizardcoder-7b",
|
||||
"wizardcoder-13b",
|
||||
"wizardcoder-34b",
|
||||
"zephyr-7b",
|
||||
"codeup-13b",
|
||||
"claude-2",
|
||||
"chat-bison-001"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
18
schema/json/ModelProvider.json
Normal file
18
schema/json/ModelProvider.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"title": "ModelProvider",
|
||||
"enum": [
|
||||
"openai",
|
||||
"openai-free-trial",
|
||||
"openai-aiohttp",
|
||||
"anthropic",
|
||||
"together",
|
||||
"ollama",
|
||||
"huggingface-tgi",
|
||||
"huggingface-inference-api",
|
||||
"llama.cpp",
|
||||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
|
|
@ -2,6 +2,86 @@
|
|||
"title": "Models",
|
||||
"$ref": "#/definitions/continuedev__core__models__Models",
|
||||
"definitions": {
|
||||
"BaseCompletionOptions": {
|
||||
"title": "BaseCompletionOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_p": {
|
||||
"title": "Top P",
|
||||
"description": "The top_p of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_k": {
|
||||
"title": "Top K",
|
||||
"description": "The top_k of the completion.",
|
||||
"type": "integer"
|
||||
},
|
||||
"presence_penalty": {
|
||||
"title": "Presence Penalty",
|
||||
"description": "The presence penalty Aof the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"title": "Frequency Penalty",
|
||||
"description": "The frequency penalty of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"stop": {
|
||||
"title": "Stop",
|
||||
"description": "The stop tokens of the completion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"max_tokens": {
|
||||
"title": "Max Tokens",
|
||||
"description": "The maximum number of tokens to generate.",
|
||||
"default": 600,
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RequestOptions": {
|
||||
"title": "RequestOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
"default": 300,
|
||||
"type": "integer"
|
||||
},
|
||||
"verify_ssl": {
|
||||
"title": "Verify Ssl",
|
||||
"description": "Whether to verify SSL certificates for requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"title": "Ca Bundle Path",
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Proxy URL to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"title": "Headers",
|
||||
"description": "Headers to use when making the HTTP request",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"LLM": {
|
||||
"title": "LLM",
|
||||
"type": "object",
|
||||
|
|
@ -32,67 +112,39 @@
|
|||
"default": 2048,
|
||||
"type": "integer"
|
||||
},
|
||||
"stop_tokens": {
|
||||
"title": "Stop Tokens",
|
||||
"description": "Tokens that will stop the completion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
"default": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BaseCompletionOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_p": {
|
||||
"title": "Top P",
|
||||
"description": "The top_p of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_k": {
|
||||
"title": "Top K",
|
||||
"description": "The top_k of the completion.",
|
||||
"type": "integer"
|
||||
},
|
||||
"presence_penalty": {
|
||||
"title": "Presence Penalty",
|
||||
"description": "The presence penalty Aof the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"title": "Frequency Penalty",
|
||||
"description": "The frequency penalty of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
"default": 300,
|
||||
"type": "integer"
|
||||
},
|
||||
"verify_ssl": {
|
||||
"title": "Verify Ssl",
|
||||
"description": "Whether to verify SSL certificates for requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"title": "Ca Bundle Path",
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Proxy URL to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"title": "Headers",
|
||||
"description": "Headers to use when making the HTTP request",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
"request_options": {
|
||||
"title": "Request Options",
|
||||
"description": "Options for the HTTP request to the LLM.",
|
||||
"default": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RequestOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"prompt_templates": {
|
||||
"title": "Prompt Templates",
|
||||
|
|
@ -104,6 +156,11 @@
|
|||
"title": "Api Key",
|
||||
"description": "The API key for the LLM provider.",
|
||||
"type": "string"
|
||||
},
|
||||
"api_base": {
|
||||
"title": "Api Base",
|
||||
"description": "The base URL of the LLM API.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
|
|||
526
schema/json/SerializedContinueConfig.json
Normal file
526
schema/json/SerializedContinueConfig.json
Normal file
|
|
@ -0,0 +1,526 @@
|
|||
{
|
||||
"title": "SerializedContinueConfig",
|
||||
"$ref": "#/definitions/continuedev__core__config__serialized_config__SerializedContinueConfig",
|
||||
"definitions": {
|
||||
"BaseCompletionOptions": {
|
||||
"title": "BaseCompletionOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"temperature": {
|
||||
"title": "Temperature",
|
||||
"description": "The temperature of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_p": {
|
||||
"title": "Top P",
|
||||
"description": "The top_p of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"top_k": {
|
||||
"title": "Top K",
|
||||
"description": "The top_k of the completion.",
|
||||
"type": "integer"
|
||||
},
|
||||
"presence_penalty": {
|
||||
"title": "Presence Penalty",
|
||||
"description": "The presence penalty Aof the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"title": "Frequency Penalty",
|
||||
"description": "The frequency penalty of the completion.",
|
||||
"type": "number"
|
||||
},
|
||||
"stop": {
|
||||
"title": "Stop",
|
||||
"description": "The stop tokens of the completion.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"max_tokens": {
|
||||
"title": "Max Tokens",
|
||||
"description": "The maximum number of tokens to generate.",
|
||||
"default": 600,
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RequestOptions": {
|
||||
"title": "RequestOptions",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timeout": {
|
||||
"title": "Timeout",
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
"default": 300,
|
||||
"type": "integer"
|
||||
},
|
||||
"verify_ssl": {
|
||||
"title": "Verify Ssl",
|
||||
"description": "Whether to verify SSL certificates for requests.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"title": "Ca Bundle Path",
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Proxy URL to use when making the HTTP request",
|
||||
"type": "string"
|
||||
},
|
||||
"headers": {
|
||||
"title": "Headers",
|
||||
"description": "Headers to use when making the HTTP request",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ModelDescription": {
|
||||
"title": "ModelDescription",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"title": "Title",
|
||||
"description": "The title you wish to give your model.",
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"title": "Provider",
|
||||
"description": "The provider of the model. This is used to determine the type of model, and how to interact with it.",
|
||||
"enum": [
|
||||
"openai",
|
||||
"openai-free-trial",
|
||||
"openai-aiohttp",
|
||||
"anthropic",
|
||||
"together",
|
||||
"ollama",
|
||||
"huggingface-tgi",
|
||||
"huggingface-inference-api",
|
||||
"llama.cpp",
|
||||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"title": "Model",
|
||||
"description": "The name of the model. Used to autodetect prompt template.",
|
||||
"type": "string"
|
||||
},
|
||||
"api_key": {
|
||||
"title": "Api Key",
|
||||
"description": "OpenAI, Anthropic, Together, or other API key",
|
||||
"type": "string"
|
||||
},
|
||||
"api_base": {
|
||||
"title": "Api Base",
|
||||
"description": "The base URL of the LLM API.",
|
||||
"type": "string"
|
||||
},
|
||||
"context_length": {
|
||||
"title": "Context Length",
|
||||
"description": "The maximum context length of the LLM in tokens, as counted by count_tokens.",
|
||||
"default": 2048,
|
||||
"type": "integer"
|
||||
},
|
||||
"template": {
|
||||
"title": "Template",
|
||||
"description": "The chat template used to format messages. This is auto-detected for most models, but can be overridden here.",
|
||||
"enum": [
|
||||
"llama2",
|
||||
"alpaca",
|
||||
"zephyr",
|
||||
"phind",
|
||||
"anthropic",
|
||||
"chatml"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
"default": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BaseCompletionOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"system_message": {
|
||||
"title": "System Message",
|
||||
"description": "A system message that will always be followed by the LLM",
|
||||
"type": "string"
|
||||
},
|
||||
"request_options": {
|
||||
"title": "Request Options",
|
||||
"description": "Options for the HTTP request to the LLM.",
|
||||
"default": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RequestOptions"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"title",
|
||||
"provider",
|
||||
"model"
|
||||
]
|
||||
},
|
||||
"ModelRoles": {
|
||||
"title": "ModelRoles",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"default": {
|
||||
"title": "Default",
|
||||
"description": "The default model. If other model roles are not set, they will fall back to default.",
|
||||
"type": "string"
|
||||
},
|
||||
"chat": {
|
||||
"title": "Chat",
|
||||
"description": "The model to use for chat. If not set, will fall back to default.",
|
||||
"type": "string"
|
||||
},
|
||||
"edit": {
|
||||
"title": "Edit",
|
||||
"description": "The model to use for editing. If not set, will fall back to default.",
|
||||
"type": "string"
|
||||
},
|
||||
"summarize": {
|
||||
"title": "Summarize",
|
||||
"description": "The model to use for summarization. If not set, will fall back to default.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"default"
|
||||
]
|
||||
},
|
||||
"SlashCommand": {
|
||||
"title": "SlashCommand",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"title": "Description",
|
||||
"type": "string"
|
||||
},
|
||||
"step": {
|
||||
"title": "Step",
|
||||
"enum": [
|
||||
"AnswerQuestionChroma",
|
||||
"GenerateShellCommandStep",
|
||||
"EditHighlightedCodeStep",
|
||||
"ShareSessionStep",
|
||||
"CommentCodeStep",
|
||||
"ClearHistoryStep",
|
||||
"StackOverflowStep",
|
||||
"OpenConfigStep"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"title": "Params",
|
||||
"default": {},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"description",
|
||||
"step"
|
||||
]
|
||||
},
|
||||
"CustomCommand": {
|
||||
"title": "CustomCommand",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"type": "string"
|
||||
},
|
||||
"prompt": {
|
||||
"title": "Prompt",
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"title": "Description",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"prompt",
|
||||
"description"
|
||||
]
|
||||
},
|
||||
"ContextProviderWithParams": {
|
||||
"title": "ContextProviderWithParams",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"enum": [
|
||||
"diff",
|
||||
"github",
|
||||
"terminal",
|
||||
"open",
|
||||
"google",
|
||||
"search",
|
||||
"url"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"title": "Params",
|
||||
"default": {},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"RetrievalSettings": {
|
||||
"title": "RetrievalSettings",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"n_retrieve": {
|
||||
"title": "N Retrieve",
|
||||
"description": "Number of results to initially retrieve from vector database",
|
||||
"default": 50,
|
||||
"type": "integer"
|
||||
},
|
||||
"n_final": {
|
||||
"title": "N Final",
|
||||
"description": "Final number of results to use after re-ranking",
|
||||
"default": 10,
|
||||
"type": "integer"
|
||||
},
|
||||
"use_reranking": {
|
||||
"title": "Use Reranking",
|
||||
"description": "Whether to use re-ranking, which will allow initial selection of n_retrieve results, then will use an LLM to select the top n_final results",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"rerank_group_size": {
|
||||
"title": "Rerank Group Size",
|
||||
"description": "Number of results to group together when re-ranking. Each group will be processed in parallel.",
|
||||
"default": 5,
|
||||
"type": "integer"
|
||||
},
|
||||
"ignore_files": {
|
||||
"title": "Ignore Files",
|
||||
"description": "Files to ignore when indexing the codebase. You can use glob patterns, such as **/*.py. This is useful for directories that contain generated code, or other directories that are not relevant to the codebase.",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"openai_api_key": {
|
||||
"title": "Openai Api Key",
|
||||
"description": "OpenAI API key",
|
||||
"type": "string"
|
||||
},
|
||||
"api_base": {
|
||||
"title": "Api Base",
|
||||
"description": "OpenAI API base URL",
|
||||
"type": "string"
|
||||
},
|
||||
"api_type": {
|
||||
"title": "Api Type",
|
||||
"description": "OpenAI API type",
|
||||
"type": "string"
|
||||
},
|
||||
"api_version": {
|
||||
"title": "Api Version",
|
||||
"description": "OpenAI API version",
|
||||
"type": "string"
|
||||
},
|
||||
"organization_id": {
|
||||
"title": "Organization Id",
|
||||
"description": "OpenAI organization ID",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"continuedev__core__config__serialized_config__SerializedContinueConfig": {
|
||||
"title": "SerializedContinueConfig",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"disallowed_steps": {
|
||||
"title": "Disallowed Steps",
|
||||
"description": "Steps that are not allowed to be run, and will be skipped if attempted",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"allow_anonymous_telemetry": {
|
||||
"title": "Allow Anonymous Telemetry",
|
||||
"description": "If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to False, we will not collect any data.",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"models": {
|
||||
"title": "Models",
|
||||
"default": [
|
||||
{
|
||||
"title": "GPT-4 (trial)",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-4",
|
||||
"api_key": ""
|
||||
}
|
||||
],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ModelDescription"
|
||||
}
|
||||
},
|
||||
"model_roles": {
|
||||
"title": "Model Roles",
|
||||
"description": "Roles for models. Each entry should be the title of a model in the models array.",
|
||||
"default": {
|
||||
"default": "GPT-4 (trial)",
|
||||
"chat": null,
|
||||
"edit": null,
|
||||
"summarize": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ModelRoles"
|
||||
}
|
||||
]
|
||||
},
|
||||
"system_message": {
|
||||
"title": "System Message",
|
||||
"description": "A system message that will always be followed by the LLM",
|
||||
"type": "string"
|
||||
},
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Default options for completion. These will be overriden by any options set for a specific model.",
|
||||
"default": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 600
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/BaseCompletionOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"slash_commands": {
|
||||
"title": "Slash Commands",
|
||||
"description": "An array of slash commands that let you map custom Steps to a shortcut.",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/SlashCommand"
|
||||
}
|
||||
},
|
||||
"custom_commands": {
|
||||
"title": "Custom Commands",
|
||||
"description": "An array of custom commands that allow you to reuse prompts. Each has name, description, and prompt properties. When you enter /<name> in the text input, it will act as a shortcut to the prompt.",
|
||||
"default": [
|
||||
{
|
||||
"name": "test",
|
||||
"prompt": "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't edit any file.",
|
||||
"description": "This is an example custom command. Use /config to edit it and create more"
|
||||
}
|
||||
],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/CustomCommand"
|
||||
}
|
||||
},
|
||||
"context_providers": {
|
||||
"title": "Context Providers",
|
||||
"description": "A list of ContextProvider objects that can be used to provide context to the LLM by typing '@'. Read more about ContextProviders in the documentation.",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ContextProviderWithParams"
|
||||
}
|
||||
},
|
||||
"user_token": {
|
||||
"title": "User Token",
|
||||
"description": "An optional token to identify the user.",
|
||||
"type": "string"
|
||||
},
|
||||
"data_server_url": {
|
||||
"title": "Data Server Url",
|
||||
"description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.",
|
||||
"default": "https://us-west1-autodebug.cloudfunctions.net",
|
||||
"type": "string"
|
||||
},
|
||||
"disable_summaries": {
|
||||
"title": "Disable Summaries",
|
||||
"description": "If set to `True`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"disable_indexing": {
|
||||
"title": "Disable Indexing",
|
||||
"description": "If set to `True`, Continue will not index the codebase. This is mainly used for debugging purposes.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"retrieval_settings": {
|
||||
"title": "Retrieval Settings",
|
||||
"description": "Settings for the retrieval system. Read more about the retrieval system in the documentation.",
|
||||
"default": {
|
||||
"n_retrieve": 50,
|
||||
"n_final": 10,
|
||||
"use_reranking": true,
|
||||
"rerank_group_size": 5,
|
||||
"ignore_files": [],
|
||||
"openai_api_key": null,
|
||||
"api_base": null,
|
||||
"api_type": null,
|
||||
"api_version": null,
|
||||
"organization_id": null
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RetrievalSettings"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
52
server/config.json
Normal file
52
server/config.json
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "GPT-4",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-4"
|
||||
},
|
||||
{
|
||||
"title": "GPT-3.5-Turbo",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-3.5-turbo"
|
||||
}
|
||||
],
|
||||
"model_roles": {
|
||||
"default": "GPT-4",
|
||||
"summarize": "GPT-3.5-Turbo"
|
||||
},
|
||||
"slash_commands": [
|
||||
{
|
||||
"name": "edit",
|
||||
"description": "Edit highlighted code",
|
||||
"step": "EditHighlightedCodeStep"
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"description": "Customize Continue",
|
||||
"step": "OpenConfigStep"
|
||||
},
|
||||
{
|
||||
"name": "comment",
|
||||
"description": "Write comments for the highlighted code",
|
||||
"step": "CommentCodeStep"
|
||||
},
|
||||
{
|
||||
"name": "share",
|
||||
"description": "Download and share this session",
|
||||
"step": "ShareSessionStep"
|
||||
},
|
||||
{
|
||||
"name": "cmd",
|
||||
"description": "Generate a shell command",
|
||||
"step": "GenerateShellCommandStep"
|
||||
}
|
||||
],
|
||||
"custom_commands": [
|
||||
{
|
||||
"name": "test",
|
||||
"prompt": "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't edit any file.",
|
||||
"description": "Write unit tests for highlighted code"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -4,15 +4,18 @@ This is the Continue configuration file.
|
|||
See https://continue.dev/docs/customization to for documentation of the available options.
|
||||
"""
|
||||
|
||||
from continuedev.core.config import (
|
||||
ContinueConfig,
|
||||
CustomCommand,
|
||||
SlashCommand,
|
||||
)
|
||||
from continuedev.core.models import Models
|
||||
from continuedev.core.config import CustomCommand, SlashCommand, ContinueConfig
|
||||
from continuedev.libs.llm import OpenAIFreeTrial
|
||||
|
||||
from continuedev.plugins.context_providers import (
|
||||
DiffContextProvider,
|
||||
GitHubIssuesContextProvider,
|
||||
TerminalContextProvider,
|
||||
URLContextProvider,
|
||||
GitHubIssuesContextProvider,
|
||||
)
|
||||
from continuedev.plugins.steps import (
|
||||
ClearHistoryStep,
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
import asyncio
|
||||
import os
|
||||
from typing import Optional
|
||||
from tqdm import tqdm
|
||||
|
||||
from .core.config import ContinueConfig
|
||||
from .headless.headless_ide import LocalIdeProtocol
|
||||
from .libs.index.build_index import build_index
|
||||
from .libs.util.ext_to_lang import ext_to_lang
|
||||
from .libs.index.chunkers.chunk import Chunk
|
||||
import typer
|
||||
from dotenv import load_dotenv
|
||||
from rich.console import Console
|
||||
from rich.markdown import Markdown
|
||||
|
||||
import typer
|
||||
from tqdm import tqdm
|
||||
|
||||
from . import run
|
||||
from .server.main import run_server
|
||||
from .core.config import ContinueConfig
|
||||
from .headless import get_headless_autopilot
|
||||
from .headless.headless_ide import LocalIdeProtocol
|
||||
from .libs.index.build_index import build_index
|
||||
from .libs.index.chunkers.chunk import Chunk
|
||||
from .libs.index.pipelines.main import main_retrieval_pipeline
|
||||
from .libs.util.ext_to_lang import ext_to_lang
|
||||
from .server.main import run_server
|
||||
|
||||
load_dotenv()
|
||||
app = typer.Typer(invoke_without_command=True)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import inspect
|
||||
import json
|
||||
import os
|
||||
import traceback
|
||||
|
|
@ -6,26 +7,24 @@ from typing import Dict, List, Optional
|
|||
|
||||
from aiohttp import ClientPayloadError
|
||||
from openai import error as openai_errors
|
||||
import inspect
|
||||
|
||||
from ..libs.util.strings import remove_quotes_and_escapes
|
||||
from ..libs.llm.prompts.chat import template_alpaca_messages
|
||||
from .context import ContextManager
|
||||
from ..libs.util.devdata import dev_data_logger
|
||||
from ..libs.util.logging import logger
|
||||
from ..libs.util.paths import getSavedContextGroupsPath
|
||||
from ..libs.util.strings import remove_quotes_and_escapes
|
||||
from ..libs.util.telemetry import posthog_logger
|
||||
from ..libs.util.traceback.traceback_parsers import (
|
||||
get_javascript_traceback,
|
||||
get_python_traceback,
|
||||
)
|
||||
from ..models.filesystem import RangeInFileWithContents
|
||||
from ..server.protocols.gui_protocol import AbstractGUIProtocolServer
|
||||
from ..server.protocols.ide_protocol import AbstractIdeProtocolServer
|
||||
from ..plugins.policies.default import DefaultPolicy
|
||||
from ..plugins.steps.on_traceback import DefaultOnTracebackStep
|
||||
|
||||
from ..server.protocols.gui_protocol import AbstractGUIProtocolServer
|
||||
from ..server.protocols.ide_protocol import AbstractIdeProtocolServer
|
||||
from .config import ContinueConfig
|
||||
from .context import ContextManager
|
||||
from .main import (
|
||||
AutopilotGenerator,
|
||||
AutopilotGeneratorOutput,
|
||||
|
|
@ -33,14 +32,14 @@ from .main import (
|
|||
ContextItem,
|
||||
ContinueCustomException,
|
||||
ContinueError,
|
||||
DeltaStep,
|
||||
Policy,
|
||||
SessionState,
|
||||
SessionUpdate,
|
||||
SetStep,
|
||||
Step,
|
||||
UpdateStep,
|
||||
SessionUpdate,
|
||||
StepDescription,
|
||||
DeltaStep,
|
||||
UpdateStep,
|
||||
)
|
||||
from .observation import Observation
|
||||
from .sdk import ContinueSDK
|
||||
|
|
|
|||
|
|
@ -1,35 +1,62 @@
|
|||
from typing import Dict, List, Optional, Type
|
||||
|
||||
from ..libs.util.edit_config import (
|
||||
create_bool_node,
|
||||
create_obj_node,
|
||||
display_llm_class,
|
||||
edit_config_property,
|
||||
)
|
||||
from ..libs.util.paths import convertConfigImports, getConfigFilePath
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
from contextlib import contextmanager
|
||||
from typing import Any, Dict, List, Optional, Type, Union
|
||||
|
||||
from pydantic import BaseModel, Field, validator
|
||||
|
||||
from ..libs.constants.default_config import default_config_json
|
||||
from ..libs.llm.base import LLM
|
||||
from ..libs.llm.openai_free_trial import OpenAIFreeTrial
|
||||
from ..libs.util.logging import logger
|
||||
from ..libs.util.paths import getConfigFilePath, getGlobalFolderPath
|
||||
from ..libs.util.telemetry import posthog_logger
|
||||
from ..models.llm import BaseCompletionOptions, RequestOptions
|
||||
from .config_utils.context import (
|
||||
CLASS_TO_CONTEXT_PROVIDER_NAME,
|
||||
CONTEXT_PROVIDER_NAME_TO_CLASS,
|
||||
ContextProviderName,
|
||||
)
|
||||
from .config_utils.shared import (
|
||||
MODEL_CLASS_TO_MODEL_PROVIDER,
|
||||
MODEL_PROVIDER_TO_MODEL_CLASS,
|
||||
ModelProvider,
|
||||
StepName,
|
||||
TemplateType,
|
||||
autodetect_prompt_templates,
|
||||
autodetect_template_function,
|
||||
)
|
||||
from .context import ContextProvider
|
||||
from .main import ContextProviderDescription, Policy, SlashCommandDescription, Step
|
||||
from .models import Models
|
||||
from ..libs.util.telemetry import posthog_logger
|
||||
from .models import MODEL_CLASSES, Models
|
||||
|
||||
|
||||
class StepWithParams(BaseModel):
|
||||
name: StepName
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
|
||||
class ContextProviderWithParams(BaseModel):
|
||||
name: ContextProviderName
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
|
||||
class SlashCommand(BaseModel):
|
||||
name: str
|
||||
description: str
|
||||
step: Type[Step]
|
||||
step: Union[Type[Step], StepName]
|
||||
params: Optional[Dict] = {}
|
||||
|
||||
def dict(self, *args, **kwargs):
|
||||
return {
|
||||
"name": self.name,
|
||||
"description": self.description,
|
||||
"params": self.params,
|
||||
"step": self.step.__name__,
|
||||
}
|
||||
# Allow step class for the migration
|
||||
@validator("step", pre=True, always=True)
|
||||
def step_is_string(cls, v):
|
||||
if isinstance(v, str):
|
||||
return v
|
||||
elif isinstance(v, object) and v.__class__.__name__ == "ModelMetaclass":
|
||||
return str(v).split(".")[-1].split("'")[0]
|
||||
else:
|
||||
return v
|
||||
|
||||
def slash_command_description(self) -> SlashCommandDescription:
|
||||
return SlashCommandDescription(
|
||||
|
|
@ -52,28 +79,263 @@ class CustomCommand(BaseModel):
|
|||
|
||||
class RetrievalSettings(BaseModel):
|
||||
n_retrieve: Optional[int] = Field(
|
||||
50, description="Number of results to initially retrieve from vector database"
|
||||
default=50,
|
||||
description="Number of results to initially retrieve from vector database",
|
||||
)
|
||||
n_final: Optional[int] = Field(
|
||||
10, description="Final number of results to use after re-ranking"
|
||||
default=10, description="Final number of results to use after re-ranking"
|
||||
)
|
||||
use_reranking: bool = Field(
|
||||
True,
|
||||
default=True,
|
||||
description="Whether to use re-ranking, which will allow initial selection of n_retrieve results, then will use an LLM to select the top n_final results",
|
||||
)
|
||||
rerank_group_size: int = Field(
|
||||
5,
|
||||
default=5,
|
||||
description="Number of results to group together when re-ranking. Each group will be processed in parallel.",
|
||||
)
|
||||
ignore_files: List[str] = Field(
|
||||
[],
|
||||
default=[],
|
||||
description="Files to ignore when indexing the codebase. You can use glob patterns, such as **/*.py. This is useful for directories that contain generated code, or other directories that are not relevant to the codebase.",
|
||||
)
|
||||
openai_api_key: Optional[str] = Field(None, description="OpenAI API key")
|
||||
api_base: Optional[str] = Field(None, description="OpenAI API base URL")
|
||||
api_type: Optional[str] = Field(None, description="OpenAI API type")
|
||||
api_version: Optional[str] = Field(None, description="OpenAI API version")
|
||||
organization_id: Optional[str] = Field(None, description="OpenAI organization ID")
|
||||
openai_api_key: Optional[str] = Field(default=None, description="OpenAI API key")
|
||||
api_base: Optional[str] = Field(default=None, description="OpenAI API base URL")
|
||||
api_type: Optional[str] = Field(default=None, description="OpenAI API type")
|
||||
api_version: Optional[str] = Field(default=None, description="OpenAI API version")
|
||||
organization_id: Optional[str] = Field(
|
||||
default=None, description="OpenAI organization ID"
|
||||
)
|
||||
|
||||
|
||||
class ModelDescription(BaseModel):
|
||||
class Config:
|
||||
extra = "allow"
|
||||
|
||||
title: str = Field(
|
||||
default=...,
|
||||
description="The title you wish to give your model.",
|
||||
)
|
||||
|
||||
provider: ModelProvider = Field(
|
||||
default=...,
|
||||
description="The provider of the model. This is used to determine the type of model, and how to interact with it.",
|
||||
)
|
||||
model: str = Field(
|
||||
default=...,
|
||||
description="The name of the model. Used to autodetect prompt template.",
|
||||
)
|
||||
api_key: Optional[str] = Field(
|
||||
default=None, description="OpenAI, Anthropic, Together, or other API key"
|
||||
)
|
||||
api_base: Optional[str] = Field(None, description="The base URL of the LLM API.")
|
||||
|
||||
context_length: int = Field(
|
||||
default=2048,
|
||||
description="The maximum context length of the LLM in tokens, as counted by count_tokens.",
|
||||
)
|
||||
template: Optional[TemplateType] = Field(
|
||||
default=None,
|
||||
description="The chat template used to format messages. This is auto-detected for most models, but can be overridden here.",
|
||||
)
|
||||
completion_options: BaseCompletionOptions = Field(
|
||||
default=BaseCompletionOptions(),
|
||||
description="Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
)
|
||||
system_message: Optional[str] = Field(
|
||||
default=None,
|
||||
description="A system message that will always be followed by the LLM",
|
||||
)
|
||||
|
||||
request_options: RequestOptions = Field(
|
||||
default=RequestOptions(),
|
||||
description="Options for the HTTP request to the LLM.",
|
||||
)
|
||||
|
||||
|
||||
class ModelRoles(BaseModel):
|
||||
default: str = Field(
|
||||
default=...,
|
||||
description="The default model. If other model roles are not set, they will fall back to default.",
|
||||
)
|
||||
chat: Optional[str] = Field(
|
||||
default=None,
|
||||
description="The model to use for chat. If not set, will fall back to default.",
|
||||
)
|
||||
edit: Optional[str] = Field(
|
||||
default=None,
|
||||
description="The model to use for editing. If not set, will fall back to default.",
|
||||
)
|
||||
summarize: Optional[str] = Field(
|
||||
default=None,
|
||||
description="The model to use for summarization. If not set, will fall back to default.",
|
||||
)
|
||||
|
||||
|
||||
CONFIG_JSON_PATH = getConfigFilePath(json=True)
|
||||
|
||||
|
||||
class SerializedContinueConfig(BaseModel):
|
||||
disallowed_steps: Optional[List[str]] = Field(
|
||||
default=[],
|
||||
description="Steps that are not allowed to be run, and will be skipped if attempted",
|
||||
)
|
||||
allow_anonymous_telemetry: Optional[bool] = Field(
|
||||
default=True,
|
||||
description="If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to False, we will not collect any data.",
|
||||
)
|
||||
models: List[ModelDescription] = Field(
|
||||
default=[
|
||||
{
|
||||
"title": "GPT-4 (trial)",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-4",
|
||||
"api_key": "",
|
||||
}
|
||||
]
|
||||
)
|
||||
model_roles: ModelRoles = Field(
|
||||
default=ModelRoles(default="GPT-4 (trial)"),
|
||||
description="Roles for models. Each entry should be the title of a model in the models array.",
|
||||
)
|
||||
system_message: Optional[str] = Field(
|
||||
default=None,
|
||||
description="A system message that will always be followed by the LLM",
|
||||
)
|
||||
completion_options: BaseCompletionOptions = Field(
|
||||
default=BaseCompletionOptions(),
|
||||
description="Default options for completion. These will be overriden by any options set for a specific model.",
|
||||
)
|
||||
slash_commands: Optional[List[SlashCommand]] = Field(
|
||||
default=[],
|
||||
description="An array of slash commands that let you map custom Steps to a shortcut.",
|
||||
)
|
||||
custom_commands: Optional[List[CustomCommand]] = Field(
|
||||
default=[
|
||||
CustomCommand(
|
||||
name="test",
|
||||
description="This is an example custom command. Use /config to edit it and create more",
|
||||
prompt="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't edit any file.",
|
||||
)
|
||||
],
|
||||
description="An array of custom commands that allow you to reuse prompts. Each has name, description, and prompt properties. When you enter /<name> in the text input, it will act as a shortcut to the prompt.",
|
||||
)
|
||||
context_providers: List[ContextProviderWithParams] = Field(
|
||||
default=[],
|
||||
description="A list of ContextProvider objects that can be used to provide context to the LLM by typing '@'. Read more about ContextProviders in the documentation.",
|
||||
)
|
||||
user_token: Optional[str] = Field(
|
||||
default=None, description="An optional token to identify the user."
|
||||
)
|
||||
data_server_url: Optional[str] = Field(
|
||||
default="https://us-west1-autodebug.cloudfunctions.net",
|
||||
description="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.",
|
||||
)
|
||||
disable_summaries: Optional[bool] = Field(
|
||||
default=False,
|
||||
description="If set to `True`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.",
|
||||
)
|
||||
disable_indexing: Optional[bool] = Field(
|
||||
default=False,
|
||||
description="If set to `True`, Continue will not index the codebase. This is mainly used for debugging purposes.",
|
||||
)
|
||||
retrieval_settings: Optional[RetrievalSettings] = Field(
|
||||
default=RetrievalSettings(),
|
||||
description="Settings for the retrieval system. Read more about the retrieval system in the documentation.",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
@contextmanager
|
||||
def edit_config():
|
||||
config = SerializedContinueConfig.parse_file(CONFIG_JSON_PATH)
|
||||
yield config
|
||||
with open(CONFIG_JSON_PATH, "w") as f:
|
||||
f.write(config.json(exclude_none=True, exclude_defaults=True, indent=2))
|
||||
|
||||
@staticmethod
|
||||
def set_temperature(temperature: float):
|
||||
with SerializedContinueConfig.edit_config() as config:
|
||||
config.completion_options.temperature = temperature
|
||||
|
||||
posthog_logger.capture_event(
|
||||
"set_temperature", {"temperature": temperature}
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def set_system_message(message: str):
|
||||
with SerializedContinueConfig.edit_config() as config:
|
||||
config.system_message = message
|
||||
|
||||
posthog_logger.capture_event("set_system_message", {"message": message})
|
||||
|
||||
@staticmethod
|
||||
def set_model_for_role(title: str, role: str):
|
||||
with SerializedContinueConfig.edit_config() as config:
|
||||
if role == "*":
|
||||
config.model_roles.default = title
|
||||
config.model_roles.chat = title
|
||||
config.model_roles.edit = title
|
||||
config.model_roles.summarize = title
|
||||
else:
|
||||
config.model_roles.__setattr__(role, title)
|
||||
|
||||
@staticmethod
|
||||
def add_model(model: ModelDescription):
|
||||
with SerializedContinueConfig.edit_config() as config:
|
||||
config.models.append(model)
|
||||
|
||||
@staticmethod
|
||||
def set_telemetry_enabled(enabled: bool):
|
||||
with SerializedContinueConfig.edit_config() as config:
|
||||
config.allow_anonymous_telemetry = enabled
|
||||
|
||||
@staticmethod
|
||||
def delete_model(title: str):
|
||||
with SerializedContinueConfig.edit_config() as config:
|
||||
config.models = [model for model in config.models if model.title != title]
|
||||
if config.model_roles.default == title:
|
||||
config.model_roles.default = config.models[0].title
|
||||
if config.model_roles.chat == title:
|
||||
config.model_roles.chat = None
|
||||
if config.model_roles.edit == title:
|
||||
config.model_roles.edit = None
|
||||
if config.model_roles.summarize == title:
|
||||
config.model_roles.summarize = None
|
||||
|
||||
def construct_models(self) -> Models:
|
||||
def model_with_title(title: Optional[str], fallback: ModelDescription):
|
||||
return next(filter(lambda x: x.title == title, self.models), fallback)
|
||||
|
||||
default = model_with_title(self.model_roles.default, self.models[0])
|
||||
chat = model_with_title(self.model_roles.chat, default)
|
||||
edit = model_with_title(self.model_roles.edit, default)
|
||||
summarize = model_with_title(self.model_roles.summarize, default)
|
||||
|
||||
saved = [
|
||||
model_with_title(model.title, default)
|
||||
for model in self.models
|
||||
if model.title
|
||||
not in [default.title, chat.title, edit.title, summarize.title]
|
||||
]
|
||||
|
||||
def create_llm(model: ModelDescription) -> LLM:
|
||||
model_class = MODEL_CLASSES[MODEL_PROVIDER_TO_MODEL_CLASS[model.provider]]
|
||||
completion_options = self.completion_options.dict()
|
||||
completion_options.update(model.completion_options.dict(exclude_none=True))
|
||||
|
||||
# Allow extra fields to be passed through
|
||||
kwargs = {**model.dict(exclude_none=True)}
|
||||
kwargs["completion_options"] = completion_options
|
||||
kwargs["template_messages"] = autodetect_template_function(model.model)
|
||||
kwargs["prompt_templates"] = autodetect_prompt_templates(model.model)
|
||||
|
||||
return model_class(**kwargs)
|
||||
|
||||
return Models(
|
||||
default=create_llm(default),
|
||||
chat=create_llm(chat),
|
||||
edit=create_llm(edit),
|
||||
summarize=create_llm(summarize),
|
||||
saved=[create_llm(model) for model in saved],
|
||||
)
|
||||
|
||||
|
||||
class ContinueConfig(BaseModel):
|
||||
|
|
@ -82,30 +344,34 @@ class ContinueConfig(BaseModel):
|
|||
"""
|
||||
|
||||
steps_on_startup: List[Step] = Field(
|
||||
[],
|
||||
default=[],
|
||||
description="Steps that will be automatically run at the beginning of a new session",
|
||||
)
|
||||
disallowed_steps: Optional[List[str]] = Field(
|
||||
[],
|
||||
default=[],
|
||||
description="Steps that are not allowed to be run, and will be skipped if attempted",
|
||||
)
|
||||
allow_anonymous_telemetry: Optional[bool] = Field(
|
||||
True,
|
||||
default=True,
|
||||
description="If this field is set to True, we will collect anonymous telemetry as described in the documentation page on telemetry. If set to False, we will not collect any data.",
|
||||
)
|
||||
models: Models = Field(
|
||||
Models(
|
||||
default=Models(
|
||||
default=OpenAIFreeTrial(model="gpt-4"),
|
||||
summarize=OpenAIFreeTrial(model="gpt-3.5-turbo"),
|
||||
),
|
||||
description="Configuration for the models used by Continue. Read more about how to configure models in the documentation.",
|
||||
)
|
||||
temperature: Optional[float] = Field(
|
||||
0.5,
|
||||
description="The temperature parameter for sampling from the LLM. Higher temperatures will result in more random output, while lower temperatures will result in more predictable output. This value ranges from 0 to 1.",
|
||||
system_message: Optional[str] = Field(
|
||||
default=None,
|
||||
description="A system message that will always be followed by the LLM",
|
||||
)
|
||||
completion_options: BaseCompletionOptions = Field(
|
||||
default=BaseCompletionOptions(),
|
||||
description="Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
)
|
||||
custom_commands: Optional[List[CustomCommand]] = Field(
|
||||
[
|
||||
default=[
|
||||
CustomCommand(
|
||||
name="test",
|
||||
description="This is an example custom command. Use /config to edit it and create more",
|
||||
|
|
@ -115,76 +381,132 @@ class ContinueConfig(BaseModel):
|
|||
description="An array of custom commands that allow you to reuse prompts. Each has name, description, and prompt properties. When you enter /<name> in the text input, it will act as a shortcut to the prompt.",
|
||||
)
|
||||
slash_commands: Optional[List[SlashCommand]] = Field(
|
||||
[],
|
||||
default=[],
|
||||
description="An array of slash commands that let you map custom Steps to a shortcut.",
|
||||
)
|
||||
on_traceback: Optional[Step] = Field(
|
||||
None,
|
||||
default=None,
|
||||
description="The step that will be run when a traceback is detected (when you use the shortcut cmd+shift+R)",
|
||||
)
|
||||
system_message: Optional[str] = Field(
|
||||
None, description="A system message that will always be followed by the LLM"
|
||||
)
|
||||
policy_override: Optional[Policy] = Field(
|
||||
None,
|
||||
default=None,
|
||||
description="A Policy object that can be used to override the default behavior of Continue, for example in order to build custom agents that take multiple steps at a time.",
|
||||
)
|
||||
context_providers: List[ContextProvider] = Field(
|
||||
[],
|
||||
default=[],
|
||||
description="A list of ContextProvider objects that can be used to provide context to the LLM by typing '@'. Read more about ContextProviders in the documentation.",
|
||||
)
|
||||
user_token: Optional[str] = Field(
|
||||
None, description="An optional token to identify the user."
|
||||
default=None, description="An optional token to identify the user."
|
||||
)
|
||||
data_server_url: Optional[str] = Field(
|
||||
"https://us-west1-autodebug.cloudfunctions.net",
|
||||
description="The URL of the server where development data is sent. No data is sent unless a valid user token is provided.",
|
||||
default="https://us-west1-autodebug.cloudfunctions.net",
|
||||
description="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.",
|
||||
)
|
||||
disable_summaries: Optional[bool] = Field(
|
||||
False,
|
||||
default=False,
|
||||
description="If set to `True`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.",
|
||||
)
|
||||
disable_indexing: Optional[bool] = Field(
|
||||
False,
|
||||
default=False,
|
||||
description="If set to `True`, Continue will not index the codebase. This is mainly used for debugging purposes.",
|
||||
)
|
||||
retrieval_settings: Optional[RetrievalSettings] = Field(
|
||||
RetrievalSettings(),
|
||||
default=RetrievalSettings(),
|
||||
description="Settings for the retrieval system. Read more about the retrieval system in the documentation.",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def schema(cls, *args, **kwargs):
|
||||
# kwargs.setdefault("exclude", {"ide"})
|
||||
return super().schema(*args, **kwargs)
|
||||
|
||||
@validator("temperature", pre=True)
|
||||
def temperature_validator(cls, v):
|
||||
return max(0.0, min(1.0, v))
|
||||
@staticmethod
|
||||
def from_serialized_config(config: SerializedContinueConfig) -> "ContinueConfig":
|
||||
context_providers = [
|
||||
CONTEXT_PROVIDER_NAME_TO_CLASS[provider.name](**provider.params)
|
||||
for provider in config.context_providers
|
||||
]
|
||||
return ContinueConfig(
|
||||
disallowed_steps=config.disallowed_steps,
|
||||
allow_anonymous_telemetry=config.allow_anonymous_telemetry,
|
||||
models=config.construct_models(),
|
||||
system_message=config.system_message,
|
||||
completion_options=config.completion_options,
|
||||
custom_commands=config.custom_commands,
|
||||
slash_commands=config.slash_commands,
|
||||
context_providers=context_providers,
|
||||
user_token=config.user_token,
|
||||
data_server_url=config.data_server_url,
|
||||
disable_summaries=config.disable_summaries,
|
||||
disable_indexing=config.disable_indexing,
|
||||
retrieval_settings=config.retrieval_settings,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def from_filepath(filepath: str, retry: bool = True) -> "ContinueConfig":
|
||||
# Use importlib to load the config file config.py at the given path
|
||||
def modifier_from_filepath(filepath: str):
|
||||
try:
|
||||
import importlib.util
|
||||
|
||||
spec = importlib.util.spec_from_file_location("config", filepath)
|
||||
config = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(config)
|
||||
|
||||
return config.config
|
||||
except ModuleNotFoundError as e:
|
||||
# Check if the module was "continuedev.src"
|
||||
if retry and e.name == "continuedev.src":
|
||||
convertConfigImports(shorten=True)
|
||||
return ContinueConfig.from_filepath(filepath, retry=False)
|
||||
else:
|
||||
raise e
|
||||
if hasattr(config, "modify_config"):
|
||||
return config.modify_config
|
||||
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to load config modifier from {filepath}: {e}")
|
||||
return None
|
||||
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def from_filepath(filepath: str, retry: bool = True) -> "ContinueConfig":
|
||||
if filepath.endswith(".json"):
|
||||
serialized_config = json.load(open(filepath))
|
||||
initial_config = ContinueConfig.from_serialized_config(
|
||||
SerializedContinueConfig(**serialized_config)
|
||||
)
|
||||
if modifier := ContinueConfig.modifier_from_filepath(
|
||||
filepath[: -len(".json")] + ".py"
|
||||
):
|
||||
try:
|
||||
return modifier(initial_config)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to modify config: {e}")
|
||||
return initial_config
|
||||
|
||||
return initial_config
|
||||
|
||||
# Use importlib to load the config file config.py at the given path
|
||||
spec = importlib.util.spec_from_file_location("config", filepath)
|
||||
config = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(config)
|
||||
|
||||
return config.config
|
||||
|
||||
@staticmethod
|
||||
def load_default() -> "ContinueConfig":
|
||||
path = getConfigFilePath()
|
||||
return ContinueConfig.from_filepath(path)
|
||||
json_path = os.path.join(getGlobalFolderPath(), "config.json")
|
||||
if not os.path.exists(json_path):
|
||||
# MIGRATE FROM OLD CONFIG FORMAT TO JSON
|
||||
py_path = getConfigFilePath()
|
||||
try:
|
||||
# If they have pre-existing old config.py this will work
|
||||
config = ContinueConfig.from_filepath(py_path)
|
||||
with open(json_path, "w") as f:
|
||||
json.dump(
|
||||
config.to_serialized_continue_config().dict(
|
||||
exclude_none=True, exclude_defaults=True
|
||||
),
|
||||
f,
|
||||
indent=2,
|
||||
)
|
||||
return config
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to load config from {py_path}: {e}")
|
||||
with open(json_path, "w") as f:
|
||||
f.write(default_config_json)
|
||||
|
||||
return ContinueConfig.load_default()
|
||||
|
||||
# And then the second time, load from the json file
|
||||
config = ContinueConfig.from_filepath(json_path)
|
||||
return config
|
||||
|
||||
def get_slash_command_descriptions(self) -> List[SlashCommandDescription]:
|
||||
custom_commands = (
|
||||
|
|
@ -227,31 +549,74 @@ class ContinueConfig(BaseModel):
|
|||
)
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def set_temperature(temperature: float):
|
||||
edit_config_property(["temperature"], temperature)
|
||||
posthog_logger.capture_event("set_temperature", {"temperature": temperature})
|
||||
def to_serialized_continue_config(self) -> SerializedContinueConfig:
|
||||
# For migration purposes
|
||||
pre_models = self.models.saved + [
|
||||
self.models.default,
|
||||
self.models.chat,
|
||||
self.models.edit,
|
||||
self.models.summarize,
|
||||
]
|
||||
titles = set()
|
||||
models: List[LLM] = []
|
||||
for model in pre_models:
|
||||
if model is None or model.title in titles:
|
||||
# Remove duplicate models
|
||||
continue # : )
|
||||
|
||||
@staticmethod
|
||||
def set_system_message(message: str):
|
||||
edit_config_property(["system_message"], message)
|
||||
posthog_logger.capture_event("set_system_message", {"message": message})
|
||||
titles.add(model.title)
|
||||
models.append(model)
|
||||
|
||||
@staticmethod
|
||||
def set_models(models: Models, role: str):
|
||||
JOINER = ",\n\t\t"
|
||||
models_args = {
|
||||
"saved": f"[{JOINER.join([display_llm_class(llm) for llm in models.saved])}]",
|
||||
("default" if role == "*" else role): display_llm_class(models.default),
|
||||
}
|
||||
edit_config_property(
|
||||
["models"],
|
||||
create_obj_node("Models", models_args),
|
||||
BACKUP_TITLE = "LLM"
|
||||
|
||||
serialized_models = [
|
||||
ModelDescription(
|
||||
title=model.title or BACKUP_TITLE,
|
||||
provider=MODEL_CLASS_TO_MODEL_PROVIDER[model.__class__.__name__],
|
||||
api_base=model.api_base,
|
||||
model=model.model,
|
||||
completion_options=model.completion_options,
|
||||
api_key=model.api_key,
|
||||
context_length=model.context_length,
|
||||
system_message=model.system_message,
|
||||
)
|
||||
for model in models
|
||||
if model is not None
|
||||
]
|
||||
|
||||
model_roles = ModelRoles(
|
||||
default=self.models.default.title or BACKUP_TITLE,
|
||||
chat=(self.models.chat or self.models.default).title,
|
||||
edit=(self.models.edit or self.models.default).title,
|
||||
summarize=(self.models.summarize or self.models.default).title,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def set_telemetry_enabled(enabled: bool):
|
||||
edit_config_property(
|
||||
["allow_anonymous_telemetry"],
|
||||
create_bool_node(enabled),
|
||||
slash_commands = []
|
||||
for slash_command in self.slash_commands:
|
||||
if not isinstance(slash_command.step, str):
|
||||
slash_command.step = slash_command.step.__class__.__name__
|
||||
slash_commands.append(slash_command)
|
||||
|
||||
return SerializedContinueConfig(
|
||||
disallowed_steps=self.disallowed_steps,
|
||||
allow_anonymous_telemetry=self.allow_anonymous_telemetry,
|
||||
models=serialized_models,
|
||||
model_roles=model_roles,
|
||||
system_message=self.system_message,
|
||||
completion_options=self.completion_options,
|
||||
custom_commands=self.custom_commands,
|
||||
slash_commands=slash_commands,
|
||||
context_providers=[
|
||||
ContextProviderWithParams(
|
||||
name=CLASS_TO_CONTEXT_PROVIDER_NAME[provider.title],
|
||||
params=provider.dict(exclude_none=True, exclude_defaults=True),
|
||||
)
|
||||
for provider in self.context_providers
|
||||
if provider.title in CLASS_TO_CONTEXT_PROVIDER_NAME
|
||||
],
|
||||
user_token=self.user_token,
|
||||
data_server_url=self.data_server_url,
|
||||
disable_summaries=self.disable_summaries,
|
||||
disable_indexing=self.disable_indexing,
|
||||
retrieval_settings=self.retrieval_settings,
|
||||
)
|
||||
|
|
|
|||
43
server/continuedev/core/config_utils/context.py
Normal file
43
server/continuedev/core/config_utils/context.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
from typing import Dict, Literal
|
||||
|
||||
from ...plugins.context_providers.diff import DiffContextProvider
|
||||
from ...plugins.context_providers.filetree import FileTreeContextProvider
|
||||
from ...plugins.context_providers.github import GitHubIssuesContextProvider
|
||||
from ...plugins.context_providers.google import GoogleContextProvider
|
||||
from ...plugins.context_providers.open_tabs import OpenTabsContextProvider
|
||||
from ...plugins.context_providers.search import SearchContextProvider
|
||||
from ...plugins.context_providers.terminal import TerminalContextProvider
|
||||
from ...plugins.context_providers.url import URLContextProvider
|
||||
|
||||
ContextProviderName = Literal[
|
||||
"diff",
|
||||
"github",
|
||||
"terminal",
|
||||
"open",
|
||||
"google",
|
||||
"search",
|
||||
"url",
|
||||
"tree",
|
||||
]
|
||||
|
||||
CONTEXT_PROVIDER_NAME_TO_CLASS = {
|
||||
"diff": DiffContextProvider,
|
||||
"github": GitHubIssuesContextProvider,
|
||||
"terminal": TerminalContextProvider,
|
||||
"open": OpenTabsContextProvider,
|
||||
"google": GoogleContextProvider,
|
||||
"search": SearchContextProvider,
|
||||
"url": URLContextProvider,
|
||||
"tree": FileTreeContextProvider,
|
||||
}
|
||||
|
||||
CLASS_TO_CONTEXT_PROVIDER_NAME: Dict[str, ContextProviderName] = {
|
||||
"DiffContextProvider": "diff",
|
||||
"GitHubIssuesContextProvider": "github",
|
||||
"TerminalContextProvider": "terminal",
|
||||
"OpenTabsContextProvider": "open",
|
||||
"GoogleContextProvider": "google",
|
||||
"SearchContextProvider": "search",
|
||||
"URLContextProvider": "url",
|
||||
"FileTreeContextProvider": "tree",
|
||||
}
|
||||
190
server/continuedev/core/config_utils/shared.py
Normal file
190
server/continuedev/core/config_utils/shared.py
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
from typing import Any, Dict, Literal, Optional
|
||||
|
||||
from ...libs.llm.prompts.chat import (
|
||||
anthropic_template_messages,
|
||||
chatml_template_messages,
|
||||
llama2_template_messages,
|
||||
phind_template_messages,
|
||||
template_alpaca_messages,
|
||||
zephyr_template_messages,
|
||||
)
|
||||
from ...libs.llm.prompts.edit import (
|
||||
alpaca_edit_prompt,
|
||||
codellama_edit_prompt,
|
||||
phind_edit_prompt,
|
||||
simplest_edit_prompt,
|
||||
zephyr_edit_prompt,
|
||||
)
|
||||
|
||||
StepName = Literal[
|
||||
"AnswerQuestionChroma",
|
||||
"GenerateShellCommandStep",
|
||||
"EditHighlightedCodeStep",
|
||||
"ShareSessionStep",
|
||||
"CommentCodeStep",
|
||||
"ClearHistoryStep",
|
||||
"StackOverflowStep",
|
||||
"OpenConfigStep",
|
||||
"GenerateShellCommandStep",
|
||||
]
|
||||
|
||||
TemplateType = Literal["llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml"]
|
||||
|
||||
|
||||
def autodetect_template_type(model: str) -> Optional[TemplateType]:
|
||||
lower = model.lower()
|
||||
if "gpt" in lower or "chat-bison" in lower:
|
||||
return None
|
||||
|
||||
if "phind" in lower:
|
||||
return "phind"
|
||||
|
||||
if "llama" in lower:
|
||||
return "llama2"
|
||||
|
||||
if "zephyr" in lower:
|
||||
return "zephyr"
|
||||
|
||||
if "claude" in lower:
|
||||
return "anthropic"
|
||||
|
||||
if "alpaca" in lower or "wizard" in lower:
|
||||
return "alpaca"
|
||||
|
||||
return "chatml"
|
||||
|
||||
|
||||
def autodetect_template_function(model: str):
|
||||
if template_type := autodetect_template_type(model):
|
||||
mapping: Dict[TemplateType, Any] = {
|
||||
"llama2": llama2_template_messages,
|
||||
"alpaca": template_alpaca_messages,
|
||||
"phind": phind_template_messages,
|
||||
"zephyr": zephyr_template_messages,
|
||||
"anthropic": anthropic_template_messages,
|
||||
"chatml": chatml_template_messages,
|
||||
}
|
||||
return mapping[template_type]
|
||||
return None
|
||||
|
||||
|
||||
def autodetect_prompt_templates(model: str):
|
||||
template_type = autodetect_template_type(model)
|
||||
|
||||
templates = {}
|
||||
|
||||
edit_template = None
|
||||
if template_type == "phind":
|
||||
edit_template = phind_edit_prompt
|
||||
elif template_type == "zephyr":
|
||||
edit_template = zephyr_edit_prompt
|
||||
elif template_type == "llama2":
|
||||
edit_template = codellama_edit_prompt
|
||||
elif template_type == "alpaca":
|
||||
edit_template = alpaca_edit_prompt
|
||||
elif template_type is not None:
|
||||
edit_template = simplest_edit_prompt
|
||||
|
||||
if edit_template is not None:
|
||||
templates["edit"] = edit_template
|
||||
|
||||
return templates
|
||||
|
||||
|
||||
ModelProvider = Literal[
|
||||
"openai",
|
||||
"openai-free-trial",
|
||||
"openai-aiohttp",
|
||||
"anthropic",
|
||||
"together",
|
||||
"ollama",
|
||||
"huggingface-tgi",
|
||||
"huggingface-inference-api",
|
||||
"llama.cpp",
|
||||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm",
|
||||
]
|
||||
|
||||
MODEL_PROVIDER_TO_MODEL_CLASS = {
|
||||
"openai": "OpenAI",
|
||||
"openai-free-trial": "OpenAIFreeTrial",
|
||||
"openai-aiohttp": "GGML",
|
||||
"anthropic": "AnthropicLLM",
|
||||
"together": "TogetherLLM",
|
||||
"ollama": "Ollama",
|
||||
"huggingface-tgi": "HuggingFaceTGI",
|
||||
"huggingface-inference-api": "HuggingFaceInferenceAPI",
|
||||
"llama.cpp": "LlamaCpp",
|
||||
"replicate": "ReplicateLLM",
|
||||
"text-gen-webui": "TextGenWebUI",
|
||||
"google-palm": "GooglePaLMAPI",
|
||||
}
|
||||
|
||||
MODEL_CLASS_TO_MODEL_PROVIDER: Dict[str, ModelProvider] = {
|
||||
"OpenAI": "openai",
|
||||
"OpenAIFreeTrial": "openai-free-trial",
|
||||
"AnthropicLLM": "anthropic",
|
||||
"TogetherLLM": "together",
|
||||
"Ollama": "ollama",
|
||||
"HuggingFaceTGI": "huggingface-tgi",
|
||||
"HuggingFaceInferenceAPI": "huggingface-inference-api",
|
||||
"LlamaCpp": "llama.cpp",
|
||||
"ReplicateLLM": "replicate",
|
||||
"TextGenWebUI": "text-gen-webui",
|
||||
"GooglePaLMAPI": "google-palm",
|
||||
}
|
||||
|
||||
MODELS = [
|
||||
# OpenAI
|
||||
"gpt-3.5-turbo",
|
||||
"gpt-3.5-turbo-16k",
|
||||
"gpt-4",
|
||||
"gpt-3.5-turbo-0613",
|
||||
"gpt-4-32k",
|
||||
"gpt-4-1106-preview",
|
||||
# Open-Source
|
||||
"mistral-7b",
|
||||
"llama2-7b",
|
||||
"llama2-13b",
|
||||
"codellama-7b",
|
||||
"codellama-13b",
|
||||
"codellama-34b",
|
||||
"phind-codellama-34b",
|
||||
"wizardcoder-7b",
|
||||
"wizardcoder-13b",
|
||||
"wizardcoder-34b",
|
||||
"zephyr-7b",
|
||||
"codeup-13b",
|
||||
# Anthropic
|
||||
"claude-2",
|
||||
# Google PaLM
|
||||
"chat-bison-001",
|
||||
]
|
||||
|
||||
ModelName = Literal[
|
||||
# OpenAI
|
||||
"gpt-3.5-turbo",
|
||||
"gpt-3.5-turbo-16k",
|
||||
"gpt-4",
|
||||
"gpt-3.5-turbo-0613",
|
||||
"gpt-4-32k",
|
||||
"gpt-4-1106-preview",
|
||||
# Open-Source
|
||||
"mistral-7b",
|
||||
"llama2-7b",
|
||||
"llama2-13b",
|
||||
"codellama-7b",
|
||||
"codellama-13b",
|
||||
"codellama-34b",
|
||||
"phind-codellama-34b",
|
||||
"wizardcoder-7b",
|
||||
"wizardcoder-13b",
|
||||
"wizardcoder-34b",
|
||||
"zephyr-7b",
|
||||
"codeup-13b",
|
||||
# Anthropic
|
||||
"claude-2",
|
||||
# Google PaLM
|
||||
"chat-bison-001",
|
||||
]
|
||||
21
server/continuedev/core/config_utils/step_name_to_class.py
Normal file
21
server/continuedev/core/config_utils/step_name_to_class.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from ...plugins.steps.clear_history import ClearHistoryStep
|
||||
from ...plugins.steps.cmd import GenerateShellCommandStep
|
||||
from ...plugins.steps.codebase import AnswerQuestionChroma
|
||||
from ...plugins.steps.comment_code import CommentCodeStep
|
||||
from ...plugins.steps.main import EditHighlightedCodeStep
|
||||
from ...plugins.steps.on_traceback import DefaultOnTracebackStep
|
||||
from ...plugins.steps.open_config import OpenConfigStep
|
||||
from ...plugins.steps.share_session import ShareSessionStep
|
||||
from ...plugins.steps.stack_overflow import StackOverflowStep
|
||||
|
||||
step_name_to_step_class = {
|
||||
"EditHighlightedCodeStep": EditHighlightedCodeStep,
|
||||
"CommentCodeStep": CommentCodeStep,
|
||||
"DefaultOnTracebackStep": DefaultOnTracebackStep,
|
||||
"ClearHistoryStep": ClearHistoryStep,
|
||||
"OpenConfigStep": OpenConfigStep,
|
||||
"AnswerQuestionChroma": AnswerQuestionChroma,
|
||||
"GenerateShellCommandStep": GenerateShellCommandStep,
|
||||
"ShareSessionStep": ShareSessionStep,
|
||||
"StackOverflowStep": StackOverflowStep,
|
||||
}
|
||||
|
|
@ -3,25 +3,24 @@ import time
|
|||
from abc import abstractmethod
|
||||
from typing import Any, Awaitable, Callable, List, Optional
|
||||
|
||||
from ..libs.util.paths import migration
|
||||
from ..server.protocols.ide_protocol import AbstractIdeProtocolServer
|
||||
|
||||
from meilisearch_python_async import Client
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
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 migrate
|
||||
from ..libs.util.telemetry import posthog_logger
|
||||
from ..server.global_config import global_config
|
||||
from ..server.meilisearch_server import (
|
||||
check_meilisearch_running,
|
||||
get_meilisearch_url,
|
||||
poll_meilisearch_running,
|
||||
remove_meilisearch_disallowed_chars,
|
||||
restart_meilisearch,
|
||||
start_meilisearch,
|
||||
remove_meilisearch_disallowed_chars,
|
||||
)
|
||||
from ..server.protocols.ide_protocol import AbstractIdeProtocolServer
|
||||
from .main import (
|
||||
ChatMessage,
|
||||
ContextItem,
|
||||
|
|
@ -139,7 +138,7 @@ class ContextProvider(BaseModel):
|
|||
summary=item.description.description,
|
||||
)
|
||||
|
||||
async def get_item(self, id: ContextItemId, query: str) -> ContextItem:
|
||||
async def get_item(self, id: ContextItemId, query: str) -> Optional[ContextItem]:
|
||||
"""
|
||||
Returns the ContextItem with the given id.
|
||||
|
||||
|
|
@ -352,9 +351,14 @@ class ContextManager:
|
|||
|
||||
# Check if need to migrate to new id format
|
||||
# If so, delete the index before recreating
|
||||
async with migration("meilisearch_context_items_001"):
|
||||
async def migrate_fn():
|
||||
await search_client.delete_index_if_exists(SEARCH_INDEX_NAME)
|
||||
|
||||
await migrate(
|
||||
"meilisearch_context_items_001",
|
||||
migrate_fn,
|
||||
)
|
||||
|
||||
await search_client.create_index(SEARCH_INDEX_NAME)
|
||||
globalSearchIndex = await search_client.get_index(SEARCH_INDEX_NAME)
|
||||
await globalSearchIndex.update_ranking_rules(
|
||||
|
|
@ -463,13 +467,13 @@ class ContextManager:
|
|||
"""
|
||||
Opens a virtual file or otherwise previews the contents of the context provider in the IDE.
|
||||
"""
|
||||
id: ContextItemId = ContextItemId.from_string(id)
|
||||
if id.provider_title not in self.provider_titles:
|
||||
item_id: ContextItemId = ContextItemId.from_string(id)
|
||||
if item_id.provider_title not in self.provider_titles:
|
||||
raise ValueError(
|
||||
f"Context provider with title {id.provider_title} not found"
|
||||
f"Context provider with title {item_id.provider_title} not found"
|
||||
)
|
||||
|
||||
await self.context_providers[id.provider_title].preview_contents(id)
|
||||
await self.context_providers[item_id.provider_title].preview_contents(item_id)
|
||||
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from typing import Callable, List, Optional
|
||||
import uuid
|
||||
from typing import Callable, Dict, List, Optional, Type
|
||||
|
||||
from pydantic import BaseModel, validator
|
||||
|
||||
|
|
@ -14,8 +14,8 @@ from ..libs.llm.ollama import Ollama
|
|||
from ..libs.llm.openai import OpenAI
|
||||
from ..libs.llm.openai_free_trial import OpenAIFreeTrial
|
||||
from ..libs.llm.replicate import ReplicateLLM
|
||||
from ..libs.llm.together import TogetherLLM
|
||||
from ..libs.llm.text_gen_webui import TextGenWebUI
|
||||
from ..libs.llm.together import TogetherLLM
|
||||
|
||||
|
||||
class ContinueSDK(BaseModel):
|
||||
|
|
@ -29,7 +29,7 @@ ALL_MODEL_ROLES = [
|
|||
"chat",
|
||||
]
|
||||
|
||||
MODEL_CLASSES = {
|
||||
MODEL_CLASSES: Dict[str, Type[LLM]] = {
|
||||
cls.__name__: cls
|
||||
for cls in [
|
||||
OpenAI,
|
||||
|
|
@ -105,7 +105,12 @@ class Models(BaseModel):
|
|||
for model in self.all_models:
|
||||
model.set_main_config_params(system_msg, temperature)
|
||||
|
||||
async def start(self, unique_id: str, system_message: str, temperature: float):
|
||||
async def start(
|
||||
self,
|
||||
unique_id: str,
|
||||
system_message: Optional[str],
|
||||
temperature: Optional[float],
|
||||
):
|
||||
"""Start each of the LLMs, or fall back to default"""
|
||||
for role in ALL_MODEL_ROLES:
|
||||
model: LLM = getattr(self, role)
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@ import asyncio
|
|||
import os
|
||||
from typing import Coroutine, List, Optional, Union
|
||||
|
||||
from ..plugins.context_providers.highlighted_code import HighlightedCodeContextProvider
|
||||
|
||||
|
||||
from ..models.filesystem import RangeInFile
|
||||
from ..models.filesystem_edit import (
|
||||
AddDirectory,
|
||||
|
|
@ -15,8 +12,9 @@ from ..models.filesystem_edit import (
|
|||
FileSystemEdit,
|
||||
)
|
||||
from ..models.main import Range
|
||||
from ..server.protocols.ide_protocol import AbstractIdeProtocolServer
|
||||
from ..plugins.context_providers.highlighted_code import HighlightedCodeContextProvider
|
||||
from ..server.protocols.gui_protocol import AbstractGUIProtocolServer
|
||||
from ..server.protocols.ide_protocol import AbstractIdeProtocolServer
|
||||
from .config import ContinueConfig
|
||||
from .lsp import ContinueLSPClient
|
||||
from .main import (
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# These steps are depended upon by ContinueSDK
|
||||
import difflib
|
||||
import subprocess
|
||||
from textwrap import dedent
|
||||
import time
|
||||
from textwrap import dedent
|
||||
from typing import Coroutine, List, Optional, Union
|
||||
|
||||
from ..libs.llm.base import LLM, PromptTemplate
|
||||
from ..libs.llm.base import LLM
|
||||
from ..libs.llm.openai_free_trial import OpenAIFreeTrial
|
||||
from ..libs.util.count_tokens import DEFAULT_MAX_TOKENS
|
||||
from ..libs.util.devdata import dev_data_logger
|
||||
|
|
@ -16,20 +16,8 @@ from ..libs.util.strings import (
|
|||
from ..libs.util.telemetry import posthog_logger
|
||||
from ..libs.util.templating import render_prompt_template
|
||||
from ..models.filesystem import FileSystem, RangeInFile, RangeInFileWithContents
|
||||
from ..models.filesystem_edit import (
|
||||
EditDiff,
|
||||
FileEditWithFullContents,
|
||||
FileSystemEdit,
|
||||
)
|
||||
|
||||
from .main import (
|
||||
ChatMessage,
|
||||
ContinueCustomException,
|
||||
DeltaStep,
|
||||
SessionUpdate,
|
||||
SetStep,
|
||||
Step,
|
||||
)
|
||||
from ..models.filesystem_edit import EditDiff, FileEditWithFullContents, FileSystemEdit
|
||||
from .main import ChatMessage, ContinueCustomException, SessionUpdate, SetStep, Step
|
||||
from .observation import TextObservation, UserInputObservation
|
||||
|
||||
|
||||
|
|
@ -626,7 +614,7 @@ Please output the code to be inserted at the cursor in order to fulfill the user
|
|||
async def gen():
|
||||
async for chunk in model_to_use.stream_chat(
|
||||
messages,
|
||||
temperature=sdk.config.temperature,
|
||||
temperature=sdk.config.completion_options.temperature,
|
||||
max_tokens=min(max_tokens, model_to_use.context_length // 2),
|
||||
):
|
||||
if "content" in chunk:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
from typing import List, Optional, Union
|
||||
|
||||
from ..server.protocols.cli_gui import CommandLineGUI
|
||||
|
||||
from ..core.autopilot import Autopilot
|
||||
from ..core.config import ContinueConfig
|
||||
from ..core.context import ContextManager, ContextProvider
|
||||
from ..core.main import SessionState
|
||||
from ..core.autopilot import Autopilot
|
||||
from ..server.protocols.cli_gui import CommandLineGUI
|
||||
from .headless_ide import LocalIdeProtocol
|
||||
from ..core.config import ContinueConfig
|
||||
|
||||
|
||||
async def get_headless_autopilot(
|
||||
|
|
@ -24,7 +23,9 @@ async def get_headless_autopilot(
|
|||
ide = LocalIdeProtocol(workspace_directory=directory)
|
||||
context_manager = ContextManager()
|
||||
# await context_manager.start(context_providers=context_providers, ide=ide)
|
||||
await config.models.start("HEADLESS", config.system_message, config.temperature)
|
||||
await config.models.start(
|
||||
"HEADLESS", config.system_message, config.completion_options.temperature
|
||||
)
|
||||
|
||||
return Autopilot(
|
||||
session_state=state,
|
||||
|
|
|
|||
|
|
@ -1,82 +1,70 @@
|
|||
default_config = """\
|
||||
\"\"\"
|
||||
This is the Continue configuration file.
|
||||
config.py allows you to modify Continue programmatically instead of just using config.json.
|
||||
|
||||
See https://continue.dev/docs/customization to for documentation of the available options.
|
||||
First, config.json is loaded. Then, if you have defined modify_config here, the function will be given the result of
|
||||
loading config.json, and will return the final ContinueConfig to be used.
|
||||
\"\"\"
|
||||
|
||||
from continuedev.core.models import Models
|
||||
from continuedev.core.config import CustomCommand, SlashCommand, ContinueConfig
|
||||
from continuedev.libs.llm import OpenAIFreeTrial
|
||||
from continuedev.core.config import ContinueConfig
|
||||
|
||||
from continuedev.plugins.context_providers import (
|
||||
DiffContextProvider,
|
||||
TerminalContextProvider,
|
||||
URLContextProvider,
|
||||
GitHubIssuesContextProvider
|
||||
)
|
||||
from continuedev.plugins.steps import (
|
||||
CommentCodeStep,
|
||||
EditHighlightedCodeStep,
|
||||
GenerateShellCommandStep,
|
||||
OpenConfigStep,
|
||||
)
|
||||
from continuedev.plugins.steps.share_session import ShareSessionStep
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.completion_options.temperature = 0.5
|
||||
return config
|
||||
|
||||
config = ContinueConfig(
|
||||
allow_anonymous_telemetry=True,
|
||||
models=Models(
|
||||
default=OpenAIFreeTrial(api_key="", model="gpt-4", title="GPT-4"),
|
||||
summarize=OpenAIFreeTrial(api_key="", model="gpt-3.5-turbo")
|
||||
),
|
||||
system_message=None,
|
||||
temperature=0.5,
|
||||
custom_commands=[
|
||||
CustomCommand(
|
||||
name="test",
|
||||
description="Write unit tests for highlighted code",
|
||||
prompt="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't edit any file.",
|
||||
)
|
||||
],
|
||||
slash_commands=[
|
||||
SlashCommand(
|
||||
name="edit",
|
||||
description="Edit highlighted code",
|
||||
step=EditHighlightedCodeStep,
|
||||
),
|
||||
SlashCommand(
|
||||
name="config",
|
||||
description="Customize Continue",
|
||||
step=OpenConfigStep,
|
||||
),
|
||||
SlashCommand(
|
||||
name="comment",
|
||||
description="Write comments for the highlighted code",
|
||||
step=CommentCodeStep,
|
||||
),
|
||||
SlashCommand(
|
||||
name="share",
|
||||
description="Download and share this session",
|
||||
step=ShareSessionStep,
|
||||
),
|
||||
SlashCommand(
|
||||
name="cmd",
|
||||
description="Generate a shell command",
|
||||
step=GenerateShellCommandStep,
|
||||
)
|
||||
],
|
||||
context_providers=[
|
||||
# GitHubIssuesContextProvider(
|
||||
# repo_name="<your github username or organization>/<your repo name>",
|
||||
# auth_token="<your github auth token>"
|
||||
# ),
|
||||
DiffContextProvider(),
|
||||
URLContextProvider(
|
||||
preset_urls = [
|
||||
# Add any common urls you reference here so they appear in autocomplete
|
||||
]
|
||||
),
|
||||
TerminalContextProvider(),
|
||||
],
|
||||
)
|
||||
"""
|
||||
|
||||
default_config_json = """\
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "GPT-4",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-4"
|
||||
},
|
||||
{
|
||||
"title": "GPT-3.5-Turbo",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-3.5-turbo"
|
||||
}
|
||||
],
|
||||
"model_roles": {
|
||||
"default": "GPT-4",
|
||||
"summarize": "GPT-3.5-Turbo"
|
||||
},
|
||||
"slash_commands": [
|
||||
{
|
||||
"name": "edit",
|
||||
"description": "Edit highlighted code",
|
||||
"step": "EditHighlightedCodeStep"
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"description": "Customize Continue",
|
||||
"step": "OpenConfigStep"
|
||||
},
|
||||
{
|
||||
"name": "comment",
|
||||
"description": "Write comments for the highlighted code",
|
||||
"step": "CommentCodeStep"
|
||||
},
|
||||
{
|
||||
"name": "share",
|
||||
"description": "Download and share this session",
|
||||
"step": "ShareSessionStep"
|
||||
},
|
||||
{
|
||||
"name": "cmd",
|
||||
"description": "Generate a shell command",
|
||||
"step": "GenerateShellCommandStep"
|
||||
}
|
||||
],
|
||||
"custom_commands": [
|
||||
{
|
||||
"name": "test",
|
||||
"prompt": "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't edit any file.",
|
||||
"description": "Write unit tests for highlighted code"
|
||||
}
|
||||
]
|
||||
}
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import asyncio
|
||||
from typing import AsyncGenerator
|
||||
|
||||
from ...core.config import ContinueConfig
|
||||
from ...server.protocols.ide_protocol import AbstractIdeProtocolServer
|
||||
from ...libs.index.chunkers.chunk_directory import (
|
||||
stream_chunk_directory,
|
||||
)
|
||||
from ...libs.index.indices.meilisearch_index import MeilisearchCodebaseIndex
|
||||
from ...libs.index.chunkers.chunk_directory import stream_chunk_directory
|
||||
from ...libs.index.indices.chroma_index import MAX_CHUNK_SIZE, ChromaCodebaseIndex
|
||||
from ...libs.index.indices.meilisearch_index import MeilisearchCodebaseIndex
|
||||
from ...server.protocols.ide_protocol import AbstractIdeProtocolServer
|
||||
|
||||
|
||||
async def build_index(
|
||||
|
|
|
|||
|
|
@ -1,45 +1,39 @@
|
|||
from typing import Any, Callable, Coroutine
|
||||
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).
|
||||
|
||||
"""
|
||||
|
||||
api_key: str
|
||||
api_key: Optional[str]
|
||||
"Anthropic API key"
|
||||
|
||||
model: str = "claude-2"
|
||||
|
||||
_async_client: AsyncAnthropic = None
|
||||
|
||||
template_messages: Callable = anthropic_template_messages
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
async def start(self, *args, **kwargs):
|
||||
await super().start(*args, **kwargs)
|
||||
self._async_client = AsyncAnthropic(api_key=self.api_key)
|
||||
|
||||
if self.model == "claude-2":
|
||||
self.context_length = 100_000
|
||||
|
|
@ -61,14 +55,16 @@ class AnthropicLLM(LLM):
|
|||
args = self.collect_args(options)
|
||||
prompt = f"{HUMAN_PROMPT} {prompt} {AI_PROMPT}"
|
||||
|
||||
async for chunk in await self._async_client.completions.create(
|
||||
prompt=prompt, stream=True, **args
|
||||
):
|
||||
async for chunk in await AsyncAnthropic(
|
||||
api_key=self.api_key
|
||||
).completions.create(prompt=prompt, stream=True, **args):
|
||||
yield chunk.completion
|
||||
|
||||
async def _complete(self, prompt: str, options) -> Coroutine[Any, Any, str]:
|
||||
args = self.collect_args(options)
|
||||
prompt = f"{HUMAN_PROMPT} {prompt} {AI_PROMPT}"
|
||||
return (
|
||||
await self._async_client.completions.create(prompt=prompt, **args)
|
||||
await AsyncAnthropic(api_key=self.api_key).completions.create(
|
||||
prompt=prompt, **args
|
||||
)
|
||||
).completion
|
||||
|
|
|
|||
|
|
@ -1,141 +1,86 @@
|
|||
import os
|
||||
import ssl
|
||||
from time import time
|
||||
from typing import Any, Callable, Coroutine, Dict, Generator, List, Optional, Union
|
||||
from typing import Any, AsyncGenerator, Callable, Coroutine, Dict, List, Optional, Union
|
||||
|
||||
import aiohttp
|
||||
import certifi
|
||||
from ..util.templating import render_templated_string
|
||||
from pydantic import Field, validator
|
||||
from pydantic import Field
|
||||
|
||||
from ...core.main import ChatMessage
|
||||
from ...models.llm import (
|
||||
BaseCompletionOptions,
|
||||
CompletionOptions,
|
||||
RequestOptions,
|
||||
)
|
||||
from ...models.main import ContinueBaseModel
|
||||
from ..util.count_tokens import (
|
||||
DEFAULT_ARGS,
|
||||
DEFAULT_MAX_TOKENS,
|
||||
CONTEXT_LENGTH_FOR_MODEL,
|
||||
DEFAULT_ARGS,
|
||||
compile_chat_messages,
|
||||
count_tokens,
|
||||
format_chat_messages,
|
||||
prune_raw_prompt_from_top,
|
||||
)
|
||||
from ..util.devdata import dev_data_logger
|
||||
from ..util.telemetry import posthog_logger
|
||||
from ..util.logging import logger
|
||||
|
||||
|
||||
class CompletionOptions(ContinueBaseModel):
|
||||
"""Options for the completion."""
|
||||
|
||||
@validator(
|
||||
"*",
|
||||
pre=True,
|
||||
always=True,
|
||||
)
|
||||
def ignore_none_and_set_default(cls, value, field):
|
||||
return value if value is not None else field.default
|
||||
|
||||
model: Optional[str] = Field(None, description="The model name")
|
||||
temperature: Optional[float] = Field(
|
||||
None, description="The temperature of the completion."
|
||||
)
|
||||
top_p: Optional[float] = Field(None, description="The top_p of the completion.")
|
||||
top_k: Optional[int] = Field(None, description="The top_k of the completion.")
|
||||
presence_penalty: Optional[float] = Field(
|
||||
None, description="The presence penalty Aof the completion."
|
||||
)
|
||||
frequency_penalty: Optional[float] = Field(
|
||||
None, description="The frequency penalty of the completion."
|
||||
)
|
||||
stop: Optional[List[str]] = Field(
|
||||
None, description="The stop tokens of the completion."
|
||||
)
|
||||
max_tokens: int = Field(
|
||||
DEFAULT_MAX_TOKENS, description="The maximum number of tokens to generate."
|
||||
)
|
||||
functions: Optional[List[Any]] = Field(
|
||||
None, description="The functions/tools to make available to the model."
|
||||
)
|
||||
|
||||
|
||||
class PromptTemplate(CompletionOptions):
|
||||
prompt: str = Field(description="The prompt to be used for the completion.")
|
||||
raw: bool = Field(False, description="Whether to use the raw prompt or not.")
|
||||
from ..util.telemetry import posthog_logger
|
||||
from ..util.templating import render_templated_string
|
||||
|
||||
|
||||
class LLM(ContinueBaseModel):
|
||||
title: Optional[str] = Field(
|
||||
None,
|
||||
default=None,
|
||||
description="A title that will identify this model in the model selection dropdown",
|
||||
)
|
||||
|
||||
unique_id: Optional[str] = Field(None, description="The unique ID of the user.")
|
||||
unique_id: Optional[str] = Field(
|
||||
default=None, description="The unique ID of the user."
|
||||
)
|
||||
model: str = Field(
|
||||
..., description="The name of the model to be used (e.g. gpt-4, codellama)"
|
||||
default=...,
|
||||
description="The name of the model to be used (e.g. gpt-4, codellama)",
|
||||
)
|
||||
|
||||
system_message: Optional[str] = Field(
|
||||
None, description="A system message that will always be followed by the LLM"
|
||||
default=None,
|
||||
description="A system message that will always be followed by the LLM",
|
||||
)
|
||||
|
||||
context_length: int = Field(
|
||||
2048,
|
||||
default=2048,
|
||||
description="The maximum context length of the LLM in tokens, as counted by count_tokens.",
|
||||
)
|
||||
max_tokens: int = Field(
|
||||
DEFAULT_MAX_TOKENS, description="The maximum number of tokens to generate."
|
||||
|
||||
completion_options: BaseCompletionOptions = Field(
|
||||
default=BaseCompletionOptions(),
|
||||
description="Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
)
|
||||
|
||||
stop_tokens: Optional[List[str]] = Field(
|
||||
None, description="Tokens that will stop the completion."
|
||||
)
|
||||
temperature: Optional[float] = Field(
|
||||
None, description="The temperature of the completion."
|
||||
)
|
||||
top_p: Optional[float] = Field(None, description="The top_p of the completion.")
|
||||
top_k: Optional[int] = Field(None, description="The top_k of the completion.")
|
||||
presence_penalty: Optional[float] = Field(
|
||||
None, description="The presence penalty Aof the completion."
|
||||
)
|
||||
frequency_penalty: Optional[float] = Field(
|
||||
None, description="The frequency penalty of the completion."
|
||||
request_options: RequestOptions = Field(
|
||||
default=RequestOptions(),
|
||||
description="Options for the HTTP request to the LLM.",
|
||||
)
|
||||
|
||||
timeout: Optional[int] = Field(
|
||||
300,
|
||||
description="Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts.",
|
||||
)
|
||||
verify_ssl: Optional[bool] = Field(
|
||||
None, description="Whether to verify SSL certificates for requests."
|
||||
)
|
||||
ca_bundle_path: str = Field(
|
||||
None,
|
||||
description="Path to a custom CA bundle to use when making the HTTP request",
|
||||
)
|
||||
proxy: Optional[str] = Field(
|
||||
None,
|
||||
description="Proxy URL to use when making the HTTP request",
|
||||
)
|
||||
headers: Optional[Dict[str, str]] = Field(
|
||||
None,
|
||||
description="Headers to use when making the HTTP request",
|
||||
)
|
||||
prompt_templates: dict = Field(
|
||||
{},
|
||||
default={},
|
||||
description='A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the "edit" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation. See the documentation for more information.',
|
||||
)
|
||||
|
||||
template_messages: Optional[Callable[[List[Dict[str, str]]], str]] = Field(
|
||||
None,
|
||||
default=None,
|
||||
description="A function that takes a list of messages and returns a prompt. This ensures that models like llama2, which are trained on specific chat formats, will always receive input in that format.",
|
||||
)
|
||||
write_log: Optional[Callable[[str], None]] = Field(
|
||||
None,
|
||||
write_log: Optional[Callable[[str], Coroutine]] = Field(
|
||||
default=None,
|
||||
description="A function that is called upon every prompt and completion, by default to log to the file which can be viewed by clicking on the magnifying glass.",
|
||||
)
|
||||
|
||||
api_key: Optional[str] = Field(
|
||||
None, description="The API key for the LLM provider."
|
||||
default=None, description="The API key for the LLM provider."
|
||||
)
|
||||
api_base: Optional[str] = Field(
|
||||
default=None, description="The base URL of the LLM API."
|
||||
)
|
||||
|
||||
class Config:
|
||||
|
|
@ -151,48 +96,16 @@ class LLM(ContinueBaseModel):
|
|||
"context_length": {
|
||||
"description": "The maximum context length of the LLM in tokens, as counted by count_tokens."
|
||||
},
|
||||
"max_tokens": {"description": "The maximum number of tokens to generate."},
|
||||
"unique_id": {"description": "The unique ID of the user."},
|
||||
"model": {
|
||||
"description": "The name of the model to be used (e.g. gpt-4, codellama)"
|
||||
},
|
||||
"timeout": {
|
||||
"description": "Set the timeout for each request to the LLM. If you are running a local LLM that takes a while to respond, you might want to set this to avoid timeouts."
|
||||
},
|
||||
"prompt_templates": {
|
||||
"description": 'A dictionary of prompt templates that can be used to customize the behavior of the LLM in certain situations. For example, set the "edit" key in order to change the prompt that is used for the /edit slash command. Each value in the dictionary is a string templated in mustache syntax, and filled in at runtime with the variables specific to the situation OR an instance of the PromptTemplate class if you want to control other parameters. See the documentation for more information.'
|
||||
},
|
||||
"template_messages": {
|
||||
"description": "A function that takes a list of messages and returns a prompt. This ensures that models like llama2, which are trained on specific chat formats, will always receive input in that format."
|
||||
},
|
||||
"write_log": {
|
||||
"description": "A function that is called upon every prompt and completion, by default to log to the file which can be viewed by clicking on the magnifying glass."
|
||||
},
|
||||
"api_key": {"description": "The API key for the LLM provider."},
|
||||
"verify_ssl": {
|
||||
"description": "Whether to verify SSL certificates for requests."
|
||||
},
|
||||
"ca_bundle_path": {
|
||||
"description": "Path to a custom CA bundle to use when making the HTTP request"
|
||||
},
|
||||
"headers": {"description": "Headers to use when making the HTTP request"},
|
||||
"proxy": {"description": "Proxy URL to use when making the HTTP request"},
|
||||
"stop_tokens": {"description": "Tokens that will stop the completion."},
|
||||
"temperature": {
|
||||
"description": "The sampling temperature used for generation."
|
||||
},
|
||||
"top_p": {
|
||||
"description": "The top_p sampling parameter used for generation."
|
||||
},
|
||||
"top_k": {
|
||||
"description": "The top_k sampling parameter used for generation."
|
||||
},
|
||||
"presence_penalty": {
|
||||
"description": "The presence penalty used for completions."
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"description": "The frequency penalty used for completions."
|
||||
},
|
||||
}
|
||||
|
||||
def dict(self, **kwargs):
|
||||
|
|
@ -220,23 +133,25 @@ class LLM(ContinueBaseModel):
|
|||
self._config_temperature = temperature
|
||||
|
||||
def create_client_session(self):
|
||||
if self.verify_ssl is False:
|
||||
if self.request_options.verify_ssl is False:
|
||||
return aiohttp.ClientSession(
|
||||
connector=aiohttp.TCPConnector(verify_ssl=False),
|
||||
timeout=aiohttp.ClientTimeout(total=self.timeout),
|
||||
headers=self.headers,
|
||||
timeout=aiohttp.ClientTimeout(total=self.request_options.timeout),
|
||||
headers=self.request_options.headers,
|
||||
trust_env=True,
|
||||
)
|
||||
else:
|
||||
ca_bundle_path = (
|
||||
certifi.where() if self.ca_bundle_path is None else self.ca_bundle_path
|
||||
certifi.where()
|
||||
if self.request_options.ca_bundle_path is None
|
||||
else self.request_options.ca_bundle_path
|
||||
)
|
||||
if os.path.exists(ca_bundle_path):
|
||||
ssl_context = ssl.create_default_context(cafile=ca_bundle_path)
|
||||
return aiohttp.ClientSession(
|
||||
connector=aiohttp.TCPConnector(ssl_context=ssl_context),
|
||||
timeout=aiohttp.ClientTimeout(total=self.timeout),
|
||||
headers=self.headers,
|
||||
timeout=aiohttp.ClientTimeout(total=self.request_options.timeout),
|
||||
headers=self.request_options.headers,
|
||||
trust_env=True,
|
||||
)
|
||||
else:
|
||||
|
|
@ -245,8 +160,8 @@ class LLM(ContinueBaseModel):
|
|||
ca_bundle_path,
|
||||
)
|
||||
return aiohttp.ClientSession(
|
||||
timeout=aiohttp.ClientTimeout(total=self.timeout),
|
||||
headers=self.headers,
|
||||
timeout=aiohttp.ClientTimeout(total=self.request_options.timeout),
|
||||
headers=self.request_options.headers,
|
||||
trust_env=True,
|
||||
)
|
||||
|
||||
|
|
@ -308,13 +223,13 @@ Settings:
|
|||
0,
|
||||
{
|
||||
"role": "system",
|
||||
"content": render_templated_string(self.get_system_message()),
|
||||
"content": render_templated_string(self.get_system_message() or ""),
|
||||
},
|
||||
)
|
||||
|
||||
return self.template_messages(msgs)
|
||||
|
||||
def log_tokens_generated(self, model: str, completion: int):
|
||||
def log_tokens_generated(self, model: str, completion: str):
|
||||
tokens = self.count_tokens(completion)
|
||||
dev_data_logger.capture(
|
||||
"tokens_generated",
|
||||
|
|
@ -329,27 +244,29 @@ Settings:
|
|||
self,
|
||||
prompt: str,
|
||||
raw: bool = False,
|
||||
model: str = None,
|
||||
temperature: float = None,
|
||||
top_p: float = None,
|
||||
top_k: int = None,
|
||||
presence_penalty: float = None,
|
||||
frequency_penalty: float = None,
|
||||
model: Optional[str] = None,
|
||||
temperature: Optional[float] = None,
|
||||
top_p: Optional[float] = None,
|
||||
top_k: Optional[int] = None,
|
||||
presence_penalty: Optional[float] = None,
|
||||
frequency_penalty: Optional[float] = None,
|
||||
stop: Optional[List[str]] = None,
|
||||
max_tokens: Optional[int] = None,
|
||||
functions: Optional[List[Any]] = None,
|
||||
log: bool = True,
|
||||
) -> Generator[Union[Any, List, Dict], None, None]:
|
||||
) -> AsyncGenerator[Union[Any, List, Dict], None]:
|
||||
"""Yield completion response, either streamed or not."""
|
||||
options = CompletionOptions(
|
||||
model=model or self.model,
|
||||
temperature=temperature or self.temperature,
|
||||
top_p=top_p or self.top_p,
|
||||
top_k=top_k or self.top_k,
|
||||
presence_penalty=presence_penalty or self.presence_penalty,
|
||||
frequency_penalty=frequency_penalty or self.frequency_penalty,
|
||||
stop=stop or self.stop_tokens,
|
||||
max_tokens=max_tokens or self.max_tokens,
|
||||
temperature=temperature or self.completion_options.temperature,
|
||||
top_p=top_p or self.completion_options.top_p,
|
||||
top_k=top_k or self.completion_options.top_k,
|
||||
presence_penalty=presence_penalty
|
||||
or self.completion_options.presence_penalty,
|
||||
frequency_penalty=frequency_penalty
|
||||
or self.completion_options.frequency_penalty,
|
||||
stop=stop or self.completion_options.stop,
|
||||
max_tokens=max_tokens or self.completion_options.max_tokens,
|
||||
functions=functions,
|
||||
)
|
||||
|
||||
|
|
@ -377,12 +294,12 @@ Settings:
|
|||
self,
|
||||
prompt: str,
|
||||
raw: bool = False,
|
||||
model: str = None,
|
||||
temperature: float = None,
|
||||
top_p: float = None,
|
||||
top_k: int = None,
|
||||
presence_penalty: float = None,
|
||||
frequency_penalty: float = None,
|
||||
model: Optional[str] = None,
|
||||
temperature: Optional[float] = None,
|
||||
top_p: Optional[float] = None,
|
||||
top_k: Optional[int] = None,
|
||||
presence_penalty: Optional[float] = None,
|
||||
frequency_penalty: Optional[float] = None,
|
||||
stop: Optional[List[str]] = None,
|
||||
max_tokens: Optional[int] = None,
|
||||
functions: Optional[List[Any]] = None,
|
||||
|
|
@ -391,13 +308,15 @@ Settings:
|
|||
"""Yield completion response, either streamed or not."""
|
||||
options = CompletionOptions(
|
||||
model=model or self.model,
|
||||
temperature=temperature or self.temperature,
|
||||
top_p=top_p or self.top_p,
|
||||
top_k=top_k or self.top_k,
|
||||
presence_penalty=presence_penalty or self.presence_penalty,
|
||||
frequency_penalty=frequency_penalty or self.frequency_penalty,
|
||||
stop=stop or self.stop_tokens,
|
||||
max_tokens=max_tokens or self.max_tokens,
|
||||
temperature=temperature or self.completion_options.temperature,
|
||||
top_p=top_p or self.completion_options.top_p,
|
||||
top_k=top_k or self.completion_options.top_k,
|
||||
presence_penalty=presence_penalty
|
||||
or self.completion_options.presence_penalty,
|
||||
frequency_penalty=frequency_penalty
|
||||
or self.completion_options.frequency_penalty,
|
||||
stop=stop or self.completion_options.stop,
|
||||
max_tokens=max_tokens or self.completion_options.max_tokens,
|
||||
functions=functions,
|
||||
)
|
||||
|
||||
|
|
@ -423,27 +342,29 @@ Settings:
|
|||
async def stream_chat(
|
||||
self,
|
||||
messages: List[ChatMessage],
|
||||
model: str = None,
|
||||
temperature: float = None,
|
||||
top_p: float = None,
|
||||
top_k: int = None,
|
||||
presence_penalty: float = None,
|
||||
frequency_penalty: float = None,
|
||||
model: Optional[str] = None,
|
||||
temperature: Optional[float] = None,
|
||||
top_p: Optional[float] = None,
|
||||
top_k: Optional[int] = None,
|
||||
presence_penalty: Optional[float] = None,
|
||||
frequency_penalty: Optional[float] = None,
|
||||
stop: Optional[List[str]] = None,
|
||||
max_tokens: Optional[int] = None,
|
||||
functions: Optional[List[Any]] = None,
|
||||
log: bool = True,
|
||||
) -> Generator[Union[Any, List, Dict], None, None]:
|
||||
) -> AsyncGenerator[Union[Any, List, Dict], None]:
|
||||
"""Yield completion response, either streamed or not."""
|
||||
options = CompletionOptions(
|
||||
model=model or self.model,
|
||||
temperature=temperature or self.temperature,
|
||||
top_p=top_p or self.top_p,
|
||||
top_k=top_k or self.top_k,
|
||||
presence_penalty=presence_penalty or self.presence_penalty,
|
||||
frequency_penalty=frequency_penalty or self.frequency_penalty,
|
||||
stop=stop or self.stop_tokens,
|
||||
max_tokens=max_tokens or self.max_tokens,
|
||||
temperature=temperature or self.completion_options.temperature,
|
||||
top_p=top_p or self.completion_options.top_p,
|
||||
top_k=top_k or self.completion_options.top_k,
|
||||
presence_penalty=presence_penalty
|
||||
or self.completion_options.presence_penalty,
|
||||
frequency_penalty=frequency_penalty
|
||||
or self.completion_options.frequency_penalty,
|
||||
stop=stop or self.completion_options.stop,
|
||||
max_tokens=max_tokens or self.completion_options.max_tokens,
|
||||
functions=functions,
|
||||
)
|
||||
|
||||
|
|
@ -507,22 +428,21 @@ Settings:
|
|||
|
||||
def _stream_complete(
|
||||
self, prompt, options: CompletionOptions
|
||||
) -> Generator[str, None, None]:
|
||||
) -> AsyncGenerator[str, None]:
|
||||
"""Stream the completion through generator."""
|
||||
raise NotImplementedError
|
||||
|
||||
async def _complete(
|
||||
self, prompt: str, options: CompletionOptions
|
||||
) -> Coroutine[Any, Any, str]:
|
||||
async def _complete(self, prompt: str, options: CompletionOptions) -> str:
|
||||
"""Return the completion of the text with the given temperature."""
|
||||
completion = ""
|
||||
async for chunk in self._stream_complete(prompt=prompt, options=options):
|
||||
completion += chunk
|
||||
|
||||
return completion
|
||||
|
||||
async def _stream_chat(
|
||||
self, messages: List[ChatMessage], options: CompletionOptions
|
||||
) -> Generator[Union[Any, List, Dict], None, None]:
|
||||
) -> AsyncGenerator[Dict[str, str], None]:
|
||||
"""Stream the chat through generator."""
|
||||
if self.template_messages is None:
|
||||
raise NotImplementedError(
|
||||
|
|
|
|||
|
|
@ -1,46 +1,45 @@
|
|||
import json
|
||||
from typing import Any, Callable, Coroutine, Dict, List, Literal, Optional
|
||||
from typing import Any, Coroutine, List, Literal, Optional
|
||||
|
||||
from pydantic import Field
|
||||
from pydantic import Field, validator
|
||||
|
||||
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"
|
||||
}]
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
||||
server_url: str = Field(
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:8000",
|
||||
description="URL of the OpenAI-compatible server where the model is being served",
|
||||
)
|
||||
|
||||
@validator("api_base", pre=True, always=True)
|
||||
def set_api_base(cls, api_base):
|
||||
return api_base or "http://localhost:8000"
|
||||
|
||||
model: str = Field(
|
||||
"ggml", description="The name of the model to use (optional for the GGML class)"
|
||||
)
|
||||
|
||||
api_base: Optional[str] = Field(None, description="OpenAI API base URL.")
|
||||
|
||||
api_type: Optional[Literal["azure", "openai"]] = Field(
|
||||
None, description="OpenAI API type."
|
||||
)
|
||||
|
|
@ -53,28 +52,6 @@ class GGML(LLM):
|
|||
None, description="OpenAI engine. For use with Azure OpenAI Service."
|
||||
)
|
||||
|
||||
api_base: Optional[str] = Field(None, description="OpenAI API base URL.")
|
||||
|
||||
api_type: Optional[Literal["azure", "openai"]] = Field(
|
||||
None, description="OpenAI API type."
|
||||
)
|
||||
|
||||
api_version: Optional[str] = Field(
|
||||
None, description="OpenAI API version. For use with Azure OpenAI Service."
|
||||
)
|
||||
|
||||
engine: Optional[str] = Field(
|
||||
None, description="OpenAI engine. For use with Azure OpenAI Service."
|
||||
)
|
||||
|
||||
template_messages: Optional[
|
||||
Callable[[List[Dict[str, str]]], str]
|
||||
] = llama2_template_messages
|
||||
|
||||
prompt_templates = {
|
||||
"edit": codellama_edit_prompt,
|
||||
}
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
|
|
@ -101,20 +78,7 @@ class GGML(LLM):
|
|||
|
||||
return f"{self.api_base}/openai/deployments/{self.engine}/{endpoint}?api-version={self.api_version}"
|
||||
else:
|
||||
return f"{self.server_url}/v1/{endpoint}"
|
||||
|
||||
def get_full_server_url(self, endpoint: str):
|
||||
endpoint = endpoint.lstrip("/").rstrip("/")
|
||||
|
||||
if self.api_type == "azure":
|
||||
if self.engine is None or self.api_version is None or self.api_base is None:
|
||||
raise Exception(
|
||||
"For Azure OpenAI Service, you must specify engine, api_version, and api_base."
|
||||
)
|
||||
|
||||
return f"{self.api_base}/openai/deployments/{self.engine}/{endpoint}?api-version={self.api_version}"
|
||||
else:
|
||||
return f"{self.server_url}/v1/{endpoint}"
|
||||
return f"{self.api_base}/v1/{endpoint}"
|
||||
|
||||
async def _raw_stream_complete(self, prompt, options):
|
||||
args = self.collect_args(options)
|
||||
|
|
@ -128,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(
|
||||
|
|
@ -167,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 = (
|
||||
|
|
@ -228,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(
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}]
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -1,29 +1,25 @@
|
|||
from typing import Callable, Dict, List, 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"
|
||||
}]
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
||||
|
|
@ -31,19 +27,11 @@ class HuggingFaceInferenceAPI(LLM):
|
|||
"Hugging Face Inference API",
|
||||
description="The name of the model to use (optional for the HuggingFaceInferenceAPI class)",
|
||||
)
|
||||
hf_token: str = Field(..., description="Your Hugging Face API token")
|
||||
endpoint_url: str = Field(
|
||||
api_key: str = Field(..., description="Your Hugging Face API token")
|
||||
api_base: Optional[str] = Field(
|
||||
None, description="Your Hugging Face Inference API endpoint URL"
|
||||
)
|
||||
|
||||
template_messages: Union[
|
||||
Callable[[List[Dict[str, str]]], str], None
|
||||
] = llama2_template_messages
|
||||
|
||||
prompt_templates = {
|
||||
"edit": codellama_edit_prompt,
|
||||
}
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
|
|
@ -63,7 +51,7 @@ class HuggingFaceInferenceAPI(LLM):
|
|||
async def _stream_complete(self, prompt, options):
|
||||
args = self.collect_args(options)
|
||||
|
||||
client = InferenceClient(self.endpoint_url, token=self.hf_token)
|
||||
client = InferenceClient(self.api_base, token=self.api_key)
|
||||
|
||||
stream = client.text_generation(prompt, stream=True, details=True, **args)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,21 @@
|
|||
import json
|
||||
from typing import Any, Callable, List
|
||||
from typing import Any, Optional
|
||||
|
||||
from pydantic import Field, validator
|
||||
|
||||
from ..util.count_tokens import DEFAULT_MAX_TOKENS
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from ...core.main import ChatMessage
|
||||
from .base import LLM, CompletionOptions
|
||||
from .prompts.chat import llama2_template_messages
|
||||
from .prompts.edit import codellama_edit_prompt
|
||||
|
||||
|
||||
class HuggingFaceTGI(LLM):
|
||||
model: str = "huggingface-tgi"
|
||||
server_url: str = Field(
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:8080", description="URL of your TGI server"
|
||||
)
|
||||
|
||||
template_messages: Callable[[List[ChatMessage]], str] = llama2_template_messages
|
||||
|
||||
prompt_templates = {
|
||||
"edit": codellama_edit_prompt,
|
||||
}
|
||||
@validator("api_base", pre=True, always=True)
|
||||
def set_api_base(cls, api_base):
|
||||
return api_base or "http://localhost:8080"
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
|
@ -42,10 +37,10 @@ class HuggingFaceTGI(LLM):
|
|||
|
||||
async with self.create_client_session() as client_session:
|
||||
async with client_session.post(
|
||||
f"{self.server_url}/generate_stream",
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -1,11 +1,9 @@
|
|||
import json
|
||||
from typing import Any, Callable, Dict
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from pydantic import Field
|
||||
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,35 +14,34 @@ 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"
|
||||
}]
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
||||
model: str = "llamacpp"
|
||||
server_url: str = Field("http://localhost:8080", description="URL of the server")
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:8080", description="URL of the server"
|
||||
)
|
||||
|
||||
@validator("api_base", pre=True, always=True)
|
||||
def set_api_base(cls, api_base):
|
||||
return api_base or "http://localhost:8080"
|
||||
|
||||
llama_cpp_args: Dict[str, Any] = Field(
|
||||
{"stop": ["[INST]"]},
|
||||
description="A list of additional arguments to pass to llama.cpp. See [here](https://github.com/ggerganov/llama.cpp/tree/master/examples/server#api-endpoints) for the complete catalog of options.",
|
||||
)
|
||||
|
||||
template_messages: Callable = llama2_template_messages
|
||||
prompt_templates = {
|
||||
"edit": codellama_edit_prompt,
|
||||
}
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
|
|
@ -71,10 +68,10 @@ class LlamaCpp(LLM):
|
|||
async def server_generator():
|
||||
async with self.create_client_session() as client_session:
|
||||
async with client_session.post(
|
||||
f"{self.server_url}/completion",
|
||||
f"{self.api_base}/completion",
|
||||
json={"prompt": prompt, "stream": True, **args},
|
||||
headers=headers,
|
||||
proxy=self.proxy,
|
||||
proxy=self.request_options.proxy,
|
||||
) as resp:
|
||||
async for line in resp.content:
|
||||
content = line.decode("utf-8")
|
||||
|
|
|
|||
|
|
@ -1,42 +1,36 @@
|
|||
import json
|
||||
from typing import Any, Callable, Dict
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import aiohttp
|
||||
from pydantic import Field
|
||||
from pydantic import Field, validator
|
||||
|
||||
from ...core.main import ContinueCustomException
|
||||
from ..util.logging import logger
|
||||
from .base import LLM, CompletionOptions
|
||||
from .prompts.chat import llama2_template_messages
|
||||
from .prompts.edit import codellama_edit_prompt
|
||||
|
||||
|
||||
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",
|
||||
}]
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
||||
model: str = "llama2"
|
||||
server_url: str = Field(
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:11434", description="URL of the Ollama server"
|
||||
)
|
||||
|
||||
template_messages: Callable = llama2_template_messages
|
||||
|
||||
prompt_templates = {
|
||||
"edit": codellama_edit_prompt,
|
||||
}
|
||||
@validator("api_base", pre=True, always=True)
|
||||
def set_api_base(cls, api_base):
|
||||
return api_base or "http://localhost:11434"
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
|
@ -48,18 +42,35 @@ class Ollama(LLM):
|
|||
"top_k": options.top_k,
|
||||
"num_predict": options.max_tokens,
|
||||
"stop": options.stop,
|
||||
"num_ctx": self.context_length,
|
||||
}
|
||||
|
||||
def get_model_name(self):
|
||||
return {
|
||||
"mistral-7b": "mistral:7b",
|
||||
"llama2-7b": "llama2:7b",
|
||||
"llama2-13b": "llama2:13b",
|
||||
"codellama-7b": "codellama:7b",
|
||||
"codellama-13b": "codellama:13b",
|
||||
"codellama-34b": "codellama:34b",
|
||||
"phind-codellama-34b": "phind-codellama:34b-v2",
|
||||
"wizardcoder-7b": "wizardcoder:7b-python",
|
||||
"wizardcoder-13b": "wizardcoder:13b-python",
|
||||
"wizardcoder-34b": "wizardcoder:34b-python",
|
||||
"zephyr-7b": "zephyr:7b",
|
||||
"codeup-13b": "codeup:13b",
|
||||
}.get(self.model, self.model)
|
||||
|
||||
async def start(self, *args, **kwargs):
|
||||
await super().start(*args, **kwargs)
|
||||
try:
|
||||
async with self.create_client_session() as session:
|
||||
async with session.post(
|
||||
f"{self.server_url}/api/generate",
|
||||
proxy=self.proxy,
|
||||
f"{self.api_base}/api/generate",
|
||||
proxy=self.request_options.proxy,
|
||||
json={
|
||||
"prompt": "",
|
||||
"model": self.model,
|
||||
"model": self.get_model_name(),
|
||||
},
|
||||
) as _:
|
||||
pass
|
||||
|
|
@ -69,8 +80,8 @@ class Ollama(LLM):
|
|||
async def get_downloaded_models(self):
|
||||
async with self.create_client_session() as session:
|
||||
async with session.get(
|
||||
f"{self.server_url}/api/tags",
|
||||
proxy=self.proxy,
|
||||
f"{self.api_base}/api/tags",
|
||||
proxy=self.request_options.proxy,
|
||||
) as resp:
|
||||
js_data = await resp.json()
|
||||
return list(map(lambda x: x["name"], js_data["models"]))
|
||||
|
|
@ -78,28 +89,29 @@ class Ollama(LLM):
|
|||
async def _stream_complete(self, prompt, options):
|
||||
async with self.create_client_session() as session:
|
||||
async with session.post(
|
||||
f"{self.server_url}/api/generate",
|
||||
f"{self.api_base}/api/generate",
|
||||
json={
|
||||
"template": prompt,
|
||||
"model": self.model,
|
||||
"model": self.get_model_name(),
|
||||
"system": self.system_message,
|
||||
"options": self.collect_args(options),
|
||||
},
|
||||
proxy=self.proxy,
|
||||
proxy=self.request_options.proxy,
|
||||
) as resp:
|
||||
if resp.status == 400:
|
||||
txt = await resp.text()
|
||||
extra_msg = ""
|
||||
if "no such file" in txt:
|
||||
extra_msg = f"\n\nThis means that the model '{self.model}' is not downloaded.\n\nYou have the following models downloaded: {', '.join(await self.get_downloaded_models())}.\n\nTo download this model, run `ollama run {self.model}` in your terminal."
|
||||
extra_msg = f"\n\nThis means that the model '{self.get_model_name()}' is not downloaded.\n\nYou have the following models downloaded: {', '.join(await self.get_downloaded_models())}.\n\nTo download this model, run `ollama run {self.get_model_name()}` in your terminal."
|
||||
raise ContinueCustomException(
|
||||
f"Ollama returned an error: {txt}{extra_msg}",
|
||||
"Invalid request to Ollama",
|
||||
)
|
||||
elif resp.status == 404:
|
||||
model_name = self.get_model_name()
|
||||
raise ContinueCustomException(
|
||||
f"Ollama not found. Please make sure the server is running.\n\n{await resp.text()}",
|
||||
"Ollama not found. Please make sure the server is running.",
|
||||
f"Ollama returned 404. Make sure the server is running and '{model_name}' is downloaded with `ollama run {model_name}`.\n\n{await resp.text()}",
|
||||
f"Ollama returned 404. Make sure the server is running and '{model_name}' is downloaded with `ollama run {model_name}`.",
|
||||
)
|
||||
elif resp.status != 200:
|
||||
raise ContinueCustomException(
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@ import asyncio
|
|||
from typing import List, Literal, Optional
|
||||
|
||||
import certifi
|
||||
from ..util.count_tokens import CONTEXT_LENGTH_FOR_MODEL
|
||||
from ..util.logging import logger
|
||||
from .prompts.chat import template_alpaca_messages
|
||||
import openai
|
||||
from openai.error import RateLimitError
|
||||
from pydantic import Field, validator
|
||||
|
||||
from ...core.main import ChatMessage
|
||||
from ..util.count_tokens import CONTEXT_LENGTH_FOR_MODEL
|
||||
from ..util.logging import logger
|
||||
from .base import LLM
|
||||
from .prompts.chat import template_alpaca_messages
|
||||
|
||||
CHAT_MODELS = {
|
||||
"gpt-3.5-turbo",
|
||||
|
|
@ -18,7 +18,7 @@ CHAT_MODELS = {
|
|||
"gpt-4",
|
||||
"gpt-3.5-turbo-0613",
|
||||
"gpt-4-32k",
|
||||
"gpt-4-1106-preview"
|
||||
"gpt-4-1106-preview",
|
||||
}
|
||||
NON_CHAT_MODELS = {
|
||||
"gpt-3.5-turbo-instruct",
|
||||
|
|
@ -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:
|
||||
|
|
@ -71,8 +68,6 @@ class OpenAI(LLM):
|
|||
description="OpenAI API key",
|
||||
)
|
||||
|
||||
proxy: Optional[str] = Field(None, description="Proxy URL to use for requests.")
|
||||
|
||||
api_base: Optional[str] = Field(None, description="OpenAI API base URL.")
|
||||
|
||||
api_type: Optional[Literal["azure", "openai"]] = Field(
|
||||
|
|
@ -83,15 +78,15 @@ class OpenAI(LLM):
|
|||
None, description="OpenAI API version. For use with Azure OpenAI Service."
|
||||
)
|
||||
|
||||
engine: Optional[str] = Field(
|
||||
None, description="OpenAI engine. For use with Azure OpenAI Service."
|
||||
)
|
||||
|
||||
use_legacy_completions_endpoint: bool = Field(
|
||||
False,
|
||||
description="Manually specify to use the legacy completions endpoint instead of chat completions.",
|
||||
)
|
||||
|
||||
engine: Optional[str] = Field(
|
||||
None, description="OpenAI engine. For use with Azure OpenAI Service."
|
||||
)
|
||||
|
||||
@validator("context_length")
|
||||
def context_length_for_model(cls, v, values):
|
||||
return CONTEXT_LENGTH_FOR_MODEL.get(values["model"], 4096)
|
||||
|
|
@ -110,13 +105,16 @@ class OpenAI(LLM):
|
|||
if self.api_version is not None:
|
||||
openai.api_version = self.api_version
|
||||
|
||||
if self.verify_ssl is not None and self.verify_ssl is False:
|
||||
if (
|
||||
self.request_options.verify_ssl is not None
|
||||
and self.request_options.verify_ssl is False
|
||||
):
|
||||
openai.verify_ssl_certs = False
|
||||
|
||||
if self.proxy is not None:
|
||||
openai.proxy = self.proxy
|
||||
if self.request_options.proxy is not None:
|
||||
openai.proxy = self.request_options.proxy
|
||||
|
||||
openai.ca_bundle_path = self.ca_bundle_path or certifi.where()
|
||||
openai.ca_bundle_path = self.request_options.ca_bundle_path or certifi.where()
|
||||
|
||||
session = self.create_client_session()
|
||||
openai.aiosession.set(session)
|
||||
|
|
@ -142,13 +140,13 @@ class OpenAI(LLM):
|
|||
async for chunk in await openai.ChatCompletion.acreate(
|
||||
messages=[{"role": "user", "content": prompt}],
|
||||
**args,
|
||||
headers=self.headers,
|
||||
headers=self.request_options.headers,
|
||||
):
|
||||
if len(chunk.choices) > 0 and "content" in chunk.choices[0].delta:
|
||||
yield chunk.choices[0].delta.content
|
||||
else:
|
||||
async for chunk in await openai.Completion.acreate(
|
||||
prompt=prompt, **args, headers=self.headers
|
||||
prompt=prompt, **args, headers=self.request_options.headers
|
||||
):
|
||||
if len(chunk.choices) > 0:
|
||||
yield chunk.choices[0].text
|
||||
|
|
@ -164,7 +162,7 @@ class OpenAI(LLM):
|
|||
messages=messages,
|
||||
stream=True,
|
||||
**args,
|
||||
headers=self.headers,
|
||||
headers=self.request_options.headers,
|
||||
):
|
||||
if not hasattr(chunk, "choices") or len(chunk.choices) == 0:
|
||||
continue
|
||||
|
|
@ -183,7 +181,7 @@ class OpenAI(LLM):
|
|||
prompt=template_alpaca_messages(messages),
|
||||
stream=True,
|
||||
**args,
|
||||
headers=self.headers,
|
||||
headers=self.request_options.headers,
|
||||
):
|
||||
if len(chunk.choices) > 0:
|
||||
yield {
|
||||
|
|
@ -204,7 +202,7 @@ class OpenAI(LLM):
|
|||
resp = await openai.ChatCompletion.acreate(
|
||||
messages=[{"role": "user", "content": prompt}],
|
||||
**args,
|
||||
headers=self.headers,
|
||||
headers=self.request_options.headers,
|
||||
)
|
||||
return resp.choices[0].message.content
|
||||
except RateLimitError as e:
|
||||
|
|
@ -217,7 +215,7 @@ class OpenAI(LLM):
|
|||
return (
|
||||
(
|
||||
await openai.Completion.acreate(
|
||||
prompt=prompt, **args, headers=self.headers
|
||||
prompt=prompt, **args, headers=self.request_options.headers
|
||||
)
|
||||
)
|
||||
.choices[0]
|
||||
|
|
|
|||
|
|
@ -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,27 +16,33 @@ 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".
|
||||
"""
|
||||
|
||||
api_key: Optional[str] = None
|
||||
|
||||
llm: Optional[LLM] = None
|
||||
|
||||
@validator("context_length", pre=True, always=True)
|
||||
|
|
@ -52,15 +58,15 @@ class OpenAIFreeTrial(LLM):
|
|||
if self.api_key is None or self.api_key.strip() == "":
|
||||
self.llm = ProxyServer(
|
||||
model=self.model,
|
||||
verify_ssl=self.verify_ssl,
|
||||
ca_bundle_path=self.ca_bundle_path,
|
||||
verify_ssl=self.request_options.verify_ssl,
|
||||
ca_bundle_path=self.request_options.ca_bundle_path,
|
||||
)
|
||||
else:
|
||||
self.llm = OpenAI(
|
||||
api_key=self.api_key,
|
||||
model=self.model,
|
||||
verify_ssl=self.verify_ssl,
|
||||
ca_bundle_path=self.ca_bundle_path,
|
||||
verify_ssl=self.request_options.verify_ssl,
|
||||
ca_bundle_path=self.request_options.ca_bundle_path,
|
||||
)
|
||||
|
||||
await self.llm.start(unique_id=unique_id)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from textwrap import dedent
|
||||
|
||||
from ...llm.base import PromptTemplate
|
||||
from ....models.llm import PromptTemplate
|
||||
|
||||
simplified_edit_prompt = dedent(
|
||||
"""\
|
||||
|
|
@ -41,10 +41,6 @@ _codellama_edit_prompt = dedent(
|
|||
[CODE]"""
|
||||
)
|
||||
|
||||
codellama_edit_prompt = PromptTemplate(
|
||||
prompt=_codellama_edit_prompt, raw=True, stop=["[/CODE]"]
|
||||
)
|
||||
|
||||
_alpaca_edit_prompt = dedent(
|
||||
"""\
|
||||
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
||||
|
|
@ -59,8 +55,51 @@ _alpaca_edit_prompt = dedent(
|
|||
|
||||
### Response:
|
||||
|
||||
Sure! Here's the code you requested:
|
||||
```
|
||||
"""
|
||||
)
|
||||
|
||||
_phind_edit_prompt = dedent(
|
||||
"""\
|
||||
### System Prompt
|
||||
You are an expert programmer and write code on the first attempt without any errors or fillers.
|
||||
|
||||
### User Message:
|
||||
Rewrite the code to satisfy this request: "{{{user_input}}}"
|
||||
|
||||
```
|
||||
{{{code_to_edit}}}
|
||||
```
|
||||
|
||||
### Assistant:
|
||||
Sure! Here's the code you requested:
|
||||
|
||||
```
|
||||
"""
|
||||
)
|
||||
|
||||
_zephyr_edit_prompt = dedent(
|
||||
"""\
|
||||
<|system|>
|
||||
You are an expert programmer and write code on the first attempt without any errors or fillers.</s>
|
||||
<|user|>
|
||||
Rewrite the code to satisfy this request: "{{{user_input}}}"
|
||||
|
||||
```
|
||||
{{{code_to_edit}}}
|
||||
```</s>
|
||||
<|assistant|>
|
||||
Sure! Here's the code you requested:
|
||||
|
||||
```
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
codellama_edit_prompt = PromptTemplate(
|
||||
prompt=_codellama_edit_prompt, raw=True, stop=["[/CODE]"]
|
||||
)
|
||||
alpaca_edit_prompt = PromptTemplate(prompt=_alpaca_edit_prompt, raw=True, stop=["```"])
|
||||
phind_edit_prompt = PromptTemplate(prompt=_phind_edit_prompt, raw=True, stop=["```"])
|
||||
zephyr_edit_prompt = PromptTemplate(prompt=_zephyr_edit_prompt, raw=True, stop=["```"])
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import json
|
|||
import traceback
|
||||
from typing import List
|
||||
|
||||
import aiohttp
|
||||
from pydantic import validator
|
||||
from ..util.count_tokens import CONTEXT_LENGTH_FOR_MODEL
|
||||
|
||||
|
|
@ -41,7 +40,7 @@ class ProxyServer(LLM):
|
|||
f"{SERVER_URL}/complete",
|
||||
json={"messages": [{"role": "user", "content": prompt}], **args},
|
||||
headers=self.get_headers(),
|
||||
proxy=self.proxy,
|
||||
proxy=self.request_options.proxy,
|
||||
) as resp:
|
||||
resp_text = await resp.text()
|
||||
if resp.status != 200:
|
||||
|
|
@ -56,7 +55,7 @@ class ProxyServer(LLM):
|
|||
f"{SERVER_URL}/stream_chat",
|
||||
json={"messages": messages, **args},
|
||||
headers=self.get_headers(),
|
||||
proxy=self.proxy,
|
||||
proxy=self.request_options.proxy,
|
||||
) as resp:
|
||||
if resp.status != 200:
|
||||
raise Exception(await resp.text())
|
||||
|
|
@ -100,7 +99,7 @@ class ProxyServer(LLM):
|
|||
f"{SERVER_URL}/stream_complete",
|
||||
json={"messages": [{"role": "user", "content": prompt}], **args},
|
||||
headers=self.get_headers(),
|
||||
proxy=self.proxy,
|
||||
proxy=self.request_options.proxy,
|
||||
) as resp:
|
||||
if resp.status != 200:
|
||||
raise Exception(await resp.text())
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
@ -36,18 +32,23 @@ class ReplicateLLM(LLM):
|
|||
|
||||
_client: replicate.Client = None
|
||||
|
||||
prompt_templates = {
|
||||
"edit": codellama_edit_prompt,
|
||||
}
|
||||
|
||||
async def start(self, *args, **kwargs):
|
||||
await super().start(*args, **kwargs)
|
||||
self._client = replicate.Client(api_token=self.api_key)
|
||||
|
||||
def get_model_name(self):
|
||||
return {
|
||||
"codellama-7b": "meta/codellama-7b-instruct:6527b83e01e41412db37de5110a8670e3701ee95872697481a355e05ce12af0e",
|
||||
"codellama-13b": "meta/codellama-13b-instruct:1f01a52ff933873dff339d5fb5e1fd6f24f77456836f514fa05e91c1a42699c7",
|
||||
"codellama-34b": "meta/codellama-34b-instruct:8281a5c610f6e88237ff3ddaf3c33b56f60809e2bdd19fbec2fda742aa18167e",
|
||||
"llama2-7b": "meta/llama-2-7b-chat:8e6975e5ed6174911a6ff3d60540dfd4844201974602551e10e9e87ab143d81e",
|
||||
"llama2-13b": "meta/llama-2-13b-chat:f4e2de70d66816a838a89eeeb621910adffb0dd0baba3976c96980970978018d",
|
||||
}.get(self.model, self.model)
|
||||
|
||||
async def _complete(self, prompt: str, options):
|
||||
def helper():
|
||||
output = self._client.run(
|
||||
self.model, input={"message": prompt, "prompt": prompt}
|
||||
self.get_model_name(), input={"message": prompt, "prompt": prompt}
|
||||
)
|
||||
completion = ""
|
||||
for item in output:
|
||||
|
|
@ -63,13 +64,13 @@ class ReplicateLLM(LLM):
|
|||
|
||||
async def _stream_complete(self, prompt, options):
|
||||
for item in self._client.run(
|
||||
self.model, input={"message": prompt, "prompt": prompt}
|
||||
self.get_model_name(), input={"message": prompt, "prompt": prompt}
|
||||
):
|
||||
yield item
|
||||
|
||||
async def _stream_chat(self, messages: List[ChatMessage], options):
|
||||
for item in self._client.run(
|
||||
self.model,
|
||||
self.get_model_name(),
|
||||
input={
|
||||
"message": messages[-1]["content"],
|
||||
"prompt": messages[-1]["content"],
|
||||
|
|
|
|||
|
|
@ -1,50 +1,37 @@
|
|||
import json
|
||||
from typing import Any, Callable, Dict, List, Union
|
||||
from typing import Any, List, Optional
|
||||
|
||||
import websockets
|
||||
from pydantic import Field
|
||||
|
||||
from ...core.main import ChatMessage
|
||||
from .base import LLM
|
||||
from .prompts.chat import llama2_template_messages
|
||||
from .prompts.edit import simplest_edit_prompt
|
||||
|
||||
|
||||
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"
|
||||
}]
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
||||
model: str = "text-gen-webui"
|
||||
server_url: str = Field(
|
||||
api_base: Optional[str] = Field(
|
||||
"http://localhost:5000", description="URL of your TextGenWebUI server"
|
||||
)
|
||||
streaming_url: str = Field(
|
||||
streaming_url: Optional[str] = Field(
|
||||
"http://localhost:5005",
|
||||
description="URL of your TextGenWebUI streaming server (separate from main server URL)",
|
||||
)
|
||||
|
||||
prompt_templates = {
|
||||
"edit": simplest_edit_prompt,
|
||||
}
|
||||
|
||||
template_messages: Union[
|
||||
Callable[[List[Dict[str, str]]], str], None
|
||||
] = llama2_template_messages
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
|
|
|
|||
|
|
@ -1,61 +1,68 @@
|
|||
import json
|
||||
from typing import Callable
|
||||
from pydantic import Field
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from continuedev.models.llm import CompletionOptions
|
||||
from pydantic import Field, validator
|
||||
|
||||
from ...core.main import ContinueCustomException
|
||||
from ..util.logging import logger
|
||||
from .base import LLM
|
||||
from .prompts.chat import llama2_template_messages
|
||||
from .prompts.edit import codellama_edit_prompt
|
||||
|
||||
|
||||
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"
|
||||
}]
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
||||
api_key: str = Field(..., description="Together API key")
|
||||
|
||||
model: str = "togethercomputer/RedPajama-INCITE-7B-Instruct"
|
||||
base_url: str = Field(
|
||||
api_base: Optional[str] = Field(
|
||||
"https://api.together.xyz",
|
||||
description="The base URL for your Together API instance",
|
||||
)
|
||||
|
||||
template_messages: Callable = llama2_template_messages
|
||||
@validator("api_base", pre=True, always=True)
|
||||
def set_api_base(cls, api_base):
|
||||
return api_base or "https://api.together.xyz"
|
||||
|
||||
prompt_templates = {
|
||||
"edit": codellama_edit_prompt,
|
||||
}
|
||||
def collect_args(self, options: CompletionOptions) -> Dict[str, Any]:
|
||||
args = super().collect_args(options)
|
||||
args["model"] = {
|
||||
"codellama-7b": "togethercomputer/CodeLlama-7b-Instruct",
|
||||
"codellama-13b": "togethercomputer/CodeLlama-13b-Instruct",
|
||||
"codellama-34b": "togethercomputer/CodeLlama-34b-Instruct",
|
||||
"llama2-7b": "togethercomputer/llama-2-7b-chat",
|
||||
"llama2-13b": "togethercomputer/llama-2-13b-chat",
|
||||
"llama2-70b": "togethercomputer/llama-2-70b-chat",
|
||||
"mistral-7b": "mistralai/Mistral-7B-Instruct-v0.1",
|
||||
}.get(self.model, self.model)
|
||||
return args
|
||||
|
||||
async def _stream_complete(self, prompt, options):
|
||||
args = self.collect_args(options)
|
||||
|
||||
async with self.create_client_session() as session:
|
||||
async with session.post(
|
||||
f"{self.base_url}/inference",
|
||||
f"{self.api_base}/inference",
|
||||
json={
|
||||
"prompt": prompt,
|
||||
"stream_tokens": True,
|
||||
**args,
|
||||
},
|
||||
headers={"Authorization": f"Bearer {self.api_key}"},
|
||||
proxy=self.proxy,
|
||||
proxy=self.request_options.proxy,
|
||||
) as resp:
|
||||
async for line in resp.content.iter_chunks():
|
||||
if line[1]:
|
||||
|
|
@ -92,10 +99,10 @@ class TogetherLLM(LLM):
|
|||
|
||||
async with self.create_client_session() as session:
|
||||
async with session.post(
|
||||
f"{self.base_url}/inference",
|
||||
f"{self.api_base}/inference",
|
||||
json={"prompt": prompt, **args},
|
||||
headers={"Authorization": f"Bearer {self.api_key}"},
|
||||
proxy=self.proxy,
|
||||
proxy=self.request_options.proxy,
|
||||
) as resp:
|
||||
text = await resp.text()
|
||||
j = json.loads(text)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue