-
Notifications
You must be signed in to change notification settings - Fork 31
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
base: master
Are you sure you want to change the base?
Improve AI output #2136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the main comment is the one at the top of the base prompt class.
input_data = { | ||
"country_id": country_id, | ||
} | ||
for key in payload: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question what is this doing and why are we doing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This route is meant to take a series of prompt inputs (as keys in a dict) and the name of a prompt and return the AI prompt pre-filled, but without actually enqueuing AI processing from Claude.
These prompts take keys of differing names, values, and types, and so this code pops payload items and adds them into a dictionary to be passed to the service, which then validates if that input data object contains all of the required keys. It also now uses Pydantic to validate the types of these args.
Question for you: do you feel there's a better approach to this process?
7872f19
to
5c15c72
Compare
…prompt generation
…n analysis already exists
5c15c72
to
c3cef39
Compare
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:
string.replace
to provide clearer behaviorAIPromptBase
class to be used for more systematized prompt generation and improved user interfaceThe 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.