ofermend commited on
Commit
2870a7d
·
1 Parent(s): e9df125

updated reqs

Browse files
Files changed (3) hide show
  1. agent.py +6 -4
  2. requirements.txt +3 -2
  3. utils.py +4 -1
agent.py CHANGED
@@ -175,7 +175,7 @@ def create_assistant_tools(cfg):
175
 
176
  ask_caselaw = vec_factory.create_rag_tool(
177
  tool_name = "ask_caselaw",
178
- tool_description = "A tool for asking questions about case law in Alaska.",
179
  tool_args_schema = QueryCaselawArgs,
180
  reranker = "chain", rerank_k = 100,
181
  rerank_chain = [
@@ -195,7 +195,7 @@ def create_assistant_tools(cfg):
195
  n_sentences_before = 2, n_sentences_after = 2, lambda_val = 0.005,
196
  summary_num_results = 15,
197
  vectara_summarizer = summarizer,
198
- include_citations = False,
199
  )
200
 
201
  tools_factory = ToolsFactory()
@@ -232,8 +232,9 @@ def initialize_agent(_cfg, agent_progress_callback=None):
232
  Do not use your own knowledge to answer questions.
233
  - If the ask_caselaw tool responds that it does not have enough information to answer the query,
234
  try to rephrase the query and call the tool again.
235
- - When presenting the output from ask_caselaw tool, use the metadata provided in the tool's response (references).
236
- For example you can include citations, decision date, or case name.
 
237
  - Citations include 3 components: volume number, reporter, and first page.
238
  Here are some examples: '253 P.2d 136', '10 Alaska 11', '6 C.M.A. 3'
239
  - Never use your internal knowledge to guess citations. Only use citations information provided by a tool or the user.
@@ -259,4 +260,5 @@ def initialize_agent(_cfg, agent_progress_callback=None):
259
  custom_instructions=legal_assistant_instructions,
260
  agent_progress_callback=agent_progress_callback,
261
  )
 
262
  return agent
 
175
 
176
  ask_caselaw = vec_factory.create_rag_tool(
177
  tool_name = "ask_caselaw",
178
+ tool_description = "A tool for asking questions about case law in Alaska. ",
179
  tool_args_schema = QueryCaselawArgs,
180
  reranker = "chain", rerank_k = 100,
181
  rerank_chain = [
 
195
  n_sentences_before = 2, n_sentences_after = 2, lambda_val = 0.005,
196
  summary_num_results = 15,
197
  vectara_summarizer = summarizer,
198
+ include_citations = True,
199
  )
200
 
201
  tools_factory = ToolsFactory()
 
232
  Do not use your own knowledge to answer questions.
233
  - If the ask_caselaw tool responds that it does not have enough information to answer the query,
234
  try to rephrase the query and call the tool again.
235
+ - If the ask_caselaw tool returns a response along with a ist of references mentioned in its response (in [N] format),
236
+ Format your response to focus on the main response, and use the metadata (such as citations, decision date, or case name)
237
+ in each relevant reference to provide more context in your response.
238
  - Citations include 3 components: volume number, reporter, and first page.
239
  Here are some examples: '253 P.2d 136', '10 Alaska 11', '6 C.M.A. 3'
240
  - Never use your internal knowledge to guess citations. Only use citations information provided by a tool or the user.
 
260
  custom_instructions=legal_assistant_instructions,
261
  agent_progress_callback=agent_progress_callback,
262
  )
263
+ agent.report()
264
  return agent
requirements.txt CHANGED
@@ -1,9 +1,10 @@
1
  omegaconf==2.3.0
2
  python-dotenv==1.0.1
3
- streamlit==1.39.0
4
  streamlit_pills==0.3.0
5
  streamlit-feedback==0.1.3
6
  uuid==1.30
7
  langdetect==1.0.9
8
  langcodes==3.4.0
9
- vectara-agentic==0.1.19
 
 
1
  omegaconf==2.3.0
2
  python-dotenv==1.0.1
3
+ streamlit==1.41.1
4
  streamlit_pills==0.3.0
5
  streamlit-feedback==0.1.3
6
  uuid==1.30
7
  langdetect==1.0.9
8
  langcodes==3.4.0
9
+ vectara-agentic==0.1.21
10
+ anthropic==0.40.0
utils.py CHANGED
@@ -31,8 +31,11 @@ def thumbs_feedback(feedback, **kwargs):
31
 
32
  def send_amplitude_data(user_query, bot_response, demo_name, feedback=None):
33
  # Send query and response to Amplitude Analytics
 
 
 
34
  data = {
35
- "api_key": os.getenv('AMPLITUDE_TOKEN'),
36
  "events": [{
37
  "device_id": st.session_state.device_id,
38
  "event_type": "submitted_query",
 
31
 
32
  def send_amplitude_data(user_query, bot_response, demo_name, feedback=None):
33
  # Send query and response to Amplitude Analytics
34
+ amplitude_token = os.environ.get('AMPLITUDE_TOKEN', None)
35
+ if amplitude_token is None:
36
+ return
37
  data = {
38
+ "api_key": amplitude_token,
39
  "events": [{
40
  "device_id": st.session_state.device_id,
41
  "event_type": "submitted_query",