ref: sidebar experience improvement with new bundles (#8824)
* cohere sidebar * side bar embeddings * move memories * sort style utils * [autofix.ci] apply automated fixes * serach components add * Update __init__.py * Update styleUtils.ts * [autofix.ci] apply automated fixes * Update model_input_constants.py * fix lint * update to wikipedia * ✨ (tableInputComponent.spec.ts): Refactor test to use for loops for better readability and efficiency ✨ (filterEdge-shard-1.spec.ts): Update model names for better clarity and consistency 🐛 (duckduckgo.spec.ts): Update selector for search button to match changes in the frontend 🐛 (generalBugs-shard-11.spec.ts): Update selector for search button to match changes in the frontend * [autofix.ci] apply automated fixes * update tests path * update tests * Update test_arxiv_component.py * [autofix.ci] apply automated fixes * make embeddings functions --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
This commit is contained in:
parent
dc671ae204
commit
e28093234b
84 changed files with 264 additions and 238 deletions
|
|
@ -3,7 +3,7 @@ import os
|
|||
import pytest
|
||||
from langchain.schema import HumanMessage
|
||||
from langchain_community.chat_models.baidu_qianfan_endpoint import QianfanChatEndpoint
|
||||
from langflow.components.languagemodels.baidu_qianfan_chat import QianfanChatEndpointComponent
|
||||
from langflow.components.baidu.baidu_qianfan_chat import QianfanChatEndpointComponent
|
||||
from qianfan.errors import APIError
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
from langflow.components.languagemodels import DeepSeekModelComponent
|
||||
from langflow.components.deepseek.deepseek import DeepSeekModelComponent
|
||||
from langflow.custom.custom_component.component import Component
|
||||
from langflow.custom.utils import build_custom_component_template
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from langflow.components.languagemodels import XAIModelComponent
|
||||
from langflow.components.xai.xai import XAIModelComponent
|
||||
from langflow.custom.custom_component.component import Component
|
||||
from langflow.custom.utils import build_custom_component_template
|
||||
from langflow.inputs.inputs import (
|
||||
|
|
@ -101,7 +101,7 @@ class TestXAIComponent(ComponentTestBaseWithoutClient):
|
|||
component.base_url = "https://api.x.ai/v1"
|
||||
component.seed = 1
|
||||
|
||||
mock_chat_openai = mocker.patch("langflow.components.languagemodels.xai.ChatOpenAI", return_value=MagicMock())
|
||||
mock_chat_openai = mocker.patch("langflow.components.xai.xai.ChatOpenAI", return_value=MagicMock())
|
||||
model = component.build_model()
|
||||
mock_chat_openai.assert_called_once_with(
|
||||
max_tokens=100,
|
||||
|
|
@ -156,7 +156,7 @@ class TestXAIComponent(ComponentTestBaseWithoutClient):
|
|||
component.seed = 1
|
||||
|
||||
mocker.patch(
|
||||
"langflow.components.languagemodels.xai.ChatOpenAI",
|
||||
"langflow.components.xai.xai.ChatOpenAI",
|
||||
side_effect=BadRequestError(
|
||||
message="Invalid API key",
|
||||
response=MagicMock(),
|
||||
|
|
@ -181,7 +181,7 @@ class TestXAIComponent(ComponentTestBaseWithoutClient):
|
|||
mock_instance = MagicMock()
|
||||
mock_bound_instance = MagicMock()
|
||||
mock_instance.bind.return_value = mock_bound_instance
|
||||
mocker.patch("langflow.components.languagemodels.xai.ChatOpenAI", return_value=mock_instance)
|
||||
mocker.patch("langflow.components.xai.xai.ChatOpenAI", return_value=mock_instance)
|
||||
|
||||
model = component.build_model()
|
||||
mock_instance.bind.assert_called_once_with(response_format={"type": "json_object"})
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from tests.base import ComponentTestBaseWithClient
|
|||
class TestArXivComponent(ComponentTestBaseWithClient):
|
||||
def test_component_versions(self, default_kwargs, file_names_mapping):
|
||||
"""Test component compatibility across versions."""
|
||||
from langflow.components.search.arxiv import ArXivComponent
|
||||
from langflow.components.arxiv.arxiv import ArXivComponent
|
||||
|
||||
# Test current version
|
||||
component = ArXivComponent(**default_kwargs)
|
||||
|
|
@ -31,7 +31,7 @@ class TestArXivComponent(ComponentTestBaseWithClient):
|
|||
|
||||
@pytest.fixture
|
||||
def component_class(self):
|
||||
from langflow.components.search.arxiv import ArXivComponent
|
||||
from langflow.components.arxiv.arxiv import ArXivComponent
|
||||
|
||||
return ArXivComponent
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from unittest.mock import patch
|
|||
|
||||
import pandas as pd
|
||||
import pytest
|
||||
from langflow.components.search import GoogleSearchAPICore
|
||||
from langflow.components.google.google_search_api_core import GoogleSearchAPICore
|
||||
from langflow.schema import DataFrame
|
||||
|
||||
from tests.base import ComponentTestBaseWithoutClient
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from langflow.components.search import GoogleSerperAPICore
|
||||
from langflow.components.google.google_serper_api_core import GoogleSerperAPICore
|
||||
from langflow.schema import DataFrame
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from unittest.mock import MagicMock, patch
|
|||
import httpx
|
||||
import pytest
|
||||
from langchain_core.tools import ToolException
|
||||
from langflow.components.search import WikidataComponent
|
||||
from langflow.components.wikipedia import WikidataComponent
|
||||
from langflow.custom import Component
|
||||
from langflow.custom.utils import build_custom_component_template
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
from langflow.components.search import WikipediaComponent
|
||||
from langflow.components.wikipedia import WikipediaComponent
|
||||
from langflow.custom import Component
|
||||
from langflow.custom.utils import build_custom_component_template
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from unittest.mock import MagicMock, patch
|
|||
|
||||
import pytest
|
||||
from langchain_core.tools import ToolException
|
||||
from langflow.components.search.yahoo import YahooFinanceMethod, YfinanceComponent
|
||||
from langflow.components.yahoosearch.yahoo import YahooFinanceMethod, YfinanceComponent
|
||||
from langflow.custom.utils import build_custom_component_template
|
||||
from langflow.schema import Data
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class TestYfinanceComponent:
|
|||
for input_name in expected_inputs:
|
||||
assert input_name in input_names
|
||||
|
||||
@patch("langflow.components.search.yahoo.yf.Ticker")
|
||||
@patch("langflow.components.yahoosearch.yahoo.yf.Ticker")
|
||||
def test_fetch_info(self, mock_ticker, component_class, default_kwargs):
|
||||
component = component_class(**default_kwargs)
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ class TestYfinanceComponent:
|
|||
assert len(result) == 1
|
||||
assert "Apple Inc." in result[0].text
|
||||
|
||||
@patch("langflow.components.search.yahoo.yf.Ticker")
|
||||
@patch("langflow.components.yahoosearch.yahoo.yf.Ticker")
|
||||
def test_fetch_news(self, mock_ticker, component_class):
|
||||
component = component_class(symbol="AAPL", method=YahooFinanceMethod.GET_NEWS, num_news=2)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from unittest.mock import MagicMock, patch
|
|||
|
||||
import pytest
|
||||
from langchain_core.tools import ToolException
|
||||
from langflow.components.search import SerpComponent
|
||||
from langflow.components.serpapi.serp import SerpComponent
|
||||
from langflow.custom import Component
|
||||
from langflow.custom.utils import build_custom_component_template
|
||||
from langflow.schema import Data
|
||||
|
|
@ -34,7 +34,7 @@ def test_serpapi_template():
|
|||
assert input_name in input_names
|
||||
|
||||
|
||||
@patch("langflow.components.search.serp.SerpAPIWrapper")
|
||||
@patch("langflow.components.serpapi.serp.SerpAPIWrapper")
|
||||
def test_fetch_content(mock_serpapi_wrapper):
|
||||
component = SerpComponent()
|
||||
component.serpapi_api_key = "test-key"
|
||||
|
|
@ -81,7 +81,7 @@ def test_error_handling():
|
|||
component.serpapi_api_key = "test-key"
|
||||
component.input_value = "test query"
|
||||
|
||||
with patch("langflow.components.search.serp.SerpAPIWrapper") as mock_serpapi:
|
||||
with patch("langflow.components.serpapi.serp.SerpAPIWrapper") as mock_serpapi:
|
||||
mock_instance = MagicMock()
|
||||
mock_serpapi.return_value = mock_instance
|
||||
mock_instance.results.side_effect = Exception("API Error")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue