Best Practices for Prompt Storage - Seeking Input from API Users

Hello API users,

I have been experimenting with different methods for storing prompts, but I am still not entirely satisfied with the results. I believe understanding the practices adopted by others could help establish some best practices in prompt storage. Therefore, I would like to gather ideas and insights from the community.

Currently, I am exploring various options such as storing prompts in a SQL database, a JSON file, multiple JSON files, directly in the code module, or even in plain text files. Each approach has its pros and cons, and I am curious to know what methods you have found effective.

Please share your experiences and let me know how you organize your prompts. Are there specific storage formats or techniques that have worked well for you? Have you encountered any challenges or limitations with your chosen approach? Any advice or recommendations you can offer would be greatly appreciated.

By pooling our knowledge and experiences, I hope we can collectively establish some best practices for prompt storage. Whether you are a seasoned developer or just getting started, your input is valuable. Let’s work together to optimize our prompt management strategies and enhance our overall usage of the API.

Thank you in advance for your contributions!

I store the prompts in the database as text. However, I also store it in user’s LocalStorage. I just synchronize everything during app initialization and update the server copy if the user edits it.

I store prompts in my code to keep things organized and create separate modules for different tasks when I use the API. It ideally helps me to manage and reuse prompts across my application more effectively.

By storing prompts separately, I can have specific modules dedicated to different tasks. For example, one module can be all about creating different types of texts, while another module focuses on generating various types of questions. I can even have a module for providing explanations on specific topics. Each module has its own set of prompts related to its specific task.

Hopefully, it helps to understand.

Thanks for sharing. Why did you choose to stay on .txt based approach? Why don’t you use .json or .yaml? Please explain why you did that choice. What are the pros and cons?

For local testing I use mySQL so I just save the prompts as plain text and when I retrieve it using the backend API, I receive it back as JSON.

1 Like

I wouldn’t store prompts on your code. I’d probably stick them in some type of basic relational database.

2 Likes

I actually put them in code as markdown files, not inside the code.
I store them in a folder for prompts and a folder for each set of prompts thus defining agents (.system.md, .user.md, .assistant.md)

Keeps everything very clear and readable