Remove Flowise Template

This commit is contained in:
Eduardo Calixto 2024-01-16 11:08:11 -03:00
parent a5f041c9a7
commit 16ebfaa8b3
15 changed files with 69 additions and 102 deletions

View file

@ -8,7 +8,6 @@ from ...libs.llm.prompts.chat import (
phind_template_messages,
template_alpaca_messages,
zephyr_template_messages,
flowise_template_messages,
)
from ...libs.llm.prompts.edit import (
alpaca_edit_prompt,
@ -17,7 +16,6 @@ from ...libs.llm.prompts.edit import (
phind_edit_prompt,
simplest_edit_prompt,
zephyr_edit_prompt,
flowise_edit_prompt,
)
STEP_NAMES = [
@ -45,7 +43,7 @@ StepName = Literal[
]
TemplateType = Literal[
"llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml", "deepseek", "flowise"
"llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml", "deepseek"
]
@ -75,9 +73,6 @@ def autodetect_template_type(model: str) -> Optional[TemplateType]:
if "deepseek" in lower:
return "deepseek"
if "flowise" in lower:
return "flowise"
return "chatml"
@ -93,7 +88,6 @@ def autodetect_template_function(
"anthropic": anthropic_template_messages,
"chatml": chatml_template_messages,
"deepseek": deepseek_template_messages,
"flowise": flowise_template_messages
}
return mapping[template_type]
return None
@ -117,8 +111,6 @@ def autodetect_prompt_templates(
edit_template = alpaca_edit_prompt
elif template_type == "deepseek":
edit_template = deepseek_edit_prompt
elif template_type == "flowise":
edit_template = flowise_edit_prompt
elif template_type is not None:
edit_template = simplest_edit_prompt
@ -206,8 +198,6 @@ MODELS = [
"claude-2",
# Google PaLM
"chat-bison-001",
# Flowise
"flowise",
]
ModelName = Literal[
@ -238,6 +228,4 @@ ModelName = Literal[
"claude-2",
# Google PaLM
"chat-bison-001",
# Flowise
"flowise",
]

View file

@ -110,15 +110,6 @@ def phind_template_messages(msgs: List[ChatMessage]) -> str:
return prompt
def flowise_template_messages(msgs: List[ChatMessage]) -> str:
prompt = ""
for msg in messages:
prompt += f"{"Human:" if (msg.role == 'user' or msg.role == 'system') else "Assistant:"} {msg.content} "
return prompt
def raw_input_template(msgs: List[ChatMessage]) -> str:
return msgs[-1].content

View file

@ -113,23 +113,6 @@ _zephyr_edit_prompt = dedent(
"""
)
_flowise_edit_prompt = dedent(
"""\
System:
You are an expert programmer and write code on the first attempt without any errors or fillers.
User:
Rewrite the code to satisfy this request: "{{{user_input}}}"
```
{{{code_to_edit}}}
```
Assistant:
Sure! Here's the code you requested:
```
"""
)
codellama_edit_prompt = PromptTemplate(
prompt=_codellama_edit_prompt, raw=True, stop=["[/CODE]"]
@ -140,4 +123,3 @@ zephyr_edit_prompt = PromptTemplate(prompt=_zephyr_edit_prompt, raw=True, stop=[
deepseek_edit_prompt = PromptTemplate(
prompt=_deepseek_edit_prompt, raw=True, stop=["```"]
)
flowise_edit_prompt = PromptTemplate(prompt=_flowise_edit_prompt, raw=True, stop=["```"])

7
core/index.d.ts vendored
View file

@ -378,8 +378,7 @@ type TemplateType =
| "none"
| "openchat"
| "deepseek"
| "xwin-coder"
| "flowise";
| "xwin-coder";
type ModelProvider =
| "openai"
@ -435,9 +434,7 @@ export type ModelName =
// Mistral
| "mistral-tiny"
| "mistral-small"
| "mistral-medium"
// Flowise
| "flowise";
| "mistral-medium";
export interface RequestOptions {
timeout?: number;

View file

@ -21,7 +21,6 @@ import {
anthropicTemplateMessages,
chatmlTemplateMessages,
deepseekTemplateMessages,
flowiseTemplateMessages,
llama2TemplateMessages,
openchatTemplateMessages,
phindTemplateMessages,
@ -33,7 +32,6 @@ import {
alpacaEditPrompt,
codellamaEditPrompt,
deepseekEditPrompt,
flowiseEditPrompt,
mistralEditPrompt,
openchatEditPrompt,
phindEditPrompt,
@ -100,10 +98,6 @@ function autodetectTemplateType(model: string): TemplateType | undefined {
return "openchat";
}
if (lower.includes("flowise")) {
return "flowise";
}
return "chatml";
}
@ -132,7 +126,6 @@ function autodetectTemplateFunction(
deepseek: deepseekTemplateMessages,
openchat: openchatTemplateMessages,
"xwin-coder": xWinCoderTemplateMessages,
flowise: flowiseTemplateMessages,
none: null,
};
@ -169,8 +162,6 @@ function autodetectPromptTemplates(
editTemplate = openchatEditPrompt;
} else if (templateType === "xwin-coder") {
editTemplate = xWinCoderEditPrompt;
} else if (templateType === "flowise") {
editTemplate = flowiseEditPrompt;
} else if (templateType) {
editTemplate = simplestEditPrompt;
}

View file

@ -205,19 +205,6 @@ function xWinCoderTemplateMessages(msgs: ChatMessage[]): string {
return prompt;
}
function flowiseTemplateMessages(messages: ChatMessage[]): string {
const HUMAN_PROMPT = "\n\nHuman:";
const AI_PROMPT = "\n\nAssistant:";
let prompt = "";
for (const message of messages) {
const role = message.role === "user" || message.role === "system" ? HUMAN_PROMPT : AI_PROMPT;
prompt += `${role} ${message.content} `;
}
return prompt;
}
export {
anthropicTemplateMessages,
chatmlTemplateMessages,
@ -228,5 +215,4 @@ export {
templateAlpacaMessages,
xWinCoderTemplateMessages,
zephyrTemplateMessages,
flowiseTemplateMessages
};

View file

@ -124,20 +124,6 @@ Just rewrite the code without explanations:
<AI>:
\`\`\`{{{language}}}`;
const flowiseEditPrompt = `System:
You are an expert programmer and write code on the first attempt without any errors or fillers.
User:
Rewrite the code to satisfy this request: "{{{userInput}}}"
\`\`\`
{{{codeToEdit}}}
\`\`\`
Assistant:
Sure! Here's the code you requested:
\`\`\`
`;
export {
alpacaEditPrompt,
codellamaEditPrompt,
@ -151,5 +137,4 @@ export {
simplifiedEditPrompt,
xWinCoderEditPrompt,
zephyrEditPrompt,
flowiseEditPrompt,
};

View file

@ -107,6 +107,6 @@ describe("LLM", () => {
// new Mistral({ apiKey: process.env.MISTRAL_API_KEY, model: "mistral-small" })
// );
// testLLM(
// new Flowise({ apiKey: process.env.FLOWISE_API_KEY, model: "flowise" })
// new Flowise({ apiKey: process.env.FLOWISE_API_KEY, model: "gpt-3.5-turbo" })
// );
});

View file

@ -54,7 +54,7 @@ However, if neither of these are the case, you will need to wire up a new LLM ob
## Customizing the Chat Template
Most open-source models expect a specific chat format, for example llama2 and codellama expect the input to look like `"[INST] How do I write bubble sort in Rust? [/INST]"`. Continue will automatically attempt to detect the correct prompt format based on the `model`value that you provide, but if you are receiving nonsense responses, you can use the`template`property to explicitly set the format that you expect. The options are:`["llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml", "openchat", "flowise", "none"]`.
Most open-source models expect a specific chat format, for example llama2 and codellama expect the input to look like `"[INST] How do I write bubble sort in Rust? [/INST]"`. Continue will automatically attempt to detect the correct prompt format based on the `model`value that you provide, but if you are receiving nonsense responses, you can use the`template`property to explicitly set the format that you expect. The options are:`["llama2", "alpaca", "zephyr", "phind", "anthropic", "chatml", "openchat", "none"]`.
If you want to create an entirely new chat template, this can be done in [config.ts](../customization/code-config.md) by defining a function and adding it to the `templateMessages` property of your `LLM`. Here is an example of `templateMessages` for the Alpaca/Vicuna format:

View file

@ -0,0 +1,18 @@
# Flowise
[Flowise](https://flowiseai.com/) is a low-code/no-code drag & drop tool with the aim to make it easy for people to visualize and build LLM apps. Continue can then be configured to use the `Flowise` LLM class, like the example here:
```json title="~/.continue/config.json"
{
"models": [
{
"provider": "flowise",
"title": "Flowise",
"model": "<MODEL>",
"apiBase": "<API_BASE>"
}
]
}
```
[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Flowise.ts)

View file

@ -166,8 +166,7 @@
"none",
"deepseek",
"openchat",
"xwin-coder",
"flowise"
"xwin-coder"
],
"type": "string"
},
@ -428,8 +427,7 @@
"codeup-13b",
"deepseek-1b",
"deepseek-7b",
"deepseek-33b",
"flowise"
"deepseek-33b"
]
},
{ "type": "string" }
@ -560,8 +558,7 @@
"codeup-13b",
"deepseek-1b",
"deepseek-7b",
"deepseek-33b",
"flowise"
"deepseek-33b"
]
},
{ "type": "string" }
@ -599,8 +596,7 @@
"codeup-13b",
"deepseek-1b",
"deepseek-7b",
"deepseek-33b",
"flowise"
"deepseek-33b"
]
},
{ "type": "string" }
@ -751,6 +747,42 @@
},
"required": ["key", "value"]
}
},
"model": {
"anyOf": [
{
"enum": [
"gpt-3.5-turbo-16k",
"gpt-4",
"gpt-3.5-turbo-0613",
"gpt-4-32k",
"gpt-4-1106-preview",
"mistral-7b",
"mistral-8x7b",
"llama2-7b",
"llama2-13b",
"codellama-7b",
"codellama-13b",
"codellama-34b",
"phind-codellama-34b",
"wizardcoder-7b",
"wizardcoder-13b",
"wizardcoder-34b",
"zephyr-7b",
"codeup-13b",
"deepseek-1b",
"deepseek-7b",
"deepseek-33b",
"claude-2",
"chat-bison-001",
"gemini-pro",
"mistral-tiny",
"mistral-small",
"mistral-medium"
]
},
{ "type": "string" }
]
}
}
}

View file

@ -412,11 +412,11 @@ const codeup: ModelPackage = {
};
const flowise: ModelPackage = {
title: "Flowise",
description: "Open source UI visual tool to build your customized LLM ochestration flow & AI agents",
title: "Flowise (GPT 3.5 Turbo)",
description: "Open source UI visual tool to build your customized LLM ochestration flow & AI agents, using GPT 3.5 Turbo",
params: {
title: "Flowise",
model: "flowise",
model: "gpt-3.5-turbo",
contextLength: 2048,
},
icon: "flowiseai.png",

View file

@ -143,8 +143,7 @@
"phind",
"anthropic",
"chatml",
"deepseek",
"flowise"
"deepseek"
],
"type": "string"
},

View file

@ -23,8 +23,7 @@
"deepseek-7b",
"deepseek-33b",
"claude-2",
"chat-bison-001",
"flowise"
"chat-bison-001"
],
"type": "string"
}

View file

@ -143,8 +143,7 @@
"phind",
"anthropic",
"chatml",
"deepseek",
"flowise"
"deepseek"
],
"type": "string"
},