Text-Completion API

List view
Quick Start
User Guide
Policies & GuardRails
Witness Anywhere: Remote Device Security
Witness Attack
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.
notion image
 

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 LLM after being processed through your response Policies and Guardrails, for example the “Harmful Responses” guardrail.
 

Usage

Example Request

curl --request POST \ --url https://api.demo2.witness.ai/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