Skip to content

Commit 8a79e9a

Browse files
committed
update env var instructions
1 parent 7b6ec2b commit 8a79e9a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

articles/search/cognitive-search-custom-skill-form.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,21 @@ Clone the [Azure Search Power Skills](https://github.com/Azure-Samples/azure-sea
3434

3535
<!-- TBD you don't change those variables, you add debug env variables to the project -->
3636

37-
Open _AnalyzeForm.cs_ and make the following changes.
38-
* Set the `formsRecognizerApiEndpoint` variable to your resource endpoint.
39-
* Set `formsRecognizerApiKeySetting` to your resource's key value.
40-
* Set `modelIdSetting` to your saved model ID.
37+
Open _PowerSkills.sln_ in Visual Studio and locate the **AnalyzeForm** project on the left pane. Then make the following changes.
38+
* Add project-level environment variables. Right-click the project file and select **Properties**. In the **Properties** window, click the **Debug** tab and then find the **Environment variables** field. Click **Add** to add the following variables:
39+
* `FORMS_RECOGNIZER_ENDPOINT_URL` with the value set to your endpoint URL.
40+
* `FORMS_RECOGNIZER_API_KEY` with the value set to your subscription key.
41+
* `FORMS_RECOGNIZER_MODEL_ID` with the value set to the ID of the model you trained.
42+
* `FORMS_RECOGNIZER_RETRY_DELAY` with the value set to 1000. This is the time in milliseconds that the program will wait before re-querying the service for a response.
43+
* `FORMS_RECOGNIZER_MAX_ATTEMPTS` with the value set to 100. This is the number of times the program will query the service while attempting to get a success response.
4144

42-
Next, find the `fieldMappings` variable. This variable defines the list of keys you want to extract from your forms and a custom label for each key. For example, a value of `{ "Address:", "address" }, { "Invoice For:", "recipient" }` means the script will only save the values for the `Address:` and `Invoice For:` keys.
45+
Next, open _AnalyzeForm.cs_ and find the `fieldMappings` variable, which references the field-mappings.json file. This file (and the variable that references it) defines the list of keys you want to extract from your forms and a custom label for each key. For example, a value of `{ "Address:", "address" }, { "Invoice For:", "recipient" }` means the script will only save the values for the detected `Address:` and `Invoice For:` keys, and it'll label those values with `"address"` and `"recipient"`, respectively.
4346

4447
Finally, note the `contentType` variable. This script runs the given Form Recognizer model on PDF files, but if you're working with a different file type, you need to change the `contentType` to the correct [MIME type](https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types) for your file.
4548

4649
## Test the function from Visual Studio
4750

48-
After you've edited your script, save it and set the **AnalyzeForm** project as the startup project in Visual Studio. Then Press **F5** to run it in your local environment. Use a REST service like Postman to call the function.
51+
After you've edited your project, save it and set the **AnalyzeForm** project as the startup project in Visual Studio. Then Press **F5** to run it in your local environment. Use a REST service like Postman to call the function.
4952

5053
```HTTP
5154
POST https://localhost:7071/api/analyze-form

0 commit comments

Comments
 (0)