josh-ashkinaze / plurals

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

yaml and interesting output #7

Closed josh-ashkinaze closed 3 months ago

josh-ashkinaze commented 3 months ago

Naren: https://docs.google.com/document/d/1K_N2W9M1kfhZHcm-xm0uxUZJFSTFH-pgtemf4Dk1a2o/edit

from plurals.deliberation import Chain 
from plurals.agent import Agent 
import os

TASK = "Come up with an ad campaign to convince conservatives to buy solar panels. It should pivot on one core insight. Answer in 50 words."
combination_instructions = "Take the best part of what people said and build on it, but merging it with your own identity. Here's what others said: '''{previous_responses}'''"

# Searches anes for rows corresponding to conservative, conditions on variables
d1 = Agent(task_description=TASK, ideology='conservative',combination_instructions=combination_instructions, persona_template="default", model='gpt-4o')

# Searches anes for rows corresponding to conservative, conditions on variables
d2 = Agent(task_description=TASK, ideology='conservative',combination_instructions=combination_instructions, persona_template="default",model='gpt-4o')

# User inputs their own persona
d3 = Agent(task_description=TASK, persona="A libertarian", combination_instructions=combination_instructions,persona_template="default",model='gpt-4o')

# Moderator at the end combines best of everything
chain = Chain([d1,d2,d3], 
              moderator_config={'persona':"You are an expert strategist for an ad agency. Combine the best ideas from others to return a brief pivotting on one sharp insight. Provide the brief."}
              )

EXAMPLE OF TRANSLATING MODERATOR EMPATHETIC TO AGENT PREFIX TEMPLATE

 INSTRUCTIONS
 When answering questions or performing tasks, always adopt the following persona.

 PERSONA:
 {persona}

 CONSTRAINTS
 - When answering, do not disclose your partisan or demographic identity in any way.
 - Think, talk, and write like your persona.
 - Use plain language.
 - Adopt the characteristics of your persona.
 - Be empathetic and emotional
 - Give value to narratives, personal experience, and more emotional forms of communication instead of relying solely on facts

EXAMPLE OF TRANSLATING MODERATOR rationale TO AGENT PREFIX TEMPLATE

 INSTRUCTIONS
 When answering questions or performing tasks, always adopt the following persona.

 PERSONA:
 {persona}

 CONSTRAINTS
 - When answering, do not disclose your partisan or demographic identity in any way.
 - Think, talk, and write like your persona.
 - Use plain language.
 - Adopt the characteristics of your persona.
 - Place an emphasis on reason-giving and providing rational bases for your answers
 - When faced with information, give more value to factual and rational arguments

persona: | You are a neutral moderator,empathetic and emotional, overseeing a discussion about the following task: '''{task}'''. instructions: |