Spaces:
Runtime error
Runtime error
notSoNLPnerd
commited on
Commit
•
fecdd86
1
Parent(s):
e162fdc
api_key
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ logging.basicConfig(
|
|
18 |
)
|
19 |
|
20 |
def get_plain_pipeline():
|
21 |
-
prompt_open_ai = PromptModel(model_name_or_path="text-davinci-003", api_key=
|
22 |
|
23 |
# Now let make one PromptNode use the default model and the other one the OpenAI model:
|
24 |
plain_llm_template = PromptTemplate(name="plain_llm", prompt_text="Answer the following question: $query")
|
@@ -47,7 +47,8 @@ def get_ret_aug_pipeline():
|
|
47 |
"$query; Answer:",
|
48 |
)
|
49 |
# Let's initiate the PromptNode
|
50 |
-
node = PromptNode("text-davinci-003", default_prompt_template=default_template,
|
|
|
51 |
|
52 |
# Let's create a pipeline with Shaper and PromptNode
|
53 |
pipe = Pipeline()
|
@@ -67,7 +68,8 @@ def get_web_ret_pipeline():
|
|
67 |
"$query; Answer:",
|
68 |
)
|
69 |
# Let's initiate the PromptNode
|
70 |
-
node = PromptNode("text-davinci-003", default_prompt_template=default_template,
|
|
|
71 |
# Let's create a pipeline with Shaper and PromptNode
|
72 |
pipe = Pipeline()
|
73 |
pipe.add_node(component=web_retriever, name='retriever', inputs=['Query'])
|
@@ -75,14 +77,12 @@ def get_web_ret_pipeline():
|
|
75 |
pipe.add_node(component=node, name="prompt_node", inputs=["shaper"])
|
76 |
return pipe
|
77 |
|
78 |
-
|
79 |
def app_init():
|
80 |
-
|
81 |
os.environ["OPENAI_API_KEY"] = st.secrets["OPENAI_API_KEY"]
|
82 |
p1 = get_plain_pipeline()
|
83 |
p2 = get_ret_aug_pipeline()
|
84 |
-
|
85 |
-
return p1, p2
|
86 |
|
87 |
|
88 |
def main():
|
|
|
18 |
)
|
19 |
|
20 |
def get_plain_pipeline():
|
21 |
+
prompt_open_ai = PromptModel(model_name_or_path="text-davinci-003", api_key=st.secrets["OPENAI_API_KEY"])
|
22 |
|
23 |
# Now let make one PromptNode use the default model and the other one the OpenAI model:
|
24 |
plain_llm_template = PromptTemplate(name="plain_llm", prompt_text="Answer the following question: $query")
|
|
|
47 |
"$query; Answer:",
|
48 |
)
|
49 |
# Let's initiate the PromptNode
|
50 |
+
node = PromptNode("text-davinci-003", default_prompt_template=default_template,
|
51 |
+
api_key=st.secrets["OPENAI_API_KEY"], max_length=500)
|
52 |
|
53 |
# Let's create a pipeline with Shaper and PromptNode
|
54 |
pipe = Pipeline()
|
|
|
68 |
"$query; Answer:",
|
69 |
)
|
70 |
# Let's initiate the PromptNode
|
71 |
+
node = PromptNode("text-davinci-003", default_prompt_template=default_template,
|
72 |
+
api_key=st.secrets["OPENAI_API_KEY"], max_length=500)
|
73 |
# Let's create a pipeline with Shaper and PromptNode
|
74 |
pipe = Pipeline()
|
75 |
pipe.add_node(component=web_retriever, name='retriever', inputs=['Query'])
|
|
|
77 |
pipe.add_node(component=node, name="prompt_node", inputs=["shaper"])
|
78 |
return pipe
|
79 |
|
|
|
80 |
def app_init():
|
|
|
81 |
os.environ["OPENAI_API_KEY"] = st.secrets["OPENAI_API_KEY"]
|
82 |
p1 = get_plain_pipeline()
|
83 |
p2 = get_ret_aug_pipeline()
|
84 |
+
p3 = get_web_ret_pipeline()
|
85 |
+
return p1, p2, p3
|
86 |
|
87 |
|
88 |
def main():
|