promptflow icon indicating copy to clipboard operation
promptflow copied to clipboard

[BUG]Trace View can't display boolean output

Open hiroki0525 opened this issue 1 year ago • 0 comments

Describe the bug

In Trace View, boolean result displayed as a blank character like "" in Output.

How To Reproduce the bug

  1. Execute a flow containing nodes with Boolean values in the result.
  2. Open Trace View like /v1.0/ui/traces

Expected behavior

In Trace View, result should be displayed like "true" in Output even for boolean value.

Screenshots

スクリーンショット 2024-08-03 13 39 05

Running Information(please complete the following information):

  • Promptflow Package Version using pf -v: 1.14.0
  • Operating System: macOS Sonoma 14.2.1
  • Python Version using python --version: python==3.11.9

Additional context Add any other context about the problem here.

  • The source code for is_pdf is as follows.
import httpx
from promptflow.core import tool

_client = httpx.AsyncClient()


@tool
async def is_pdf(url: str) -> bool:
    if url.lower().endswith(".pdf"):
        return True
    response = await _client.head(url)
    content_type: str = response.headers.get("Content-Type", "")
    return content_type == "application/pdf"
  • The part of the response data of /v1.0/Spans/list API which is requested from the browser are as follow.
response data
[
    {
        "name": "is_pdf",
        "context": {
            "trace_id": "0x122f3293ce6e02532282d398ecbca0be",
            "span_id": "0xe93d8c589fbdf3e9",
            "trace_state": ""
        },
        "kind": "1",
        "parent_id": "0xc4ef992122d2f5c5",
        "start_time": "2024-08-03T04:05:37.460715",
        "end_time": "2024-08-03T04:05:37.460873",
        "status": {
            "status_code": "Ok",
            "description": ""
        },
        "attributes": {
            "framework": "promptflow",
            "span_type": "Function",
            "function": "is_pdf",
            "node_name": "is_pdf",
            "execution_target": "dag",
            "line_run_id": "eb2e7eb5-6c0f-4616-9665-ea650606ed8a",
            "inputs": "{\n  \"url\": \"https://www.ringerhut.jp/quality/allergy-nutrition_value/pdf/allergy-nutrition_value.pdf\"\n}",
            "output": "true"
        },
        "events": [
            {
                "name": "promptflow.function.inputs",
                "timestamp": "2024-08-03T04:05:37.460797",
                "attributes": {
                    "payload": "{\n  \"url\": \"https://www.ringerhut.jp/quality/allergy-nutrition_value/pdf/allergy-nutrition_value.pdf\"\n}"
                }
            },
            {
                "name": "promptflow.function.output",
                "timestamp": "2024-08-03T04:05:37.460848",
                "attributes": {
                    "payload": "true"
                }
            }
        ],
        "links": [],
        "resource": {
            "attributes": {
                "service.name": "promptflow",
                "collection": "foods_flow"
            },
            "schema_url": ""
        },
        "external_event_data_uris": [
            "b3605e3a-b4b3-4c10-a7d5-08e07de33bd3",
            "abbcb20e-3ae6-4a42-b82d-187bc81ad7d9"
        ]
    },

hiroki0525 avatar Aug 03 '24 05:08 hiroki0525