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

make a jupyter or readme of different examples #8

Closed josh-ashkinaze closed 4 months ago

josh-ashkinaze commented 5 months ago

query_str: add to tests and this

query_str method: It does a search through a pandas dataframe When you say ideology==liberal .... if ideology == 'liberal': return data[data['ideo5'].isin([1, 2])]

query_str is like "ideo5 in @[1,2]"

josh-ashkinaze commented 5 months ago

Seperate things:

Chain: Each agent sees the previous agent's responses in a `chain' Ensemble: Each agent completes the task indepently using asynchronous requests Debate: Two agents respond to each other

For each of these we can add a moderator at the end

It's using LiteLLM as a backend to make API calls. So the list of supported models is from LiteLLM and the way to set enviornment variables can be seen in LiteLLM's documentation (maybe link to it). Examples:

Example of setting API keys in your enviornment

import os
os.environ["OPENAI_API_KEY"] = "placeholder"
os.environ["ANTHROPIC_API_KEY"] = "placeholder"
josh-ashkinaze commented 4 months ago

@narenedara I am actually closing this since I started it and Emily can finish using some outputs she had. I should note a few name changes (that I thought makes it easier for uses)....only the first would affect end-users btw.

  1. I changed agent.process_task() to agent.process() since it's shorter and matches chains etc.
  2. I changed prefix_template to persona_template since I think it's not really a prefix anymore right?
  3. For many functions, I denoted them as private by adding an underscore before the name.

However, if you already started this please commit to a branch and I can integrate in the README. You can never really have too many examples for users!

But, it would be helpful if you worked on the unit test stuff we talked about! You will see I also updated the unit tests:

  1. For some of them we don't need to process the Structure really since we are interested in just personas
  2. I added things such as generating a random persona.