✨ option to disable streaming with anthropic
This commit is contained in:
parent
4f225349f0
commit
0b55aee72f
6 changed files with 47 additions and 1 deletions
1
core/index.d.ts
vendored
1
core/index.d.ts
vendored
|
|
@ -596,6 +596,7 @@ interface BaseCompletionOptions {
|
|||
numThreads?: number;
|
||||
keepAlive?: number;
|
||||
raw?: boolean;
|
||||
stream?: boolean;
|
||||
}
|
||||
|
||||
export interface ModelDescription {
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
11
docs/static/schemas/config.json
vendored
11
docs/static/schemas/config.json
vendored
|
|
@ -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."
|
||||
|
|
|
|||
|
|
@ -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."
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -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."
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue