Last active
July 10, 2025 02:55
-
-
Save johnjosephhorton/1aeed0808b0895a0ad4d49a07d3d6590 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.11" | |
# dependencies = [ | |
# "pip", | |
# "edsl @ git+https://github.com/expectedparrot/edsl.git@improved_report", | |
# ] | |
# /// | |
from textwrap import dedent | |
from edsl import QuestionFreeText, QuestionList, Agent | |
def create_report(agent): | |
report = ( | |
( | |
QuestionList( | |
question_name="failure", | |
question_text="Please list a collection of famous product failures from the past 20 year", | |
) | |
.to_jobs() | |
.select("failure") | |
.to_scenario_list() | |
.expand("failure") | |
.to( | |
QuestionFreeText( | |
question_name="press_release", | |
question_text="""Please write a press release for product described here: {{ scenario.failure }} | |
It should be 1-2 paragraphs long and a positive, forward-looking press release about the launch, as the time it was launched. | |
""", | |
) | |
) | |
.select("failure", "press_release") | |
.to_scenario_list() | |
.to( | |
QuestionFreeText( | |
question_name="critique", | |
question_text="""Please assess the product described here: | |
{{ scenario.press_release }} for the product described here: {{ scenario.failure }}. | |
You do not know the future, so do not use knowledge you have about this actual product. | |
Try to be as objective as possible, going off of the press release alone. | |
""", | |
) | |
.add_question( | |
QuestionFreeText( | |
question_name="features_you_would_like_to_see", | |
question_text=""" | |
Based on the product described here: {{ scenario.failure }}, and your thoughts on it here, | |
{{ critique.answer }}, what other features would you like to see in the product and why? | |
""", | |
) | |
) | |
.by([agent]) | |
) | |
) | |
.then( | |
"report_from_template", | |
template=dedent( | |
"""\ | |
# Analysis of {{ failure }} | |
## Firm's simulutaed press release | |
{{ press_release }} | |
## Market Research Critique | |
### Critique from {{ role }} | |
{{ critique }} | |
### Features you would like to see | |
{{ features_you_would_like_to_see }}""" | |
), | |
format="pdf", | |
filestore=True, | |
) | |
.run() | |
) | |
return report | |
agent = Agent( | |
traits={ | |
"persona": """Devoted civil war re-enactor and comptroller from Bethesda. Father of 3. 40 pounds overweight and feels bad about it.""", | |
"role": "Civil War Re-enactor", | |
}, | |
instruction= dedent("""\ | |
Connect your critiques to your own experiences and points of view. | |
Feel free to be creative and add personal anecdotes and details. | |
Use concrete examples and details, recalling moments and stories. | |
You should imagine using the product yourself and how that might go for you. | |
You can be brutally honest and critical---don't worry about hurting anyone's feelings. | |
This is your internal monologue, so you can be as honest as you want. | |
You should be able to imagine using the product yourself and how that might go for you. | |
"""), | |
) | |
report = create_report(agent) | |
report.view() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment