Spaces:
Sleeping
Sleeping
Read OpenAI key from env
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import chainlit as cl
|
|
|
3 |
from langchain_openai import ChatOpenAI
|
4 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
5 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
@@ -10,8 +11,8 @@ from langchain_community.chat_message_histories import ChatMessageHistory
|
|
10 |
from langchain.memory import ConversationBufferMemory
|
11 |
from langchain_core.prompts import PromptTemplate
|
12 |
|
13 |
-
#
|
14 |
-
open_ai_key = "
|
15 |
|
16 |
llm = ChatOpenAI(api_key=open_ai_key)
|
17 |
|
|
|
1 |
import gradio as gr
|
2 |
import chainlit as cl
|
3 |
+
import os
|
4 |
from langchain_openai import ChatOpenAI
|
5 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
6 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
11 |
from langchain.memory import ConversationBufferMemory
|
12 |
from langchain_core.prompts import PromptTemplate
|
13 |
|
14 |
+
# Access the OpenAI API key from the environment
|
15 |
+
open_ai_key = os.getenv("OPENAI_API_KEY")
|
16 |
|
17 |
llm = ChatOpenAI(api_key=open_ai_key)
|
18 |
|