Spaces:
Sleeping
Sleeping
prompt template fix
Browse files
app.py
CHANGED
@@ -6,24 +6,23 @@ from langchain.prompts import PromptTemplate
|
|
6 |
from langchain.chains import LLMChain
|
7 |
import datetime
|
8 |
|
9 |
-
NUM_WORDS_DEFAULT =
|
10 |
-
# FORMALITY_DEFAULT = "Casual"
|
11 |
TEMPERATURE_DEFAULT = 0.5
|
12 |
EMOTION_DEFAULT = "N/A"
|
13 |
-
# TRANSLATE_TO_DEFAULT = "Don't translate"
|
14 |
LITERARY_STYLE_DEFAULT = "Poetry"
|
15 |
CHARACTER_DEFAULT = "The Old Lady Who Swallowed A Fly"
|
|
|
|
|
16 |
# PROMPT_TEMPLATE = PromptTemplate(
|
17 |
# input_variables=["original_words", "num_words", "formality", "emotions", "translate_to", "literary_style", "character"],
|
18 |
# template="Express {num_words} in a {formality} manner, "
|
19 |
# "{emotions}{translate_to}{literary_style}{character} the following: \n{original_words}\n",
|
20 |
# )
|
21 |
PROMPT_TEMPLATE = PromptTemplate(
|
22 |
-
input_variables=["
|
23 |
-
template="Express the following {num_words}
|
24 |
)
|
25 |
|
26 |
-
|
27 |
def set_openai_api_key(api_key, openai_api_key, temperature, llm_chain):
|
28 |
if api_key:
|
29 |
print("temperature: ", temperature)
|
|
|
6 |
from langchain.chains import LLMChain
|
7 |
import datetime
|
8 |
|
9 |
+
NUM_WORDS_DEFAULT = 80
|
|
|
10 |
TEMPERATURE_DEFAULT = 0.5
|
11 |
EMOTION_DEFAULT = "N/A"
|
|
|
12 |
LITERARY_STYLE_DEFAULT = "Poetry"
|
13 |
CHARACTER_DEFAULT = "The Old Lady Who Swallowed A Fly"
|
14 |
+
# FORMALITY_DEFAULT = "Casual"
|
15 |
+
# TRANSLATE_TO_DEFAULT = "Don't translate"
|
16 |
# PROMPT_TEMPLATE = PromptTemplate(
|
17 |
# input_variables=["original_words", "num_words", "formality", "emotions", "translate_to", "literary_style", "character"],
|
18 |
# template="Express {num_words} in a {formality} manner, "
|
19 |
# "{emotions}{translate_to}{literary_style}{character} the following: \n{original_words}\n",
|
20 |
# )
|
21 |
PROMPT_TEMPLATE = PromptTemplate(
|
22 |
+
input_variables=["num_words", "literary_style", "emotions", "character", "original_words"],
|
23 |
+
template="Express the following {num_words}{literary_style}{emotions}{character}: \n{original_words}\n",
|
24 |
)
|
25 |
|
|
|
26 |
def set_openai_api_key(api_key, openai_api_key, temperature, llm_chain):
|
27 |
if api_key:
|
28 |
print("temperature: ", temperature)
|