Spaces:
Sleeping
Sleeping
Commit
·
fbf5201
1
Parent(s):
daa3b07
stable v1
Browse files
app.py
CHANGED
|
@@ -47,9 +47,9 @@ class PineconeSearch:
|
|
| 47 |
|
| 48 |
def __call__(self,query):
|
| 49 |
docs = self.docsearch.similarity_search(query=query, k=self.topk)
|
| 50 |
-
context = ""
|
| 51 |
for doc in docs:
|
| 52 |
-
context += f"Content:\n{doc.page_content}\n"
|
| 53 |
context += f"Source: {doc.metadata['url']}\n"
|
| 54 |
context += "----"
|
| 55 |
return context
|
|
@@ -83,8 +83,8 @@ def print_token_and_price(response):
|
|
| 83 |
print(f"Total price: {price*370:.2f} Ft")
|
| 84 |
print("===================================")
|
| 85 |
|
| 86 |
-
agent_prompt = """You are an expert research assistant. You
|
| 87 |
-
|
| 88 |
|
| 89 |
|
| 90 |
def stream(input_text, history, user_prompt, topic, topk) -> Generator:
|
|
@@ -98,7 +98,6 @@ def stream(input_text, history, user_prompt, topic, topk) -> Generator:
|
|
| 98 |
|
| 99 |
response = call_openai(
|
| 100 |
messages=[{"role": "system", "content": agent_prompt},
|
| 101 |
-
{"role": "system", "content": user_prompt},
|
| 102 |
{"role": "user", "content": input_text},
|
| 103 |
{"role": "system", "content": tool_resp}
|
| 104 |
],
|
|
@@ -144,7 +143,7 @@ def ask_llm(message, history, prompt, topic, topk):
|
|
| 144 |
agent_prompt_textbox = gr.Textbox(
|
| 145 |
label = "Set the behaviour of the agent",
|
| 146 |
lines = 2,
|
| 147 |
-
value = "
|
| 148 |
)
|
| 149 |
namespace_drobdown = gr.Dropdown(
|
| 150 |
["1_D3_receptor", "2_dopamine", "3_mitochondrial"],
|
|
|
|
| 47 |
|
| 48 |
def __call__(self,query):
|
| 49 |
docs = self.docsearch.similarity_search(query=query, k=self.topk)
|
| 50 |
+
context = "ARTICLES:\n\n"
|
| 51 |
for doc in docs:
|
| 52 |
+
context += f"Content:\n{doc.page_content}\n\n"
|
| 53 |
context += f"Source: {doc.metadata['url']}\n"
|
| 54 |
context += "----"
|
| 55 |
return context
|
|
|
|
| 83 |
print(f"Total price: {price*370:.2f} Ft")
|
| 84 |
print("===================================")
|
| 85 |
|
| 86 |
+
agent_prompt = """You are an expert research assistant. You will recieve informations about articles. Use only these informations, be factual and do not invent!
|
| 87 |
+
Make your brief answer in short. Point out the facts appear in the articles and quote the sources in [bracket]."""
|
| 88 |
|
| 89 |
|
| 90 |
def stream(input_text, history, user_prompt, topic, topk) -> Generator:
|
|
|
|
| 98 |
|
| 99 |
response = call_openai(
|
| 100 |
messages=[{"role": "system", "content": agent_prompt},
|
|
|
|
| 101 |
{"role": "user", "content": input_text},
|
| 102 |
{"role": "system", "content": tool_resp}
|
| 103 |
],
|
|
|
|
| 143 |
agent_prompt_textbox = gr.Textbox(
|
| 144 |
label = "Set the behaviour of the agent",
|
| 145 |
lines = 2,
|
| 146 |
+
value = "NOT WORKING"
|
| 147 |
)
|
| 148 |
namespace_drobdown = gr.Dropdown(
|
| 149 |
["1_D3_receptor", "2_dopamine", "3_mitochondrial"],
|