Create Organization
Creates an organization. User must be a Platform Admin
Request Body schema: application/jsonrequired
name required | string Organization name. The names of the organization must be unique |
description required | string Organization description |
isDefault | boolean Whether the organization is the default organization of the platform |
Responses
Request samples
- Payload
{- "name": "string",
- "description": "string",
- "isDefault": true
}
Response samples
- 201
{- "admin": { },
- "organization": {
- "name": "string",
- "description": "string",
- "isDefault": true,
- "id": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "publicLevelPermissions": "CreateOrganization",
- "collaborators": [
- {
- "userId": "string",
- "permissions": "CreateOrganization"
}
]
}
}
Response samples
- 200
[- {
- "name": "string",
- "description": "string",
- "isDefault": true,
- "id": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "publicLevelPermissions": "CreateOrganization",
- "collaborators": [
- {
- "userId": "string",
- "permissions": "CreateOrganization"
}
]
}
]
Update Organization metadata
Update organization's name and description. User must be a Platform Admin
path Parameters
_id required | string Organization to update |
Request Body schema: application/jsonrequired
name | string New name of the organization |
description | string New description of the organization |
Responses
Request samples
- Payload
{- "name": "string",
- "description": "string"
}
Response samples
- 200
{- "name": "string",
- "description": "string",
- "isDefault": true,
- "id": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "publicLevelPermissions": "CreateOrganization",
- "collaborators": [
- {
- "userId": "string",
- "permissions": "CreateOrganization"
}
]
}
Get Organization
Get organization. User must have GetOrganization permission on the organization
path Parameters
_id required | string Organization to get details of |
Responses
Response samples
- 200
{- "name": "string",
- "description": "string",
- "isDefault": true,
- "id": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "publicLevelPermissions": "CreateOrganization",
- "collaborators": [
- {
- "userId": "string",
- "permissions": "CreateOrganization"
}
]
}
Mark as Default
Keep this as the default organization of the platform. User must me platform admin
path Parameters
_id required | string Organization to mark as default |
Responses
Response samples
- 200
{- "name": "string",
- "description": "string",
- "isDefault": true,
- "id": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "publicLevelPermissions": "CreateOrganization",
- "collaborators": [
- {
- "userId": "string",
- "permissions": "CreateOrganization"
}
]
}
Update Org Permissions
Update Organization organization. User must have UpdateOrganization permission on the organization
path Parameters
_id required | string Organization to update permissions of |
Request Body schema: application/jsonrequired
publicLevelPermissions required | string Enum: "CreateOrganization" "GetOrganization" "GetAllOrganizations" "UpdateOrganization" "DeleteOrganization" "MakeOrganizationDefault" "AddUserToOrganization" "RemoveUserFromOrganization" "UpdateOrganizationUserPermissions" Public level permissions on org for all the users in the org. Must be of OrganizationPermission enum |
required | Array of objects (OrganizationCollaborator) List of collaborators with the permissions to the organization |
Responses
Request samples
- Payload
{- "publicLevelPermissions": "CreateOrganization",
- "collaborators": [
- {
- "userId": "string",
- "permissions": "CreateOrganization"
}
]
}
Response samples
- 200
{- "name": "string",
- "description": "string",
- "isDefault": true,
- "id": "string",
- "created_at": "2019-08-24T14:15:22Z",
- "publicLevelPermissions": "CreateOrganization",
- "collaborators": [
- {
- "userId": "string",
- "permissions": "CreateOrganization"
}
]
}
Add User
Add user to the organization with the permissions defined. User must have AddUserToOrganization permission on the organization
path Parameters
_id required | string Organization to add user to |
userId required | string User to add |
Request Body schema: application/jsonrequired
permissions required | Array of strings List of permissions to assign to the user |
Responses
Request samples
- Payload
{- "permissions": [
- "string"
]
}
Update user permission
Update permission of the user in the organization. Calling user must have UpdateOrganizationUserPermissions permission on the organization
path Parameters
_id required | string Organization to update permissions of user in |
userId required | string User to update permissions of |
Request Body schema: application/jsonrequired
permissions required | Array of strings List of permissions to assign to the user |
Responses
Request samples
- Payload
{- "permissions": [
- "string"
]
}
Apply policies on messages
header Parameters
X-Num-Tokens | string Number of tokens analyzed by policies |
Warning | string Warning displayed about tokens being not analyzed due to length |
Request Body schema: application/jsonrequired
required | Array of objects (AnalyzeMessage) OpenAI style messages with optional RAG context to analyze |
textType required | string Enum: "MODEL_INPUT" "MODEL_RESPONSE" Whether last message is a prompt or response |
policyIds required | Array of strings List of policies to apply |
modelId | string The model id of the LLM to associate inference with |
clientId | string The client id of the sender |
metadata | object Metadata to be attached to the request |
Responses
Request samples
- Payload
{- "messages": [
- {
- "role": "user",
- "content": "string",
- "ragContext": "string"
}
], - "textType": "MODEL_INPUT",
- "policyIds": [
- "string"
], - "modelId": "string",
- "clientId": "string",
- "metadata": { }
}
Response samples
- 200
{- "text": "string",
- "textType": "MODEL_INPUT",
- "finalAction": "BLOCK",
- "appliedPolicies": [
- {
- "policy": {
- "id": "string",
- "name": "string",
- "description": "string",
- "method": "PII",
- "action": "BLOCK",
- "methodParams": { },
- "decisionParams": { },
- "applicableTo": "INPUT",
- "created_at": "2019-08-24T14:15:22Z",
- "creatorId": "string"
}, - "outputs": { },
- "action": "string"
}
], - "error": "string"
}
Get Logs
Retrieve logs from chat and analyze interactions. Narrow search down by using the query filters.
path Parameters
modelId required | string |
query Parameters
startTime | number The start time (in UTC seconds) to filter by |
endTime | number The end time (in UTC seconds) to filter by |
pageNum | number Default: 1 The page number |
perPage | number Default: 50 The number of results per page |
sortDir | string Default: "desc" Enum: "asc" "desc" The direction to sort results by. |
policyId | string The policy id to filter by |
policyType | string Enum: "PII" "TOXICITY" "ALIGNMENT" "HALLUCINATION" "RAG_HALLUCINATION" The policy type to filter by |
textType | string Enum: "MODEL_INPUT" "MODEL_RESPONSE" The text type to filter by |
action | string Enum: "BLOCK" "WARN" "REDACT" "SANITIZE" "NONE" The policy action to filter by |
clientId | string The client id to filter by |
userId | string The user id to filter by |
metadata | string Example: metadata={origin: {platform: "chatgpt.com", browser: "Chrome"}, version: "3.16"} User-defined log metadata to filter by. Should be a json string |
Responses
Response samples
- 200
{- "logs": [
- {
- "timestamp": "string",
- "analyses": [
- {
- "text": "string",
- "textType": "MODEL_INPUT",
- "appliedPolicies": [
- {
- "outputs": { },
- "violated": true,
- "feedback": { },
- "promptId": "string",
- "policy": {
- "id": "string",
- "name": "string",
- "description": "string",
- "method": "PII",
- "action": "BLOCK",
- "methodParams": { },
- "decisionParams": { },
- "applicableTo": "INPUT",
- "created_at": "2019-08-24T14:15:22Z",
- "creatorId": "string"
}, - "action": "BLOCK"
}
]
}
], - "action": "BLOCK"
}
], - "totalCount": 0
}
Get Count of Logs
Retrieve number of log entries from chat and analyze interactions. Narrow search down by using the query filters.
path Parameters
modelId required | string |
query Parameters
startTime | number The start time (in UTC seconds) to filter by |
endTime | number The end time (in UTC seconds) to filter by |
policyId | string The policy id to filter by |
policyType | string Enum: "PII" "TOXICITY" "ALIGNMENT" "HALLUCINATION" "RAG_HALLUCINATION" The policy type to filter by |
textType | string Enum: "MODEL_INPUT" "MODEL_RESPONSE" The text type to filter by |
action | string Enum: "BLOCK" "WARN" "REDACT" "SANITIZE" "NONE" The policy action to filter by |
clientId | string The client id to filter by |
userId | string The user id to filter by |
metadata | string Example: metadata={origin: {platform: "chatgpt.com", browser: "Chrome"}, version: "3.16"} User-defined log metadata to filter by. Should be a json string |
Responses
Response samples
- 200
0
Get stats
Retrieve dashboard metrics. Narrow search down by using the query filters. At least one of modelId, clientId, or userId must be specified.
path Parameters
modelId required | string |
query Parameters
startTime | number The start time to filter by |
endTime | number The end time to filter by |
numDataPoints | number Default: 2 Number of data points to discretize time period. Must be greater than 1. |
clientId | string The client id to filter by |
Responses
Response samples
- 200
{- "overview": {
- "MODEL_INPUT": {
- "total": [
- 0
], - "flagged": [
- 0
]
}, - "MODEL_RESPONSE": {
- "total": [
- 0
], - "flagged": [
- 0
]
}
}, - "privacy": {
- "MODEL_INPUT": {
- "entity_types": {
- "LOCATION": [
- 0,
- 37
]
}, - "total": [
- 0
]
}, - "MODEL_RESPONSE": {
- "entity_types": {
- "LOCATION": [
- 0,
- 37
]
}, - "total": [
- 0
]
}
}, - "toxicity": {
- "MODEL_INPUT": {
- "total": [
- 0
], - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}
}, - "MODEL_RESPONSE": {
- "total": [
- 0
], - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}
}
}, - "alignment": {
- "MODEL_INPUT": {
- "total": [
- 0
], - "policies": {
- "property1": {
- "name": "string",
- "num_violations": [
- 0
], - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}
}, - "property2": {
- "name": "string",
- "num_violations": [
- 0
], - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}
}
}
}, - "MODEL_RESPONSE": {
- "total": [
- 0
], - "policies": {
- "property1": {
- "name": "string",
- "num_violations": [
- 0
], - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}
}, - "property2": {
- "name": "string",
- "num_violations": [
- 0
], - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}
}
}
}
}, - "hallucination": {
- "MODEL_RESPONSE": {
- "total": [
- 0
], - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}, - "average": {
- "value": 0,
- "data": [
- 0
]
}
}
}, - "ragHallucination": {
- "MODEL_RESPONSE": {
- "entries": {
- "value": 0,
- "data": [
- 0
]
}, - "violations": {
- "value": 0,
- "data": [
- 0
]
}, - "retrievalRelevance": {
- "violations": {
- "value": 0,
- "data": [
- 0
]
}, - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}, - "average": {
- "value": 0,
- "data": [
- 0
]
}
}, - "responseRelevance": {
- "violations": {
- "value": 0,
- "data": [
- 0
]
}, - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}, - "average": {
- "value": 0,
- "data": [
- 0
]
}
}, - "responseFaithfulness": {
- "violations": {
- "value": 0,
- "data": [
- 0
]
}, - "violation_rate": {
- "value": 0,
- "data": [
- 0
]
}, - "average": {
- "value": 0,
- "data": [
- 0
]
}
}
}
}, - "latency": {
- "e2eLatency": {
- "percentile50": {
- "value": 0,
- "data": [
- 0
]
}, - "percentile90": {
- "value": 0,
- "data": [
- 0
]
}, - "percentile99": {
- "value": 0,
- "data": [
- 0
]
}
}, - "inputGuardrailLatency": {
- "percentile50": {
- "value": 0,
- "data": [
- 0
]
}, - "percentile90": {
- "value": 0,
- "data": [
- 0
]
}, - "percentile99": {
- "value": 0,
- "data": [
- 0
]
}
}, - "outputGuardrailLatency": {
- "percentile50": {
- "value": 0,
- "data": [
- 0
]
}, - "percentile90": {
- "value": 0,
- "data": [
- 0
]
}, - "percentile99": {
- "value": 0,
- "data": [
- 0
]
}
}, - "llmCompletionLatency": {
- "percentile50": {
- "value": 0,
- "data": [
- 0
]
}, - "percentile90": {
- "value": 0,
- "data": [
- 0
]
}, - "percentile99": {
- "value": 0,
- "data": [
- 0
]
}
}, - "requests": {
- "successful": {
- "value": 0,
- "data": [
- 0
]
}, - "failed": {
- "value": 0,
- "data": [
- 0
]
}
}, - "failureTypes": {
- "http4xx": {
- "value": 0,
- "data": [
- 0
]
}, - "http5xx": {
- "value": 0,
- "data": [
- 0
]
}
}
}, - "timestamps": [
- 0
], - "rules": {
- "ruleViolations": 0,
- "rulesActive": 0
}
}
Guardrailed Chat
Apply policies to messages and send non-violating prompts to LLM. Routes messages to the LLM behind modelId. Blocks/modifies prompt/response as policies dictate
path Parameters
modelId required | string |
session_id required | string Session id to link chat messages to |
header Parameters
X-Num-Tokens | string Number of tokens analyzed by policies |
Warning | string Warning displayed about tokens being not analyzed due to length |
Request Body schema: application/jsonrequired
clientId | string The client id of the sender |
required | Array of objects (ChatMessage) OpenAI style messages to send to the LLM |
metadata | object Metadata to be attached to the request |
overridePolicyIds | Array of strings Explicit list of policies to apply instead of the ones attached to the model |
Responses
Request samples
- Payload
{- "clientId": "string",
- "messages": [
- {
- "role": "user",
- "content": "string"
}
], - "metadata": { },
- "overridePolicyIds": [
- "string"
]
}
Response samples
- 200
{- "source": {
- "user": "string",
- "session": "string",
- "model": "string",
- "client": "string"
}, - "chat": {
- "queryId": "string",
- "prompt": "string",
- "preprocessedPrompt": "string",
- "response": "string",
- "desanitizedResponse": "string",
- "postprocessedResponse": "string",
- "ragContext": "string",
- "error": "string"
}, - "metadata": { },
- "analyses": [
- {
- "text": "string",
- "textType": "MODEL_INPUT",
- "finalAction": "BLOCK",
- "appliedPolicies": [
- {
- "policy": {
- "id": "string",
- "name": "string",
- "description": "string",
- "method": "PII",
- "action": "BLOCK",
- "methodParams": { },
- "decisionParams": { },
- "applicableTo": "INPUT",
- "created_at": "2019-08-24T14:15:22Z",
- "creatorId": "string"
}, - "outputs": { },
- "action": "string"
}
], - "error": "string"
}
]
}
Update policies applied to a model
path Parameters
id required | string |
Request Body schema: application/jsonrequired
policyIds required | Array of strings List of policy ids to activate on the model |
action required | string Enum: "ADD" "REMOVE" "REPLACE" Operation to perform on models |
Responses
Request samples
- Payload
{- "policyIds": [
- "string"
], - "action": "ADD"
}
Create policy
Creates a policy on DynamoGuard. Each policy uses methodParams as arguments for the underlying policy and decisionParams to determine the action to take based on the policy result.
Request Body schema: application/jsonrequired
name required | string Name of the policy |
description | string Description of the policy |
method required | string Enum: "PII" "TOXICITY" "ALIGNMENT" "HALLUCINATION" "RAG_HALLUCINATION" Type of policy |
action required | string Default: "NONE" Enum: "BLOCK" "WARN" "REDACT" "SANITIZE" "NONE" The action to take if the policy is violated |
methodParams required | object The arguments for the policy. These differ depending on the policy type |
decisionParams required | object The parameters for determining the policy action from outputs. These differ depending on the policy type |
applicableTo required | string Default: "ALL" Enum: "INPUT" "OUTPUT" "ALL" Which type of message the policy should apply to |
Responses
Request samples
- Payload
{- "name": "string",
- "description": "string",
- "method": "PII",
- "action": "BLOCK",
- "methodParams": { },
- "decisionParams": { },
- "applicableTo": "INPUT"
}
Response samples
- 201
{- "id": "string",
- "name": "string",
- "description": "string",
- "method": "PII",
- "action": "BLOCK",
- "methodParams": { },
- "decisionParams": { },
- "applicableTo": "INPUT",
- "created_at": "2019-08-24T14:15:22Z",
- "creatorId": "string"
}
Get all policies
Retrieves all policies a user made. If modelId is specified, attaches policy statuses as well
query Parameters
policyType | string Enum: "PII" "TOXICITY" "ALIGNMENT" "HALLUCINATION" "RAG_HALLUCINATION" Policy type to filter on |
modelId | string If specified, attaches policy status in relation to the modelId |
expand | boolean If true, attaches dataset info. Only available for content policies |
attachModels | boolean If specified, attaches models policy is applied to |
page required | number |
limit required | number |
includeAllowedScopes required | boolean |
Responses
Response samples
- 200
{- "total": 0,
- "policies": [
- {
- "id": "string",
- "name": "string",
- "description": "string",
- "method": "PII",
- "action": "BLOCK",
- "methodParams": { },
- "decisionParams": { },
- "applicableTo": "INPUT",
- "created_at": "2019-08-24T14:15:22Z",
- "creatorId": "string",
- "stage": "seed",
- "allowedBehaviors": [
- "string"
], - "disallowedBehaviors": [
- "string"
], - "feedback": {
- "promptId": "string",
- "review": {
- "prompt": "string",
- "isCompliant": true,
- "feedback": true
}, - "createdAt": "2019-08-24T14:15:22Z",
- "creator": "string"
}, - "status": "string",
- "models": [
- "string"
], - "creator": {
- "id": "string",
- "email": "string"
}
}
]
}
Update policy
Same description as policy creation
path Parameters
id required | string Policy id to update |
Request Body schema: application/jsonrequired
name | string Name of the policy |
description | string Description of the policy |
method | string Enum: "PII" "TOXICITY" "ALIGNMENT" "HALLUCINATION" "RAG_HALLUCINATION" Type of policy |
action | string Default: "NONE" Enum: "BLOCK" "WARN" "REDACT" "SANITIZE" "NONE" The action to take if the policy is violated |
methodParams | object The arguments for the policy. These differ depending on the policy type |
decisionParams | object The parameters for determining the policy action from outputs. These differ depending on the policy type |
applicableTo | string Default: "ALL" Enum: "INPUT" "OUTPUT" "ALL" Which type of message the policy should apply to |
Responses
Request samples
- Payload
{- "name": "string",
- "description": "string",
- "method": "PII",
- "action": "BLOCK",
- "methodParams": { },
- "decisionParams": { },
- "applicableTo": "INPUT"
}
Response samples
- 200
{- "id": "string",
- "name": "string",
- "description": "string",
- "method": "PII",
- "action": "BLOCK",
- "methodParams": { },
- "decisionParams": { },
- "applicableTo": "INPUT",
- "created_at": "2019-08-24T14:15:22Z",
- "creatorId": "string"
}
Get policy
Use query params to add additional information
path Parameters
id required | string Policy id to retrieve |
query Parameters
expand | boolean If true, attaches dataset info. Only available for content policies |
modelId | string If specified, attaches policy status in reference to the given model. Also filters policy stats. |
promptId | string If specified, attaches feedback for the prompt |
attachModels | boolean If specified, attaches models policy is applied to |
Responses
Response samples
- 200
{- "id": "string",
- "name": "string",
- "description": "string",
- "method": "PII",
- "action": "BLOCK",
- "methodParams": { },
- "decisionParams": { },
- "applicableTo": "INPUT",
- "created_at": "2019-08-24T14:15:22Z",
- "creatorId": "string",
- "stage": "seed",
- "allowedBehaviors": [
- "string"
], - "disallowedBehaviors": [
- "string"
], - "feedback": {
- "promptId": "string",
- "review": {
- "prompt": "string",
- "isCompliant": true,
- "feedback": true
}, - "createdAt": "2019-08-24T14:15:22Z",
- "creator": "string"
}, - "status": "string",
- "models": [
- "string"
]
}
Add/remove policy to/from models
path Parameters
id required | string |
Request Body schema: application/jsonrequired
modelIds required | Array of strings List of model ids to add/remove policy to |
action required | string Enum: "ADD" "REMOVE" "REPLACE" Operation to perform on models |
Responses
Request samples
- Payload
{- "modelIds": [
- "string"
], - "action": "ADD"
}
Create Remote Model
Creates a remote model configuration. User must have CreateModel permission
Request Body schema: application/jsonrequired
name required | string Display name for the model |
key required | string Unique identifier for the model (usually UUID) |
type required | string Enum: "REMOTE" "LOCAL" "THIRD_PARTY" "LOCAL_GUARDRAIL" Type of model |
useCase required | string Intended use case for the model |
required | object |
Responses
Request samples
- Payload
{- "name": "string",
- "key": "string",
- "type": "REMOTE",
- "useCase": "chat",
- "config": {
- "remoteModelApiProvider": "openai",
- "remoteModelApiInstance": "gpt-4",
- "remoteModelEndpoint": "string",
- "apiKey": "string",
- "apiVersion": "string",
- "awsRegion": "string",
- "modelType": "string"
}
}
Response samples
- 201
{- "id": "string",
- "name": "string",
- "key": "string",
- "type": "string",
- "useCase": "string",
- "config": {
- "remoteModelApiProvider": "string",
- "remoteModelApiInstance": "string",
- "remoteModelEndpoint": "string",
- "apiVersion": "string",
- "awsRegion": "string",
- "modelType": "string"
}, - "metadata": {
- "userEmail": "string",
- "modelType": "string",
- "source": "string",
- "contributors": [
- "string"
]
}, - "created_at": "2019-08-24T14:15:22Z"
}