import os | |
import streamlit as st | |
from langchain_openai import OpenAI | |
from langchain_core.prompts import ChatPromptTemplate | |
st.title("Chat with your data") | |
inp = st.text_input("Enter your prompt here") | |
llm = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"), temperature=0.2) | |
# prompt = ChatPromptTemplate.from_messages( | |
# [ | |
# ( | |
# "system", | |
# "You are a helpful assistant that answer questions from user.", | |
# ), | |
# ("human", "{input}"), | |
# ] | |
# ) | |
chain = llm | |
if inp: | |
response = chain.invoke(input=inp) | |
st.write(response) | |