Merge branch 'preview' into nate/litellm
This commit is contained in:
commit
c193cc9181
61 changed files with 753 additions and 347 deletions
|
|
@ -10,7 +10,7 @@ Continue can be deeply customized by editing `~/.continue/config.json` (`%userpr
|
|||
|
||||
Currently, you can customize the following:
|
||||
|
||||
- [Models](./models.md) - Use Continue with any LLM, including local models, Azure OpenAI service, any OpenAI-compatible API, and more.
|
||||
- [Models](../model-setup/select-model.md) and [proivders](../model-setup/select-provider.md)
|
||||
- [Context Providers](./context-providers.md) - Just type '@' to easily add attachments to your prompt. Define which sources you want to easily reference, including GitHub Issues, terminal output, and preset URLs.
|
||||
- [Slash Commands](./slash-commands.md) - Call custom prompts or programs written with our SDK by typing `/`.
|
||||
- [Other Configuration](./other-configuration.md) - Configure other settings like the system message and temperature.
|
||||
- [Other Configuration](./other-configuration.md) - Configure other settings like the system message and temperature.
|
||||
|
|
@ -1,32 +1,10 @@
|
|||
---
|
||||
title: Models
|
||||
description: Swap out different LLM providers
|
||||
keywords: [openai, anthropic, PaLM, ollama, ggml]
|
||||
title: Configuration
|
||||
description: Configure your LLM and model provider
|
||||
keywords: [configure, llm, provider]
|
||||
---
|
||||
|
||||
# Models
|
||||
|
||||
Continue makes it easy to swap out different LLM providers. You can either click the "+" button next to the model dropdown to configure in the UI or manually add them to your `config.json`. Once you've done this, you will be able to switch between them with the model selection dropdown.
|
||||
|
||||
Commercial Models
|
||||
|
||||
- [OpenAIFreeTrial](../reference/Models/openaifreetrial.md) (default) - Use gpt-4 or gpt-3.5-turbo free with our API key, or with your API key. gpt-4 is probably the most capable model of all options.
|
||||
- [OpenAI](../reference/Models/openai.md) - Use any OpenAI model with your own key. Can also change the base URL if you have a server that uses the OpenAI API format, including using the Azure OpenAI service, LocalAI, etc.
|
||||
- [AnthropicLLM](../reference/Models/anthropicllm.md) - Use claude-2 with your Anthropic API key. Claude 2 is also highly capable, and has a 100,000 token context window.
|
||||
- [GooglePaLMAPI](../reference/Models/googlepalmapi.md) - Try out the `chat-bison-001` model, which is currently in public preview, after creating an API key in [Google MakerSuite](https://makersuite.google.com/u/2/app/apikey)
|
||||
|
||||
Local Models
|
||||
|
||||
- [Ollama](../reference/Models/ollama.md) - If you are on Mac or Linux, Ollama is the simplest way to run open-source models like Code Llama.
|
||||
- [OpenAI](../reference/Models/openai.md) - If you have access to an OpenAI-compatible server (e.g. llama-cpp-python, LocalAI, FastChat, TextGenWebUI, etc.), you can use the `OpenAI` class and just change the base URL.
|
||||
- [GGML](../reference/Models/ggml.md) - An alternative way to connect to OpenAI-compatible servers. Will use `aiohttp` directly instead of the `openai` Python package.
|
||||
- [LlamaCpp](../reference/Models/llamacpp.md) - Build llama.cpp from source and use its built-in API server.
|
||||
|
||||
Open-Source Models (not local)
|
||||
|
||||
- [TogetherLLM](../reference/Models/togetherllm.md) - Use any model from the [Together Models list](https://docs.together.ai/docs/inference-models) with your Together API key.
|
||||
- [ReplicateLLM](../reference/Models/replicatellm.md) - Use any open-source model from the [Replicate Streaming List](https://replicate.com/collections/streaming-language-models) with your Replicate API key.
|
||||
- [HuggingFaceInferenceAPI](../reference/Models/huggingfaceinferenceapi.md) - Use any open-source model from the [Hugging Face Inference API](https://huggingface.co/inference-api) with your Hugging Face token.
|
||||
# Configuration
|
||||
|
||||
## Change the default LLM
|
||||
|
||||
|
|
@ -97,7 +75,7 @@ If by chance the provider has the exact same API interface as OpenAI, the `OpenA
|
|||
|
||||
Most open-source models expect a specific chat format, for example llama2 and codellama expect the input to look like `"[INST] How do I write bubble sort in Rust? [/INST]"`. Continue will automatically attempt to detect the correct prompt format based on the `model`value that you provide, but if you are receiving nonsense responses, you can use the`template`property to explicitly set the format that you expect. The options are:`["llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml"]`.
|
||||
|
||||
If you want to create an entirely new chat template, this can be done in [config.py](./code-config.md) by defining a function and adding it to the `template_messages` property of your `LLM`. Here is an example of `template_messages` for the Alpaca/Vicuna format:
|
||||
If you want to create an entirely new chat template, this can be done in [config.py](../customization/code-config.md) by defining a function and adding it to the `template_messages` property of your `LLM`. Here is an example of `template_messages` for the Alpaca/Vicuna format:
|
||||
|
||||
```python
|
||||
def template_alpaca_messages(msgs: List[Dict[str, str]]) -> str:
|
||||
|
|
@ -120,7 +98,7 @@ It can then be used like this:
|
|||
|
||||
```python title="~/.continue/config.py"
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.models[0].template_messages = template_alpaca_messages
|
||||
config.models.default.template_messages = template_alpaca_messages
|
||||
return config
|
||||
```
|
||||
|
||||
|
|
@ -150,7 +128,7 @@ It can then be used like this in `config.py`:
|
|||
|
||||
```python title="~/.continue/config.py"
|
||||
def modify_config(config: ContinueConfig) -> ContinueConfig:
|
||||
config.models[0].prompt_templates["edit"] = "<INSERT_TEMPLATE_HERE>"
|
||||
config.models.edit.prompt_templates["edit"] = "<INSERT_TEMPLATE_HERE>"
|
||||
return config
|
||||
```
|
||||
|
||||
45
docs/docs/model-setup/select-model.md
Normal file
45
docs/docs/model-setup/select-model.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
title: Select model
|
||||
description: Swap out different LLMs
|
||||
keywords: [gpt-4, codellama, claude-2, wizardcoder, wizardcoder]
|
||||
---
|
||||
|
||||
# Select a Large Language Model
|
||||
|
||||
Continue makes it easy to swap out different LLMs. You can either click the "+" button next to the model dropdown to configure in the GUI or manually add them to your `config.json`. Once you've done this, you will be able to switch between them in the model selection dropdown.
|
||||
|
||||
**In addition to selecting a LLM, you will need to figure out [what model provider to use](./select-provider.md).**
|
||||
|
||||
## Open-source LLMs
|
||||
|
||||
Models available for configuration in the GUI:
|
||||
- [Code Llama-Instruct-7B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#1-code-llama)
|
||||
- [Code Llama-Instruct-13B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#1-code-llama)
|
||||
- [Code Llama-Instruct-34B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#1-code-llama)
|
||||
- [WizardCoder-7B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#2-wizardcoder)
|
||||
- [WizardCoder-13B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#2-wizardcoder)
|
||||
- [WizardCoder-34B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#2-wizardcoder)
|
||||
- [Phind-CodeLlama-34B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#3-phind-codellama)
|
||||
- [Mistral-Instruct-7B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#4-mistral)
|
||||
- [StarCoder-15B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#5-starcoder)
|
||||
- [Deepseek-Coder-1.3b-Instruct](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#6-deepseek-coder)
|
||||
- [Deepseek-Coder-6.7b-Instruct](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#6-deepseek-coder)
|
||||
- [Deepseek-Coder-33b-Instruct](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#6-deepseek-coder)
|
||||
- [Llama2-Chat-7B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#7-llama2)
|
||||
- [Llama2-Chat-13B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#7-llama2)
|
||||
- [Llama2-Chat-70B](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#7-llama2)
|
||||
- [CodeUp-13B](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf)
|
||||
- [Zephyr-7B](https://huggingface.co/huggingfaceh4/zephyr-7b-beta)
|
||||
|
||||
**You can also use other open-source models**, but you will need to manually add them to your `config.json`.
|
||||
|
||||
## Commercial LLMs
|
||||
|
||||
Models available for configuration in the GUI:
|
||||
- [GPT-4](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#1-gpt-4)
|
||||
- [GPT-4-Turbo](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#2-gpt-4-turbo)
|
||||
- [GPT-3.5-Turbo](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#3-gpt-35-turbo)
|
||||
- [Claude-2](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#4-claude-2)
|
||||
- [PaLM-2](https://github.com/continuedev/what-llm-to-use/blob/main/README.md#5-palm-2)
|
||||
|
||||
**You can also use other commercial models**, but you will need to manually add them to your `config.json`.
|
||||
53
docs/docs/model-setup/select-provider.md
Normal file
53
docs/docs/model-setup/select-provider.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
title: Select a provider
|
||||
description: Swap out different LLM providers
|
||||
keywords: [openai, anthropic, PaLM, ollama, ggml]
|
||||
---
|
||||
|
||||
# Select a model provider
|
||||
|
||||
Continue makes it easy to swap out different LLM providers. You can either click the "+" button next to the model dropdown to configure in the GUI or manually add them to your `config.json`. Once you've done this, you will be able to switch between them in the model selection dropdown.
|
||||
|
||||
**In addition to selecting a model provider, you will need to figure out [what LLM to use](./select-model.md).**
|
||||
|
||||
## Local
|
||||
|
||||
You can run a model on your local computer using:
|
||||
- [Ollama](../reference/Model%20Providers/ollama.md)
|
||||
- [LM Studio](../reference/Model%20Providers/ggml.md)
|
||||
- [Llama.cpp](../reference/Model%20Providers/llamacpp.md)
|
||||
- [LocalAI](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
- [Text generation web UI](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
- [FastChat](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
- [llama-cpp-python](../reference/Model%20Providers/openai.md) (OpenAI compatible server)
|
||||
|
||||
Once you have it running, you will need to configure it in the GUI or manually add it to your `config.json`.
|
||||
|
||||
## Cloud
|
||||
|
||||
You can deploy a model in your [AWS](https://github.com/continuedev/deploy-os-code-llm#aws), [GCP](https://github.com/continuedev/deploy-os-code-llm#gcp), [Azure](https://github.com/continuedev/deploy-os-code-llm#azure), or [other clouds](https://github.com/continuedev/deploy-os-code-llm#others-2) using:
|
||||
- [HuggingFace TGI](https://github.com/continuedev/deploy-os-code-llm#tgi)
|
||||
- [vLLM](https://github.com/continuedev/deploy-os-code-llm#vllm)
|
||||
- [SkyPilot](https://github.com/continuedev/deploy-os-code-llm#skypilot)
|
||||
- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) (OpenAI compatible API)
|
||||
|
||||
Once you have it deloyed, you will need to wire up a new LLM class and manually add it to your `config.json`. This requires you to implement the `stream_complete`, `complete`, and `stream_chat` methods. You can see examples in [`server/continuedev/libs/llm`](https://github.com/continuedev/continue/tree/main/server/continuedev/libs/llm). However, if the provider has the exact same API interface as OpenAI, the `OpenAI` class will work for you. You will just need to change the `api_base` parameter.
|
||||
|
||||
## SaaS
|
||||
|
||||
### Open-source LLMs
|
||||
|
||||
You can deploy open-source LLMs on a service using:
|
||||
- [Together](../reference/Model%20Providers/togetherllm.md)
|
||||
- [HuggingFace Inference Endpoints](../reference/Model%20Providers/huggingfaceinferenceapi.md)
|
||||
- [Anyscale Endpoints](../reference/Model%20Providers/openai.md) (OpenAI compatible API)
|
||||
- [Replicate](../reference/Model%20Providers/replicatellm.md)
|
||||
|
||||
### Commercial LLMs
|
||||
|
||||
You can use commercial LLMs via APIs using:
|
||||
- [OpenAI API](../reference/Model%20Providers/openai.md)
|
||||
- [Azure OpenAI Service](../reference/Model%20Providers/openai.md) (OpenAI compatible API)
|
||||
- [Anthrophic API](../reference/Model%20Providers/anthropicllm.md)
|
||||
- [Google PaLM API](../reference/Model%20Providers/googlepalmapi.md)
|
||||
- [OpenAI free trial](../reference/Model%20Providers/openaifreetrial.md)
|
||||
|
|
@ -15,6 +15,6 @@ The FileContextProvider is a ContextProvider that allows you to search files in
|
|||
<ClassPropertyRef name='title' details='{"title": "Title", "default": "file", "type": "string"}' required={false} default="file"/>
|
||||
<ClassPropertyRef name='ide' details='{"title": "Ide"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='display_title' details='{"title": "Display Title", "default": "Files", "type": "string"}' required={false} default="Files"/>
|
||||
<ClassPropertyRef name='description' details='{"title": "Description", "default": "Reference files in the current workspace", "type": "string"}' required={false} default="Reference files in the current workspace"/>
|
||||
<ClassPropertyRef name='description' details='{"title": "Description", "default": "Type to search the workspace", "type": "string"}' required={false} default="Type to search the workspace"/>
|
||||
<ClassPropertyRef name='dynamic' details='{"title": "Dynamic", "default": false, "type": "boolean"}' required={false} default="False"/>
|
||||
<ClassPropertyRef name='requires_query' details='{"title": "Requires Query", "description": "Indicates whether the ContextProvider requires a query. For example, the SearchContextProvider requires you to type '@search <STRING_TO_SEARCH>'. This will change the behavior of the UI so that it can indicate the expectation for a query.", "default": false, "type": "boolean"}' required={false} default="False"/>
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ Claude 2 is not yet publicly released. You can request early access [here](https
|
|||
<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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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,6 +4,8 @@ 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.
|
||||
|
||||
You can also use this class for [LM Studio](https://lmstudio.ai).
|
||||
|
||||
Once the model is running on localhost:8000, change `~/.continue/config.json` to look like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
|
|
@ -24,6 +26,8 @@ Once the model is running on localhost:8000, change `~/.continue/config.json` to
|
|||
<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=""/>
|
||||
<ClassPropertyRef name='chat_endpoint' details='{"title": "Chat Endpoint", "description": "The endpoint to call for chat completions", "default": "chat/completions", "type": "string"}' required={false} default="chat/completions"/>
|
||||
<ClassPropertyRef name='completions_endpoint' details='{"title": "Completions Endpoint", "description": "The endpoint to call for chat completions", "default": "completions", "type": "string"}' required={false} default="completions"/>
|
||||
|
||||
|
||||
### Inherited Properties
|
||||
|
|
@ -33,8 +37,8 @@ Once the model is running on localhost:8000, change `~/.continue/config.json` to
|
|||
<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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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"/>
|
||||
|
|
@ -29,7 +29,7 @@ The Google PaLM API is currently in public preview, so production applications a
|
|||
<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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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=""/>
|
||||
|
|
@ -30,7 +30,7 @@ Hugging Face Inference API is a great option for newly released language models.
|
|||
<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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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=""/>
|
||||
|
|
@ -17,8 +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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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"/>
|
||||
|
|
@ -25,7 +25,7 @@ After it's up and running, change `~/.continue/config.json` to look like this:
|
|||
|
||||
## Properties
|
||||
|
||||
<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]']}"/>
|
||||
<ClassPropertyRef name='llama_cpp_args' details='{"title": "Llama Cpp Args", "description": "A list of additional arguments to pass to llama.cpp. See 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]']}"/>
|
||||
|
||||
|
||||
### Inherited Properties
|
||||
|
|
@ -35,8 +35,8 @@ After it's up and running, change `~/.continue/config.json` to look like this:
|
|||
<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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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"/>
|
||||
38
docs/docs/reference/Model Providers/llamafile.md
Normal file
38
docs/docs/reference/Model Providers/llamafile.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
||||
|
||||
# Llamafile
|
||||
|
||||
A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contained binary that can run an open-source LLM. You can configure this provider in your config.json as follows:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"models": [{
|
||||
"title": "Llamafile",
|
||||
"provider": "llamafile",
|
||||
"model": "mistral-7b",
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
Optionally, you can set the `llamafile_command` property, which will be run to start the llamafile if it isn't already running on port 8080. Be sure to use an absolute path to the llamafile binary. For example: `/Users/yourusername/mistral-7b-instruct-v0.1-Q4_K_M-server.llamafile`.
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/llamafile.py)
|
||||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='llama_cpp_args' details='{"title": "Llama Cpp Args", "description": "A list of additional arguments to pass to llama.cpp. See 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]']}"/>
|
||||
<ClassPropertyRef name='llamafile_command' details='{"title": "Llamafile Command", "type": "string"}' required={false} default=""/>
|
||||
|
||||
|
||||
### 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": "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='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": 1023}, "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': 1023}"/>
|
||||
<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.", "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"/>
|
||||
|
|
@ -27,8 +27,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": "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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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"/>
|
||||
|
|
@ -2,14 +2,45 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
# OpenAI
|
||||
|
||||
The OpenAI class can be used to access OpenAI models like gpt-4 and gpt-3.5-turbo.
|
||||
The OpenAI class can be used to access OpenAI models like GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo.
|
||||
|
||||
If you are locally serving a model that uses an OpenAI-compatible server, you can simply change the `api_base` like this:
|
||||
### Azure OpenAI Service
|
||||
|
||||
If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant. After applying for access [here](https://azure.microsoft.com/en-us/products/ai-services/openai-service), you will typically hear back within only a few days. Once you have access, set up a model in `config.json` like so:
|
||||
|
||||
```json
|
||||
"models": [{
|
||||
"title": "Azure OpenAI",
|
||||
"provider": "openai",
|
||||
"model": "gpt-4",
|
||||
"api_base": "https://my-azure-openai-instance.openai.azure.com/",
|
||||
"engine": "my-azure-openai-deployment",
|
||||
"api_version": "2023-07-01-preview",
|
||||
"api_type": "azure",
|
||||
"api_key": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
The easiest way to find this information is from the chat playground in the Azure OpenAI portal. Under the "Chat Session" section, click "View Code" to see each of these parameters.
|
||||
|
||||
### OpenAI compatible servers / APIs
|
||||
|
||||
OpenAI compatible servers
|
||||
- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation)
|
||||
- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md)
|
||||
- [LocalAI](https://localai.io/basics/getting_started/)
|
||||
- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
|
||||
|
||||
OpenAI compatible APIs
|
||||
- [Anyscale Endpoints](https://github.com/continuedev/deploy-os-code-llm#others)
|
||||
- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints)
|
||||
|
||||
If you are [using an OpenAI compatible server / API](../../model-setup/select-provider#local), you can change the `api_base` like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"models": [{
|
||||
"title": "OpenAI-compatible server",
|
||||
"title": "OpenAI-compatible server / API",
|
||||
"provider": "openai",
|
||||
"model": "MODEL_NAME",
|
||||
"api_key": "EMPTY",
|
||||
|
|
@ -18,13 +49,6 @@ If you are locally serving a model that uses an OpenAI-compatible server, you ca
|
|||
}
|
||||
```
|
||||
|
||||
Options for serving models locally with an OpenAI-compatible server include:
|
||||
|
||||
- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation)
|
||||
- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md)
|
||||
- [LocalAI](https://localai.io/basics/getting_started/)
|
||||
- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
|
||||
|
||||
[View the source](https://github.com/continuedev/continue/blob/main/server/continuedev/libs/llm/openai.py)
|
||||
|
||||
## Properties
|
||||
|
|
@ -43,7 +67,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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "type": "object"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='api_base' details='{"title": "Api Base", "description": "OpenAI API base URL.", "type": "string"}' required={false} default=""/>
|
||||
|
|
@ -37,7 +37,7 @@ Once you are using Continue regularly though, you will need to add an OpenAI API
|
|||
|
||||
## Properties
|
||||
|
||||
<ClassPropertyRef name='llm' details='{"$ref": "#/definitions/LLM"}' required={false} default=""/>
|
||||
<ClassPropertyRef name='llm' details='{"title": "Llm", "description": "The LLM to use for completion.", "allOf": [{"$ref": "#/definitions/LLM"}]}' required={false} default=""/>
|
||||
|
||||
|
||||
### Inherited Properties
|
||||
|
|
@ -47,8 +47,8 @@ Once you are using Continue regularly though, you will need to add an OpenAI API
|
|||
<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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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=""/>
|
||||
|
|
@ -31,8 +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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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=""/>
|
||||
|
|
@ -31,7 +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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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=""/>
|
||||
|
|
@ -28,8 +28,8 @@ TextGenWebUI is a comprehensive, open-source language model UI and local server.
|
|||
<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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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"/>
|
||||
|
|
@ -29,7 +29,7 @@ The Together API is a cloud platform for running large AI models. You can sign u
|
|||
<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='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='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": 1023}, "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': 1023}"/>
|
||||
<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='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.", "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"/>
|
||||
|
|
@ -10,10 +10,10 @@ import ClassPropertyRef from '@site/src/components/ClassPropertyRef.tsx';
|
|||
|
||||
<ClassPropertyRef name='disallowed_steps' details='{"title": "Disallowed Steps", "description": "Steps that are not allowed to be run, and will be skipped if attempted", "default": [], "type": "array", "items": {"type": "string"}}' required={false} default="[]"/>
|
||||
<ClassPropertyRef name='allow_anonymous_telemetry' details='{"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"}' required={false} default="True"/>
|
||||
<ClassPropertyRef name='models' details='{"title": "Models", "default": [{"title": "GPT-4 (trial)", "provider": "openai-free-trial", "model": "gpt-4", "api_key": ""}], "type": "array", "items": {"$ref": "#/definitions/ModelDescription"}}' required={false} default="[{'title': 'GPT-4 (trial)', 'provider': 'openai-free-trial', 'model': 'gpt-4', 'api_key': ''}]"/>
|
||||
<ClassPropertyRef name='models' details='{"title": "Models", "default": [{"title": "GPT-4 (trial)", "provider": "openai-free-trial", "model": "gpt-4", "api_key": "", "api_base": null, "context_length": 2048, "template": null, "completion_options": {"temperature": null, "top_p": null, "top_k": null, "presence_penalty": null, "frequency_penalty": null, "stop": null, "max_tokens": 1023}, "system_message": null, "request_options": {"timeout": 300, "verify_ssl": null, "ca_bundle_path": null, "proxy": null, "headers": null}}], "type": "array", "items": {"$ref": "#/definitions/ModelDescription"}}' required={false} default="[{'title': 'GPT-4 (trial)', 'provider': 'openai-free-trial', 'model': 'gpt-4', 'api_key': '', 'api_base': None, 'context_length': 2048, 'template': None, 'completion_options': {'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 1023}, 'system_message': None, 'request_options': {'timeout': 300, 'verify_ssl': None, 'ca_bundle_path': None, 'proxy': None, 'headers': None}}]"/>
|
||||
<ClassPropertyRef name='model_roles' details='{"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"}]}' required={false} default="{'default': 'GPT-4 (trial)', 'chat': None, 'edit': None, 'summarize': None}"/>
|
||||
<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='completion_options' details='{"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"}]}' required={false} default="{'temperature': None, 'top_p': None, 'top_k': None, 'presence_penalty': None, 'frequency_penalty': None, 'stop': None, 'max_tokens': 600}"/>
|
||||
<ClassPropertyRef name='completion_options' details='{"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": 1023}, "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': 1023}"/>
|
||||
<ClassPropertyRef name='slash_commands' details='{"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"}}' required={false} default="[]"/>
|
||||
<ClassPropertyRef name='custom_commands' details='{"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"}}' required={false} 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'}]"/>
|
||||
<ClassPropertyRef name='context_providers' details='{"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"}}' required={false} default="[]"/>
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ Continue can be run even on an air-gapped computer if you use a local model. You
|
|||
2. In VS Code settings, search "continue" and check the box that says "Manually Running Server". This will stop Continue from trying to kill and redownload the server binary.
|
||||
3. Follow instructions to [run Continue manually](./manually-run-continue.md).
|
||||
4. Open `~/.continue/config.json` and set `"allow_anonymous_telemetry": false`. This will stop Continue from attempting requests to PostHog.
|
||||
5. Also in `config.json`, set the default model to a local model. You can read about the available options [here](../customization/models.md).
|
||||
5. Also in `config.json`, set the default model to a local model. You can read about the available options [here](../model-setup/select-model.md).
|
||||
6. Restart VS Code to ensure that the changes to `config.json` take effect.
|
||||
|
|
|
|||
|
|
@ -18,6 +18,17 @@ const sidebars = {
|
|||
"quickstart",
|
||||
"how-to-use-continue",
|
||||
"how-continue-works",
|
||||
{
|
||||
type: "category",
|
||||
label: "🌉 Model setup",
|
||||
collapsible: true,
|
||||
collapsed: true,
|
||||
items: [
|
||||
"model-setup/select-provider",
|
||||
"model-setup/select-model",
|
||||
"model-setup/configuration",
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "🎨 Customization",
|
||||
|
|
@ -25,7 +36,6 @@ const sidebars = {
|
|||
collapsed: true,
|
||||
items: [
|
||||
"customization/overview",
|
||||
"customization/models",
|
||||
"customization/context-providers",
|
||||
"customization/slash-commands",
|
||||
"customization/other-configuration",
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@
|
|||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm",
|
||||
"lmstudio"
|
||||
"lmstudio",
|
||||
"llamafile"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -460,7 +461,8 @@
|
|||
"huggingface-tgi",
|
||||
"huggingface-inference-api",
|
||||
"llama.cpp",
|
||||
"text-gen-webui"
|
||||
"text-gen-webui",
|
||||
"llamafile"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -514,7 +516,10 @@
|
|||
"wizardcoder-13b",
|
||||
"wizardcoder-34b",
|
||||
"zephyr-7b",
|
||||
"codeup-13b"
|
||||
"codeup-13b",
|
||||
"deepseek-1b",
|
||||
"deepseek-7b",
|
||||
"deepseek-33b"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -550,6 +555,23 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"provider": {
|
||||
"const": "llamafile"
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"llamafile_command": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.7.19",
|
||||
"version": "0.7.23",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.7.19",
|
||||
"version": "0.7.23",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"version": "0.7.19",
|
||||
"version": "0.7.23",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
69
extensions/vscode/schema/ContinueConfig.d.ts
vendored
69
extensions/vscode/schema/ContinueConfig.d.ts
vendored
|
|
@ -32,46 +32,25 @@ export type DisallowedSteps = string[];
|
|||
*/
|
||||
export type AllowAnonymousTelemetry = boolean;
|
||||
/**
|
||||
* The title you wish to give your model.
|
||||
* A title that will identify this model in the model selection dropdown
|
||||
*/
|
||||
export type Title = string;
|
||||
/**
|
||||
* The provider of the model. This is used to determine the type of model, and how to interact with it.
|
||||
* The unique ID of the user.
|
||||
*/
|
||||
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"
|
||||
| "lmstudio";
|
||||
export type UniqueId = string;
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
* The name of the model to be used (e.g. gpt-4, codellama)
|
||||
*/
|
||||
export type Model = string;
|
||||
/**
|
||||
* OpenAI, Anthropic, Together, or other API key
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type SystemMessage1 = 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" | "deepseek";
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
|
|
@ -104,10 +83,6 @@ 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 SystemMessage1 = string;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
|
|
@ -128,7 +103,15 @@ export type CaBundlePath = string;
|
|||
* Proxy URL to use when making the HTTP request
|
||||
*/
|
||||
export type Proxy = string;
|
||||
export type Models = ModelDescription[];
|
||||
/**
|
||||
* The API key for the LLM provider.
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type Models = LLM[];
|
||||
/**
|
||||
* Roles for models. Each entry should be the title of a model in the models array.
|
||||
*/
|
||||
|
|
@ -333,17 +316,17 @@ export interface FunctionCall {
|
|||
arguments: Arguments;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface ModelDescription {
|
||||
title: Title;
|
||||
provider: Provider;
|
||||
export interface LLM {
|
||||
title?: Title;
|
||||
unique_id?: UniqueId;
|
||||
model: Model;
|
||||
system_message?: SystemMessage1;
|
||||
context_length?: ContextLength;
|
||||
completion_options?: CompletionOptions;
|
||||
request_options?: RequestOptions;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
context_length?: ContextLength;
|
||||
template?: Template;
|
||||
completion_options?: CompletionOptions;
|
||||
system_message?: SystemMessage1;
|
||||
request_options?: RequestOptions;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
|
|
@ -370,6 +353,12 @@ export interface RequestOptions1 {
|
|||
export interface Headers {
|
||||
[k: string]: string;
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
export interface PromptTemplates {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface ModelRoles1 {
|
||||
default: Default;
|
||||
chat?: Chat;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ export type Provider =
|
|||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm"
|
||||
| "lmstudio";
|
||||
| "lmstudio"
|
||||
| "llamafile";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
|
|
|
|||
3
extensions/vscode/schema/ModelProvider.d.ts
vendored
3
extensions/vscode/schema/ModelProvider.d.ts
vendored
|
|
@ -18,4 +18,5 @@ export type ModelProvider =
|
|||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm"
|
||||
| "lmstudio";
|
||||
| "lmstudio"
|
||||
| "llamafile";
|
||||
|
|
|
|||
10
extensions/vscode/schema/Models.d.ts
vendored
10
extensions/vscode/schema/Models.d.ts
vendored
|
|
@ -86,7 +86,7 @@ export type ApiKey = string;
|
|||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type Saved = LLM[];
|
||||
export type Saved = (unknown | LLM)[];
|
||||
export type Temperature1 = number;
|
||||
export type SystemMessage1 = string;
|
||||
|
||||
|
|
@ -94,10 +94,10 @@ export type SystemMessage1 = string;
|
|||
* Main class that holds the current model configuration
|
||||
*/
|
||||
export interface Models1 {
|
||||
default: LLM;
|
||||
summarize: LLM;
|
||||
edit: LLM;
|
||||
chat: LLM;
|
||||
default?: unknown;
|
||||
summarize?: unknown;
|
||||
edit?: unknown;
|
||||
chat?: unknown;
|
||||
saved?: Saved;
|
||||
temperature?: Temperature1;
|
||||
system_message?: SystemMessage1;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ export type Provider =
|
|||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm"
|
||||
| "lmstudio";
|
||||
| "lmstudio"
|
||||
| "llamafile";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
|
|
|
|||
BIN
gui/public/logos/llamafile.png
Normal file
BIN
gui/public/logos/llamafile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
|
|
@ -232,8 +232,8 @@ function ModelSelect(props: {}) {
|
|||
<StyledListbox
|
||||
value={"GPT-4"}
|
||||
onChange={(val: string) => {
|
||||
if (val === defaultModel.title) return;
|
||||
client?.setModelForRoleFromTitle("*", val);
|
||||
if (val === defaultModel?.title) return;
|
||||
client?.setModelForRoleFromTitle("default", val);
|
||||
}}
|
||||
defaultValue={"GPT-4"}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ function GUI(props: GUIProps) {
|
|||
client?.stopSession();
|
||||
persistSession();
|
||||
dispatch(newSession());
|
||||
mainTextInputRef.current?.focus();
|
||||
mainTextInputRef.current?.focus?.();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -737,7 +737,7 @@ function GUI(props: GUIProps) {
|
|||
value={step.description as string}
|
||||
active={active && isLastUserInput(index)}
|
||||
onEnter={(e, value) => {
|
||||
if (value) {
|
||||
if (value && client) {
|
||||
client?.stopSession();
|
||||
const newHistory = [
|
||||
...sessionState.history.slice(0, index),
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
lightGray,
|
||||
secondaryDark,
|
||||
vscBackground,
|
||||
vscForeground,
|
||||
} from "../components";
|
||||
import styled from "styled-components";
|
||||
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
||||
|
|
@ -85,7 +86,7 @@ const ConfigJsonButton = styled(Button)`
|
|||
margin-left: auto;
|
||||
margin-right: 4px;
|
||||
background-color: transparent;
|
||||
color: white;
|
||||
color: ${vscForeground};
|
||||
border: 1px solid ${lightGray};
|
||||
&:hover {
|
||||
background-color: ${lightGray};
|
||||
|
|
|
|||
|
|
@ -14,5 +14,8 @@ export const contextLengthSelector = (state: RootStore) => {
|
|||
|
||||
export const defaultModelSelector = (state: RootStore) => {
|
||||
const title = state.serverState.config.model_roles?.default;
|
||||
return state.serverState.config.models.find((model) => model.title === title);
|
||||
if (!Array.isArray(state.serverState.config.models)) return;
|
||||
return state.serverState.config.models?.find(
|
||||
(model) => model.title === title
|
||||
);
|
||||
};
|
||||
|
|
|
|||
69
gui/src/schema/ContinueConfig.d.ts
vendored
69
gui/src/schema/ContinueConfig.d.ts
vendored
|
|
@ -32,46 +32,25 @@ export type DisallowedSteps = string[];
|
|||
*/
|
||||
export type AllowAnonymousTelemetry = boolean;
|
||||
/**
|
||||
* The title you wish to give your model.
|
||||
* A title that will identify this model in the model selection dropdown
|
||||
*/
|
||||
export type Title = string;
|
||||
/**
|
||||
* The provider of the model. This is used to determine the type of model, and how to interact with it.
|
||||
* The unique ID of the user.
|
||||
*/
|
||||
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"
|
||||
| "lmstudio";
|
||||
export type UniqueId = string;
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
* The name of the model to be used (e.g. gpt-4, codellama)
|
||||
*/
|
||||
export type Model = string;
|
||||
/**
|
||||
* OpenAI, Anthropic, Together, or other API key
|
||||
* A system message that will always be followed by the LLM
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type SystemMessage1 = 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" | "deepseek";
|
||||
/**
|
||||
* Options for the completion endpoint. Read more about the completion options in the documentation.
|
||||
*/
|
||||
|
|
@ -104,10 +83,6 @@ 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 SystemMessage1 = string;
|
||||
/**
|
||||
* Options for the HTTP request to the LLM.
|
||||
*/
|
||||
|
|
@ -128,7 +103,15 @@ export type CaBundlePath = string;
|
|||
* Proxy URL to use when making the HTTP request
|
||||
*/
|
||||
export type Proxy = string;
|
||||
export type Models = ModelDescription[];
|
||||
/**
|
||||
* The API key for the LLM provider.
|
||||
*/
|
||||
export type ApiKey = string;
|
||||
/**
|
||||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type Models = LLM[];
|
||||
/**
|
||||
* Roles for models. Each entry should be the title of a model in the models array.
|
||||
*/
|
||||
|
|
@ -333,17 +316,17 @@ export interface FunctionCall {
|
|||
arguments: Arguments;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface ModelDescription {
|
||||
title: Title;
|
||||
provider: Provider;
|
||||
export interface LLM {
|
||||
title?: Title;
|
||||
unique_id?: UniqueId;
|
||||
model: Model;
|
||||
system_message?: SystemMessage1;
|
||||
context_length?: ContextLength;
|
||||
completion_options?: CompletionOptions;
|
||||
request_options?: RequestOptions;
|
||||
prompt_templates?: PromptTemplates;
|
||||
api_key?: ApiKey;
|
||||
api_base?: ApiBase;
|
||||
context_length?: ContextLength;
|
||||
template?: Template;
|
||||
completion_options?: CompletionOptions;
|
||||
system_message?: SystemMessage1;
|
||||
request_options?: RequestOptions;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface BaseCompletionOptions {
|
||||
|
|
@ -370,6 +353,12 @@ export interface RequestOptions1 {
|
|||
export interface Headers {
|
||||
[k: string]: string;
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
export interface PromptTemplates {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface ModelRoles1 {
|
||||
default: Default;
|
||||
chat?: Chat;
|
||||
|
|
|
|||
3
gui/src/schema/ModelDescription.d.ts
vendored
3
gui/src/schema/ModelDescription.d.ts
vendored
|
|
@ -26,7 +26,8 @@ export type Provider =
|
|||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm"
|
||||
| "lmstudio";
|
||||
| "lmstudio"
|
||||
| "llamafile";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
|
|
|
|||
3
gui/src/schema/ModelProvider.d.ts
vendored
3
gui/src/schema/ModelProvider.d.ts
vendored
|
|
@ -18,4 +18,5 @@ export type ModelProvider =
|
|||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm"
|
||||
| "lmstudio";
|
||||
| "lmstudio"
|
||||
| "llamafile";
|
||||
|
|
|
|||
10
gui/src/schema/Models.d.ts
vendored
10
gui/src/schema/Models.d.ts
vendored
|
|
@ -86,7 +86,7 @@ export type ApiKey = string;
|
|||
* The base URL of the LLM API.
|
||||
*/
|
||||
export type ApiBase = string;
|
||||
export type Saved = LLM[];
|
||||
export type Saved = (unknown | LLM)[];
|
||||
export type Temperature1 = number;
|
||||
export type SystemMessage1 = string;
|
||||
|
||||
|
|
@ -94,10 +94,10 @@ export type SystemMessage1 = string;
|
|||
* Main class that holds the current model configuration
|
||||
*/
|
||||
export interface Models1 {
|
||||
default: LLM;
|
||||
summarize: LLM;
|
||||
edit: LLM;
|
||||
chat: LLM;
|
||||
default?: unknown;
|
||||
summarize?: unknown;
|
||||
edit?: unknown;
|
||||
chat?: unknown;
|
||||
saved?: Saved;
|
||||
temperature?: Temperature1;
|
||||
system_message?: SystemMessage1;
|
||||
|
|
|
|||
3
gui/src/schema/SerializedContinueConfig.d.ts
vendored
3
gui/src/schema/SerializedContinueConfig.d.ts
vendored
|
|
@ -34,7 +34,8 @@ export type Provider =
|
|||
| "replicate"
|
||||
| "text-gen-webui"
|
||||
| "google-palm"
|
||||
| "lmstudio";
|
||||
| "lmstudio"
|
||||
| "llamafile";
|
||||
/**
|
||||
* The name of the model. Used to autodetect prompt template.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -491,6 +491,17 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = {
|
|||
{ ...apiBaseInput, defaultValue: "http://localhost:11434" },
|
||||
],
|
||||
},
|
||||
llamafile: {
|
||||
title: "llamafile",
|
||||
provider: "llamafile",
|
||||
icon: "llamafile.png",
|
||||
description:
|
||||
"llamafiles are a self-contained binary to run an open-source LLM",
|
||||
longDescription: `To get started with llamafiles, find and download a binary on their [GitHub repo](https://github.com/Mozilla-Ocho/llamafile#binary-instructions). Then run it with the following command:\n\n\`\`\`shell\nchmod +x ./llamafile\n./llamafile\n\`\`\``,
|
||||
tags: [ModelProviderTag["Local"], ModelProviderTag["Open-Source"]],
|
||||
packages: osModels,
|
||||
collectInputFor: [...completionParamsInputs],
|
||||
},
|
||||
together: {
|
||||
title: "TogetherAI",
|
||||
provider: "together",
|
||||
|
|
|
|||
|
|
@ -177,48 +177,28 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"ModelDescription": {
|
||||
"title": "ModelDescription",
|
||||
"LLM": {
|
||||
"title": "LLM",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"title": "Title",
|
||||
"description": "The title you wish to give your model.",
|
||||
"description": "A title that will identify this model in the model selection dropdown",
|
||||
"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",
|
||||
"lmstudio"
|
||||
],
|
||||
"unique_id": {
|
||||
"title": "Unique Id",
|
||||
"description": "The unique ID of the user.",
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"title": "Model",
|
||||
"description": "The name of the model. Used to autodetect prompt template.",
|
||||
"description": "The name of the model to be used (e.g. gpt-4, codellama)",
|
||||
"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.",
|
||||
"system_message": {
|
||||
"title": "System Message",
|
||||
"description": "A system message that will always be followed by the LLM",
|
||||
"type": "string"
|
||||
},
|
||||
"context_length": {
|
||||
|
|
@ -227,20 +207,6 @@
|
|||
"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",
|
||||
"deepseek"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"completion_options": {
|
||||
"title": "Completion Options",
|
||||
"description": "Options for the completion endpoint. Read more about the completion options in the documentation.",
|
||||
|
|
@ -259,11 +225,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"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.",
|
||||
|
|
@ -279,11 +240,24 @@
|
|||
"$ref": "#/definitions/RequestOptions"
|
||||
}
|
||||
]
|
||||
},
|
||||
"prompt_templates": {
|
||||
"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.",
|
||||
"type": "object"
|
||||
},
|
||||
"api_key": {
|
||||
"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": [
|
||||
"title",
|
||||
"provider",
|
||||
"model"
|
||||
]
|
||||
},
|
||||
|
|
@ -610,12 +584,9 @@
|
|||
"default": [
|
||||
{
|
||||
"title": "GPT-4 (trial)",
|
||||
"provider": "openai-free-trial",
|
||||
"model": "gpt-4",
|
||||
"api_key": "",
|
||||
"api_base": null,
|
||||
"context_length": 2048,
|
||||
"template": null,
|
||||
"system_message": null,
|
||||
"context_length": 8192,
|
||||
"completion_options": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
|
|
@ -625,19 +596,50 @@
|
|||
"stop": null,
|
||||
"max_tokens": 1023
|
||||
},
|
||||
"system_message": null,
|
||||
"request_options": {
|
||||
"timeout": 300,
|
||||
"verify_ssl": null,
|
||||
"ca_bundle_path": null,
|
||||
"proxy": null,
|
||||
"headers": null
|
||||
}
|
||||
},
|
||||
"prompt_templates": {},
|
||||
"template_messages": null,
|
||||
"api_key": "",
|
||||
"api_base": null,
|
||||
"llm": {
|
||||
"title": null,
|
||||
"model": "gpt-4",
|
||||
"system_message": null,
|
||||
"context_length": 2048,
|
||||
"completion_options": {
|
||||
"temperature": null,
|
||||
"top_p": null,
|
||||
"top_k": null,
|
||||
"presence_penalty": null,
|
||||
"frequency_penalty": null,
|
||||
"stop": null,
|
||||
"max_tokens": 1023
|
||||
},
|
||||
"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,
|
||||
"class_name": "ProxyServer"
|
||||
},
|
||||
"class_name": "OpenAIFreeTrial"
|
||||
}
|
||||
],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ModelDescription"
|
||||
"$ref": "#/definitions/LLM"
|
||||
}
|
||||
},
|
||||
"model_roles": {
|
||||
|
|
|
|||
|
|
@ -149,7 +149,6 @@
|
|||
"prompt_templates": {
|
||||
"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"
|
||||
},
|
||||
"api_key": {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@
|
|||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm",
|
||||
"lmstudio"
|
||||
"lmstudio",
|
||||
"llamafile"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm",
|
||||
"lmstudio"
|
||||
"lmstudio",
|
||||
"llamafile"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
|
|
@ -149,7 +149,6 @@
|
|||
"prompt_templates": {
|
||||
"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"
|
||||
},
|
||||
"api_key": {
|
||||
|
|
@ -173,23 +172,52 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"default": {
|
||||
"$ref": "#/definitions/LLM"
|
||||
"title": "Default",
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"$ref": "#/definitions/LLM"
|
||||
}
|
||||
]
|
||||
},
|
||||
"summarize": {
|
||||
"$ref": "#/definitions/LLM"
|
||||
"title": "Summarize",
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"$ref": "#/definitions/LLM"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edit": {
|
||||
"$ref": "#/definitions/LLM"
|
||||
"title": "Edit",
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"$ref": "#/definitions/LLM"
|
||||
}
|
||||
]
|
||||
},
|
||||
"chat": {
|
||||
"$ref": "#/definitions/LLM"
|
||||
"title": "Chat",
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"$ref": "#/definitions/LLM"
|
||||
}
|
||||
]
|
||||
},
|
||||
"saved": {
|
||||
"title": "Saved",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/LLM"
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"$ref": "#/definitions/LLM"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"temperature": {
|
||||
|
|
@ -200,13 +228,7 @@
|
|||
"title": "System Message",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"default",
|
||||
"summarize",
|
||||
"edit",
|
||||
"chat"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +107,8 @@
|
|||
"replicate",
|
||||
"text-gen-webui",
|
||||
"google-palm",
|
||||
"lmstudio"
|
||||
"lmstudio",
|
||||
"llamafile"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,18 +8,22 @@ 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.paths import getConfigFilePath, getGlobalFolderPath, sync_migrate
|
||||
from ..libs.util.telemetry import posthog_logger
|
||||
from ..models.llm import BaseCompletionOptions, RequestOptions
|
||||
from .config_utils.context import CONTEXT_PROVIDER_NAME_TO_CLASS, ContextProviderName
|
||||
from .config_utils.shared import (
|
||||
MODEL_CLASS_TO_MODEL_PROVIDER,
|
||||
MODEL_PROVIDER_TO_MODEL_CLASS,
|
||||
STEP_NAMES,
|
||||
ModelProvider,
|
||||
StepName,
|
||||
TemplateType,
|
||||
autodetect_prompt_templates,
|
||||
autodetect_template_function,
|
||||
autodetect_template_type,
|
||||
)
|
||||
from .context import ContextProvider
|
||||
from .main import ContextProviderDescription, Policy, SlashCommandDescription, Step
|
||||
|
|
@ -47,11 +51,23 @@ class SlashCommand(BaseModel):
|
|||
def step_is_string(cls, v):
|
||||
if isinstance(v, str):
|
||||
return v
|
||||
elif isinstance(v, object) and v.__class__.__name__ == "ModelMetaclass":
|
||||
elif (
|
||||
isinstance(v, object)
|
||||
and v.__class__.__name__ == "ModelMetaclass"
|
||||
and v.__class__.__name__ in STEP_NAMES
|
||||
):
|
||||
return str(v).split(".")[-1].split("'")[0]
|
||||
else:
|
||||
return v
|
||||
|
||||
def dict(self, *args, **kwargs):
|
||||
d = super().dict(*args, **kwargs)
|
||||
if isinstance(d["step"], str):
|
||||
d["step"] = d["step"].split(".")[-1]
|
||||
else:
|
||||
d["step"] = d["step"].__name__
|
||||
return d
|
||||
|
||||
def slash_command_description(self) -> SlashCommandDescription:
|
||||
return SlashCommandDescription(
|
||||
name=self.name,
|
||||
|
|
@ -273,6 +289,12 @@ class SerializedContinueConfig(BaseModel):
|
|||
else:
|
||||
config.model_roles.__setattr__(role, title)
|
||||
|
||||
def migrate_func():
|
||||
if role == "default" and config.model_roles.chat is not None:
|
||||
config.model_roles.chat = None
|
||||
|
||||
sync_migrate("select_default_model_001", migrate_func)
|
||||
|
||||
@staticmethod
|
||||
def add_model(model: ModelDescription):
|
||||
with SerializedContinueConfig.edit_config() as config:
|
||||
|
|
@ -314,11 +336,10 @@ class ContinueConfig(BaseModel):
|
|||
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(
|
||||
models: List[LLM] = Field(
|
||||
default=[
|
||||
ModelDescription(
|
||||
OpenAIFreeTrial(
|
||||
title="GPT-4 (trial)",
|
||||
provider="openai-free-trial",
|
||||
model="gpt-4",
|
||||
api_key="",
|
||||
)
|
||||
|
|
@ -393,7 +414,10 @@ class ContinueConfig(BaseModel):
|
|||
allow_anonymous_telemetry=config.allow_anonymous_telemetry
|
||||
if config.allow_anonymous_telemetry is not None
|
||||
else True,
|
||||
models=config.models,
|
||||
models=[
|
||||
ContinueConfig.create_llm(config.completion_options, model)
|
||||
for model in config.models
|
||||
],
|
||||
model_roles=config.model_roles,
|
||||
system_message=config.system_message,
|
||||
completion_options=config.completion_options,
|
||||
|
|
@ -447,6 +471,9 @@ class ContinueConfig(BaseModel):
|
|||
|
||||
serialized_config = json.loads(contents)
|
||||
|
||||
except json.JSONDecodeError as e:
|
||||
raise e
|
||||
|
||||
except ValueError as e:
|
||||
logger.warning(f"Found empty config.json at {filepath}: {e}")
|
||||
with open(filepath, "w") as f:
|
||||
|
|
@ -583,7 +610,9 @@ class ContinueConfig(BaseModel):
|
|||
return SerializedContinueConfig(
|
||||
disallowed_steps=self.disallowed_steps,
|
||||
allow_anonymous_telemetry=self.allow_anonymous_telemetry,
|
||||
models=self.models,
|
||||
models=[
|
||||
ContinueConfig.model_description_from(model) for model in self.models
|
||||
],
|
||||
model_roles=self.model_roles,
|
||||
system_message=self.system_message,
|
||||
completion_options=self.completion_options,
|
||||
|
|
@ -604,28 +633,50 @@ class ContinueConfig(BaseModel):
|
|||
retrieval_settings=self.retrieval_settings,
|
||||
)
|
||||
|
||||
def create_llm(self, model: ModelDescription) -> LLM:
|
||||
@staticmethod
|
||||
def create_llm(
|
||||
completion_options: BaseCompletionOptions, model: ModelDescription
|
||||
) -> LLM:
|
||||
model_class = MODEL_CLASSES[MODEL_PROVIDER_TO_MODEL_CLASS[model.provider]]
|
||||
completion_options = self.completion_options.dict(
|
||||
exclude_none=True, exclude_defaults=True
|
||||
)
|
||||
completion_options.update(
|
||||
options = completion_options.dict(exclude_none=True, exclude_defaults=True)
|
||||
options.update(
|
||||
model.completion_options.dict(exclude_none=True, exclude_defaults=True)
|
||||
)
|
||||
|
||||
if "max_tokens" not in completion_options:
|
||||
completion_options["max_tokens"] = min(2048, model.context_length // 2)
|
||||
if "max_tokens" not in options:
|
||||
options["max_tokens"] = min(2048, model.context_length // 2)
|
||||
|
||||
# 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)
|
||||
kwargs["completion_options"] = options
|
||||
kwargs["template_messages"] = autodetect_template_function(
|
||||
model.model, model.template
|
||||
)
|
||||
kwargs["prompt_templates"] = autodetect_prompt_templates(
|
||||
model.model, model.template
|
||||
)
|
||||
|
||||
return model_class(**kwargs)
|
||||
|
||||
@staticmethod
|
||||
def model_description_from(llm: LLM) -> ModelDescription:
|
||||
return ModelDescription(
|
||||
title=llm.title or "LLM",
|
||||
provider=MODEL_CLASS_TO_MODEL_PROVIDER.get(
|
||||
llm.__class__.__name__, "custom" # type: ignore
|
||||
),
|
||||
model=llm.model,
|
||||
api_key=llm.api_key,
|
||||
api_base=llm.api_base,
|
||||
context_length=llm.context_length,
|
||||
template=autodetect_template_type(llm.model),
|
||||
completion_options=llm.completion_options,
|
||||
system_message=llm.system_message,
|
||||
request_options=llm.request_options,
|
||||
)
|
||||
|
||||
def construct_models(self) -> Models:
|
||||
def model_with_title(title: Optional[str], fallback: ModelDescription):
|
||||
def model_with_title(title: Optional[str], fallback: LLM):
|
||||
return next(filter(lambda x: x.title == title, self.models), fallback)
|
||||
|
||||
default = model_with_title(self.model_roles.default, self.models[0])
|
||||
|
|
@ -640,11 +691,10 @@ class ContinueConfig(BaseModel):
|
|||
not in [default.title, chat.title, edit.title, summarize.title]
|
||||
]
|
||||
|
||||
models = Models(
|
||||
default=self.create_llm(default),
|
||||
chat=self.create_llm(chat),
|
||||
edit=self.create_llm(edit),
|
||||
summarize=self.create_llm(summarize),
|
||||
saved=[self.create_llm(model) for model in saved],
|
||||
return Models(
|
||||
default=default,
|
||||
chat=chat,
|
||||
edit=edit,
|
||||
summarize=summarize,
|
||||
saved=saved,
|
||||
)
|
||||
return models
|
||||
|
|
|
|||
|
|
@ -18,6 +18,18 @@ from ...libs.llm.prompts.edit import (
|
|||
zephyr_edit_prompt,
|
||||
)
|
||||
|
||||
STEP_NAMES = [
|
||||
"AnswerQuestionChroma",
|
||||
"GenerateShellCommandStep",
|
||||
"EditHighlightedCodeStep",
|
||||
"ShareSessionStep",
|
||||
"CommentCodeStep",
|
||||
"ClearHistoryStep",
|
||||
"StackOverflowStep",
|
||||
"OpenConfigStep",
|
||||
"GenerateShellCommandStep",
|
||||
]
|
||||
|
||||
StepName = Literal[
|
||||
"AnswerQuestionChroma",
|
||||
"GenerateShellCommandStep",
|
||||
|
|
@ -64,8 +76,10 @@ def autodetect_template_type(model: str) -> Optional[TemplateType]:
|
|||
return "chatml"
|
||||
|
||||
|
||||
def autodetect_template_function(model: str):
|
||||
if template_type := autodetect_template_type(model):
|
||||
def autodetect_template_function(
|
||||
model: str, explicit_template: Optional[TemplateType] = None
|
||||
):
|
||||
if template_type := explicit_template or autodetect_template_type(model):
|
||||
mapping: Dict[TemplateType, Any] = {
|
||||
"llama2": llama2_template_messages,
|
||||
"alpaca": template_alpaca_messages,
|
||||
|
|
@ -79,8 +93,10 @@ def autodetect_template_function(model: str):
|
|||
return None
|
||||
|
||||
|
||||
def autodetect_prompt_templates(model: str):
|
||||
template_type = autodetect_template_type(model)
|
||||
def autodetect_prompt_templates(
|
||||
model: str, explicit_template: Optional[TemplateType] = None
|
||||
):
|
||||
template_type = explicit_template or autodetect_template_type(model)
|
||||
|
||||
templates = {}
|
||||
|
||||
|
|
@ -118,6 +134,7 @@ ModelProvider = Literal[
|
|||
"text-gen-webui",
|
||||
"google-palm",
|
||||
"lmstudio",
|
||||
"llamafile",
|
||||
]
|
||||
|
||||
MODEL_PROVIDER_TO_MODEL_CLASS = {
|
||||
|
|
@ -134,6 +151,7 @@ MODEL_PROVIDER_TO_MODEL_CLASS = {
|
|||
"text-gen-webui": "TextGenWebUI",
|
||||
"google-palm": "GooglePaLMAPI",
|
||||
"lmstudio": "LMStudio",
|
||||
"llamafile": "Llamafile",
|
||||
}
|
||||
|
||||
MODEL_CLASS_TO_MODEL_PROVIDER: Dict[str, ModelProvider] = {
|
||||
|
|
@ -149,6 +167,7 @@ MODEL_CLASS_TO_MODEL_PROVIDER: Dict[str, ModelProvider] = {
|
|||
"TextGenWebUI": "text-gen-webui",
|
||||
"GooglePaLMAPI": "google-palm",
|
||||
"LMStudio": "lmstudio",
|
||||
"Llamafile": "llamafile",
|
||||
}
|
||||
|
||||
MODELS = [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import uuid
|
||||
from typing import Any, Callable, Dict, List, Optional, Type
|
||||
from typing import Any, Callable, Dict, List, Optional, Type, Union
|
||||
|
||||
from pydantic import BaseModel, Field, validator
|
||||
from pydantic import BaseModel, validator
|
||||
|
||||
from ..libs.llm.anthropic import AnthropicLLM
|
||||
from ..libs.llm.base import LLM
|
||||
|
|
@ -10,6 +10,7 @@ from ..libs.llm.google_palm_api import GooglePaLMAPI
|
|||
from ..libs.llm.hf_inference_api import HuggingFaceInferenceAPI
|
||||
from ..libs.llm.hf_tgi import HuggingFaceTGI
|
||||
from ..libs.llm.llamacpp import LlamaCpp
|
||||
from ..libs.llm.llamafile import Llamafile
|
||||
from ..libs.llm.lmstudio import LMStudio
|
||||
from ..libs.llm.ollama import Ollama
|
||||
from ..libs.llm.openai import OpenAI
|
||||
|
|
@ -46,6 +47,7 @@ MODEL_CLASSES: Dict[str, Type[LLM]] = {
|
|||
GooglePaLMAPI,
|
||||
TextGenWebUI,
|
||||
LMStudio,
|
||||
Llamafile,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -63,18 +65,19 @@ MODEL_MODULE_NAMES = {
|
|||
"GooglePaLMAPI": "google_palm_api",
|
||||
"TextGenWebUI": "text_gen_webui",
|
||||
"LMStudio": "lmstudio",
|
||||
"Llamafile": "llamafile",
|
||||
}
|
||||
|
||||
|
||||
class Models(BaseModel):
|
||||
"""Main class that holds the current model configuration"""
|
||||
|
||||
default: LLM
|
||||
summarize: LLM
|
||||
edit: LLM
|
||||
chat: LLM
|
||||
default: Union[Any, LLM]
|
||||
summarize: Union[Any, LLM]
|
||||
edit: Union[Any, LLM]
|
||||
chat: Union[Any, LLM]
|
||||
|
||||
saved: List[LLM] = []
|
||||
saved: List[Union[Any, LLM]] = []
|
||||
|
||||
temperature: Optional[float] = None
|
||||
system_message: Optional[str] = None
|
||||
|
|
@ -115,9 +118,7 @@ class Models(BaseModel):
|
|||
temperature: Optional[float],
|
||||
):
|
||||
"""Start each of the LLMs, or fall back to default"""
|
||||
for role in ALL_MODEL_ROLES:
|
||||
model: LLM = getattr(self, role)
|
||||
|
||||
for model in self.saved + self.all_models:
|
||||
model.start(unique_id)
|
||||
model.write_log = self.write_log
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,12 @@ from typing import Any, AsyncGenerator, Callable, Coroutine, Dict, List, Optiona
|
|||
|
||||
import aiohttp
|
||||
import certifi
|
||||
from pydantic import Field
|
||||
from pydantic import Field, validator
|
||||
|
||||
from ...core.config_utils.shared import (
|
||||
autodetect_prompt_templates,
|
||||
autodetect_template_function,
|
||||
)
|
||||
from ...core.main import ChatMessage
|
||||
from ...models.llm import BaseCompletionOptions, CompletionOptions, RequestOptions
|
||||
from ...models.main import ContinueBaseModel
|
||||
|
|
@ -58,7 +62,7 @@ class LLM(ContinueBaseModel):
|
|||
)
|
||||
|
||||
prompt_templates: dict = Field(
|
||||
default={},
|
||||
default=None,
|
||||
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.',
|
||||
)
|
||||
|
||||
|
|
@ -103,6 +107,14 @@ class LLM(ContinueBaseModel):
|
|||
},
|
||||
}
|
||||
|
||||
@validator("template_messages", pre=True, always=True)
|
||||
def set_template_messages(cls, template_messages, values):
|
||||
return template_messages or autodetect_template_function(values["model"])
|
||||
|
||||
@validator("prompt_templates", pre=True, always=True)
|
||||
def set_prompt_templates(cls, prompt_templates, values):
|
||||
return prompt_templates or autodetect_prompt_templates(values["model"])
|
||||
|
||||
def dict(self, **kwargs):
|
||||
original_dict = super().dict(**kwargs)
|
||||
original_dict.pop("write_log")
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ class GGML(LLM):
|
|||
"""
|
||||
See our [5 minute quickstart](https://github.com/continuedev/ggml-server-example) to run any model locally with ggml. While these models don't yet perform as well, they are free, entirely private, and run offline.
|
||||
|
||||
You can also use this class for [LM Studio](https://lmstudio.ai).
|
||||
|
||||
Once the model is running on localhost:8000, change `~/.continue/config.json` to look like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class LlamaCpp(LLM):
|
|||
|
||||
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.",
|
||||
description="A list of additional arguments to pass to llama.cpp. See https://github.com/ggerganov/llama.cpp/tree/master/examples/server#api-endpoints for the complete catalog of options.",
|
||||
)
|
||||
|
||||
class Config:
|
||||
|
|
|
|||
93
server/continuedev/libs/llm/llamafile.py
Normal file
93
server/continuedev/libs/llm/llamafile.py
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
import asyncio
|
||||
import socket
|
||||
import subprocess
|
||||
from typing import Any, AsyncGenerator, Coroutine, List, Optional
|
||||
|
||||
from continuedev.core.main import ChatMessage
|
||||
from continuedev.models.llm import CompletionOptions
|
||||
|
||||
from .llamacpp import LlamaCpp
|
||||
|
||||
|
||||
def test_port(PORT):
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
try:
|
||||
s.bind(("", PORT)) ## Try to open port
|
||||
except OSError as e:
|
||||
if e.errno == 98: ## Errorno 98 means address already bound
|
||||
return True
|
||||
elif e.errno == 48: ## Errorno 48 means address already in use
|
||||
return True
|
||||
return False
|
||||
s.close()
|
||||
return False
|
||||
|
||||
|
||||
STARTUP_DELAY = 3.0
|
||||
|
||||
|
||||
class Llamafile(LlamaCpp):
|
||||
"""
|
||||
A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contained binary that can run an open-source LLM. You can configure this provider in your config.json as follows:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"models": [{
|
||||
"title": "Llamafile",
|
||||
"provider": "llamafile",
|
||||
"model": "mistral-7b",
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
Optionally, you can set the `llamafile_command` property, which will be run to start the llamafile if it isn't already running on port 8080. Be sure to use an absolute path to the llamafile binary. For example: `/Users/yourusername/mistral-7b-instruct-v0.1-Q4_K_M-server.llamafile`.
|
||||
"""
|
||||
|
||||
llamafile_command: Optional[str] = None
|
||||
|
||||
def check_and_start(self) -> bool:
|
||||
# Try to start the llamafile if it's not already started on port 8080
|
||||
if not self.llamafile_command:
|
||||
return False
|
||||
|
||||
port = int((self.api_base or ":8080").split(":")[-1])
|
||||
|
||||
if not test_port(port):
|
||||
subprocess.Popen(
|
||||
self.llamafile_command.split(" "),
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.STDOUT,
|
||||
close_fds=True,
|
||||
start_new_session=True,
|
||||
shell=True,
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def start(self, unique_id: str | None = None):
|
||||
super().start(unique_id)
|
||||
self.check_and_start()
|
||||
|
||||
async def _stream_chat(
|
||||
self, messages: List[ChatMessage], options: CompletionOptions
|
||||
):
|
||||
if self.check_and_start():
|
||||
await asyncio.sleep(STARTUP_DELAY)
|
||||
|
||||
async for message in super()._stream_chat(messages, options):
|
||||
yield message
|
||||
|
||||
async def _stream_complete(self, prompt, options):
|
||||
if self.check_and_start():
|
||||
await asyncio.sleep(STARTUP_DELAY)
|
||||
|
||||
async for message in super()._stream_complete(prompt, options):
|
||||
yield message
|
||||
|
||||
async def _complete(self, prompt: str, options: CompletionOptions):
|
||||
if self.check_and_start():
|
||||
await asyncio.sleep(STARTUP_DELAY)
|
||||
|
||||
return await super()._complete(prompt, options)
|
||||
|
|
@ -60,6 +60,9 @@ class Ollama(LLM):
|
|||
"wizardcoder-34b": "wizardcoder:34b-python",
|
||||
"zephyr-7b": "zephyr:7b",
|
||||
"codeup-13b": "codeup:13b",
|
||||
"deepseek-1b": "deepseek-coder:1.3b",
|
||||
"deepseek-7b": "deepseek-coder:6.7b",
|
||||
"deepseek-33b": "deepseek-coder:33b",
|
||||
}.get(self.model, self.model)
|
||||
|
||||
def start(self, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -38,14 +38,45 @@ NON_CHAT_MODELS = {
|
|||
|
||||
class OpenAI(LLM):
|
||||
"""
|
||||
The OpenAI class can be used to access OpenAI models like gpt-4 and gpt-3.5-turbo.
|
||||
The OpenAI class can be used to access OpenAI models like GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo.
|
||||
|
||||
If you are locally serving a model that uses an OpenAI-compatible server, you can simply change the `api_base` like this:
|
||||
### Azure OpenAI Service
|
||||
|
||||
If you'd like to use OpenAI models but are concerned about privacy, you can use the Azure OpenAI service, which is GDPR and HIPAA compliant. After applying for access [here](https://azure.microsoft.com/en-us/products/ai-services/openai-service), you will typically hear back within only a few days. Once you have access, set up a model in `config.json` like so:
|
||||
|
||||
```json
|
||||
"models": [{
|
||||
"title": "Azure OpenAI",
|
||||
"provider": "openai",
|
||||
"model": "gpt-4",
|
||||
"api_base": "https://my-azure-openai-instance.openai.azure.com/",
|
||||
"engine": "my-azure-openai-deployment",
|
||||
"api_version": "2023-07-01-preview",
|
||||
"api_type": "azure",
|
||||
"api_key": "<MY_API_KEY>"
|
||||
}]
|
||||
```
|
||||
|
||||
The easiest way to find this information is from the chat playground in the Azure OpenAI portal. Under the "Chat Session" section, click "View Code" to see each of these parameters.
|
||||
|
||||
### OpenAI compatible servers / APIs
|
||||
|
||||
OpenAI compatible servers
|
||||
- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation)
|
||||
- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md)
|
||||
- [LocalAI](https://localai.io/basics/getting_started/)
|
||||
- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
|
||||
|
||||
OpenAI compatible APIs
|
||||
- [Anyscale Endpoints](https://github.com/continuedev/deploy-os-code-llm#others)
|
||||
- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints)
|
||||
|
||||
If you are [using an OpenAI compatible server / API](../../model-setup/select-provider#local), you can change the `api_base` like this:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"models": [{
|
||||
"title": "OpenAI-compatible server",
|
||||
"title": "OpenAI-compatible server / API",
|
||||
"provider": "openai",
|
||||
"model": "MODEL_NAME",
|
||||
"api_key": "EMPTY",
|
||||
|
|
@ -53,13 +84,6 @@ class OpenAI(LLM):
|
|||
}]
|
||||
}
|
||||
```
|
||||
|
||||
Options for serving models locally with an OpenAI-compatible server include:
|
||||
|
||||
- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation)
|
||||
- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md)
|
||||
- [LocalAI](https://localai.io/basics/getting_started/)
|
||||
- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
|
||||
"""
|
||||
|
||||
api_key: str = Field(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import os
|
||||
import re
|
||||
from typing import Awaitable, Callable, Optional
|
||||
from typing import Any, Awaitable, Callable, Optional
|
||||
|
||||
from ..constants.default_config import default_config
|
||||
from ..constants.main import (
|
||||
|
|
@ -44,6 +44,12 @@ async def migrate(migration_id: str, migrate_func: Callable[[], Awaitable]):
|
|||
markMigrated(migration_id)
|
||||
|
||||
|
||||
def sync_migrate(migration_id: str, migrate_func: Callable[[], Any]):
|
||||
if not hasMigrated(migration_id):
|
||||
migrate_func()
|
||||
markMigrated(migration_id)
|
||||
|
||||
|
||||
def getSessionsFolderPath():
|
||||
path = os.path.join(getGlobalFolderPath(), CONTINUE_SESSIONS_FOLDER)
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ LLM_MODULES = [
|
|||
("openai_free_trial", "OpenAIFreeTrial"),
|
||||
("google_palm_api", "GooglePaLMAPI"),
|
||||
("queued", "QueuedLLM"),
|
||||
("llamafile", "Llamafile"),
|
||||
]
|
||||
|
||||
CONTEXT_PROVIDER_MODULES = [
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class HighlightedCodeContextProvider(ContextProvider):
|
|||
)
|
||||
return ChatMessage(
|
||||
role="user",
|
||||
content=f"Code in this file is highlighted ({item.description.name}):\n```\n{rif.contents}\n```",
|
||||
content=f"```{item.description.name}\n{rif.contents}\n```",
|
||||
summary=f"Code in this file is highlighted: {item.description.name}",
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,42 +24,35 @@ PROMPT = """Use the above code to answer the following question. You should not
|
|||
|
||||
|
||||
async def get_faster_model(sdk: ContinueSDK) -> Optional[LLM]:
|
||||
def get_model_description() -> Optional[ModelDescription]:
|
||||
# First, check for GPT-3/3.5
|
||||
models = sdk.config.models
|
||||
if gpt3_model := next(filter(lambda m: "gpt-3" in m.model, models), None):
|
||||
return gpt3_model
|
||||
# First, check for GPT-3/3.5
|
||||
models: List[LLM] = sdk.config.models
|
||||
if gpt3_model := next(filter(lambda m: "gpt-3" in m.model, models), None):
|
||||
return gpt3_model
|
||||
|
||||
# Then, check for OpenAIFreeTrial
|
||||
if openai_free_trial_model := next(
|
||||
filter(lambda m: m.__class__.__name__ == "OpenAIFreeTrial", models), None
|
||||
):
|
||||
new_model = openai_free_trial_model.copy()
|
||||
new_model.model = "gpt-3.5-turbo"
|
||||
return new_model
|
||||
# Then, check for OpenAIFreeTrial
|
||||
if openai_free_trial_model := next(
|
||||
filter(lambda m: m.__class__.__name__ == "OpenAIFreeTrial", models), None
|
||||
):
|
||||
new_model = openai_free_trial_model.copy()
|
||||
new_model.model = "gpt-3.5-turbo"
|
||||
return new_model
|
||||
|
||||
# Then, check for an API Key
|
||||
if openai_model := next(
|
||||
filter(
|
||||
lambda m: hasattr(m, "api_key")
|
||||
and m.api_key is not None
|
||||
and m.api_key.startswith("sk-"),
|
||||
models,
|
||||
),
|
||||
None,
|
||||
):
|
||||
new_model = openai_model.copy()
|
||||
new_model.model = "gpt-3.5-turbo"
|
||||
return new_model
|
||||
# Then, check for an API Key
|
||||
if openai_model := next(
|
||||
filter(
|
||||
lambda m: hasattr(m, "api_key")
|
||||
and m.api_key is not None
|
||||
and m.api_key.startswith("sk-"),
|
||||
models,
|
||||
),
|
||||
None,
|
||||
):
|
||||
new_model = openai_model.copy()
|
||||
new_model.model = "gpt-3.5-turbo"
|
||||
return new_model
|
||||
|
||||
# Return None, so re-ranking probably shouldn't happen
|
||||
return None
|
||||
|
||||
if desc := get_model_description():
|
||||
llm = sdk.config.create_llm(desc)
|
||||
llm.start(sdk.ide.window_info.unique_id)
|
||||
else:
|
||||
return None
|
||||
# Return None, so re-ranking probably shouldn't happen
|
||||
return None
|
||||
|
||||
|
||||
class AnswerQuestionChroma(Step):
|
||||
|
|
@ -167,7 +160,10 @@ class AnswerQuestionChroma(Step):
|
|||
model = sdk.models.chat.model
|
||||
# if model == "gpt-4":
|
||||
# model = "gpt-4-32k" # Not publicly available yet?
|
||||
if model == "gpt-3.5-turbo":
|
||||
if (
|
||||
model == "gpt-3.5-turbo"
|
||||
and not sdk.models.chat.__class__.__name__ == "OpenAIFreeTrial"
|
||||
):
|
||||
model = "gpt-3.5-turbo-16k"
|
||||
|
||||
await sdk.run_step(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "continuedev"
|
||||
version = "0.1.99"
|
||||
version = "0.1.101"
|
||||
description = ""
|
||||
authors = ["Nate Sesti <sestinj@gmail.com>"]
|
||||
readme = "README.md"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue