Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simple getting started examples #2

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/Getting_started__basic_chatbot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"description":"Simplest possible chatbot model","name":"Getting Started: Basic chatbot","id":"7","data":{"nodes":[{"width":384,"height":693,"id":"dndnode_24","type":"genericNode","position":{"x":228.87326389541306,"y":465.8628482073749},"data":{"type":"ChatOpenAI","node":{"template":{"verbose":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"verbose","type":"bool","list":false},"client":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"client","type":"Any","list":false},"model_name":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"gpt-3.5-turbo","password":false,"options":["gpt-3.5-turbo","gpt-4","gpt-4-32k"],"name":"model_name","type":"str","list":true},"temperature":{"required":false,"placeholder":"","show":true,"multiline":false,"value":0.7,"password":false,"name":"temperature","type":"float","list":false},"model_kwargs":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"model_kwargs","type":"code","list":false},"openai_api_key":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"","password":true,"name":"openai_api_key","display_name":"OpenAI API Key","type":"str","list":false},"openai_organization":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"openai_organization","type":"str","list":false},"request_timeout":{"required":false,"placeholder":"","show":false,"multiline":false,"value":60,"password":false,"name":"request_timeout","type":"int","list":false},"max_retries":{"required":false,"placeholder":"","show":false,"multiline":false,"value":6,"password":false,"name":"max_retries","type":"int","list":false},"streaming":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"streaming","type":"bool","list":false},"n":{"required":false,"placeholder":"","show":false,"multiline":false,"value":1,"password":false,"name":"n","type":"int","list":false},"max_tokens":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"max_tokens","type":"int","list":false},"_type":"ChatOpenAI"},"description":"Wrapper around OpenAI Chat large language models.","base_classes":["BaseChatModel","ChatOpenAI","BaseLanguageModel"]},"id":"dndnode_24","value":null},"selected":false,"dragging":false,"positionAbsolute":{"x":228.87326389541306,"y":465.8628482073749}},{"width":384,"height":583,"id":"dndnode_28","type":"genericNode","position":{"x":806,"y":554},"data":{"type":"ConversationChain","node":{"template":{"memory":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"memory","type":"BaseMemory","list":false},"verbose":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"verbose","type":"bool","list":false},"prompt":{"required":false,"placeholder":"","show":true,"multiline":false,"value":{"input_variables":["history","input"],"output_parser":null,"partial_variables":{},"template":"The 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.\n\nCurrent conversation:\n{history}\nHuman: {input}\nAI:","template_format":"f-string","validate_template":true,"_type":"prompt"},"password":false,"name":"prompt","type":"BasePromptTemplate","list":false},"llm":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"llm","type":"BaseLanguageModel","list":false},"output_key":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"response","password":false,"name":"output_key","type":"str","list":false},"input_key":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"input","password":false,"name":"input_key","type":"str","list":false},"_type":"ConversationChain"},"description":"Chain to have a conversation and load context from memory.","base_classes":["LLMChain","Chain","ConversationChain"]},"id":"dndnode_28","value":null},"selected":true,"dragging":false,"positionAbsolute":{"x":806,"y":554}}],"edges":[{"source":"dndnode_24","sourceHandle":"ChatOpenAI|dndnode_24|BaseChatModel|ChatOpenAI|BaseLanguageModel","target":"dndnode_28","targetHandle":"BaseLanguageModel|llm|dndnode_28","className":"animate-pulse","id":"reactflow__edge-dndnode_24ChatOpenAI|dndnode_24|BaseChatModel|ChatOpenAI|BaseLanguageModel-dndnode_28BaseLanguageModel|llm|dndnode_28"}],"viewport":{"x":72.90967759109208,"y":42.767127446564814,"zoom":0.5}},"chat":[{"message":"Who am I talking to?","isSend":true},{"message":"You are talking to an AI language model developed by OpenAI. My purpose is to assist and provide helpful responses to your queries.","isSend":false,"thought":"\u001b[1m> Entering new ConversationChain chain...\u001b[0m\nPrompt after formatting:\n\u001b[32;1m\u001b[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.\n\nCurrent conversation:\n\nHuman: Who am I talking to?\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"description":"Simple chatbot with custom prompt template and conversational memory buffer","name":"Getting Started: Basic chatbot with prompt and history","id":"7","data":{"nodes":[{"width":384,"height":693,"id":"dndnode_24","type":"genericNode","position":{"x":170.87326389541306,"y":465.8628482073749},"data":{"type":"ChatOpenAI","node":{"template":{"verbose":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"verbose","type":"bool","list":false},"client":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"client","type":"Any","list":false},"model_name":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"gpt-3.5-turbo","password":false,"options":["gpt-3.5-turbo","gpt-4","gpt-4-32k"],"name":"model_name","type":"str","list":true},"temperature":{"required":false,"placeholder":"","show":true,"multiline":false,"value":0.7,"password":false,"name":"temperature","type":"float","list":false},"model_kwargs":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"model_kwargs","type":"code","list":false},"openai_api_key":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"","password":true,"name":"openai_api_key","display_name":"OpenAI API Key","type":"str","list":false},"openai_organization":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"openai_organization","type":"str","list":false},"request_timeout":{"required":false,"placeholder":"","show":false,"multiline":false,"value":60,"password":false,"name":"request_timeout","type":"int","list":false},"max_retries":{"required":false,"placeholder":"","show":false,"multiline":false,"value":6,"password":false,"name":"max_retries","type":"int","list":false},"streaming":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"streaming","type":"bool","list":false},"n":{"required":false,"placeholder":"","show":false,"multiline":false,"value":1,"password":false,"name":"n","type":"int","list":false},"max_tokens":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"max_tokens","type":"int","list":false},"_type":"ChatOpenAI"},"description":"Wrapper around OpenAI Chat large language models.","base_classes":["BaseChatModel","ChatOpenAI","BaseLanguageModel"]},"id":"dndnode_24","value":null},"selected":true,"dragging":false,"positionAbsolute":{"x":170.87326389541306,"y":465.8628482073749}},{"width":384,"height":477,"id":"dndnode_30","type":"genericNode","position":{"x":1250.1806448178158,"y":588.4657451068704},"data":{"type":"LLMChain","node":{"template":{"memory":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"memory","type":"BaseMemory","list":false},"verbose":{"required":false,"placeholder":"","show":false,"multiline":false,"value":false,"password":false,"name":"verbose","type":"bool","list":false},"prompt":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"prompt","type":"BasePromptTemplate","list":false},"llm":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"llm","type":"BaseLanguageModel","list":false},"output_key":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"text","password":false,"name":"output_key","type":"str","list":false},"_type":"LLMChain"},"description":"Chain to run queries against LLMs.","base_classes":["LLMChain","Chain"]},"id":"dndnode_30","value":null},"selected":false,"positionAbsolute":{"x":1250.1806448178158,"y":588.4657451068704},"dragging":false},{"width":384,"height":349,"id":"dndnode_31","type":"genericNode","position":{"x":172.18064481781585,"y":67.26574510687044},"data":{"type":"PromptTemplate","node":{"template":{"input_variables":{"required":true,"placeholder":"","show":false,"multiline":false,"password":false,"name":"input_variables","type":"str","list":true},"output_parser":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"output_parser","type":"BaseOutputParser","list":false},"partial_variables":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"partial_variables","type":"code","list":false},"template":{"required":true,"placeholder":"","show":true,"multiline":true,"password":false,"name":"template","type":"prompt","list":false,"value":"The 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.\n\nCurrent conversation:\n\n{history}\nHuman: {text}\nAI:"},"template_format":{"required":false,"placeholder":"","show":false,"multiline":false,"value":"f-string","password":false,"name":"template_format","type":"str","list":false},"validate_template":{"required":false,"placeholder":"","show":false,"multiline":false,"value":true,"password":false,"name":"validate_template","type":"bool","list":false},"_type":"PromptTemplate"},"description":"Schema to represent a prompt for an LLM.","base_classes":["StringPromptTemplate","PromptTemplate","BasePromptTemplate"]},"id":"dndnode_31","value":null},"selected":false,"dragging":false,"positionAbsolute":{"x":172.18064481781585,"y":67.26574510687044}},{"width":384,"height":357,"id":"dndnode_32","type":"genericNode","position":{"x":802.1806448178158,"y":43.265745106870426},"data":{"type":"ConversationBufferMemory","node":{"template":{"chat_memory":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"chat_memory","type":"BaseChatMessageHistory","list":false},"output_key":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"output_key","type":"str","list":false},"input_key":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"input_key","type":"str","list":false},"return_messages":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"return_messages","type":"bool","list":false},"human_prefix":{"required":false,"placeholder":"","show":false,"multiline":false,"value":"Human","password":false,"name":"human_prefix","type":"str","list":false},"ai_prefix":{"required":false,"placeholder":"","show":false,"multiline":false,"value":"AI","password":false,"name":"ai_prefix","type":"str","list":false},"memory_key":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"history","password":false,"name":"memory_key","type":"str","list":false},"_type":"ConversationBufferMemory"},"description":"Buffer for storing conversation memory.","base_classes":["BaseMemory","ConversationBufferMemory","BaseChatMemory"]},"id":"dndnode_32","value":null},"selected":false,"positionAbsolute":{"x":802.1806448178158,"y":43.265745106870426},"dragging":false}],"edges":[{"source":"dndnode_24","sourceHandle":"ChatOpenAI|dndnode_24|BaseChatModel|ChatOpenAI|BaseLanguageModel","target":"dndnode_30","targetHandle":"BaseLanguageModel|llm|dndnode_30","className":"animate-pulse","id":"reactflow__edge-dndnode_24ChatOpenAI|dndnode_24|BaseChatModel|ChatOpenAI|BaseLanguageModel-dndnode_30BaseLanguageModel|llm|dndnode_30","selected":false},{"source":"dndnode_31","sourceHandle":"PromptTemplate|dndnode_31|StringPromptTemplate|PromptTemplate|BasePromptTemplate","target":"dndnode_30","targetHandle":"BasePromptTemplate|prompt|dndnode_30","className":"animate-pulse","id":"reactflow__edge-dndnode_31PromptTemplate|dndnode_31|StringPromptTemplate|PromptTemplate|BasePromptTemplate-dndnode_30BasePromptTemplate|prompt|dndnode_30"},{"source":"dndnode_32","sourceHandle":"ConversationBufferMemory|dndnode_32|BaseMemory|ConversationBufferMemory|BaseChatMemory","target":"dndnode_30","targetHandle":"BaseMemory|memory|dndnode_30","className":"animate-pulse","id":"reactflow__edge-dndnode_32ConversationBufferMemory|dndnode_32|BaseMemory|ConversationBufferMemory|BaseChatMemory-dndnode_30BaseMemory|memory|dndnode_30"}],"viewport":{"x":0,"y":0,"zoom":1}},"chat":[{"message":"Who am I talking to?","isSend":true},{"message":"You are talking to an AI language model developed by OpenAI. My purpose is to assist and provide helpful responses to your queries.","isSend":false,"thought":"\u001b[1m> Entering new ConversationChain chain...\u001b[0m\nPrompt after formatting:\n\u001b[32;1m\u001b[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.\n\nCurrent conversation:\n\nHuman: Who am I talking to?\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"},{"message":"who am i talking to?","isSend":true},{"message":"You are talking to an AI language model developed by OpenAI. My purpose is to understand and respond to natural language input from humans like you. How can I assist you today?","isSend":false,"thought":"\u001b[1m> Entering new LLMChain chain...\u001b[0m\nPrompt after formatting:\n\u001b[32;1m\u001b[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.\n\nCurrent conversation:\n\n\nHuman: who am i talking to?\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"},{"message":"what was your previous answer to my question?","isSend":true},{"message":"My previous answer to your question was: \"You are talking to an AI language model developed by OpenAI. My purpose is to understand and respond to natural language input from humans like you. How can I assist you today?\"","isSend":false,"thought":"\u001b[1m> Entering new LLMChain chain...\u001b[0m\nPrompt after formatting:\n\u001b[32;1m\u001b[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.\n\nCurrent conversation:\n\nHuman: who am i talking to?\nAI: You are talking to an AI language model developed by OpenAI. My purpose is to understand and respond to natural language input from humans like you. How can I assist you today?\nHuman: what was your previous answer to my question?\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"}]}