-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
executable file
·47 lines (30 loc) · 1.3 KB
/
test.py
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
39
40
41
42
43
44
45
46
47
#!/bin/python3
################################################################################
# from langchain.llms import OpenAI
# llm = OpenAI(temperature=0.9)
# text = "What would be a good company name for a company that makes colorful socks?"
# print(llm(text))
################################################################################
# from langchain.prompts import PromptTemplate
# prompt = PromptTemplate(
# input_variables=["product"],
# template="What is a good name for a company that makes {product}?",
# )
# print(prompt.format(product="colorful socks"))
################################################################################
# from langchain.prompts import PromptTemplate
# from langchain.llms import OpenAI
# from langchain.chains import LLMChain
# llm = OpenAI(temperature=0.9)
# prompt = PromptTemplate(
# input_variables=["product"],
# template="What is a good name for a company that makes {product}?",
# )
# chain = LLMChain(llm=llm, prompt=prompt)
# print(chain.run("colorful socks"))
################################################################################
from langchain import OpenAI, ConversationChain
llm = OpenAI(temperature=0)
conversation = ConversationChain(llm=llm, verbose=True)
output = conversation.predict(input="Hi there!")
print(output)