Apply RESTful API functionality to your content
The Restful API Caller component allows you to integrate AutoClassifier with any RESTful APIs (LLMs, AI Cloud Services, etc.) by enabling flexible endpoint configurations, request customizations, and API response management to facilitate efficient data transformation and metadata generation.
Prerequisites
You must complete the following prerequisites before setting up the Restful API Caller component:
-
You must use a valid RESTful API and refer to the applicable documentation for usage instructions.
Limitations
Note the following limitations:
-
Only complete URLs are supported. For example, https://api.openai.com/v1/embeddings.
Configure the component
To configure you component, do the following:
-
In the AutoClassifier administration portal, Add a new component to a new or existing pipeline.
-
When adding your component, select Restful API Caller from the New Component list and provide a Name for your component.
-
In the Endpoint URL field, enter the endpoint URL for your RESTful API.
-
In the Request Headers field, enter the Key and Value for your RESTful API. You can click Add Header or Add Secure Header to add additional key-value pair request headers.
-
In the Request Body field, enter the body for your desired request to your API. Additionally, you can inject metadata that was generated by the other components. To do so, provide the metadata property name in curled braces ({}) in the request body. AutoClassifier will treat this metadata property as a placeholder, and will look for it within the pipeline. If any string type property with the mentioned placeholder is found, the placeholder is replaced by that value. If not, it is replaced by an empty string (“”). For example:
Copy{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Act like an assistant and tell me the summary of the text I provide to you in French."
},
{
"role": "user"
"content": "{{body}}"
}
],
"temperature": 0.7,
"top_p": 1.0,
"frequency_penalty" 0.0,
"presence_penalty": 0.0
} -
In the Response Key Path field, you can specify the key path that you want to receive from the API response. For example, using the sample above, entering choices[0].message.content will return only the summary of the text in french.
-
In the Response Datatype field, select the data type that you expect to receive from the response from the drop-down menu.
-
In the Output Type field, you can select either Single Valued or Multiple Valued.
-
In the Output Metadata Name field, enter the property name to assign to the metadata that is generated by the component.
-
Enable the Send Raw data as Metdata to return your API response as a property from the component.
-
To verify if your API endpoint is valid, you can click Test Request. If valid, you will receive an "Api Endpoint hit succeeded" message and the response to your configured prompt will display in the Response field.
-
Click Save.
Output details
The Restful API Caller returns the following metadata properties and values:
| Property | Description |
|---|---|
| Api_Response | This property displays the full response that you received based on your Request Body specification. |
| <Output metadata name> | This property displays the metadata that was generated by the Restful API Caller component. This name of this property is dependent on the Output Metadata Name that you specified in step 9. |