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

LangGraph nodes within Prompt Flow error out when Prompt Flow tracing is turned on #3850

Open
yeamusic21 opened this issue Nov 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@yeamusic21
Copy link

Describe the bug
When using LangGraph within Prompt Flow, nodes that invoke a graph error out when Prompt Flow tracing is turned on.

How To Reproduce the bug
Steps to reproduce the behavior, how frequent can you experience the bug:

  1. Create node that calls a LangGraph graph (graph.invoke(input))
  2. Run Prompt Flow graph

Expected behavior
No error

Screenshots
N/A

Running Information(please complete the following information):

  • Promptflow Package Version: promptflow==1.16.1
  • Operating System: Windows 11
  • Python Version: 3.13.0

Additional context
Running graph.invoke(input) works when setting PF_DISABLE_TRACING=true

Without setting this env variable, we get the following message:

File **"C:\Users\MattY\Code\PromptFlowSandbox\PrmtFlPyVenv\Lib\site-packages\promptflow\tracing\_trace.py"**, line 145, in collect_openai_tokens_for_parent_span
    **key: (self._span_id_to_tokens[parent_span_id].get(key, 0) or 0) + (tokens.get(key, 0) or 0)**
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'dict' and 'dict'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\MattY\Code\PromptFlowSandbox\PrmtFlPyVenv\Lib\site-packages\promptflow\_core\flow_execution_context.py", line 90, in invoke_tool
    result = self._invoke_tool_inner(node, f, kwargs)
  File "C:\Users\MattY\Code\PromptFlowSandbox\PrmtFlPyVenv\Lib\site-packages\promptflow\_core\flow_execution_context.py", line 206, in _invoke_tool_inner
    raise ToolExecutionError(node_name=node_name, module=module) from e
promptflow._core._errors.ToolExecutionError: Execution failure in 'python_concat': (TypeError) unsupported operand type(s) for +: 'dict' and 'dict'
2024-11-11 14:29:39 -0500    8824 execution.flow     WARNING  Failed to calculate metrics due to exception: unsupported operand type(s) for +: 'int' and 'dict'.
2024-11-11 14:29:39 -0500    8824 execution.flow     WARNING  Failed to calculate metrics due to exception: unsupported operand type(s) for +: 'int' and 'dict'.
2024-11-11 14:29:39 -0500    8824 execution.flow     ERROR    Flow execution has failed. Cancelling all running nodes: python_concat.
pf.flow.test failed with UserErrorException: TypeError: **Execution failure in 'python_concat': (TypeError) unsupported operand type(s) for +: 'dict' and 'dict'**
WARNING:azure.monitor.opentelemetry.exporter.export._base:Retrying due to server request error: <urllib3.connection.HTTPSConnection object at 0x000001EE56BA7ED0>: Failed to resolve 'eastus-8.in.applicationinsights.azure.com' ([Errno 11001] getaddrinfo failed).
@yeamusic21 yeamusic21 added the bug Something isn't working label Nov 11, 2024
@yeamusic21 yeamusic21 changed the title [BUG] LangGraph nodes within Prompt Flow error out when Prompt Flow tracing is turned on Nov 11, 2024
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

1 participant