Skip to content
Sending Chat Histor...
 
Notifications
Clear all

Sending Chat History to a Workflow via Tool

4 Posts
3 Users
0 Reactions
4 Views
Paul_Vincent
(@paul_vincent)
Posts: 7
Active Member
Topic starter
 

Describe the problem/error/question

I have adapted an AI workflow template that passes a user's query to a workflow tool when the answer is not known. That tool then prompts the user to repeat their question and include their email address so a human can get in touch. This is functioning, but I want to avoid the user having to repeat the question by passing the entire conversation history to the tool once the email address has been provided (this is to create a support ticket). However, I'm unsure how to pass the chat history to the Tool; can anyone offer some guidance?

What is the error message (if any)?

No error, I just need to refine the workflow.

Please share your workflow

Share the output returned by the last node


{
  "action": "saveContext",
  "input": {
    "input": "Respond to this query as though you don't know the answer. What's the square root of an orange? myemail@myemail.com",
    "system_message": "You are a helpful and friendly assistant for students and staff at the Open College of the Arts. When asked questions you should refer to the provided Vector Store Tool context. When you can't answer from the context, or you're not confident of the answer, use the dont_know_tool. When you use the dont_know_tool, always respond with the message from the tool.",
    "formatting_instructions": "IMPORTANT: Always call `format_final_response` to format your final response!"
  },
  "output": {
    "input": "Respond to this query as though you don't know the answer. What's the square root of an orange? myemail@myemail.com",
    "system_message": "You are a helpful and friendly assistant for students and staff at the Open College of the Arts. When asked questions you should refer to the provided Vector Store Tool context. When you can't answer from the context, or you're not confident of the answer, use the dont_know_tool. When you use the dont_know_tool, always respond with the message from the tool.",
    "formatting_instructions": "IMPORTANT: Always call `format_final_response` to format your final response!",
    "chat_history": [
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "HumanMessage"
        ],
        "kwargs": {
          "content": "Respond to this query as though you don't know the answer",
          "additional_kwargs": {},
          "response_metadata": {}
        }
      },
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "AIMessage"
        ],
        "kwargs": {
          "content": "I'm sorry, I don't know the answer. Please repeat your question and include your email address so I can request help.",
          "tool_calls": [],
          "invalid_tool_calls": [],
          "additional_kwargs": {},
          "response_metadata": {}
        }
      },
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "HumanMessage"
        ],
        "kwargs": {
          "content": "Respond to this query as though you don't know the answer. What's the square root of an apple?",
          "additional_kwargs": {},
          "response_metadata": {}
        }
      },
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "AIMessage"
        ],
        "kwargs": {
          "content": "I'm sorry, I don't know the answer. Please repeat your question and include your email address so I can request help.",
          "tool_calls": [],
          "invalid_tool_calls": [],
          "additional_kwargs": {},
          "response_metadata": {}
        }
      },
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "HumanMessage"
        ],
        "kwargs": {
          "content": "myemail@myemail.com",
          "additional_kwargs": {},
          "response_metadata": {}
        }
      },
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "AIMessage"
        ],
        "kwargs": {
          "content": "Thank you for getting in touch. I've raised a ticket for a human to help.",
          "tool_calls": [],
          "invalid_tool_calls": [],
          "additional_kwargs": {},
          "response_metadata": {}
        }
      },
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "HumanMessage"
        ],
        "kwargs": {
          "content": "Respond to this query as though you don't know the answer. What's the square root of an orange?",
          "additional_kwargs": {},
          "response_metadata": {}
        }
      },
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "AIMessage"
        ],
        "kwargs": {
          "content": "I'm sorry, I don't know the answer. Please repeat your question and include your email address so I can request help.",
          "tool_calls": [],
          "invalid_tool_calls": [],
          "additional_kwargs": {},
          "response_metadata": {}
        }
      },
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "HumanMessage"
        ],
        "kwargs": {
          "content": "Respond to this query as though you don't know the answer. What's the square root of an orange? myemail@myemail.com",
          "additional_kwargs": {},
          "response_metadata": {}
        }
      },
      {
        "lc": 1,
        "type": "constructor",
        "id": [
          "langchain_core",
          "messages",
          "AIMessage"
        ],
        "kwargs": {
          "content": "Thank you for getting in touch. I've raised a ticket for a human to help.",
          "tool_calls": [],
          "invalid_tool_calls": [],
          "additional_kwargs": {},
          "response_metadata": {}
        }
      }
    ],
    "output": "Thank you for getting in touch. I've raised a ticket for a human to help."
  }
}

Information on your callin.io setup

  • callin.io version: 1.62.3
  • Database (default: SQLite): SQLite
  • callin.io EXECUTIONS_PROCESS setting (default: own, main): default
  • Running callin.io via (Docker, npm, callin.io cloud, desktop app): Docker
  • Operating system: Ubuntu 22.04.4
 
Posted : 22/10/2024 9:26 am
ria
 ria
(@ria)
Posts: 48
Eminent Member
 

Hi there!

Thanks for posting here and welcome to the community!

:cake:

It can be challenging and unreliable to depend on the LLM to pass the complete chat history to the sub-workflow tool, and it's also prone to hallucinations.

However, this could be an excellent use case for the Memory Manager Node. You would connect the same memory type, provide the same session key, and simply retrieve the memory within the tool. The customer's email can be sent by the Agent as a parameter to the tool.

Here’s a basic demonstration:

 
Posted : 25/10/2024 6:20 am
Paul_Vincent
(@paul_vincent)
Posts: 7
Active Member
Topic starter
 

Many thanks for the help with this - I’m quite new to callin.io and still getting to grips with what the various nodes do. So the buffer memory persists across workflows - I’d assumed it would somehow need connecting up; I’ll give that a try on Monday. Thanks again!

 
Posted : 25/10/2024 6:02 pm
system
(@system)
Posts: 332
Reputable Member
 

This discussion was automatically closed 7 days following the last response. New replies are no longer permitted.

 
Posted : 01/11/2024 6:02 pm
Share: