ofermend commited on
Commit
99fb1b8
·
1 Parent(s): d462d83
Files changed (3) hide show
  1. agent.py +2 -5
  2. app.py +5 -2
  3. requirements.txt +1 -1
agent.py CHANGED
@@ -140,7 +140,7 @@ def create_assistant_tools(cfg):
140
  class QueryCaselawArgs(BaseModel):
141
  query: str = Field(..., description="The user query.")
142
  citations: Optional[str] = Field(default = None,
143
- description = "The citation of the case. Optional.",
144
  examples = ['253 P.2d 136', '10 Alaska 11', '6 C.M.A. 3'])
145
 
146
  vec_factory = VectaraToolFactory(vectara_api_key=cfg.api_key,
@@ -151,12 +151,9 @@ def create_assistant_tools(cfg):
151
  ask_caselaw = vec_factory.create_rag_tool(
152
  tool_name = "ask_caselaw",
153
  tool_description = """
 
154
  Returns a response (str) to the user query base on case law in the state of Alaska.
155
  If 'citations' is provided, filters the response based on information from that case.
156
- The response includes metadata about the case such as title/name the ruling, the court,
157
- the decision date, the judges, and the case citation.
158
- You can use case citations from the metadata as input to other tools.
159
- Use this tool for general case law queries.
160
  """,
161
  tool_args_schema = QueryCaselawArgs,
162
  reranker = "multilingual_reranker_v1", rerank_k = 100,
 
140
  class QueryCaselawArgs(BaseModel):
141
  query: str = Field(..., description="The user query.")
142
  citations: Optional[str] = Field(default = None,
143
+ description = "The citations of the case. Optional.",
144
  examples = ['253 P.2d 136', '10 Alaska 11', '6 C.M.A. 3'])
145
 
146
  vec_factory = VectaraToolFactory(vectara_api_key=cfg.api_key,
 
151
  ask_caselaw = vec_factory.create_rag_tool(
152
  tool_name = "ask_caselaw",
153
  tool_description = """
154
+ Use this tool for general case law queries.
155
  Returns a response (str) to the user query base on case law in the state of Alaska.
156
  If 'citations' is provided, filters the response based on information from that case.
 
 
 
 
157
  """,
158
  tool_args_schema = QueryCaselawArgs,
159
  reranker = "multilingual_reranker_v1", rerank_k = 100,
app.py CHANGED
@@ -2,6 +2,8 @@ from PIL import Image
2
  import sys
3
  import uuid
4
 
 
 
5
 
6
  import streamlit as st
7
  from streamlit_pills import pills
@@ -38,7 +40,7 @@ def update_func(status_type: AgentStatusType, msg: str):
38
  output = f"{status_type.value} - {msg}"
39
  st.session_state.log_messages.append(output)
40
 
41
- def launch_bot():
42
  def reset():
43
  st.session_state.messages = [{"role": "assistant", "content": initial_prompt, "avatar": "🦖"}]
44
  st.session_state.thinking_message = "Agent at work..."
@@ -155,4 +157,5 @@ def launch_bot():
155
 
156
  if __name__ == "__main__":
157
  st.set_page_config(page_title="Legal Assistant", layout="wide")
158
- launch_bot()
 
 
2
  import sys
3
  import uuid
4
 
5
+ import nest_asyncio
6
+ import asyncio
7
 
8
  import streamlit as st
9
  from streamlit_pills import pills
 
40
  output = f"{status_type.value} - {msg}"
41
  st.session_state.log_messages.append(output)
42
 
43
+ async def launch_bot():
44
  def reset():
45
  st.session_state.messages = [{"role": "assistant", "content": initial_prompt, "avatar": "🦖"}]
46
  st.session_state.thinking_message = "Agent at work..."
 
157
 
158
  if __name__ == "__main__":
159
  st.set_page_config(page_title="Legal Assistant", layout="wide")
160
+ nest_asyncio.apply()
161
+ asyncio.run(launch_bot())
requirements.txt CHANGED
@@ -6,4 +6,4 @@ streamlit-feedback==0.1.3
6
  uuid==1.30
7
  langdetect==1.0.9
8
  langcodes==3.4.0
9
- vectara-agentic==0.1.5
 
6
  uuid==1.30
7
  langdetect==1.0.9
8
  langcodes==3.4.0
9
+ vectara-agentic==0.1.6