Skip to content
Snippets Groups Projects
dummy_agent.py 2.03 KiB
Newer Older
Dipam Chakraborty's avatar
Dipam Chakraborty committed
from typing import List, Dict

class DummyResponseAgent(object):
    def __init__(self):
        """ Load your model(s) here """
        pass

    def generate_responses(self, test_data: List[Dict]) -> List[str]:
        """
        You will be provided with a batch of upto 50 independent conversations
        
        Input 1
        [
            {"persona A": ..., "persona B": ... "dialogue": ... }, # conversation 1  Turn 1
            ...
            {"persona A": ..., "persona B": ... "dialogue": ... }  # conversation 50 Turn 1
        ]

        Model should return 50 responses for Turn 1

        ...
        Input 7
        [
            {"persona A": ..., "persona B": ... "dialogue": ... }, # conversation 1  Turn 7
            ...
            {"persona A": ..., "persona B": ... "dialogue": ... }  # conversation 50 Turn 7
        ]
        Model should return 50 responses for Turn 7

        Note: Turn numbers will NOT be provided as input

        Return a dictionary with the following format

        "use_api": True/False                                                               - Note that this cannot be used when using GPU
        "prompts": [ <list of the prompts that go as "content" to the api > ]               - Note that every call is independent and we don't use threads
        "max_generated_tokens": [ list of ints for the max generation limit on each call]   - Note that the submission will fail if the total generation limit is exceeded
        "final_responses: [ <list of strings with the final responses> ]                    - Only used when use_api is set to False

Dipam Chakraborty's avatar
Dipam Chakraborty committed
        """
        # print(f"{len(test_data)=}, {test_data[0].keys()=}, {len(test_data[-1]['dialogue'])}")

        response = {
            "use_api": False,                                    # Ignored if GPU true is set in aicrowd.json
            "prompts": ["" for _ in test_data],                  # Ignored if GPU true is set in aicrowd.json
            "final_responses": ["THIS IS A TEST REPLY" for _ in test_data]
        }
        return response