diff --git a/core/index.d.ts b/core/index.d.ts index 7df72f6a5..bb07af99c 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -596,6 +596,7 @@ interface BaseCompletionOptions { numThreads?: number; keepAlive?: number; raw?: boolean; + stream?: boolean; } export interface ModelDescription { diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index 22dc17721..974bfc7cd 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -32,6 +32,7 @@ class Anthropic extends BaseLLM { max_tokens: options.maxTokens ?? 2048, model: options.model === "claude-2" ? "claude-2.1" : options.model, stop_sequences: options.stop?.filter((x) => x.trim() !== ""), + stream: options.stream ?? true, }; return finalOptions; @@ -92,10 +93,15 @@ class Anthropic extends BaseLLM { ...this._convertArgs(options), messages: this._convertMessages(messages), system: this.systemMessage, - stream: true, }), }); + if (options.stream === false) { + const data = await response.json(); + yield { role: "assistant", content: data.content[0].text }; + return; + } + for await (const value of streamSse(response)) { if (value.delta?.text) { yield { role: "assistant", content: value.delta.text }; diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index 550b480bb..008dd9858 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -6,6 +6,12 @@ "title": "BaseCompletionOptions", "type": "object", "properties": { + "stream": { + "title": "Stream", + "description": "Whether to stream the LLM response. Currently only respected by the 'anthropic' provider. Otherwise will always stream.", + "type": "boolean", + "default": true + }, "temperature": { "title": "Temperature", "description": "The temperature of the completion.", @@ -1674,6 +1680,11 @@ "type": "object", "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://continue.dev/docs/walkthroughs/tab-autocomplete#configuration-options).", "properties": { + "disable": { + "type": "boolean", + "description": "Disable tab autocomplete. This can also be done from the IDE settings.", + "default": false + }, "useCopyBuffer": { "type": "boolean", "description": "Determines whether the copy buffer will be considered when contructing the prompt." diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index 550b480bb..008dd9858 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -6,6 +6,12 @@ "title": "BaseCompletionOptions", "type": "object", "properties": { + "stream": { + "title": "Stream", + "description": "Whether to stream the LLM response. Currently only respected by the 'anthropic' provider. Otherwise will always stream.", + "type": "boolean", + "default": true + }, "temperature": { "title": "Temperature", "description": "The temperature of the completion.", @@ -1674,6 +1680,11 @@ "type": "object", "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://continue.dev/docs/walkthroughs/tab-autocomplete#configuration-options).", "properties": { + "disable": { + "type": "boolean", + "description": "Disable tab autocomplete. This can also be done from the IDE settings.", + "default": false + }, "useCopyBuffer": { "type": "boolean", "description": "Determines whether the copy buffer will be considered when contructing the prompt." diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 49f4c2ecc..008dd9858 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -6,6 +6,12 @@ "title": "BaseCompletionOptions", "type": "object", "properties": { + "stream": { + "title": "Stream", + "description": "Whether to stream the LLM response. Currently only respected by the 'anthropic' provider. Otherwise will always stream.", + "type": "boolean", + "default": true + }, "temperature": { "title": "Temperature", "description": "The temperature of the completion.", diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 0bb4679a2..fb3b3e1f4 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -6,6 +6,12 @@ "title": "BaseCompletionOptions", "type": "object", "properties": { + "stream": { + "title": "Stream", + "description": "Whether to stream the LLM response. Currently only respected by the 'anthropic' provider. Otherwise will always stream.", + "type": "boolean", + "default": true + }, "temperature": { "title": "Temperature", "description": "The temperature of the completion.", @@ -1879,6 +1885,11 @@ "type": "object", "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://continue.dev/docs/walkthroughs/tab-autocomplete#configuration-options).", "properties": { + "disable": { + "type": "boolean", + "description": "Disable tab autocomplete. This can also be done from the IDE settings.", + "default": false + }, "useCopyBuffer": { "type": "boolean", "description": "Determines whether the copy buffer will be considered when contructing the prompt."