def test_search_with_custom_parameters(mock_valyu):
    """Test search method with custom parameters."""
    # Mock the Valyu client and response
    mock_client = Mock()
    mock_valyu.return_value = mock_client

    # Create mock result object
    mock_result = Mock()
    mock_result.content = "Custom test content"
    mock_result.title = "Custom test title"
    mock_result.url = "https://custom-test.com"
    mock_result.source = "custom_source"
    mock_result.price = 3.0
    mock_result.length = 300
    mock_result.data_type = "text"
    mock_result.relevance_score = 0.7

    # Mock response object
    mock_response = Mock()
    mock_response.results = [mock_result]
    mock_client.search.return_value = mock_response

    tool = ValyuToolSpec(api_key="test_key")

    # Test search with custom parameters
    documents = tool.search(
        query="custom test query",
        search_type="proprietary",
        max_num_results=10,
        relevance_threshold=0.8,
        max_price=50.0,
        start_date="2023-01-01",
        end_date="2023-12-31",
    )

    # Verify the client was called with custom parameters
    mock_client.search.assert_called_once_with(
        query="custom test query",
        search_type="proprietary",
        max_num_results=10,
        relevance_threshold=0.8,
        max_price=50.0,
        start_date="2023-01-01",
        end_date="2023-12-31",
    )

    # Verify document creation
    assert len(documents) == 1
    assert documents[0].text == "Custom test content"
Test search method with custom parameters.
llama-index-integrations/tools/llama-index-tools-valyu/tests/test_tools_valyu.py