yashasgupta commited on
Commit
3ac4f4b
·
verified ·
1 Parent(s): 8c7fa3d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_openai import ChatOpenAI
2
+
3
+ from langchain_core.prompts import ChatPromptTemplate
4
+
5
+ os.environ["OPENAI_API_KEY"] = os.getenv("k1")
6
+
7
+ prompt = ChatPromptTemplate.from_messages([("system","you are a good assistant for translation to {il} to {ol}"),
8
+ ("human","{i}")])
9
+
10
+ chain = prompt|llm
11
+
12
+ re = chain.invoke({"il":"english","ol":"french","i":"what is the captal of india"})