josh-ashkinaze / plurals

Plurals: A System for Guiding LLMs Via Simulated Social Ensembles
https://josh-ashkinaze.github.io/plurals/
12 stars 2 forks source link

improve unit tests in a few ways #20

Closed josh-ashkinaze closed 4 months ago

josh-ashkinaze commented 5 months ago

I made these changes for test_moderator_default; we want everything to be like this.

    def test_moderator_default(self):
        a2 = Agent(ideology='neutral', model=self.model)
        a3 = Agent(ideology='liberal', model=self.model)
        a4 = Agent(ideology='conservative', model=self.model)
        mod = Moderator()
        mixed = Chain([a2, a3, a4], task_description=self.task, moderator=mod)
        mixed.process()
        formatted_responses = mixed.responses[:-1]

        print("Mixed", mixed.moderator.persona)

        expected_persona = SmartString(DEFAULTS['moderator']['persona']['default']).format(task=self.task)
        expected_combination_instructions = SmartString(DEFAULTS['moderator']['combination_instructions']['default']).format(previous_responses=format_previous_responses(formatted_responses))

        # Assertions
        self.assertIsNotNone(mixed.final_response)
        self.assertEqual(expected_persona, mixed.moderator.persona)
        self.assertEqual(expected_combination_instructions, mixed.moderator.combination_instructions)
josh-ashkinaze commented 4 months ago

due to the changes I made def pull from main before working on this!

josh-ashkinaze commented 4 months ago

@narenedara I updated debate with a fix. So use updated branch

https://github.com/josh-ashkinaze/plurals/commit/667f48131eeeb896fadc05dee79704a453a67df9

josh-ashkinaze commented 4 months ago

I did the debate unit test so closed that