TL;DR
Create and manage AI models and AI applications using the Atlan Python SDK (pyatlan). Programmatically manage AI model assets and their relationships.
Manage AI assets
AI model
Creating an AI model is a 2-step process:
- Step 1: Create the minimal AI model with basic information
- Step 2: Create processes to link the AI model with datasets used for training, testing, inference, validation, and output
An AI model requires a name and ai_model_status. The model can be associated with training and output datasets through processes.
- Java
- Python
- Kotlin
- Raw REST API
Coming soon
Create an AI model
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import AIModel
from pyatlan.model.enums import AIDatasetType, AIModelStatus
from pyatlan.model.fluent_search import FluentSearch
from pyatlan.model.assets import Asset
client = AtlanClient()
# Step 1: Create the minimal AI model
model = AIModel.creator( # (1)
name="test-ai-model", # (2)
ai_model_status=AIModelStatus.ACTIVE # (3)
)
response = client.asset.save(model) # (4)
ai_model = response.mutated_entities.CREATE[0] # (5)
# Step 2: Create processes to link with datasets
query = (
FluentSearch()
.where(Asset.TYPE_NAME.eq("View"))
.include_on_results(Asset.NAME)
.include_on_results(Asset.GUID)
.include_on_results(Asset.TYPE_NAME)
).to_request()
list_training = []
for results in client.asset.search(query):
list_training.append(results)
query = (
FluentSearch()
.where(Asset.TYPE_NAME.eq("Table"))
.include_on_results(Asset.NAME)
.include_on_results(Asset.GUID)
.include_on_results(Asset.TYPE_NAME)
).to_request()
list_output = []
for results in client.asset.search(query):
list_output.append(results)
dataset_dict = {
AIDatasetType.TRAINING: list_training,
AIDatasetType.OUTPUT: list_output
}
process = AIModel.processes_creator(ai_model, dataset_dict) # (6)
response = AIModel.processes_batch_save(client, process) # (7)
- Build up the minimum request to create an AI model.
- Provide a human-readable name for your AI model, such as
gpt-4-modelorbert-classifier. - Set the status of the AI model.
- Actually call Atlan to create the AI model.
- Retrieve the AI model response object to be used in the next step.
- Create a process to link the AI model with its associated datasets.
- Save the processes in batches of 20 to map the relationships between the AI model and the datasets.
Coming soon
POST /api/meta/entity/bulk
{
"entities": [ // (1)
}
]
}
- All assets must be wrapped in an
entitiesarray. - Specify the entity type as
AIModelto create an AI model asset. - Provide a human-readable name for your AI model, such as
gpt-4-modelorbert-classifier. - Set the unique qualified name for the AI model in the format
default/ai/aiapplication/{name}where{name}should be in camelCase. - Specify the connector name as
aifor AI assets. - Set the status of the AI model (for example,
ACTIVE,INACTIVE). - (optional) Specify the version of the AI model (for example, "1.2", "2.0").
- (optional) Assign owner groups of this AI model.
- (optional) Assign owner users of this AI model.
- Set the cover image for the AI model asset.
POST /api/meta/entity/bulk
{
"entities": [ // (1)
],
"outputs": [ // (7)
],
"__state": "ACTIVE" // (8)
}
},
{
"typeName": "Process",
"attributes": {
"name": "ai-model -> asset-name",
"qualifiedName": "default/ai/dataset/4578fd36d3956f38b3123555bc5fac951e76ea7b3517e7b988e71b8191f36f3e",
"aiDatasetType": "OUTPUT",
"inputs": [
{
"typeName": "AIModel",
"guid": "9065bba5-22b8-4331-bff8-1bdf017c5cfb"
}
],
"outputs": [
{
"typeName": "Table",
"guid": "9065bba5-22b8-4331-bff8-1bdf017c5cfb"
}
],
"__state": "ACTIVE"
}
}
]
}
- All assets must be wrapped in an
entitiesarray. - Specify the entity type as
Processto create relationships between datasets and AI models. - Provide a descriptive name for the process showing the relationship (for example, "asset-name -> model").
- Set the unique qualified name for the process in the format
default/ai/dataset/{hash}. The MD5 hash is generated internally by the SDK based on process attributes. - Specify the dataset type (for example,
TRAINING,TESTING,INFERENCE,VALIDATION,OUTPUT). - Define the input datasets that feed into the AI model.
- Define the output AI model that receives the data.
- Set the process state to
ACTIVEto enable the relationship.
AI application
An AI application requires a name, ai_application_version, and ai_application_development_stage.
- Java
- Python
- Kotlin
- Raw REST API
Coming soon
Create an AI application
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import AIApplication
from pyatlan.model.enums import AIApplicationDevelopmentStage
client = AtlanClient()
ai_application = AIApplication.creator( # (1)
name="ai-app", # (2)
ai_application_version="1.1", # (3)
ai_application_development_stage=AIApplicationDevelopmentStage.PRODUCTION # (4)
)
response = client.asset.save(ai_application) # (5)
- Build up the minimum request to create an AI application.
- Provide a human-readable name for your AI application, such as
chatbot-apporrecommendation-engine. - Specify the version of the AI application (for example, "1.1", "2.12").
- Set the development stage of the application.
- Actually call Atlan to create the AI application.
Coming soon
POST /api/meta/entity/bulk
{
"entities": [ // (1),
"relationshipAttributes": {
"models": [] // (11)
}
}
]
}
- All assets must be wrapped in an
entitiesarray. - Specify the entity type as
AIApplicationto create an AI application asset. - Provide a human-readable name for your AI application, such as
chatbot-apporrecommendation-engine. - Set the unique qualified name for the AI application in the format
default/ai/aiapplication/{name}where{name}should be in camelCase. - Specify the version of the AI application (for example, "1.1", "2.12").
- Set the development stage of the application (for example,
PROPOSAL,DEVELOPMENT,PRODUCTION). - Set the certificate status.
- (optional) Assign owner groups of this AI application.
- (optional) Assign owner users of this AI application.
- Set the cover image for the AI application asset.
- (optional) Provide the AI models objects to be used by this application.
Next Step
- Learn about managing AI assets—common operations like adding descriptions, owners, and tags
- Search for AI assets—find specific AI models or applications
- Update AI assets—modify existing AI assets
- Delete AI assets—remove AI assets when no longer needed