Skip to content

How do I integrate ChatOpenAI, UpstashRedisChatMessageHistory and tool calling? #28769

Answered by dosubot bot
henriquegdantas asked this question in Ask Dosu
Discussion options

You must be logged in to vote

To resolve the tool calling issue in your implementation, ensure that each tool call is followed by a corresponding response message. Here's how you can address the problem:

  1. Capture Tool Responses: After making a tool call, capture the response and append it to the chat history. This ensures that each tool call has a corresponding response message.

  2. Update Chat History: Make sure to update the chat history with both the tool call and its response before invoking the model again. This maintains the correct sequence of messages.

  3. Example Implementation:

    const toolResponse = await dummyTool.invoke(responseMessage.tool_calls![0]);
    chatHistory.push(responseMessage);
    chatHistory.push(toolR…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by henriquegdantas
Comment options

You must be logged in to vote
9 replies
@dosubot
Comment options

@henriquegdantas
Comment options

@dosubot
Comment options

@henriquegdantas
Comment options

@dosubot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant