write me a python command line app that first checks the target directory for api_key file if it does not exist we must prompt the user for an api key and uses that map to predict the provider name then save that key and name to a api_key file and reuse it going forward, so the next time the user logs in their first choice is to use the name of provider xy-xx***** OR they can add a new provider the user can add multiple providers and multiple instances of the same provider. our map also contains the provider url and switches the import library used to make the calls. set this functionality up first. once the api key is determined we can begin the real application which is an ai idea generator. now we ask the user for a prompt and a number of cycles. then we begin a sequence of ai prompts to the selected provider. the initial prompt contains system prompt: “You are an idea generator. Based on the user prompt write a list of 25 creative real-world ideas about the user prompt” use the provided user prompt as user prompt. Now write the results to a new text file titled as windows safe user_prompt + default + timestamp.txt. Now we begin cycle prompts, cycle prompts are syncronous prompts that include the aggregate results from the last prompts and a new prompt like: “You are an idea generator create 25 new unique ideas about ${user_prompt} NOT in the list below: ” we want to run the cycle prompts the number of times chosen by the user, so if the user chose 10 cycles, we are going to end up in theory getting 250 total unique ideas across 10 queries. write all those results to a windows safe user_prompt + cycles + timestamp.txt file. I want each step passed to print onto the screen, the cmd user should get feedback and progress bars. make sure we have good layer separation between the ai request handling and our built in prompts and our cycling and our file management and our screen management. i want the code to be DRY and SRP. bundle the working python app into a downloadable zip.
by
Tags:
Leave a Reply