legaltextai commited on
Commit
a5522ed
·
verified ·
1 Parent(s): d9b5c1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -63,7 +63,17 @@ def extract_text_from_link(url):
63
 
64
  @st.cache_data(ttl=3600)
65
  def get_summary(text):
66
- prompt = f'''{HUMAN_PROMPT}
 
 
 
 
 
 
 
 
 
 
67
  You are a law professor specialized in legal writing and legal research.
68
  Summarize the case in {text} in json format according to the following requirements:
69
  Facts (name of the case and its parties, what happened factually).
@@ -79,15 +89,9 @@ def get_summary(text):
79
  - 'blue flag' means the case has been appealed to the U.S. Court of Appeals or the U.S. Supreme Court (excluding appeals originating from agencies).
80
 
81
  Present the summary in json format.
82
- {AI_PROMPT}'''
83
- completion = anthropic.completions.create(
84
- #model="claude-2",
85
- model = "claude-instant-1.2",
86
- max_tokens_to_sample=2000,
87
- prompt=prompt,
88
- )
89
- response = completion.completion
90
- return response
91
 
92
  search_query = st.text_input("case name, e.g. brown v board supreme, 372 US 335, google v oracle appeal")
93
 
 
63
 
64
  @st.cache_data(ttl=3600)
65
  def get_summary(text):
66
+
67
+ message = client.messages.create(
68
+ model = "claude-instant-1.2",
69
+ max_tokens_to_sample=2000,
70
+ messages=[
71
+ {
72
+ "role": "user",
73
+ "content": [
74
+ {
75
+ "type": "text",
76
+ "text": f'''
77
  You are a law professor specialized in legal writing and legal research.
78
  Summarize the case in {text} in json format according to the following requirements:
79
  Facts (name of the case and its parties, what happened factually).
 
89
  - 'blue flag' means the case has been appealed to the U.S. Court of Appeals or the U.S. Supreme Court (excluding appeals originating from agencies).
90
 
91
  Present the summary in json format.
92
+ '''
93
+ ]
94
+ return message.content
 
 
 
 
 
 
95
 
96
  search_query = st.text_input("case name, e.g. brown v board supreme, 372 US 335, google v oracle appeal")
97