mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-14 13:49:21 +03:00
6.3 KiB
6.3 KiB
In [1]:
from langchain import OpenAI, ConversationChain
llm = OpenAI(temperature=0)
conversation = ConversationChain(llm=llm, verbose=True)
conversation.predict(input="Hi there!")Out [1]:
[1m> Entering new chain...[0m Prompt after formatting: [32;1m[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know. Current conversation: Human: Hi there! AI:[0m [1m> Finished chain.[0m
' Hello! How are you today?'
In [2]:
conversation.predict(input="I'm doing well! Just having a conversation with an AI.")Out [2]:
[1m> Entering new chain...[0m Prompt after formatting: [32;1m[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know. Current conversation: Human: Hi there! AI: Hello! How are you today? Human: I'm doing well! Just having a conversation with an AI. AI:[0m [1m> Finished chain.[0m
" That's great! What would you like to talk about?"
In [3]:
conversation.predict(input="Tell me about yourself.")Out [3]:
[1m> Entering new chain...[0m Prompt after formatting: [32;1m[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know. Current conversation: Human: Hi there! AI: Hello! How are you today? Human: I'm doing well! Just having a conversation with an AI. AI: That's great! What would you like to talk about? Human: Tell me about yourself. AI:[0m [1m> Finished chain.[0m
' I am an AI created to provide information and support to humans. I enjoy learning and exploring new things.'
In [ ]: