Skip to content

Response Info

pyllmut.mutant_lib.response_info.ResponseInfo

Bases: PromptInfo

A class to store information about response details from the LLM.

Source code in pyllmut/mutant_lib/response_info.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class ResponseInfo(PromptInfo):
    """A class to store information about response details from the LLM."""

    def __init__(
            self,
            prompt_content: str,
            original_module_content: str,
            line_number: int,
            sent_token_count: int,
            response_content: str,
            received_token_count: int
    ):
        """
        Initializes the ResponseInfo object with the given parameters.

        Args:
            prompt_content (str): The content of the prompt.
            original_module_content (str): The content of the module we plan to generate mutants for.
            line_number (int): The line number in the module where we want to generate mutants.
            sent_token_count (int): The number of sent tokens when using the LLM.
            response_content (str): The response returned from the model.
            received_token_count (int): The number of tokens in the response.
        """
        super().__init__(
            prompt_content,
            original_module_content,
            line_number
        )
        self._sent_token_count = sent_token_count
        self._response_content = response_content
        self._received_token_count = received_token_count

    def get_sent_token_count(self) -> int:
        """Returns the number of sent tokens when using the LLM."""
        return self._sent_token_count

    def get_response_content(self) -> str:
        """Returns the response returned from the model."""
        return self._response_content

    def get_received_token_count(self) -> int:
        """Returns the number of tokens in the response."""
        return self._received_token_count

get_line_number()

Returns the line number in the module where we want to generate mutants.

Source code in pyllmut/mutant_lib/prompt_info.py
30
31
32
def get_line_number(self) -> int:
    """Returns the line number in the module where we want to generate mutants."""
    return self._line_number

get_original_module_content()

Returns the content of the module we plan to generate mutants for.

Source code in pyllmut/mutant_lib/prompt_info.py
26
27
28
def get_original_module_content(self) -> str:
    """Returns the content of the module we plan to generate mutants for."""
    return self._original_module_content

get_prompt_content()

Returns the content of the prompt.

Source code in pyllmut/mutant_lib/prompt_info.py
22
23
24
def get_prompt_content(self) -> str:
    """Returns the content of the prompt."""
    return self._prompt_content

get_received_token_count()

Returns the number of tokens in the response.

Source code in pyllmut/mutant_lib/response_info.py
44
45
46
def get_received_token_count(self) -> int:
    """Returns the number of tokens in the response."""
    return self._received_token_count

get_response_content()

Returns the response returned from the model.

Source code in pyllmut/mutant_lib/response_info.py
40
41
42
def get_response_content(self) -> str:
    """Returns the response returned from the model."""
    return self._response_content

get_sent_token_count()

Returns the number of sent tokens when using the LLM.

Source code in pyllmut/mutant_lib/response_info.py
36
37
38
def get_sent_token_count(self) -> int:
    """Returns the number of sent tokens when using the LLM."""
    return self._sent_token_count