Perform Find by Natural Language
Envía una indicación en lenguaje natural y una lista de campos de la presentación actual a un modelo, lo que devuelve una solicitud de búsqueda de FileMaker y ejecuta una búsqueda.
Temas relacionados
Opciones
-
Nombre de cuenta es una expresión de texto para el nombre de la cuenta de IA que se va a utilizar. En el archivo actual, utilice el paso de guión Configurar cuenta de IA para configurar la cuenta y asignarle este nombre en cualquier momento antes de que se ejecute este paso de guión.
-
Modelo es el nombre del modelo de generación de texto que se utiliza. Especifique el nombre del modelo como expresión de texto. Para conocer los modelos compatibles, consulte las Especificaciones técnicas de FileMaker.
-
Indicación es una expresión de texto para la solicitud o pregunta de lenguaje natural que se enviará al modelo.
-
Get specifies the type of response to retrieve from the model.
-
Found Set: Performs the find request generated by the model and updates the found set in the current window.
-
Found Set as JSON: Performs the find request generated by the model and returns the found set's data as a JSON object. Doesn't change the found set in the current window.
-
Find Request as JSON: Does not perform the find. Returns the FileMaker find request generated by the model as a JSON object.
-
-
Nombre de plantilla de indicaciones especifica el nombre de una plantilla de indicaciones personalizada configurada utilizando el paso de guion paso de guión Configurar plantilla de indicaciones. Utilice esta opción para diseñar una indicación adicional con el fin de contribuir a lograr una respuesta óptima en un modelo de IA.
-
Parámetros es una expresión de texto para un objeto JSON que consiste en pares clave-valor para parámetros adicionales que son compatibles con el proveedor del modelo. Por ejemplo:
{"temperatura": 0.7, "semilla": 42}
. Consulte la documentación del proveedor del modelo para conocer los nombres clave de los parámetros admitidos y sus rangos válidos.La clave
context_prompt
es un parámetro especial que le permite incorporar instrucciones o contexto adicionales al modelo antes de la indicación principal. Por ejemplo:{"context_prompt": "Tratar 'hoy' como 03/09/2025"}
. -
Objetivo de respuesta especifica el campo o la variable en el que se almacenará la respuesta del modelo.
Compatibilidad
Producto | Format |
FileMaker Pro | Sí |
FileMaker Go | Sí |
FileMaker WebDirect | Sí |
FileMaker Server | Sí |
FileMaker Cloud | Sí |
FileMaker Data API | Sí |
Publicación en la Web personalizada | Sí |
Se origina en
22.0
Descripción
This script step allows you to perform FileMaker find requests on your data using natural language without specifying find criteria as in the paso de guión Ejecutar búsqueda. It uses an AI model to interpret a natural language prompt, analyze the fields available on the current layout, and generate an appropriate FileMaker find request (and sort order, if applicable).
The interaction between this script step and the model typically follows these steps:
-
This script step identifies all fields accessible by a find on the current layout. It sends information about these fields (similar to the output of the función GetFieldsOnLayout) along with the Prompt to the specified Model. (This includes prompts provided in an optional prompt template and the
context_prompt
parameter.) -
The model analyzes the prompt and layout field information, then generates a FileMaker find request and sort order designed to retrieve the requested records.
-
This script step receives the generated find request and sort order.
-
The script step performs an action based on the Get option.
The Get option determines what happens after the model generates the find request:
Get | Does this |
---|---|
Found Set |
Performs the generated find request on the current layout and, in step 4, updates the found set. If the model generated a sort order, the found set is also sorted accordingly. The Response Target is not used when this option is selected. |
Found Set as JSON |
Performs the generated find request and, in step 4, returns the data from the resulting found set as a JSON object in the Response Target. The JSON structure is the same as the response to a find request performed via the FileMaker Data API. It includes the found set's data, data information (like found count and total record count), and any messages (errors or warnings). See the example below and the example in paso de guión Ejecutar FileMaker Data API. |
Find Request as JSON |
Does not perform the find. In step 4, returns the generated FileMaker find request and sort order as a JSON object in the Response Target. This option is primarily useful for debugging to see exactly what find request the model generated. The JSON structure is similar to the |
Notas
-
Only fields accessible by a find on the current layout are sent to the model. For more on the criteria used to determine which fields are accessible by find, see the función GetFieldsOnLayout, which uses the same criteria as this script step. The same information sent to the model (layout name, field names, types, and descriptions) is returned by GetFieldsOnLayout.
-
Field comments you enter in the Manage Database dialog are included with the field information sent to the model. To improve the model's ability to generate useful find requests, you can use the comment to explain the purpose of the field. See Definir y modificar campos. For more on controlling which fields' comments are sent to the model, see the función GetFieldsOnLayout.
-
If you specify a Prompt Template Name, this script step uses the template configured via the paso de guión Configurar plantilla de indicaciones. Prompt templates can use constants like
:schema:
(replaced with layout field information),:question:
(replaced with Prompt), and:context:
(replaced with thecontext_prompt
parameter in Parameters). -
This script step can be used for multilingual finds, as AI models can operate on multiple languages.
-
When no relevant records are found, a message is returned in the Response Target (if used), and the función Get ( LastError ) returns error 401 ("No records match the request").
-
This script step can't perform finds that require aggregate functions (for example, finding the record with the highest value in a field). However, the model may return a find request that includes sort criteria to help identify such records (for example, sorting records by the Price field in descending order).
Ejemplo 1
Configures an AI account, goes to the Contacts layout, then uses this script step to search for contacts named "Alea" in the current layout. This script step sends the findable fields on the current layout and the prompt "Find contacts named Alea" to the model. The model sends back a find request (possibly a request for "Alea" in the Name field), and this script step performs the find, updating the found set in the current window.
Configure AI Account [ Account Name: "my-account" ; Model Provider: OpenAI ; API key: "sk-..." ]
Go to Layout [ "Contacts" (Contacts) ; Animation: None ]
Perform Find by Natural Language [ Account Name: "my-account" ; Model: "gpt-4o" ; Prompt: "Find contacts named Alea" ; Get: Found Set ]
Ejemplo 2
Configures an AI account, prompts the user for a query, then performs the find and returns the data of the resulting found set as JSON in the $$FoundSetData variable. Queries are performed on the current layout.
Configure AI Account [ Account Name: "my-account" ; Model Provider: OpenAI ; API key: "sk-..." ]
Go to Layout [ "Products" (Products) ; Animation: None ]
Show Custom Dialog [ "Find products:" ; $$UserPrompt ]
If [ not IsEmpty ( $$UserPrompt ) ]
Perform Find by Natural Language [ Account Name: "my-account" ; Model: "gpt-4o" ; Prompt: $$UserPrompt ; Get: Found Set as JSON ; Response Target: $$FoundSetData ]
Show Custom Dialog [ "Found Set Data:" ; JSONFormatElements ( $$FoundSetData ) ]
End If
Possible output stored in $$FoundSetData (formatted using JSONFormatElements), assuming the prompt was "Find products with price less than 6, and sort them in descending order by price":
{
"messages" :
[
{
"code" : "0",
"message" : "OK"
}
],
"response" :
{
"data" :
[
{
"fieldData" :
{
"Price" : 5.99,
"ProductID" : 107,
"ProductName" : "Safety Glasses",
"Status" : "In Stock"
},
"modId" : "0",
"portalData" : {},
"recordId" : "61"
},
{
"fieldData" :
{
"Price" : 5.5,
"ProductID" : 122,
"ProductName" : "Putty Knife",
"Status" : "In Stock"
},
"modId" : "0",
"portalData" : {},
"recordId" : "76"
}
],
"dataInfo" :
{
"database" : "Ordering System",
"foundCount" : 2,
"layout" : "Products",
"returnedCount" : 2,
"table" : "Products",
"totalRecordCount" : 42
}
}
}
Ejemplo 3
Configures an AI account, then configures a custom prompt template that uses the predefined prompt for a find request. The predefined prompt describes the JSON format for a find request and includes the following: Use the following information as context: \":context:\"
.
After going to the Products layout and setting the $$Today variable to a natural language phrase to use for context later, this script step substitutes the :context:
constant used in the prompt template with the value of the context_prompt
key in Parameters. It then sends that along with the prompt "Find records created today sorted by product name" to the model.
The model returns the find request as a JSON object in the $$FindRequestJSON variable, which you can use for debugging purposes.
Configure AI Account [ Account Name: "my-account" ; Model Provider: OpenAI ; API key: "sk-..." ]
Configure Prompt Template [ Template Name: "FindToday" ; Model Provider: OpenAI ; Template Type: Find Request ; Find Request Prompt: "Generate and only return a JSON layout query to perform a find request..." ]
Go to Layout [ "Products" (Products) ; Animation: None ]
Set Variable [ $$Today ; Value: "Today is " & Get ( CurrentDate ) ]
Perform Find by Natural Language [ Account Name: "my-account" ; Model: "gpt-4o" ; Prompt: "Find records created today sorted by product name" ; Get: Find Request as JSON ; Parameters: JSONSetElement ( "{}" ; "context_prompt" ; $$Today ; JSONString ) ; Response Target: $$FindRequestJSON ]
Show Custom Dialog [ "Generated Find Request" ; JSONFormatElements ( $$FindRequestJSON ) ]
Possible output stored in $$FindRequestJSON (formatted using JSONFormatElements), assuming the current date is 03/09/2025 and the layout has CreationDate and ProductName fields:
{
"layouts" : "Products",
"query" :
[
{
"Products::CreationDate" : "03/09/2025"
}
],
"sort" :
[
{
"fieldName" : "Products::ProductName",
"sortOrder" : "ascend"
}
]
}