fix: Remove the dataframe output from structured (#8233)

* fix: Remove the dataframe output from structured

* Remove unneeded import

* Update the description field

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

* Update structured_output.py

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* 🐛 (typescript_test.yml): increase the maximum shard count to 40 to improve test distribution and performance

* Update Financial Report Parser.json

* Fix templates

* [autofix.ci] apply automated fixes

* Update Pokédex Agent.json

* [autofix.ci] apply automated fixes

* temp test fix

* test fixes

* [autofix.ci] apply automated fixes

* add shards

*  (freeze-path.spec.ts): add functionality to add a flow to test on an empty langflow if the condition is met

* file path fix

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Yuqi Tang <yuqi.tang@datastax.com>
Co-authored-by: Carlos Coelho <80289056+carlosrcoelho@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: Mike Fortman <michael.fortman@datastax.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
This commit is contained in:
Eric Hare 2025-06-10 15:03:54 -07:00 committed by GitHub
commit fa18841788
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 172 additions and 474 deletions

View file

@ -5,7 +5,6 @@ from langflow.base.models.chat_result import get_chat_result
from langflow.custom.custom_component.component import Component
from langflow.helpers.base_model import build_model_from_schema
from langflow.io import (
BoolInput,
HandleInput,
MessageTextInput,
MultilineInput,
@ -13,16 +12,12 @@ from langflow.io import (
TableInput,
)
from langflow.schema.data import Data
from langflow.schema.dataframe import DataFrame
from langflow.schema.table import EditMode
class StructuredOutputComponent(Component):
display_name = "Structured Output"
description = (
"Transforms LLM responses into **structured data formats**. Ideal for extracting specific information "
"or creating consistent outputs."
)
description = "Uses an LLM to generate structured data. Ideal for extraction and consistency."
name = "StructuredOutput"
icon = "braces"
@ -96,6 +91,14 @@ class StructuredOutputComponent(Component):
"options": ["str", "int", "float", "bool", "dict"],
"default": "str",
},
{
"name": "multiple",
"display_name": "As List",
"type": "boolean",
"description": "Set to True if this output field should be a list of the specified type.",
"default": "False",
"edit_mode": EditMode.INLINE,
},
],
value=[
{
@ -106,13 +109,6 @@ class StructuredOutputComponent(Component):
}
],
),
BoolInput(
name="multiple",
advanced=True,
display_name="Generate Multiple",
info="[Deprecated] Always set to True",
value=True,
),
]
outputs = [
@ -121,11 +117,6 @@ class StructuredOutputComponent(Component):
display_name="Structured Output",
method="build_structured_output",
),
Output(
name="structured_output_dataframe",
display_name="DataFrame",
method="as_dataframe",
),
]
def build_structured_output_base(self) -> Data:
@ -175,9 +166,3 @@ class StructuredOutputComponent(Component):
output = self.build_structured_output_base()
return Data(text_key="results", data={"results": output})
def as_dataframe(self) -> DataFrame:
output = self.build_structured_output_base()
if isinstance(output, list):
return DataFrame(data=output)
return DataFrame(data=[output])

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,7 @@
import { expect, Page, test } from "@playwright/test";
import * as dotenv from "dotenv";
import path from "path";
import { addFlowToTestOnEmptyLangflow } from "../../utils/add-flow-to-test-on-empty-langflow";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
import { initialGPTsetup } from "../../utils/initialGPTsetup";
@ -20,6 +21,14 @@ test(
await awaitBootstrapTest(page);
const firstRunLangflow = await page
.getByTestId("empty-project-description")
.count();
if (firstRunLangflow > 0) {
await addFlowToTestOnEmptyLangflow(page);
}
await page.getByTestId("side_nav_options_all-templates").click();
await page.getByRole("heading", { name: "Basic Prompting" }).click();

View file

@ -260,7 +260,7 @@ test(
await page.getByTestId("button_run_chat output").click();
await page.waitForTimeout(1000);
await page.waitForTimeout(3000);
await page.waitForSelector("text=built successfully", {
timeout: 30000 * 3,

View file

@ -34,6 +34,15 @@ withEventDeliveryModes(
await initialGPTsetup(page);
//* TODO: Remove these 3 steps once the template is updated *//
await page.getByTestId("dropdown-output-openaimodel").click();
await page
.getByTestId("dropdown-item-output-openaimodel-language model")
.click();
await page.getByTestId("tab_1_stringify").click();
await page.getByTestId("playground-btn-flow-io").click();
await page.waitForSelector('[data-testid="button-send"]', {

View file

@ -39,6 +39,15 @@ withEventDeliveryModes(
await initialGPTsetup(page);
//* TODO: Remove these 3 steps once the template is updated *//
await page
.getByTestId("handle-structuredoutput-shownode-structured output-right")
.click();
await page
.getByTestId("handle-parser-shownode-data or dataframe-left")
.click();
await page.getByTestId("tab_1_stringify").click();
await page.getByRole("button", { name: "Playground", exact: true }).click();
await page.waitForSelector('[data-testid="input-chat-playground"]', {

View file

@ -41,6 +41,23 @@ withEventDeliveryModes(
.nth(0)
.fill(process.env.TAVILY_API_KEY ?? "");
//* TODO: Remove these 5 steps once the template is updated *//
await page.getByTestId("dropdown-output-openaimodel").click();
await page
.getByTestId("dropdown-item-output-openaimodel-language model")
.click();
await page
.getByTestId("handle-structuredoutput-shownode-structured output-right")
.click();
await page
.getByTestId("handle-parser-shownode-data or dataframe-left")
.click();
await page.getByTestId("tab_1_stringify").click();
await page.getByTestId("button_run_chat output").click();
await page.waitForSelector("text=built successfully", {
timeout: 60000 * 3,