feat: messages nodes implemented but deactivated for now
This commit is contained in:
parent
376265cb8f
commit
e0c96b2cbb
3 changed files with 37 additions and 5 deletions
|
|
@ -13,10 +13,11 @@ agents:
|
||||||
prompts:
|
prompts:
|
||||||
- PromptTemplate
|
- PromptTemplate
|
||||||
- FewShotPromptTemplate
|
- FewShotPromptTemplate
|
||||||
- ChatPromptTemplate
|
- ZeroShotPrompt
|
||||||
- SystemMessagePromptTemplate
|
# Wait more tests
|
||||||
- AIMessagePromptTemplate
|
# - ChatPromptTemplate
|
||||||
- HumanMessagePromptTemplate
|
# - SystemMessagePromptTemplate
|
||||||
|
# - HumanMessagePromptTemplate
|
||||||
|
|
||||||
llms:
|
llms:
|
||||||
- OpenAI
|
- OpenAI
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,24 @@ FORCE_SHOW_FIELDS = [
|
||||||
"max_value_length",
|
"max_value_length",
|
||||||
"max_tokens",
|
"max_tokens",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
DEFAULT_PROMPT = """
|
||||||
|
I want you to act as a naming consultant for new companies.
|
||||||
|
|
||||||
|
Here are some examples of good company names:
|
||||||
|
|
||||||
|
- search engine, Google
|
||||||
|
- social media, Facebook
|
||||||
|
- video sharing, YouTube
|
||||||
|
|
||||||
|
The name should be short, catchy and easy to remember.
|
||||||
|
|
||||||
|
What is a good name for a company that makes {product}?
|
||||||
|
"""
|
||||||
|
|
||||||
|
SYSTEM_PROMPT = """
|
||||||
|
You are a helpful assistant that talks casually about life in general.
|
||||||
|
You are a good listener and you can talk about anything.
|
||||||
|
"""
|
||||||
|
|
||||||
|
HUMAN_PROMPT = "{input}"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ from typing import Optional
|
||||||
from langchain.agents.mrkl import prompt
|
from langchain.agents.mrkl import prompt
|
||||||
|
|
||||||
from langflow.template.base import FrontendNode, Template, TemplateField
|
from langflow.template.base import FrontendNode, Template, TemplateField
|
||||||
|
from langflow.template.constants import DEFAULT_PROMPT, HUMAN_PROMPT, SYSTEM_PROMPT
|
||||||
from langflow.utils.constants import DEFAULT_PYTHON_FUNCTION
|
from langflow.utils.constants import DEFAULT_PYTHON_FUNCTION
|
||||||
from langchain.agents import loading
|
from langchain.agents import loading
|
||||||
|
|
||||||
|
|
@ -244,6 +245,15 @@ class PromptFrontendNode(FrontendNode):
|
||||||
def format_field(field: TemplateField, name: Optional[str] = None) -> None:
|
def format_field(field: TemplateField, name: Optional[str] = None) -> None:
|
||||||
# if field.field_type == "StringPromptTemplate"
|
# if field.field_type == "StringPromptTemplate"
|
||||||
# change it to str
|
# change it to str
|
||||||
if field.field_type == "StringPromptTemplate":
|
if field.field_type == "StringPromptTemplate" and "Message" in name:
|
||||||
field.field_type = "str"
|
field.field_type = "str"
|
||||||
field.multiline = True
|
field.multiline = True
|
||||||
|
field.value = HUMAN_PROMPT if "Human" in field.name else SYSTEM_PROMPT
|
||||||
|
if field.name == "template":
|
||||||
|
field.value = DEFAULT_PROMPT
|
||||||
|
|
||||||
|
if (
|
||||||
|
"Union" in field.field_type
|
||||||
|
and "BaseMessagePromptTemplate" in field.field_type
|
||||||
|
):
|
||||||
|
field.field_type = "BaseMessagePromptTemplate"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue