JulsdL commited on
Commit
ead288d
·
1 Parent(s): deeba11

Updated Quiz Agent prompt

Browse files
aims_tutor/document_processing.py CHANGED
@@ -13,7 +13,7 @@ load_dotenv()
13
 
14
  # Configuration for OpenAI
15
  OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
16
- openai_chat_model = ChatOpenAI(model="gpt-4-turbo", temperature=0.1)
17
 
18
  class DocumentManager:
19
  """
@@ -82,7 +82,7 @@ class DocumentManager:
82
 
83
  qdrant_vectorstore = Qdrant.from_documents(split_chunks, embedding_model, location=":memory:", collection_name="Notebook")
84
 
85
- qdrant_retriever = qdrant_vectorstore.as_retriever() # Set the Qdrant vector store as a retriever
86
 
87
  multiquery_retriever = MultiQueryRetriever.from_llm(retriever=qdrant_retriever, llm=openai_chat_model, include_original=True) # Create a multi-query retriever on top of the Qdrant retriever
88
 
 
13
 
14
  # Configuration for OpenAI
15
  OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
16
+ openai_chat_model = ChatOpenAI(model="gpt-4o", temperature=0.1)
17
 
18
  class DocumentManager:
19
  """
 
82
 
83
  qdrant_vectorstore = Qdrant.from_documents(split_chunks, embedding_model, location=":memory:", collection_name="Notebook")
84
 
85
+ qdrant_retriever = qdrant_vectorstore.as_retriever()
86
 
87
  multiquery_retriever = MultiQueryRetriever.from_llm(retriever=qdrant_retriever, llm=openai_chat_model, include_original=True) # Create a multi-query retriever on top of the Qdrant retriever
88
 
aims_tutor/graph.py CHANGED
@@ -40,12 +40,10 @@ def generate_quiz(
40
  num_questions: Annotated[int, "Number of questions to generate"] = 5
41
  ) -> Annotated[List[dict], "List of quiz questions"]:
42
  """Generate a quiz based on the provided documents."""
43
- # Placeholder logic for quiz generation
44
- # In a real scenario, you'd use NLP techniques to generate questions
45
  questions = [{"question": f"Question {i+1}", "options": ["Option 1", "Option 2", "Option 3"], "answer": "Option 1"} for i in range(num_questions)]
46
  return questions
47
 
48
- # Define a function to create agents
49
  def create_agent(
50
  llm: ChatOpenAI,
51
  tools: list,
@@ -70,12 +68,12 @@ def create_agent(
70
  executor = AgentExecutor(agent=agent, tools=tools)
71
  return executor
72
 
73
- # Define a function to create agent nodes
74
  def agent_node(state, agent, name):
75
  result = agent.invoke(state)
76
  return {"messages": state["messages"] + [AIMessage(content=result["output"], name=name)]}
77
 
78
- # Define a function to create the supervisor
79
  def create_team_supervisor(llm: ChatOpenAI, system_prompt, members) -> AgentExecutor:
80
  """An LLM-based router."""
81
  options = ["WAIT", "FINISH"] + members
@@ -138,8 +136,9 @@ def create_aims_chain(retrieval_chain):
138
  quiz_agent = create_agent(
139
  llm,
140
  [generate_quiz, retrieve_information_tool],
141
- "You are a quiz creator that generates quizzes based on the provided notebook content.",
142
  )
 
143
  quiz_node = functools.partial(agent_node, agent=quiz_agent, name="QuizAgent")
144
 
145
  # Create Supervisor Agent
 
40
  num_questions: Annotated[int, "Number of questions to generate"] = 5
41
  ) -> Annotated[List[dict], "List of quiz questions"]:
42
  """Generate a quiz based on the provided documents."""
 
 
43
  questions = [{"question": f"Question {i+1}", "options": ["Option 1", "Option 2", "Option 3"], "answer": "Option 1"} for i in range(num_questions)]
44
  return questions
45
 
46
+ # Function to create agents
47
  def create_agent(
48
  llm: ChatOpenAI,
49
  tools: list,
 
68
  executor = AgentExecutor(agent=agent, tools=tools)
69
  return executor
70
 
71
+ # Function to create agent nodes
72
  def agent_node(state, agent, name):
73
  result = agent.invoke(state)
74
  return {"messages": state["messages"] + [AIMessage(content=result["output"], name=name)]}
75
 
76
+ # Function to create the supervisor
77
  def create_team_supervisor(llm: ChatOpenAI, system_prompt, members) -> AgentExecutor:
78
  """An LLM-based router."""
79
  options = ["WAIT", "FINISH"] + members
 
136
  quiz_agent = create_agent(
137
  llm,
138
  [generate_quiz, retrieve_information_tool],
139
+ "You are a quiz creator that generates quizzes based on the provided notebook content. Use the retrieval tool to gather context if needed.",
140
  )
141
+
142
  quiz_node = functools.partial(agent_node, agent=quiz_agent, name="QuizAgent")
143
 
144
  # Create Supervisor Agent