-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstProject.py
More file actions
38 lines (32 loc) · 1000 Bytes
/
Copy pathfirstProject.py
File metadata and controls
38 lines (32 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from dotenv import load_dotenv
# import os
from langchain.chains import LLMChain
from langchain_core.prompts import PromptTemplate
from langchain_openai import ChatOpenAI
"""
#TODO
Working with LangChain:
1. PromptTemplate
2. ChatOpenAI
3. LLMChain
"""
if __name__ == "__main__":
print("Hello Langchain!")
load_dotenv()
"""print(os.getenv('OPENAI_API_KEY'))"""
# information1 = """
# SVM
# """
# information2 = """
# CNN
# """
# summary_template = """
# Difference between {information1} and {information2} in not more than 600 words
# """
information = "Bey blade"
summary_template = "Tell me something about the series {information} "
prompt = PromptTemplate(input_variables=["information"], template=summary_template)
chatModel = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo")
chain = LLMChain(llm=chatModel, prompt=prompt)
result = chain.invoke(input={"information": information})
print(result)