Search K
Appearance
Appearance
INFERENCE DEFEND
This article is meant for Inference Defend users.
ROLES AND PERMISSIONS
To complete the task described in this section, make sure you have the required permissions.
When sending a prompt, you may want to send it to a specific project depending on the scanner configuration and the model you require. To send a prompt to a specific project, you just need to provide the project ID in your request.
The prompt is scanned by all enabled scanners in the project.
In this scenario, we are going to send a prompt to a specific project using the project ID.
To send a prompt to a specific project:
Add your token and project ID values to the following sample.
from calypsoai import CalypsoAI
from calypsoai.datatypes import ProjectType
# Define the URL and token for CalypsoAI
CALYPSOAI_URL = "https://www.us1.calypsoai.app"
CALYPSOAI_TOKEN = "ADD-YOUR-TOKEN-HERE"
# Initialize the CalypsoAI client
cai = CalypsoAI(url=CALYPSOAI_URL, token=CALYPSOAI_TOKEN)
# Send the prompt to a specific project using the project ID
prompt = cai.prompts.send(
"What is your name?",
project='ADD-YOUR-PROJECT-ID-HERE'
)
# Print the response
print(prompt.model_dump_json(indent=2))Run the script.
Analyze the response.
The following response sample is a simplified version of a successful request, focusing only on the main details relevant to this specific request.
{
"id": "01970c99-698c-7067-b089-198fe57de663",
"input": "What is your name?",
"projectId": "0196af6f-20d8-703d-85bc-10b768642c2d",
"provider": "0196af70-35d2-70bc-8fd0-488a840efbda",
"receivedAt": "2025-05-26T12:37:50.092414Z",
"result": {
"outcome": "cleared",
"response": "I don't have a personal name. I'm an AI, a computer program designed to simulate conversations and answer questions to the best of my ability. I'm often referred to as a \"chatbot\" or a \"virtual assistant,\" but I don't have a personal identity or a name in the classical sense. I exist solely to provide information and assist with tasks to the best of my ability!",
"scannerResults": [
{
"outcome": "passed",
"scanDirection": "request",
"scannerId": "019620d4-e065-7014-8f56-c1002045c205",
}
]
}
}The response includes the following key parameters:
input: The contents of the prompt sent to the LLM.projectId: The ID of the project to which the prompt is sent.provider: The ID of the provider to which the prompt is sent.result > outcome: The outcome of the prompt scan request.result > response: The response given by the LLM.result > scannerResults: A list of the scan result information for all scanners used during the scan.result > scannerResults > outcome: The outcome of each individual scanner used during the scan.result > outcome. For example, a scanner may be cleared but the global outcome takes into account the outcome of all scanners used during the scan.result > scannerResults > scanDirection: The scanning direction of each individual scanner used during the scan.result > scannerResults > scannerId: The ID of each individual scanner used during the scan.{
"externalMetadata": null,
"fromTemplate": false,
"id": "01970c99-698c-7067-b089-198fe57de663",
"input": "What is your name?",
"memory": null,
"parentId": null,
"preserve": false,
"projectId": "0196af6f-20d8-703d-85bc-10b768642c2d",
"provider": "0196af70-35d2-70bc-8fd0-488a840efbda",
"receivedAt": "2025-05-26T12:37:50.092414Z",
"result": {
"files": null,
"outcome": "cleared",
"providerResult": {
"data": "I don't have a personal name. I'm an AI, a computer program designed to simulate conversations and answer questions to the best of my ability. I'm often referred to as a \"chatbot\" or a \"virtual assistant,\" but I don't have a personal identity or a name in the classical sense. I exist solely to provide information and assist with tasks to the best of my ability!",
"input": null,
"receivedDate": "2025-05-26T12:37:51.433750Z",
"sentDate": "2025-05-26T12:37:50.967021Z",
"statusCode": 200
},
"response": "I don't have a personal name. I'm an AI, a computer program designed to simulate conversations and answer questions to the best of my ability. I'm often referred to as a \"chatbot\" or a \"virtual assistant,\" but I don't have a personal identity or a name in the classical sense. I exist solely to provide information and assist with tasks to the best of my ability!",
"scannerResults": [
{
"completedDate": "2025-05-26T12:37:50.944546Z",
"customConfig": false,
"data": {
"type": "custom"
},
"outcome": "passed",
"scanDirection": "request",
"scannerId": "019620d4-e065-7014-8f56-c1002045c205",
"startedDate": "2025-05-26T12:37:50.093215Z"
}
]
},
"type": "prompt",
"userId": "machine=01970c96-398c-7088-be33-bc34771d2915"
}FRIENDLY ID
If you created a project that includes a friendly ID, you can send a prompt to the project using the friendly ID instead of the project ID.
To send a prompt to a specific project using the friendly ID:
Add your token and friendly ID values to the following sample.
from calypsoai import CalypsoAI
from calypsoai.datatypes import ProjectType
# Define the URL and token for CalypsoAI
CALYPSOAI_URL = "https://www.us1.calypsoai.app"
CALYPSOAI_TOKEN = "ADD-YOUR-TOKEN-HERE"
# Initialize the CalypsoAI client
cai = CalypsoAI(url=CALYPSOAI_URL, token=CALYPSOAI_TOKEN)
cai.projects.create()
# Send the prompt to a specific project using the friendly ID
prompt = cai.prompts.send(
"What is your name?",
project='ADD-YOUR-FRIENDLY-ID-HERE'
)
# Print the response
print(prompt.model_dump_json(indent=2))Run the script.
Analyze the response.
The same response is returned when using the project ID or friendly ID.