File size: 590 Bytes
b884933
 
 
f16688d
 
b884933
 
f16688d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)