fix: Refactor a few more components to proper folders (#8324)
* fix: Refactor a few more components to proper folders * Rename action for load files * [autofix.ci] apply automated fixes * Update tests for new naming * Update video_file.py * Update video_file.py * Update video_file.py * Update test_batch_run_component.py * Move unit tests * Update test_structured_output_component.py --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Yuqi Tang <yuqi.tang@datastax.com>
This commit is contained in:
parent
644bc87eca
commit
9aaca68687
18 changed files with 31 additions and 53 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import re
|
||||
|
||||
import pytest
|
||||
from langflow.components.helpers.batch_run import BatchRunComponent
|
||||
from langflow.components.processing.batch_run import BatchRunComponent
|
||||
from langflow.schema import DataFrame
|
||||
|
||||
from tests.base import ComponentTestBaseWithoutClient
|
||||
|
|
@ -5,7 +5,7 @@ from unittest.mock import patch
|
|||
import openai
|
||||
import pytest
|
||||
from langchain_openai import ChatOpenAI
|
||||
from langflow.components.helpers.structured_output import StructuredOutputComponent
|
||||
from langflow.components.processing.structured_output import StructuredOutputComponent
|
||||
from langflow.helpers.base_model import build_model_from_schema
|
||||
from langflow.inputs.inputs import TableInput
|
||||
from pydantic import BaseModel
|
||||
|
|
@ -53,7 +53,7 @@ class TestStructuredOutputComponent(ComponentTestBaseWithoutClient):
|
|||
system_prompt="Test system prompt",
|
||||
)
|
||||
|
||||
with patch("langflow.components.helpers.structured_output.get_chat_result", mock_get_chat_result):
|
||||
with patch("langflow.components.processing.structured_output.get_chat_result", mock_get_chat_result):
|
||||
result = component.build_structured_output_base()
|
||||
assert isinstance(result, list)
|
||||
assert result == [{"field": "value"}]
|
||||
|
|
@ -174,7 +174,7 @@ class TestStructuredOutputComponent(ComponentTestBaseWithoutClient):
|
|||
with pytest.raises(ValueError, match="Invalid type: invalid_type"):
|
||||
component.build_structured_output()
|
||||
|
||||
@patch("langflow.components.helpers.structured_output.get_chat_result")
|
||||
@patch("langflow.components.processing.structured_output.get_chat_result")
|
||||
def test_nested_output_schema(self, mock_get_chat_result):
|
||||
class ChildModel(BaseModel):
|
||||
child: str = "value"
|
||||
|
|
@ -208,7 +208,7 @@ class TestStructuredOutputComponent(ComponentTestBaseWithoutClient):
|
|||
assert isinstance(result, list)
|
||||
assert result == [{"parent": {"child": "value"}}]
|
||||
|
||||
@patch("langflow.components.helpers.structured_output.get_chat_result")
|
||||
@patch("langflow.components.processing.structured_output.get_chat_result")
|
||||
def test_large_input_value(self, mock_get_chat_result):
|
||||
large_input = "Test input " * 1000
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ def ingestion_graph():
|
|||
file_component.set(path="test.txt")
|
||||
file_component.set_on_output(name="dataframe", value=Data(text="This is a test file."), cache=True)
|
||||
text_splitter = SplitTextComponent(_id="text-splitter-123")
|
||||
text_splitter.set(data_inputs=file_component.load_dataframe)
|
||||
text_splitter.set(data_inputs=file_component.load_files)
|
||||
openai_embeddings = OpenAIEmbeddingsComponent(_id="openai-embeddings-123")
|
||||
openai_embeddings.set(
|
||||
openai_api_key="sk-123", openai_api_base="https://api.openai.com/v1", openai_api_type="openai"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue