LiuZiyi commited on
Commit
31401fa
1 Parent(s): fa41ea8

first commit

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. __pycache__/secret_key.cpython-39.pyc +0 -0
  3. app.py +19 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ secret_key.py
__pycache__/secret_key.cpython-39.pyc ADDED
Binary file (245 Bytes). View file
 
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_openai import OpenAI
2
+ from langchain.prompts import PromptTemplate
3
+ from langchain.chains import LLMChain
4
+ from secret_key import openapi_key
5
+
6
+ import os
7
+ os.environ['OPENAI_API_KEY'] = openapi_key
8
+
9
+ llm = OpenAI(temperature=0.6)
10
+
11
+ prompt_template_name = PromptTemplate(
12
+ input_variables = ['cuisine'],
13
+ template = "I want to open a restaurant for {cuisine} food. Suggest a fancy name for this."
14
+ )
15
+
16
+ chain = LLMChain(llm=llm, prompt=prompt_template_name)
17
+ response = chain.invoke({"cuisine":"American"})
18
+ print(response)
19
+ # {'cuisine': 'American', 'text': '\n\n"Stateside Eats" '}