Brian Dunning's FileMaker Custom Functions

DetectPromptFormat

While Storing Prompts, it helps detect JSON prompts., Markdown prompts or Plain Text

  Be the first to rate this function Log in to vote

Binu Alexander   Binu Alexander - Show more from this author
ASC,
https://www.linkedin.com/in/drbinualexander/

  Sample input:
PromptFormatDetector("Write a poem about FileMaker Citizen Developers")

DetectPromptFormat ( "{\"prompt\": \"Summarize this record\", \"tone\": \"formal\"}" )
  Sample output:
Plain Text, JSON

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

`DetectPromptFormat` looks at a prompt stored in a FileMaker field and tells you what kind of text it is. It first checks whether the content is structured JSON data — if it starts with `{` or `[` and parses correctly, it's JSON. If not, it looks for common Markdown formatting clues like headings, bold text, bullet lists, code blocks, and links, with extra weight given to prompt-specific headings like "SYSTEM PROMPT" and "USER PROMPT." If even one Markdown signal is found, it's labeled Markdown; otherwise it's Plain Text. The idea is to check JSON first (since that's a definitive yes-or-no test), then fall back to pattern-matching for Markdown, so your downstream logic always knows what format it's working with.

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 22 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: