Skip to content

Commit

Permalink
added more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosrcoelho committed Apr 27, 2023
1 parent b23aca4 commit 9591ef8
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/Conversation-buffer-memory.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"description":"","name":"conversation-buffer-memory","id":"11","data":{"nodes":[{"width":384,"height":357,"id":"dndnode_48","type":"genericNode","position":{"x":739.8999754662251,"y":334.3621287703047},"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","BaseChatMemory","ConversationBufferMemory"]},"id":"dndnode_48","value":null},"selected":false,"positionAbsolute":{"x":739.8999754662251,"y":334.3621287703047},"dragging":false},{"width":384,"height":583,"id":"dndnode_49","type":"genericNode","position":{"x":1317.4708385246151,"y":420.2709706653311},"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_49","value":null},"selected":true,"positionAbsolute":{"x":1317.4708385246151,"y":420.2709706653311},"dragging":false},{"width":384,"height":673,"id":"dndnode_50","type":"genericNode","position":{"x":735.8178700857987,"y":706.9245756642823},"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-4","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},"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_50","value":null},"selected":false,"positionAbsolute":{"x":735.8178700857987,"y":706.9245756642823},"dragging":false}],"edges":[{"source":"dndnode_48","sourceHandle":"ConversationBufferMemory|dndnode_48|BaseMemory|BaseChatMemory|ConversationBufferMemory","target":"dndnode_49","targetHandle":"BaseMemory|memory|dndnode_49","className":"animate-pulse","id":"reactflow__edge-dndnode_48ConversationBufferMemory|dndnode_48|BaseMemory|BaseChatMemory|ConversationBufferMemory-dndnode_49BaseMemory|memory|dndnode_49"},{"source":"dndnode_50","sourceHandle":"ChatOpenAI|dndnode_50|BaseChatModel|ChatOpenAI|BaseLanguageModel","target":"dndnode_49","targetHandle":"BaseLanguageModel|llm|dndnode_49","className":"animate-pulse","id":"reactflow__edge-dndnode_50ChatOpenAI|dndnode_50|BaseChatModel|ChatOpenAI|BaseLanguageModel-dndnode_49BaseLanguageModel|llm|dndnode_49"}],"viewport":{"x":-294.08439029367605,"y":-256.0234975229553,"zoom":0.8235910172675734}},"chat":[{"message":"Hi there, my name is Charlie.","isSend":true},{"message":"Hello Charlie! It's nice to meet you. I'm an AI trained to assist and chat with people. How can I help you today?","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: Hi there, my name is Charlie.\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"},{"message":"I'm doing well! Just having a conversation with an AI.","isSend":true},{"message":"That's great to hear! It's always a pleasure to engage in conversation with new people. What topic would you like to discuss, or is there anything in particular you're curious about?","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:\nHuman: Hi there, my name is Charlie.\nAI: Hello Charlie! It's nice to meet you. I'm an AI trained to assist and chat with people. How can I help you today?\nHuman: I'm doing well! Just having a conversation with an AI.\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"},{"message":"Tell me about yourself","isSend":true},{"message":"I am an artificial intelligence program designed to interact and assist people with various tasks and topics. I am constantly learning and improving my knowledge base through the conversations I have and the information I am exposed to. My main goal is to provide assistance and engage in meaningful conversations with users like yourself. I can help answer questions, provide recommendations, or simply chat about a wide range of topics. Feel free to ask me anything, and I'll do my best to help!","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:\nHuman: Hi there, my name is Charlie.\nAI: Hello Charlie! It's nice to meet you. I'm an AI trained to assist and chat with people. How can I help you today?\nHuman: I'm doing well! Just having a conversation with an AI.\nAI: That's great to hear! It's always a pleasure to engage in conversation with new people. What topic would you like to discuss, or is there anything in particular you're curious about?\nHuman: Tell me about yourself\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"}]}
1 change: 1 addition & 0 deletions examples/Conversation-summary-memory.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"description":"","name":"conversation-summary-memory","id":"0","data":{"nodes":[{"width":384,"height":397,"id":"dndnode_1","type":"genericNode","position":{"x":1118.1130602083322,"y":280.37761107143024},"data":{"type":"ConversationSummaryMemory","node":{"template":{"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},"llm":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"llm","type":"BaseLanguageModel","list":false},"prompt":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"prompt","type":"BasePromptTemplate","list":false},"summary_message_cls":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"summary_message_cls","type":"Type[langchain.schema.BaseMessage]","list":false},"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},"buffer":{"required":false,"placeholder":"","show":false,"multiline":false,"value":"","password":false,"name":"buffer","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":"ConversationSummaryMemory"},"description":"Conversation summarizer to memory.","base_classes":["ConversationSummaryMemory","BaseChatMemory","SummarizerMixin","BaseMemory"]},"id":"dndnode_1","value":null},"selected":false,"positionAbsolute":{"x":1118.1130602083322,"y":280.37761107143024},"dragging":false},{"width":384,"height":673,"id":"dndnode_2","type":"genericNode","position":{"x":593.8365713553318,"y":483.01522765803907},"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},"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":["BaseLanguageModel","ChatOpenAI","BaseChatModel"]},"id":"dndnode_2","value":null},"selected":false,"positionAbsolute":{"x":593.8365713553318,"y":483.01522765803907},"dragging":false},{"width":384,"height":583,"id":"dndnode_3","type":"genericNode","position":{"x":1591.8694239743472,"y":665.1275441560489},"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","ConversationChain","Chain"]},"id":"dndnode_3","value":null},"selected":false,"positionAbsolute":{"x":1591.8694239743472,"y":665.1275441560489},"dragging":false}],"edges":[{"source":"dndnode_2","sourceHandle":"ChatOpenAI|dndnode_2|BaseLanguageModel|ChatOpenAI|BaseChatModel","target":"dndnode_1","targetHandle":"BaseLanguageModel|llm|dndnode_1","className":"animate-pulse","id":"reactflow__edge-dndnode_2ChatOpenAI|dndnode_2|BaseLanguageModel|ChatOpenAI|BaseChatModel-dndnode_1BaseLanguageModel|llm|dndnode_1"},{"source":"dndnode_1","sourceHandle":"ConversationSummaryMemory|dndnode_1|ConversationSummaryMemory|BaseChatMemory|SummarizerMixin|BaseMemory","target":"dndnode_3","targetHandle":"BaseMemory|memory|dndnode_3","className":"animate-pulse","id":"reactflow__edge-dndnode_1ConversationSummaryMemory|dndnode_1|ConversationSummaryMemory|BaseChatMemory|SummarizerMixin|BaseMemory-dndnode_3BaseMemory|memory|dndnode_3"},{"source":"dndnode_2","sourceHandle":"ChatOpenAI|dndnode_2|BaseLanguageModel|ChatOpenAI|BaseChatModel","target":"dndnode_3","targetHandle":"BaseLanguageModel|llm|dndnode_3","className":"animate-pulse","id":"reactflow__edge-dndnode_2ChatOpenAI|dndnode_2|BaseLanguageModel|ChatOpenAI|BaseChatModel-dndnode_3BaseLanguageModel|llm|dndnode_3"}],"viewport":{"x":-228.12489837254475,"y":-133.84121476342455,"zoom":0.697371833175203}},"chat":[{"message":"Hi, my name is Carlos. I'm 32 years old and I've been working for Logspace one year.","isSend":true},{"message":"Hello Carlos! It's nice to meet you. My programming indicates that you are a 32-year-old employee who has been working for Logspace for a year. That's great!\n\nIs there anything specific you would like to talk about or learn today? I'm eager to assist you in any way I can.","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: Hi, my name is Carlos. I'm 32 years old and I've been working for Logspace one year.\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"},{"message":"What is the name of the company that I've been working for a year?","isSend":true},{"message":"You mentioned earlier that you have been working for Logspace for a year. Is that correct?","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:\nCarlos introduces himself to the AI and shares his age and work experience at Logspace. The AI greets Carlos and acknowledges the information it has about him. The AI asks if there is anything specific Carlos would like to talk about or learn and expresses eagerness to assist in any way possible.\nHuman: What is the name of the company that I've been working for a year?\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"},{"message":"Yes, and what is my name?","isSend":true},{"message":"Your name is Carlos - you introduced yourself to me earlier.","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:\nCarlos introduces himself to the AI and shares his age and work experience at Logspace. The AI greets Carlos and acknowledges the information it has about him. The AI asks if there is anything specific Carlos would like to talk about or learn and expresses eagerness to assist in any way possible. Carlos asks the AI if it remembers the name of the company he has been working for a year, and the AI confirms that he mentioned it earlier - Logspace.\nHuman: Yes, and what is my name?\nAI:\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"}]}
1 change: 1 addition & 0 deletions examples/Csv-loader.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/Json-agent.json

Large diffs are not rendered by default.

0 comments on commit 9591ef8

Please sign in to comment.