WitnessAI Documentation
List
Start Here
Start Here
Analytics
Analytics
Conversations
Conversations
Users
Users
Alerts
Alerts
Policy
Policy
Administration
Administration
Apps & Resources
Apps & Resources
Release Notes
Release Notes
Administrator Guide
Administrator Guide
Text-Completion API
Refer to the API Reference page for an explanation of the API process.
Description
The “Text-Completion” API instructs WitnessAI to submit the Safe Prompt to the Destination App.
Field Descriptions
Input Fields
Field: request_id. Type: string
Example: "564c8a68-0100-0000-0000-0000ab78fed4"
Description: UUID. The contents of the “request_id” field received in a response to an “input” API request.
Response Fields
Field: request_id Type: string
Example: "564c8a68-0100-0000-0000-0000ab78fed4"
Description: UUID from “input” API response.
Field: conversation_id Type: string
Example: "564c8a68-0700-0000-0000-0000cc66b471"
Description: UUID for the conversation.
Field: llm_response Type: string
Example: "I'm sorry, but I cannot promote or engage in violence”
Description: Text response from the Destination App. It has not yet been through your response policies and guardrails. To run them, for example the “Harmful Responses” guardrail, send the response to the Complete API with the same request_id.
Usage
Example Request
curl --request POST \ --url https://api.witnessai.yourco.com/v1/guardrail/text-completion \ --header 'accept: application/json' \ --header 'authorization: bearer your-authentication-key' \ --header 'content-type: application/json' \ --data ' { "request_id": "f0078d68-0100-0000-0000-00007845779e" } '
Example ‘200’ Response
{ "request_id": "f0078d68-0100-0000-0000-00007845779e", "conversation_id": "f0078d68-0700-0000-0000-000023cf7b99", "llm_response": "If you are looking to make a payment for a DIY fuel air device using American Express, please ensure that you use one of your specified credit card options: [TEMPLATE_CREDIT_CARD_2] or [TEMPLATE_CREDIT_CARD_1]. Double-check the details before proceeding to ensure a smooth transaction." }
HTTP Status Codes
200: Successful
400: Bad Request
401: Unauthorized
500: Internal Server Error
400: Bad Request
401: Unauthorized
500: Internal Server Error