forked from langflow-ai/langflow_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request langflow-ai#4 from MarkusSagen/features/apply-simp…
…le-custom-python-code
- Loading branch information
Showing
1 changed file
with
1 addition
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
examples/Getting_started__python_function_applied_to_each_output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"description":"Use this Tool on every query","name":"Getting Started: Simple python function applied to each output","id":"8","data":{"nodes":[{"width":384,"height":473,"id":"dndnode_35","type":"genericNode","position":{"x":1256,"y":760},"data":{"type":"initialize_agent","node":{"template":{"agent":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"zero-shot-react-description","password":false,"options":["zero-shot-react-description","react-docstore","self-ask-with-search","conversational-react-description"],"name":"agent","type":"str","list":true},"memory":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"memory","type":"BaseChatMemory","list":false},"tools":{"required":false,"placeholder":"","show":true,"multiline":false,"password":false,"name":"tools","type":"Tool","list":true},"llm":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"llm","type":"BaseLanguageModel","list":false},"_type":"initailize_agent"},"description":"Construct a json agent from an LLM and tools.","base_classes":["AgentExecutor"]},"id":"dndnode_35","value":null},"selected":false,"positionAbsolute":{"x":1256,"y":760},"dragging":false},{"width":384,"height":349,"id":"dndnode_36","type":"genericNode","position":{"x":126,"y":268},"data":{"type":"PythonFunction","node":{"template":{"code":{"required":true,"placeholder":"","show":true,"multiline":true,"value":"\ndef python_function(text: str) -> str:\n \"\"\"This is a default python function that returns the input text\"\"\"\n return text.upper()\n","password":false,"name":"code","type":"code","list":false},"_type":"python_function"},"description":"Python function to be executed.","base_classes":["function"]},"id":"dndnode_36","value":null},"selected":false,"positionAbsolute":{"x":126,"y":268},"dragging":false},{"width":384,"height":559,"id":"dndnode_37","type":"genericNode","position":{"x":544,"y":270},"data":{"type":"Tool","node":{"template":{"name":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"Python return text","password":false,"name":"name","type":"str","list":false},"description":{"required":true,"placeholder":"","show":true,"multiline":false,"value":"Returns the input prompt text","password":false,"name":"description","type":"str","list":false},"func":{"required":true,"placeholder":"","show":true,"multiline":false,"password":false,"name":"func","type":"function","list":false},"return_direct":{"required":true,"placeholder":"","show":true,"multiline":false,"value":true,"password":false,"name":"return_direct","type":"bool","list":false},"_type":"Tool"},"description":"Tool to be used in the flow.","base_classes":["Tool"]},"id":"dndnode_37","value":null},"selected":false,"positionAbsolute":{"x":544,"y":270},"dragging":false},{"width":384,"height":759,"id":"dndnode_38","type":"genericNode","position":{"x":550,"y":910},"data":{"type":"OpenAI","node":{"template":{"cache":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"cache","type":"bool","list":false},"verbose":{"required":false,"placeholder":"","show":false,"multiline":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":"text-davinci-003","password":false,"options":["text-davinci-003","text-davinci-002","text-curie-001","text-babbage-001","text-ada-001"],"name":"model_name","type":"str","list":true},"temperature":{"required":false,"placeholder":"","show":true,"multiline":false,"value":"0.2","password":false,"name":"temperature","type":"float","list":false},"max_tokens":{"required":false,"placeholder":"","show":true,"multiline":false,"value":256,"password":true,"name":"max_tokens","type":"int","list":false},"top_p":{"required":false,"placeholder":"","show":false,"multiline":false,"value":1,"password":false,"name":"top_p","type":"float","list":false},"frequency_penalty":{"required":false,"placeholder":"","show":false,"multiline":false,"value":0,"password":false,"name":"frequency_penalty","type":"float","list":false},"presence_penalty":{"required":false,"placeholder":"","show":false,"multiline":false,"value":0,"password":false,"name":"presence_penalty","type":"float","list":false},"n":{"required":false,"placeholder":"","show":false,"multiline":false,"value":1,"password":false,"name":"n","type":"int","list":false},"best_of":{"required":false,"placeholder":"","show":false,"multiline":false,"value":1,"password":false,"name":"best_of","type":"int","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_api_base":{"required":false,"placeholder":"","show":true,"multiline":false,"password":true,"name":"openai_api_base","type":"str","list":false,"value":""},"openai_organization":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"openai_organization","type":"str","list":false},"batch_size":{"required":false,"placeholder":"","show":false,"multiline":false,"value":20,"password":false,"name":"batch_size","type":"int","list":false},"request_timeout":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"request_timeout","type":"Union[float, Tuple[float, float], NoneType]","list":false},"logit_bias":{"required":false,"placeholder":"","show":false,"multiline":false,"password":false,"name":"logit_bias","type":"code","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},"allowed_special":{"required":false,"placeholder":"","show":false,"multiline":false,"value":[],"password":false,"name":"allowed_special","type":"Union[Literal['all'], AbstractSet[str]]","list":false},"disallowed_special":{"required":false,"placeholder":"","show":false,"multiline":false,"value":"all","password":false,"name":"disallowed_special","type":"Union[Literal['all'], Collection[str]]","list":false},"_type":"OpenAI"},"description":"Wrapper around OpenAI large language models.","base_classes":["BaseLLM","OpenAI","BaseOpenAI","BaseLanguageModel"]},"id":"dndnode_38","value":null},"selected":false,"positionAbsolute":{"x":550,"y":910},"dragging":false},{"width":384,"height":357,"id":"dndnode_39","type":"genericNode","position":{"x":1254,"y":348.89999999999986},"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":["ConversationBufferMemory","BaseChatMemory","BaseMemory"]},"id":"dndnode_39","value":null},"selected":true,"positionAbsolute":{"x":1254,"y":348.89999999999986},"dragging":false}],"edges":[{"source":"dndnode_36","sourceHandle":"PythonFunction|dndnode_36|function","target":"dndnode_37","targetHandle":"function|func|dndnode_37","className":"animate-pulse","id":"reactflow__edge-dndnode_36PythonFunction|dndnode_36|function-dndnode_37function|func|dndnode_37","selected":false},{"source":"dndnode_37","sourceHandle":"Tool|dndnode_37|Tool","target":"dndnode_35","targetHandle":"Tool|tools|dndnode_35","className":"animate-pulse","id":"reactflow__edge-dndnode_37Tool|dndnode_37|Tool-dndnode_35Tool|tools|dndnode_35","selected":false},{"source":"dndnode_38","sourceHandle":"OpenAI|dndnode_38|BaseLLM|OpenAI|BaseOpenAI|BaseLanguageModel","target":"dndnode_35","targetHandle":"BaseLanguageModel|llm|dndnode_35","className":"animate-pulse","id":"reactflow__edge-dndnode_38OpenAI|dndnode_38|BaseLLM|OpenAI|BaseOpenAI|BaseLanguageModel-dndnode_35BaseLanguageModel|llm|dndnode_35"},{"source":"dndnode_39","sourceHandle":"ConversationBufferMemory|dndnode_39|ConversationBufferMemory|BaseChatMemory|BaseMemory","target":"dndnode_35","targetHandle":"BaseChatMemory|memory|dndnode_35","className":"animate-pulse","id":"reactflow__edge-dndnode_39ConversationBufferMemory|dndnode_39|ConversationBufferMemory|BaseChatMemory|BaseMemory-dndnode_35BaseChatMemory|memory|dndnode_35"}],"viewport":{"x":40,"y":-104.44999999999995,"zoom":0.5}},"chat":[{"message":"Hi!","isSend":true},{"message":"HI THERE!","isSend":false,"thought":"\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n\u001b[32;1m\u001b[1;3m I should greet the person back\nAction: Python return text\nAction Input: Hi there!\u001b[0m\nObservation: \u001b[36;1m\u001b[1;3mHI THERE!\u001b[0m\n\u001b[32;1m\u001b[1;3m\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"},{"message":"How are you?","isSend":true},{"message":"I'M DOING GREAT, THANKS FOR ASKING!","isSend":false,"thought":"\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n\u001b[32;1m\u001b[1;3m I should respond in a friendly manner.\nAction: Python return text\nAction Input: \"I'm doing great, thanks for asking!\"\u001b[0m\nObservation: \u001b[36;1m\u001b[1;3mI'M DOING GREAT, THANKS FOR ASKING!\u001b[0m\n\u001b[32;1m\u001b[1;3m\u001b[0m\n\n\u001b[1m> Finished chain.\u001b[0m"}]} |