lizhen commited on
Commit
037db72
·
1 Parent(s): 7d16c91

完成快速入门。

Browse files
Files changed (1) hide show
  1. openai_conversation_chain.py +15 -0
openai_conversation_chain.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain import OpenAI, ConversationChain
2
+
3
+ llm = OpenAI(temperature=0)
4
+ conversation = ConversationChain(llm=llm, verbose=True)
5
+
6
+ conversation.predict(input="作为一名国内资深理财师,可以给我一些投资理财建议吗?")
7
+ conversation.predict(input="继续")
8
+
9
+ while True:
10
+ msg=input("Human:")
11
+ if msg == 'Bye':
12
+ break
13
+ conversation.predict(input=msg)
14
+ conversation.predict(input="好的")
15
+ print("Finished!")