Merge branch 'preview'
This commit is contained in:
commit
15dabb40c5
34 changed files with 397 additions and 291 deletions
|
|
@ -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"/>
|
||||
|
|
|
|||
|
|
@ -14,11 +14,13 @@ A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contai
|
|||
}
|
||||
```
|
||||
|
||||
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 [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]']}"/>
|
||||
<ClassPropertyRef name='llamafile_command' details='{"title": "Llamafile Command", "type": "string"}' required={false} default=""/>
|
||||
|
||||
|
||||
|
|
@ -31,6 +33,6 @@ A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contai
|
|||
<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.", "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"/>
|
||||
|
|
|
|||
|
|
@ -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="[]"/>
|
||||
|
|
|
|||
70
extensions/vscode/schema/ContinueConfig.d.ts
vendored
70
extensions/vscode/schema/ContinueConfig.d.ts
vendored
|
|
@ -32,47 +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"
|
||||
| "llamafile";
|
||||
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.
|
||||
*/
|
||||
|
|
@ -105,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.
|
||||
*/
|
||||
|
|
@ -129,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.
|
||||
*/
|
||||
|
|
@ -334,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 {
|
||||
|
|
@ -371,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;
|
||||
|
|
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ function ModelSelect(props: {}) {
|
|||
value={"GPT-4"}
|
||||
onChange={(val: string) => {
|
||||
if (val === defaultModel?.title) return;
|
||||
client?.setModelForRoleFromTitle("*", val);
|
||||
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),
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ export const contextLengthSelector = (state: RootStore) => {
|
|||
|
||||
export const defaultModelSelector = (state: RootStore) => {
|
||||
const title = state.serverState.config.model_roles?.default;
|
||||
if (!Array.isArray(state.serverState.config.models)) return;
|
||||
return state.serverState.config.models?.find(
|
||||
(model) => model.title === title
|
||||
);
|
||||
|
|
|
|||
70
gui/src/schema/ContinueConfig.d.ts
vendored
70
gui/src/schema/ContinueConfig.d.ts
vendored
|
|
@ -32,47 +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"
|
||||
| "llamafile";
|
||||
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.
|
||||
*/
|
||||
|
|
@ -105,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.
|
||||
*/
|
||||
|
|
@ -129,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.
|
||||
*/
|
||||
|
|
@ -334,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 {
|
||||
|
|
@ -371,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;
|
||||
|
|
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -177,49 +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",
|
||||
"llamafile"
|
||||
],
|
||||
"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": {
|
||||
|
|
@ -228,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.",
|
||||
|
|
@ -260,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.",
|
||||
|
|
@ -280,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"
|
||||
]
|
||||
},
|
||||
|
|
@ -611,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,
|
||||
|
|
@ -626,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": {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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 = {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
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, validator
|
||||
|
||||
|
|
@ -72,12 +72,12 @@ MODEL_MODULE_NAMES = {
|
|||
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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ class OpenAI(LLM):
|
|||
The OpenAI class can be used to access OpenAI models like GPT-4, GPT-4 Turbo, and GPT-3.5 Turbo.
|
||||
|
||||
### 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",
|
||||
|
|
@ -59,20 +59,20 @@ class OpenAI(LLM):
|
|||
```
|
||||
|
||||
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:
|
||||
|
||||
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"
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue