Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AI output #2136

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Improve AI output #2136

wants to merge 16 commits into from

Conversation

anth-volk
Copy link
Collaborator

Fixes #2131
Fixes #2126
Fixes #2125
Required for PolicyEngine/policyengine-app#2325
Required for PolicyEngine/policyengine-app#2321

In an effort to make our AI output endpoints more sustainable, resilient, and modular, this PR does the following:

  • Moves away from using f-string manipulation and toward using Python string.replace to provide clearer behavior
  • Creates a new endpoint to be used for fetching AI prompts, de-linking the prompting and generation processes
  • Refactors both society-wide and household analysis to return JSON outputs in cases where users are re-accessing previously generated AI outputs
  • Creates an AIPromptBase class to be used for more systematized prompt generation and improved user interface
  • Creates a superclass on top of this for the society-wide analysis prompt

The changes here are required to enable a front-end PR implementing fixes for PolicyEngine/policyengine-app#2325 and PolicyEngine/policyengine-app#2321.

This code does not yet add tests, hence opening in draft form. I'd like these tests to mirror the structure proposed in #2114, and thus will implement that folder and test structure for these tests, and then refactor based upon future movement on that PR.

@anth-volk anth-volk marked this pull request as ready for review January 30, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant