from langchain.llms import OpenAI from dotenv import load_dotenv import streamlit as st import os load_dotenv() OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY") def get_openai_response(question): llm = OpenAI(openai_api_key = OPENAI_API_KEY, model_name="gpt-3.5-turbo-instruct", temperature=0.6) response = llm(question) return response # Initialize streamlit app st.set_page_config(page_title = "Q&A chatbot") st.header("Langchain Application") input = st.text_input("Input: ", key="input") response = get_openai_response(input) submit = st.button("Ask the question") if submit: st.subheader("The response is: ") st.write(response)