Now that we have checked our model using the Try it section of the App and ingested our data set we can prepare to launch the App in production in your company's environment whether as an internal tool or an external customer facing service, this is achieved through the API tab in the Application
You will initially be presented with a default API code snippet in the upper window.
Creating an API key
To be able use our APIs and to test the API within the App UI you need to create a unique API Key which you need to copy and keep safe. If you havent not yet created a key click on the DEFINE AN API KEY TO USE THIS APP link, or you can click on the Security menu by mousing over your initials in the top right hand corner of the screen.
- Click on to create a new API Key under Graft API Keys
Graft will create a new key and offer a one time chance to copy it
- Click on COPY to copy to your clipboard
You can select between API keys in the API tab in your APPs using the drop down list
Ensure that you store the API safely, do NOT add to your GitHub repository
If you believe a key has been compromised please let our Support team know with the first 7 characters of the key
Configuring your API snippet
Graft Automatically generates a code snippet which you can embed in your own application or environment. It defaults to a CSV output format and includes all the available fields from the data source. The configuration panel on the right hand side of the screen allows you to dynamically configure the code and test it within Graft ahead of copying and using externally. Each subsection can be minimized by clicking on the toggle.
Output format can be switched between CSV (default), TSV (Tab separated variable) and JSONL (Json lines output)
Entity Columns allows you to toggle off any field that you do not need in your results. Check or uncheck fields as needed. Outside of this list Graft will provide a probability value for the search match which can not be removed through the UI. This value can be helpful to develop a threshold limit for what to present to your end user.
Entity KNN_Adhoc is the query value we wish to use. In this Image search example we would input the URI of an image we would like to find similar images of
Entity KNN_K is the number of results you wish to return. Through experimentation you can optimize this number to suit your application.
Testing your API snippet
Using the API tab in your search app directly uses the Graft API and your API key to generate the requested results, so if this code works you know with appropriate formatting for your environment that it will correctly connect and provide results.
To test using the sample image shown in What to do first,
- Right click and Copy Image Address
- Paste the url into the Entity KNN_AHDOC field replacing the query text placeholder
- Adjust the fields to be returned in the ENTITY COLUMNS section
- Set the number of results you would like
- Set the format of the results (CSV,TSV,JSONL)
Once you are happy with the request click TEST REQUEST
Graft will generate a set of results for you which can be copied using the button to the right of the RESPONSE header.