dify icon indicating copy to clipboard operation
dify copied to clipboard

toast says '>' not supported between instances of 'float' and 'NoneType' on knowlege retereval testing

Open TaylorHere opened this issue 1 year ago • 4 comments

Self Checks

  • [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [X] Please do not modify this template :) and fill in all the required fields.

Dify version

0.8.0

Cloud or Self Hosted

Cloud

Steps to reproduce

Retrieval testing any database in my account, will reproduce this bug.

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

TaylorHere avatar Sep 12 '24 18:09 TaylorHere

@TaylorHere Hello there! I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer. I'm a bot designed to assist with all things software development.

The error occurs in the _assert_greater_than method of the ConditionProcessor class. Specifically, the comparison between float and NoneType happens when actual_value is None. Here is the relevant code snippet:

def _assert_greater_than(self, actual_value: Optional[int | float], expected_value: str | int | float) -> bool:
    """
    Assert greater than
    :param actual_value: actual value
    :param expected_value: expected value
    :return:
    """
    if actual_value is None:
        return False

    if not isinstance(actual_value, int | float):
        raise ValueError("Invalid actual value type: number")

    if isinstance(actual_value, int):
        expected_value = int(expected_value)
    else:
        expected_value = float(expected_value)

    if actual_value <= expected_value:
        return False
    return True

To fix this issue, ensure that actual_value is not None before performing the comparison [1].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Sep 12 '24 18:09 dosubot[bot]

I'm having the same issue when retrieving knowledge or testing the retrieval. Also use cloud version.

GabrielBaumerIA avatar Sep 12 '24 19:09 GabrielBaumerIA

Here too, the same error.

Midasstart avatar Sep 13 '24 01:09 Midasstart

I reproduced this problem in Cloud version.

Please take a look at this issue. :) @JohnJyong

crazywoola avatar Sep 13 '24 01:09 crazywoola

another error says when run knowlege retereval testing shapes (1536,) and (3072,) not aligned: 1536 (dim 0) != 3072 (dim 0)

TaylorHere avatar Sep 13 '24 03:09 TaylorHere