Spaces:
Sleeping
Sleeping
Update API key
Browse files
app.py
CHANGED
@@ -1,8 +1,11 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
from langchain_openai import OpenAI
|
3 |
|
4 |
# Creating a function for getting the responses from OpenAI
|
5 |
def get_response(question):
|
|
|
|
|
6 |
llm = OpenAI()
|
7 |
answer = llm.invoke(question)
|
8 |
return answer
|
|
|
1 |
+
import keyfile as kf
|
2 |
import streamlit as st
|
3 |
from langchain_openai import OpenAI
|
4 |
|
5 |
# Creating a function for getting the responses from OpenAI
|
6 |
def get_response(question):
|
7 |
+
if "OPENAI_API_KEY" not in os.environ:
|
8 |
+
os.environ["OPENAI_API_KEY"] = getpass.getpass("Enter your OpenAI API key: ")
|
9 |
llm = OpenAI()
|
10 |
answer = llm.invoke(question)
|
11 |
return answer
|