Spaces:
Sleeping
Sleeping
import os | |
from pdfminer.high_level import extract_text | |
from langchain_astradb import AstraDBVectorStore | |
from langchain_core.prompts import PromptTemplate | |
from langchain_openai import OpenAIEmbeddings | |
from langchain_anthropic import ChatAnthropic | |
from langchain_google_genai import ChatGoogleGenerativeAI | |
ASTRA_DB_API_ENDPOINT = os.environ["ASTRA_DB_API_ENDPOINT"] | |
ASTRA_DB_APPLICATION_TOKEN = os.environ["ASTRA_DB_APPLICATION_TOKEN"] | |
OPENAI_API_KEY = os.environ["OPENAI_API_KEY"] | |
ANTHROPIC_API_KEY = os.environ["ANTHROPIC_API_KEY"] | |
GOOGLE_API_KEY = os.environ["GOOGLE_API_KEY"] | |
collection_name = "ilj_test" | |
embedding = OpenAIEmbeddings(model="text-embedding-ada-002") | |
models = { | |
"claude-3": ChatAnthropic(model='claude-3-sonnet-20240229'), | |
"gemini-pro": ChatGoogleGenerativeAI(model="gemini-1.5-pro-latest", temperature=0.0) | |
} | |
def model_names(): | |
return models.keys() | |
def pipeline(file, model_name, balance_type, apsn_transactions, max_fees_per_day, min_overdrawn_fee, min_transaction_overdraft): | |
disclosure_text = extract_text(file) | |
astra = AstraDBVectorStore( | |
api_endpoint=ASTRA_DB_API_ENDPOINT, | |
token=ASTRA_DB_APPLICATION_TOKEN, | |
collection_name=collection_name, | |
embedding=embedding | |
) | |
related_docs = astra.search(disclosure_text, search_type="similarity") | |
prompt = PromptTemplate.from_template( | |
""" | |
law context: | |
20-cv-12061 08-23-2021 | |
Veronica Gardner, Plaintiff, v. Flagstar Bank, FSB, Defendant. | |
GERSHWIN A. DRAIN, UNITED STATES DISTRICT JUDGE | |
OPINION AND ORDER GRANTING IN PART AND DENYING IN PART DEFENDANT'S MOTION TO DISMISS [#18] | |
GERSHWIN A. DRAIN, UNITED STATES DISTRICT JUDGE | |
I. Introduction | |
On July 31, 2020, Plaintiff Veronica Gardner brought the instant action on behalf of herself and all others similarly situated against Defendant Flagstar Bank, FSB (“Flagstar” or “Bank”). ECF No. 1. Plaintiff filed her First Amended Complaint on October 6, 2020 and alleges that Defendant unlawfully assesses and collects overdraft fees on transactions, sometimes multiple times, in violation of the contract between the parties. Id. Plaintiff brings two state law claims for breach of contract and conversion. Id. | |
Presently before the Court is Defendant's Motion to Dismiss. ECF No. 18. This matter is fully briefed. ECF Nos. 20, 23. Plaintiff also filed two Notices of Supplemental Authority. ECF Nos. 26 | |
Tims v. LGE Cmty. Credit Union 935 F.3d 1228 (11th Cir. 2019) | |
have considered the matter. See Salls v. Dig. Fed. Credit Union , 349 F. Supp. 3d 81, 91 (D. Mass 2018) (collecting cases). | |
Tims's complaint challenged the substance of LGE's Opt-In Agreement. Because the safe harbor does not protect financial institutions from challenges to the substance of Opt-In Agreements, Tims's EFTA claim survives a motion to dismiss, and the district court erred in granting the motion. | |
IV. CONCLUSION | |
For the foregoing reasons, we reverse the district court's order granting LGE's motion to dismiss and remand for further proceedings consistent with this opinion. | |
REVERSED AND REMANDED. | |
13 | |
-------- | |
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. | |
Here are the answers to the bank's policy questions: | |
Do you charge on available balance or ledger balance?: {balance_type} | |
Do you charge for APSN transactions?: {apsn_transactions} | |
How many overdraft fees per day can be charged?: {max_fees_per_day} | |
What is the minimum amount overdrawn to incur a fee?: {min_overdrawn_fee} | |
What is the minimum transaction amount to trigger an overdraft?: {min_transaction_overdraft} | |
Please output in the following format: | |
{{entire disclosure text}} | |
------ | |
{{reasons_for_changes}} | |
""" | |
) | |
val = prompt.format( | |
context=related_docs, | |
disclosure=disclosure_text, | |
balance_type=balance_type, | |
apsn_transactions=apsn_transactions, | |
max_fees_per_day=max_fees_per_day, | |
min_overdrawn_fee=min_overdrawn_fee, | |
min_transaction_overdraft=min_transaction_overdraft, | |
) | |
chat_response = models[model_name].invoke(input=val) | |
return chat_response.content | |