ScanDefenitions
Back to ListDescription: Extract references in an ai-prompt, to generate ref abstracts
FileMaker Prototype:
Set Variable [$res; ACF_Run("ScanDefenitions"; string_prompt)]
Category: OPENAI
NOTE: This function serves as a reference template. To use it effectively, you may need to adjust certain parts of the code, such as field names, database structures, and specific data lists to fit the requirements of your system. This customization allows the function to work seamlessly within your environment.
Function source:
function ScanDefenitions ( string prompt )
JSON def;
array string tokens, toklist, aKeyWord, aAbstract;
tokens = explode (" ", prompt);
string word;
int i,x;
x = sizeof ( tokens );
for (i=1, x)
if ( left ( tokens[i], 1) == "@") then
word = substring(tokens[i], 1);
toklist[] = word;
prompt = substitute (prompt, tokens[i],word);
end if
end for
string InPart = "('" + implode ("','", toklist) + "')";
def["prompt"] = prompt;
// Query for abstracts
string sql = "SELECT KeyWord, Abstract FROM Defenitions WHERE KeyWord IN "+InPart+"
INTO :aKeyWord, :aAbstract";
string res = executeSQL ( sql );
x = sizeof (aKeyWord);
if ( x==0) then
def["hits"] = "None";
else
def["hits"] = string ( x);
for (i=1,x)
def["messages[]"] = JSON (
"role", "user",
"content",aAbstract[i]);
end for
end if
return def;
end