neuralmesh / apimesh

Serves as the template to enable llms in any gihub project
GNU General Public License v3.0
0 stars 2 forks source link

create promptlibrary api #4

Open m-c-frank opened 9 months ago

m-c-frank commented 9 months ago

i need to more easily edit the prompts that are used in the workflow.

i guess just using textraw-server and a repo that contains the prompts is the easiest way to got!

m-c-frank commented 9 months ago

Here are five efficient methods for creating a Prompt Library API to easily edit prompts used in a workflow:

  1. File-based Storage:

    • Save the prompts in individual text files in a designated folder.
    • Use a simple directory structure to organize the prompts by category or function.
    • Implement an API endpoint to read the content of a specific prompt file and return it as a response.
    • Utilize standard file read operations to access and modify the prompts.
    • This approach requires minimal setup and has low complexity, making it efficient for quick changes to prompts.
  2. Single JSON File:

    • Store all the prompts in a single JSON file, using a key-value structure where the keys represent the prompt names and the values hold the actual prompts.
    • Implement an API endpoint to read the JSON file and return the required prompt based on its key.
    • Use a JSON parser library to easily access and manipulate the prompts.
    • With only one file to manage, this method simplifies the editing process by reducing the number of files and directories to handle.
  3. Database:

    • Create a database table with columns for prompt name and prompt content.
    • Implement a database API to retrieve the desired prompt by its name.
    • Use SQL queries with proper indexing to optimize retrieval performance.
    • Enable administrative access to directly edit the prompts in the database or provide an interface/API for editing the prompts.
    • This method offers a clean and centralized approach to storing and editing prompts, making it efficient for managing a large number of prompts.
  4. Key-Value Store:

    • Utilize a key-value store database like Redis or Memcached to store the prompts.
    • Set the prompt name as the key and the prompt content as the value.
    • Implement an API to read the prompt based on its key from the key-value store.
    • These databases provide fast in-memory access and are optimized for speedy read operations, making them efficient for prompt retrieval.
  5. Version Control System Integration:

    • Use a version control system like Git to manage the prompt files.
    • Create a separate repository specifically for storing and managing the prompts.
    • Implement an interface/API to fetch the prompts directly from the repository.
    • Utilize the version control system's commands or library to handle updates and changes to the prompts.
    • This method allows for easy collaboration, versioning, and tracking of prompt changes, making it efficient for teams working on prompt development.
m-c-frank commented 9 months ago

we will use the prompts issue #14 to represent the promptlibrary where links to interesting chatgpt chats are stored