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

No stream_url when using Tool Calling Agent #4652

Open
thiagotps opened this issue Nov 16, 2024 · 1 comment
Open

No stream_url when using Tool Calling Agent #4652

thiagotps opened this issue Nov 16, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@thiagotps
Copy link

Bug Description

When calling the run api with stream=true , on a flow that uses the tool calling agent component, there is no stream_url in the answer. The api returns as if stream was set to false.

Reproduction

Just create a flow with the tool calling agent component, and try to run it through the api with stream=true

curl -X POST \
    "http://127.0.0.1:7860/api/v1/run/ebf006d1-0bb0-483f-be5e-4869943170b0?stream=true" \
    -H 'Content-Type: application/json'\
    -d '{"input_value": "message",
    "output_type": "chat",
    "input_type": "chat",
    "tweaks": {
  "ChatInput-faGMo": {},
  "ChatOutput-ylRIj": {},
  "AmazonBedrockModel-bBEen": {},
  "ToolCallingAgent-J1Adc": {},
  "DuckDuckGoSearch-1jkk8": {}
}}'
{
    "session_id": "ebf006d1-0bb0-483f-be5e-4869943170b0",
    "outputs": [
        {
            "inputs": {
                "input_value": "message"
            },
            "outputs": [
                {
                    "results": {
                        "message": {
                            "timestamp": "2024-11-16T20:01:16",
                            "sender": "Machine",
                            "sender_name": "AI",
                            "session_id": "ebf006d1-0bb0-483f-be5e-4869943170b0",
                            "text": "It looks like you just sent a message. What would you like to talk about or ask? I'm here to help.",
                            "files": [

                            ],
                            "error": false,
                            "edit": false,
                            "properties": {
                                "text_color": "",
                                "background_color": "",
                                "edited": false,
                                "source": {
                                    "id": "ToolCallingAgent-J1Adc",
                                    "display_name": "Tool Calling Agent",
                                    "source": "Tool Calling Agent"
                                },
                                "icon": "LangChain",
                                "allow_markdown": false,
                                "state": "complete",
                                "targets": [

                                ]
                            },
                            "category": "message",
                            "content_blocks": [
                                {
                                    "title": "Agent Steps",
                                    "contents": [
                                        {
                                            "type": "text",
                                            "duration": 7,
                                            "header": {
                                                "title": "Input",
                                                "icon": "MessageSquare"
                                            },
                                            "text": ""
                                        },
                                        {
                                            "type": "text",
                                            "duration": 1837,
                                            "header": {
                                                "title": "Output",
                                                "icon": "MessageSquare"
                                            },
                                            "text": "It looks like you just sent a message. What would you like to talk about or ask? I'm here to help."
                                        }
                                    ],
                                    "allow_markdown": true,
                                    "media_url": null
                                }
                            ],
                            "id": "3b20650e-b074-4c63-855a-0229634d2334",
                            "flow_id": "ebf006d1-0bb0-483f-be5e-4869943170b0"
                        }
                    },
                    "artifacts": {
                        "message": "It looks like you just sent a message. What would you like to talk about or ask? I'm here to help.",
                        "sender": "Machine",
                        "sender_name": "AI",
                        "files": [

                        ],
                        "type": "object"
                    },
                    "outputs": {
                        "message": {
                            "message": {
                                "timestamp": "2024-11-16 20:01:16 ",
                                "sender": "Machine",
                                "sender_name": "AI",
                                "session_id": "ebf006d1-0bb0-483f-be5e-4869943170b0",
                                "text": "It looks like you just sent a message. What would you like to talk about or ask? I'm here to help.",
                                "files": [

                                ],
                                "error": false,
                                "edit": false,
                                "properties": {
                                    "text_color": "",
                                    "background_color": "",
                                    "edited": false,
                                    "source": {
                                        "id": "ToolCallingAgent-J1Adc",
                                        "display_name": "Tool Calling Agent",
                                        "source": "Tool Calling Agent"
                                    },
                                    "icon": "LangChain",
                                    "allow_markdown": false,
                                    "state": "complete",
                                    "targets": [

                                    ]
                                },
                                "category": "message",
                                "content_blocks": [
                                    {
                                        "title": "Agent Steps",
                                        "contents": [
                                            {
                                                "type": "text",
                                                "duration": 7,
                                                "header": {
                                                    "title": "Input",
                                                    "icon": "MessageSquare"
                                                },
                                                "text": ""
                                            },
                                            {
                                                "type": "text",
                                                "duration": 1837,
                                                "header": {
                                                    "title": "Output",
                                                    "icon": "MessageSquare"
                                                },
                                                "text": "It looks like you just sent a message. What would you like to talk about or ask? I'm here to help."
                                            }
                                        ],
                                        "allow_markdown": true,
                                        "media_url": null
                                    }
                                ],
                                "id": "3b20650e-b074-4c63-855a-0229634d2334",
                                "flow_id": "ebf006d1-0bb0-483f-be5e-4869943170b0"
                            },
                            "type": "object"
                        }
                    },
                    "logs": {
                        "message": [

                        ]
                    },
                    "messages": [

                    ],
                    "component_display_name": "Chat Output",
                    "component_id": "ChatOutput-ylRIj",
                    "used_frozen_result": false
                }
            ]
        }
    ]
}

Expected behavior

Instead of the call to block until the model returns the last message, the api should simply return reponse contaning a stream_url field.

Who can help?

No response

Operating System

Arch Linux

Langflow Version

1.1.0 (commit efe6407)

Python Version

3.12

Screenshot

image

Flow File

No response

@thiagotps thiagotps added the bug Something isn't working label Nov 16, 2024
Copy link

dosubot bot commented Nov 16, 2024

The issue you're experiencing, where the stream_url is not included in the response when using the tool calling agent component with stream=true, could be related to how the stream parameter is processed or how the tool calling agent component interacts with the streaming logic.

The build_stream_url method is responsible for generating the streaming URL when stream=true. It is called correctly in scenarios where the message is an instance of AsyncIterator or Iterator [1]. If the tool calling agent component does not produce a message in this form, the stream_url might not be generated.

To address this, you might want to check if the tool calling agent component is configured to support streaming and if it produces messages as iterators. Additionally, ensure that the component's logic aligns with the expected behavior for streaming, as any deviation might prevent the stream_url from being included in the response.

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants