Skip to main content

AI Features

The Qarion SDK provides methods for generating AI-powered descriptions and interacting with the AI Copilot.

Usage

Generate Product Description

from qarion import QarionClient

client = QarionClient(api_key="qk_...")

description = client.ai.generate_description(
asset_type="table",
asset_name="revenue_transactions",
context={
"columns": ["id", "customer_id", "amount", "currency", "created_at"],
"tags": ["finance", "revenue"],
"product_type": "Table",
"environment": "production",
"lineage": {
"upstream": ["raw_transactions"],
"downstream": ["revenue_dashboard"],
},
},
)
print(description.description)

Generate Field Description

description = client.ai.generate_description(
asset_type="field",
asset_name="customer_id",
context={
"parent_table": "revenue_transactions",
"data_type": "uuid",
"neighboring_columns": ["id", "amount", "created_at"],
},
)

Chat with Copilot

response = client.ai.chat(
messages=[
{"role": "user", "content": "Which tables contain customer PII?"}
],
use_tools=True,
page_context="catalog",
)
print(response.response)
for source in response.sources:
print(f" - {source.product_name} (relevance: {source.relevance})")

Get AI Usage (Admin)

usage = client.ai_logs.get_usage(days=30)
for entry in usage:
print(f"{entry['date']} | {entry['model']} | {entry['request_count']} calls")