im
commited on
Commit
·
3a120e2
1
Parent(s):
6f0fc7c
turn off search, upgrade model to gpt-4o and increase the proofread depth
Browse files- app.py +4 -2
- socratic.py +4 -2
- tool.py +2 -1
app.py
CHANGED
|
@@ -30,7 +30,7 @@ def init_session() -> None:
|
|
| 30 |
st.session_state.theaetetus = SocraticGPT(role=THEAETETUS, tools=st.session_state.agent._tools,
|
| 31 |
key=st.session_state.key, n_round=N_ROUND)
|
| 32 |
st.session_state.plato = SocraticGPT(role=PLATO, tools=st.session_state.agent._tools, key=st.session_state.key,
|
| 33 |
-
n_round=N_ROUND
|
| 34 |
st.session_state.dialog_lead = None
|
| 35 |
st.session_state.dialog_follower = None
|
| 36 |
st.session_state.messages = []
|
|
@@ -227,4 +227,6 @@ if __name__ == "__main__":
|
|
| 227 |
|
| 228 |
# TODO: publish/access dialog debug logs, so the user can dig into the details
|
| 229 |
# TODO: possible answers to the question - like 'double check your answer' or 'make the answer sound like a pirate' etc
|
| 230 |
-
# TODO: get rid of autogenerated 'Footnote' header in agent's references
|
|
|
|
|
|
|
|
|
| 30 |
st.session_state.theaetetus = SocraticGPT(role=THEAETETUS, tools=st.session_state.agent._tools,
|
| 31 |
key=st.session_state.key, n_round=N_ROUND)
|
| 32 |
st.session_state.plato = SocraticGPT(role=PLATO, tools=st.session_state.agent._tools, key=st.session_state.key,
|
| 33 |
+
n_round=N_ROUND)
|
| 34 |
st.session_state.dialog_lead = None
|
| 35 |
st.session_state.dialog_follower = None
|
| 36 |
st.session_state.messages = []
|
|
|
|
| 227 |
|
| 228 |
# TODO: publish/access dialog debug logs, so the user can dig into the details
|
| 229 |
# TODO: possible answers to the question - like 'double check your answer' or 'make the answer sound like a pirate' etc
|
| 230 |
+
# TODO: get rid of autogenerated 'Footnote' header in agent's references
|
| 231 |
+
# TODO: handle rate limit reject, e.g. Limit: 10000 / min. Please try again in 6ms. - it's easy to wait for 6 ms. explicitly prompt it or ask Plato
|
| 232 |
+
# TODO: streaming response https://github.com/langchain-ai/streamlit-agent/blob/main/streamlit_agent/basic_streaming.py
|
socratic.py
CHANGED
|
@@ -11,7 +11,7 @@ SOCRATES = "Socrates"
|
|
| 11 |
THEAETETUS = "Theaetetus"
|
| 12 |
PLATO = "Plato"
|
| 13 |
class SocraticGPT:
|
| 14 |
-
def __init__(self, role, tools, key, n_round=10, model="gpt-
|
| 15 |
self.role = role
|
| 16 |
self.model = model
|
| 17 |
self.n_round = n_round
|
|
@@ -43,7 +43,9 @@ class SocraticGPT:
|
|
| 43 |
- Detail the logical steps they took to arrive at their final answer.
|
| 44 |
- Use the agent to perform specific operations.
|
| 45 |
- Asses critically your way of thinking. Apply critical thinking.
|
|
|
|
| 46 |
- Conclude with a final statement that directly answers the problem.
|
|
|
|
| 47 |
|
| 48 |
Their final answer should be concise and free from logical errors, such as false dichotomy, hasty generalization, and circular reasoning.
|
| 49 |
Immediately provide the answer if nobody has objections to the solution. If they encounter any issues with the validity of their answer, they should re-evaluate their reasoning and calculations. Before providing the final answer, every participant has to accept the solution or reject it with a clear explaination. Do not provide the answer if someone has reasonable objections to it.
|
|
@@ -81,7 +83,7 @@ class SocraticGPT:
|
|
| 81 |
self.history.append(AIMessage(content=msg))
|
| 82 |
return msg
|
| 83 |
|
| 84 |
-
def get_proofread(self, temperature=0, history_depth=
|
| 85 |
pf_template = HumanMessage(
|
| 86 |
content=f""" \
|
| 87 |
The above is the conversation between {SOCRATES} and {THEAETETUS} and the agent. They were likely to have made multiple mistakes or not follow guidelines or try inefficient way to solve the problem or incorrectly use the agent.
|
|
|
|
| 11 |
THEAETETUS = "Theaetetus"
|
| 12 |
PLATO = "Plato"
|
| 13 |
class SocraticGPT:
|
| 14 |
+
def __init__(self, role, tools, key, n_round=10, model="gpt-4o"):
|
| 15 |
self.role = role
|
| 16 |
self.model = model
|
| 17 |
self.n_round = n_round
|
|
|
|
| 43 |
- Detail the logical steps they took to arrive at their final answer.
|
| 44 |
- Use the agent to perform specific operations.
|
| 45 |
- Asses critically your way of thinking. Apply critical thinking.
|
| 46 |
+
- Follow {PLATO}'s advises.
|
| 47 |
- Conclude with a final statement that directly answers the problem.
|
| 48 |
+
- If the user provides feedback, then do not answer instantly, discuss the question with other participants.
|
| 49 |
|
| 50 |
Their final answer should be concise and free from logical errors, such as false dichotomy, hasty generalization, and circular reasoning.
|
| 51 |
Immediately provide the answer if nobody has objections to the solution. If they encounter any issues with the validity of their answer, they should re-evaluate their reasoning and calculations. Before providing the final answer, every participant has to accept the solution or reject it with a clear explaination. Do not provide the answer if someone has reasonable objections to it.
|
|
|
|
| 83 |
self.history.append(AIMessage(content=msg))
|
| 84 |
return msg
|
| 85 |
|
| 86 |
+
def get_proofread(self, temperature=0, history_depth=20):
|
| 87 |
pf_template = HumanMessage(
|
| 88 |
content=f""" \
|
| 89 |
The above is the conversation between {SOCRATES} and {THEAETETUS} and the agent. They were likely to have made multiple mistakes or not follow guidelines or try inefficient way to solve the problem or incorrectly use the agent.
|
tool.py
CHANGED
|
@@ -8,6 +8,7 @@ from crawlbase import CrawlingAPI
|
|
| 8 |
import streamlit as st
|
| 9 |
|
| 10 |
|
|
|
|
| 11 |
client = Metaphor(api_key=st.secrets["METAPHOR_API_KEY"])
|
| 12 |
|
| 13 |
@tool
|
|
@@ -72,5 +73,5 @@ def scrape_page_and_return_the_content_directly(url: str):
|
|
| 72 |
def get_tools():
|
| 73 |
wikipedia = WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper())
|
| 74 |
wikipedia.description = wikipedia.description + " Prioritise this tool if you want to learn about facts."
|
| 75 |
-
return [scrape_page,
|
| 76 |
# return [scrape_page]
|
|
|
|
| 8 |
import streamlit as st
|
| 9 |
|
| 10 |
|
| 11 |
+
#TODO: replace search with something else
|
| 12 |
client = Metaphor(api_key=st.secrets["METAPHOR_API_KEY"])
|
| 13 |
|
| 14 |
@tool
|
|
|
|
| 73 |
def get_tools():
|
| 74 |
wikipedia = WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper())
|
| 75 |
wikipedia.description = wikipedia.description + " Prioritise this tool if you want to learn about facts."
|
| 76 |
+
return [scrape_page, wikipedia, scrape_page_and_return_the_content_directly]
|
| 77 |
# return [scrape_page]
|