Spaces:
Sleeping
Sleeping
anmolsahai
commited on
Commit
•
3a51e49
1
Parent(s):
ef6d86c
text
Browse files- __pycache__/langchain_pipeline.cpython-310.pyc +0 -0
- all_text_OCR.txt +0 -0
- langchain_pipeline.py +21 -35
__pycache__/langchain_pipeline.cpython-310.pyc
CHANGED
Binary files a/__pycache__/langchain_pipeline.cpython-310.pyc and b/__pycache__/langchain_pipeline.cpython-310.pyc differ
|
|
all_text_OCR.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
langchain_pipeline.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import os
|
2 |
-
from pdfminer
|
3 |
from langchain_astradb import AstraDBVectorStore
|
4 |
from langchain_core.prompts import PromptTemplate
|
5 |
from langchain_openai import OpenAIEmbeddings
|
@@ -25,7 +25,12 @@ def model_names():
|
|
25 |
return models.keys()
|
26 |
|
27 |
def pipeline(file, model_name, balance_type, apsn_transactions, max_fees_per_day, min_overdrawn_fee, min_transaction_overdraft):
|
28 |
-
disclosure_text = extract_text(file)
|
|
|
|
|
|
|
|
|
|
|
29 |
astra = AstraDBVectorStore(
|
30 |
api_endpoint=ASTRA_DB_API_ENDPOINT,
|
31 |
token=ASTRA_DB_APPLICATION_TOKEN,
|
@@ -37,44 +42,25 @@ def pipeline(file, model_name, balance_type, apsn_transactions, max_fees_per_day
|
|
37 |
|
38 |
prompt = PromptTemplate.from_template(
|
39 |
"""
|
40 |
-
|
41 |
-
|
42 |
-
United State Dealt a 26 a are Vini
|
43 |
-
liability for Wells Fargo's violations of the
|
44 |
-
"fraudulent" prong of California's Unfair
|
45 |
-
Competition Law is affirmed, and we remand for
|
46 |
-
the district court to determine what relief, if any, is
|
47 |
-
appropriate and consistent with this opinion.
|
48 |
-
10 In lisht of the decision to vacate thel
|
49 |
-
parties' arguments as to the amount of
|
50 |
-
restitution awarded, prejudgment interest,
|
51 |
-
and punitive damages.
|
52 |
-
AFFIRMED in part, REVERSED in part, and
|
53 |
-
REMANDED. Each party shall pay its own fees
|
54 |
-
on appeal.
|
55 |
-
15
|
56 |
-
|
57 |
-
casetext
|
58 |
-
Gutierrez v. Wells Fargo Bank, NA
|
59 |
-
704 F.3d 712 (9th Cir. 2012)
|
60 |
-
--------
|
61 |
|
62 |
-
above are several cases and a bank disclosure. Using the cases, please provide changes to the disclosure and keep as much formatting as possible and to ensure there are no legal contradictions between the content of the disclosure and the cases and please provide reasoning for each proposed change. Please also integrate the bank's policies into the disclosure. In the first sentence, please include a reference to the account agreement "for more information on overdrafts" and a placeholder for a URL. Available balance or ledger balance should replace money in the first sentence.
|
63 |
-
Here are the answers to the bank's policy questions:
|
64 |
-
Do you charge on available balance or ledger balance?: {balance_type}
|
65 |
-
Do you charge for APSN transactions?: {apsn_transactions}
|
66 |
-
How many overdraft fees per day can be charged?: {max_fees_per_day}
|
67 |
-
What is the minimum amount overdrawn to incur a fee?: {min_overdrawn_fee}
|
68 |
-
What is the minimum transaction amount to trigger an overdraft?: {min_transaction_overdraft}
|
69 |
|
70 |
-
Please output in the following format:
|
71 |
-
{{entire disclosure text
|
72 |
-
------
|
73 |
-
{{reasons_for_changes}}
|
74 |
"""
|
75 |
)
|
76 |
val = prompt.format(
|
77 |
-
context=
|
78 |
disclosure=disclosure_text,
|
79 |
balance_type=balance_type,
|
80 |
apsn_transactions=apsn_transactions,
|
|
|
1 |
import os
|
2 |
+
from pdfminer import high_level
|
3 |
from langchain_astradb import AstraDBVectorStore
|
4 |
from langchain_core.prompts import PromptTemplate
|
5 |
from langchain_openai import OpenAIEmbeddings
|
|
|
25 |
return models.keys()
|
26 |
|
27 |
def pipeline(file, model_name, balance_type, apsn_transactions, max_fees_per_day, min_overdrawn_fee, min_transaction_overdraft):
|
28 |
+
disclosure_text = high_level.extract_text(file)
|
29 |
+
|
30 |
+
# Read the legal cases context from the text file
|
31 |
+
with open("all Text OCR.txt", "r") as f:
|
32 |
+
legal_cases_context = f.read()
|
33 |
+
|
34 |
astra = AstraDBVectorStore(
|
35 |
api_endpoint=ASTRA_DB_API_ENDPOINT,
|
36 |
token=ASTRA_DB_APPLICATION_TOKEN,
|
|
|
42 |
|
43 |
prompt = PromptTemplate.from_template(
|
44 |
"""
|
45 |
+
law context:
|
46 |
+
{context}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
above are several cases and a bank disclosure. Using the cases, please provide changes to the disclosure and keep as much formatting as possible and to ensure there are no legal contradictions between the content of the disclosure and the cases and please provide reasoning for each proposed change. Please also integrate the bank's policies into the disclosure. In the first sentence, please include a reference to the account agreement "for more information on overdrafts" and a placeholder for a URL. Available balance or ledger balance should replace money in the first sentence.
|
49 |
+
Here are the answers to the bank's policy questions:
|
50 |
+
Do you charge on available balance or ledger balance?: {balance_type}
|
51 |
+
Do you charge for APSN transactions?: {apsn_transactions}
|
52 |
+
How many overdraft fees per day can be charged?: {max_fees_per_day}
|
53 |
+
What is the minimum amount overdrawn to incur a fee?: {min_overdrawn_fee}
|
54 |
+
What is the minimum transaction amount to trigger an overdraft?: {min_transaction_overdraft}
|
55 |
|
56 |
+
Please output in the following format:
|
57 |
+
{{entire disclosure text}}
|
58 |
+
------
|
59 |
+
{{reasons_for_changes}}
|
60 |
"""
|
61 |
)
|
62 |
val = prompt.format(
|
63 |
+
context=legal_cases_context,
|
64 |
disclosure=disclosure_text,
|
65 |
balance_type=balance_type,
|
66 |
apsn_transactions=apsn_transactions,
|