justice_leauge_client_bot / Prompts_and_Chains.py
Shashank1406's picture
Update Prompts_and_Chains.py
9377e98 verified
# ******* THIS FILE CONTAINS ALL THE PROMPTS & CHAINS USED IN Functions.py ***********
from Templates import *
from langchain import PromptTemplate
from langchain.chains import LLMChain
from langchain.llms import OpenAI
from dotenv import load_dotenv
import os
class PromptTemplates:
def __init__(self):
self.legal_adviser_bot_prompt = PromptTemplate(
input_variables=["chat_history","input",], template=legal_adviser_template
)
self.lawyer_recommendations_prompt = PromptTemplate(
input_variables=["user_inputs", "matching_lawyers","additional_info"], template=lawyer_recommendation_template
)
class LLMChains:
def __init__(self):
load_dotenv()
openai_api_key = os.getenv("OPENAI_API_KEY")
obj = PromptTemplates()
# generate summary chain
self.legal_adviser_bot_chain = LLMChain(
llm=OpenAI(model_name='gpt-3.5-turbo-16k',api_key=os.environ.get('OPEN_API_KEY'), temperature=0.7),
prompt=obj.legal_adviser_bot_prompt,
verbose="true",
)
self.lawyer_recommendations_chain = LLMChain(
llm=OpenAI(model_name="gpt-3.5-turbo-16k",api_key=os.environ.get('OPEN_API_KEY'), temperature=0.7),
prompt=obj.lawyer_recommendations_prompt,
verbose="true",
)