Spaces:
Sleeping
Sleeping
Commit
•
7e54064
1
Parent(s):
7191b35
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,6 @@ from langchain.prompts import PromptTemplate
|
|
4 |
from langchain_core.prompts import FewShotPromptTemplate
|
5 |
from langchain.prompts.example_selector import LengthBasedExampleSelector
|
6 |
|
7 |
-
|
8 |
def getLLMResponse(query,age_option,tasktype_option,numberOfWords):
|
9 |
llm = OpenAI(model="gpt-3.5-turbo-instruct", temperature=.9)
|
10 |
|
@@ -64,13 +63,15 @@ def getLLMResponse(query,age_option,tasktype_option,numberOfWords):
|
|
64 |
)
|
65 |
|
66 |
|
67 |
-
prefix = """You need to {template_tasktype_option} for a {template_ageoption}
|
68 |
-
Here are some
|
69 |
"""
|
70 |
|
71 |
suffix = """
|
72 |
Question: {template_userInput}
|
73 |
-
Response:
|
|
|
|
|
74 |
|
75 |
example_selector = LengthBasedExampleSelector(
|
76 |
examples=examples,
|
@@ -119,3 +120,4 @@ submit = st.button("Generate")
|
|
119 |
|
120 |
if submit:
|
121 |
st.write(getLLMResponse(form_input,age_option,tasktype_option,numberOfWords))
|
|
|
|
4 |
from langchain_core.prompts import FewShotPromptTemplate
|
5 |
from langchain.prompts.example_selector import LengthBasedExampleSelector
|
6 |
|
|
|
7 |
def getLLMResponse(query,age_option,tasktype_option,numberOfWords):
|
8 |
llm = OpenAI(model="gpt-3.5-turbo-instruct", temperature=.9)
|
9 |
|
|
|
63 |
)
|
64 |
|
65 |
|
66 |
+
prefix = """You need to {template_tasktype_option} for a {template_ageoption}:
|
67 |
+
Here are some set of questions and expected responses for a person like this. these examples are to familarize yourself. The last question does not have a response. you need to generate it:
|
68 |
"""
|
69 |
|
70 |
suffix = """
|
71 |
Question: {template_userInput}
|
72 |
+
Response: ?
|
73 |
+
The final response should not be more than {template_numberOfWords} words
|
74 |
+
"""
|
75 |
|
76 |
example_selector = LengthBasedExampleSelector(
|
77 |
examples=examples,
|
|
|
120 |
|
121 |
if submit:
|
122 |
st.write(getLLMResponse(form_input,age_option,tasktype_option,numberOfWords))
|
123 |
+
|