Leaders / app.py
Bullet500's picture
Create app.py
11cfde0 verified
raw
history blame
1.32 kB
import streamlit as st #deployment
from langchain.chains.llm import LLMChain #individual chain
from langchain.chains.sequential import SequentialChain #combine chains
from langchain_groq import ChatGroq # llm model
from langchain.prompts import PromptTemplate #prompt for query
st.title('LEADER DATABASE') #title
leader_name=st.text_input('Enter The Famous leader_name from India.')
sub=st.button('SUBMIT')
LLM_model=ChatGroq(temperature=0.6,
groq_api_key='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')
prompt1=PromptTemplate(input=['A'],
template='tell me about {A} in 20 words.')
chain1=LLMChain(llm=LLM_model,prompt=prompt1,output_key='person')
prompt2=PromptTemplate(input=['person'],
template='what is date of birth of this {person}.')
chain2=LLMChain(llm=LLM_model,prompt=prompt2,output_key='dob')
prompt3=PromptTemplate(input=['dob'],
template='mention how many time win elections {dob}.')
chain3=LLMChain(llm=LLM_model,prompt=prompt3,output_key='election win')
#combine all the chains in sequence
parent=SequentialChain(chains=[chain1,chain2,chain3],
input_variables=['A'],
output_variables=['person','dob','election win']
)