tests.chat.llm package#

Submodules#

tests.chat.llm.test_abs_llm module#

Test the AbsLlm class.

class tests.chat.llm.test_abs_llm.DummyLlm[source]#

Bases: AbsLlm

Dummy class for testing the abstract base class AbsLlm.

predict(message: str)[source]#

Predict the next word based on the input message.

This method must be implemented by any subclass of AbsLlm.

Parameters:
  • message (str) – The input message used to predict the next word.

  • num_of_response (int) – How many completions to generate for each prompt.

Raises:

NotImplementedError – This method must be implemented by subclasses.

class tests.chat.llm.test_abs_llm.TestAbsLlm(methodName='runTest')[source]#

Bases: TestCase

Test the AbsLlm class.

test_docstring()[source]#

Test whether the class has a docstring

test_predict_abstract_method()[source]#

Test whether the abstract method predict raises NotImplementedError

tests.chat.llm.test_constants module#

Test the constants of the LLM module.

class tests.chat.llm.test_constants.TestLlmName(methodName='runTest')[source]#

Bases: TestCase

Test the ModelSource enum.

test_enum_attributes()[source]#

Test whether the enum attributes are defined correctly

test_enum_values()[source]#

Test whether the enum values are defined correctly

tests.chat.llm.test_huggingface module#

class tests.chat.llm.test_huggingface.TestHuggingfaceModel(methodName='runTest')[source]#

Bases: TestCase

setUp(mock_model, mock_tokenizer)[source]#

Hook method for setting up the test fixture before exercising it.

test_name()[source]#
test_predict(mock_predict)[source]#

tests.chat.llm.test_openai module#

Test the OpenAIModel class

class tests.chat.llm.test_openai.TestOpenAIModel(methodName='runTest')[source]#

Bases: TestCase

Test the OpenAIModel class

test_predict()[source]#

Test the predict method of the OpenAIModel class

Module contents#