bstraehle commited on
Commit
b610816
1 Parent(s): 6ed6ed9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -10,6 +10,18 @@ _ = load_dotenv(find_dotenv())
10
 
11
  #openai.api_key = os.environ["OPENAI_API_KEY"]
12
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  def invoke(openai_api_key, youtube_url, prompt):
14
  openai.api_key = openai_api_key
15
  url = youtube_url
 
10
 
11
  #openai.api_key = os.environ["OPENAI_API_KEY"]
12
 
13
+ ###
14
+ from langchain.chat_models import ChatOpenAI
15
+ llm = ChatOpenAI(model_name = "gpt-4", temperature = 0)
16
+
17
+ from langchain.prompts import PromptTemplate
18
+ template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. Use three sentences maximum. Keep the answer as concise as possible. Always say "Author: Bernd Straehle 🚀" at the end of the answer.
19
+ {context}
20
+ Question: {question}
21
+ Helpful Answer:"""
22
+ QA_CHAIN_PROMPT = PromptTemplate(input_variables = ["context", "question"], template = template, )
23
+ ###
24
+
25
  def invoke(openai_api_key, youtube_url, prompt):
26
  openai.api_key = openai_api_key
27
  url = youtube_url