HiroJ commited on
Commit
b5d8e30
·
unverified ·
1 Parent(s): f3f6178

Adjusting wrong model and prompt

Browse files
Files changed (2) hide show
  1. custom_agent.py +8 -7
  2. langgraph_agent.py +0 -0
custom_agent.py CHANGED
@@ -13,8 +13,11 @@ import os
13
  load_dotenv(find_dotenv())
14
 
15
  DEFAULT_PROMPT = """
16
- You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
17
-
 
 
 
18
  """
19
 
20
 
@@ -130,8 +133,6 @@ class CustomAgent:
130
  self.embeddings = HuggingFaceEmbeddings(
131
  model_name="sentence-transformers/all-mpnet-base-v2"
132
  )
133
- print(os.environ.get("SUPABASE_URL"))
134
- print(os.environ.get("SUPABASE_SERVICE_KEY"))
135
 
136
  self.supabase: Client = create_client(
137
  os.environ.get("SUPABASE_URL"), os.environ.get("SUPABASE_SERVICE_ROLE_KEY")
@@ -146,7 +147,7 @@ class CustomAgent:
146
 
147
  # Create the agent
148
  self.agent = create_react_agent(
149
- model="openai:gpt-4-1106-preview",
150
  tools=[
151
  web_search,
152
  add,
@@ -164,7 +165,7 @@ class CustomAgent:
164
  """Retriever"""
165
  similar_question = self.vector_store.similarity_search(query)
166
  return HumanMessage(
167
- content=f"Here I provide a similar question and answer for reference: \n\n{similar_question[0].page_content}",
168
  )
169
 
170
  def __call__(self, question: str) -> str:
@@ -191,5 +192,5 @@ class CustomAgent:
191
  if __name__ == "__main__":
192
  agent = CustomAgent()
193
  agent(
194
- 'What was the volume in m^3 of the fish bag that was calculated in the University of Leicester paper "Can Hiccup Supply Enough Fish to Maintain a Dragon\u2019s Diet?"'
195
  )
 
13
  load_dotenv(find_dotenv())
14
 
15
  DEFAULT_PROMPT = """
16
+ You are a helpful assistant tasked with answering questions using a set of tools.
17
+ Now, I will ask you a question. Report your thoughts, and finish your answer with the following template:
18
+ FINAL ANSWER: [YOUR FINAL ANSWER].
19
+ YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
20
+ Your answer should only start with "FINAL ANSWER: ", then follows with the answer.
21
  """
22
 
23
 
 
133
  self.embeddings = HuggingFaceEmbeddings(
134
  model_name="sentence-transformers/all-mpnet-base-v2"
135
  )
 
 
136
 
137
  self.supabase: Client = create_client(
138
  os.environ.get("SUPABASE_URL"), os.environ.get("SUPABASE_SERVICE_ROLE_KEY")
 
147
 
148
  # Create the agent
149
  self.agent = create_react_agent(
150
+ model="openai:gpt-4.1",
151
  tools=[
152
  web_search,
153
  add,
 
165
  """Retriever"""
166
  similar_question = self.vector_store.similarity_search(query)
167
  return HumanMessage(
168
+ content=f"Here I provide a similar question and answer for reference, you can use it to answer the question: \n\n{similar_question[0].page_content}",
169
  )
170
 
171
  def __call__(self, question: str) -> str:
 
192
  if __name__ == "__main__":
193
  agent = CustomAgent()
194
  agent(
195
+ "How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia."
196
  )
langgraph_agent.py DELETED
File without changes