AI Prompt Manager ve Tool Registry Service API Referansı
AI PROMPT SERVICE (/api/prompts)
PromptsController — /api/prompts
| # | Method | Route | Auth | Description |
|---|---|---|---|---|
| 1 | GET | /api/prompts?page={int}&pageSize={int} | Required | Prompt listesi (lifecycle: Draft → Review → Approved → Active → Archived) — PaginatedList<PromptDto> |
| 2 | POST | /api/prompts | Required | Yeni prompt oluştur — 201 Created (CreatePromptCommand: title, content, modelId, temperature, tags) |
| 3 | GET | /api/prompts/{promptId:guid} | Required | Prompt detayı + versiyon geçmişi — ApiResponse<PromptDetailDto> |
| 4 | PUT | /api/prompts/{promptId:guid} | Required | Prompt güncelle (UpdatePromptCommand) |
| 5 | DELETE | /api/prompts/{promptId:guid} | Required | Prompt sil (soft delete, Archived) |
Prompt Version Management
| # | Method | Route | Auth | Description |
|---|---|---|---|---|
| 6 | POST | /api/prompts/{promptId}/new-version | Required | Yeni versiyon kaydet — 201 Created (CreateNewVersionCommand: versionNote) |
| 7 | GET | /api/prompts/{promptId}/versions?page={int}&pageSize={int} | Required | Versiyon listesi — ApiResponse<List<PromptVersionDto>> |
| 8 | PUT | /api/prompts/{promptId}/versions/{versionId:guid}/review | Required | İnceleme (Review) — 204 No Content |
| 9 | PUT | /api/prompts/{promptId}/versions/{versionId:guid}/approve | Required | Onaylama (Approved/Active) — 204 No Content |
Prompt Detail Response
{
"id": "guid",
"title": "string",
"content": "string (system prompt içeriği)",
"modelId": "guid | null",
"temperature": 0.7,
"lifecycleStatus": "Active",
"versions": [{
"id": "guid",
"versionNumber": "v3",
"content": "string",
"status": "Active",
"changedBy": "string",
"createdAt": "datetime"
}],
"tags": ["string[]"],
"abTestConfig": { "variantA": true, "variantB": false },
"autoEvaluationScores": { "quality": 0.85, "safety": 0.92 }
}
Dynamic Variables (Runtime Render)
Prompt template'inde {{variable_name}} placeholder kullanılır:
Template:
Sen {{sirket_adi}} için çalışan bir asistansın.
{{musteri_adi}} adlı müşteriye {{dil}} dilinde yardım et.
Runtime Render:
{ "sirket_adi": "Acme Ltd.", "musteri_adi": "Ali Yılmaz", "dil": "Türkçe" }
→ "Sen Acme Ltd. için çalışan bir asistansın. Ali Yılmaz adlı müşteriye Türkçe dilinde yardım et."
AI TOOL REGISTRY (/api/tools)
ToolsController — /api/tools
| # | Method | Route | Auth | Description |
|---|---|---|---|---|
| 1 | GET | /api/tools?agentId={guid}&search={string}&kbStatus={int}&page={int}&pageSize={int} | Required | Tool listesi — ApiResponse<List<TenantConfiguredToolDto>> |
| 2 | POST | /api/tools | Required | Yeni tool oluştur/güncelle — 201 Created (CreateOrUpdateToolCommand: displayName, baseToolId, description, configParams) |
| 3 | GET | /api/tools/built-in?page={int}&pageSize={int} | Required | Built-in tool listesi (Browser Action, Db Execute, Db Query, HTTP Request, Manage Schedule, Send Discord Message, Send Email, Send Slack Message, Send Teams Message, Send Telegram Message, Send WhatsApp Message) |
| 4 | POST | /api/tools/built-in/select | Required | Built-in tool'dan yeni tool oluştur — 201 Created ({ baseToolId: "guid" }) |
| 5 | PUT | /api/tools/{toolId:guid} | Required | Tool güncelle |
| 6 | DELETE | /api/tools/{toolId:guid} | Required | Tool sil (soft delete) |
Tool Configuration — Multi-step Setup Flow
Step 1: Display & Schema Config (GET/PUT /api/tools/{id}/config)
{
"id": "guid",
"displayName": "Db Query",
"description": "Natural language to SQL SELECT query and structured results.",
"baseToolId": "db_query",
"type": "Built-in",
"status": "Active",
"schema": {
"databaseType": "postgresql",
"schemaName": "public",
"tables": ["products", "orders", "customers"],
"connectionString": "Vault Secret reference"
},
"kbStatus": { "hasChunks": true, "chunkCount": 152 }
}
Step 2: Parameters Config (GET/PUT /api/tools/{id}/config-params)
{
"maxRows": 100,
"readOnly": true,
"timeoutSeconds": 30
}
Status Lifecycle
PENDING → [Admin Onayı] → APPROVED → ACTIVE
↓
REJECTED
AI ANALYTICS SERVICE (/api/analytics)
AnalyticsController — /api/analytics
| # | Method | Route | Auth | Description |
|---|---|---|---|---|
| 1 | GET | /api/analytics/llm?startDate={date}&endDate={date} | Required | LLM maliyet & token analizi — 200 OK (ApiResponse<LLMAnalyticsDto>) |
Response:
{
"success": true,
"result": {
"totalRequests": 15420,
"totalTokensUsed": 45000000,
"totalCostUSD": 1234.00,
"avgLatencyMs": 850,
"errorRatePercent": 2.0,
"activeAgentCount": 5,
"modelBreakdown": [{
"modelName": "gpt-4o",
"dailyCosts": [{ "date": "2026-03-01", "cost": 45.20, "tokens": 500000 }],
"p95LatencyMs": 1800,
"p99LatencyMs": 3200
}, {
"modelName": "claude-sonnet-4-6",
"dailyCosts": [{ "date": "2026-03-01", "cost": 12.80, "tokens": 320000 }],
"p95LatencyMs": 1400,
"p99LatencyMs": 2800
}]
}
}
Budget Alerts (via analytics)
⚠️
budgetAlert: Aylık bütçenin %80'ine ulaşıldı — Mevcut: $401 / Limit: $500, Tahmini ay sonu: $520
SupportAnalyticsController — /api/analytics/support
| # | Method | Route | Auth | Description |
|---|---|---|---|---|
| 2 | GET | /api/analytics/support?startDate={date}&endDate={date} | Required | Destek & CSAT analizi — 200 OK (ApiResponse<SupportAnalyticsDto>) |
Response:
{
"success": true,
"result": {
"totalConversations": 1247,
"resolutionRatePercent": 83.0,
"escalationRatePercent": 17.0,
"avgDurationMinutes": 4.2,
"csatScore": 4.3,
"csatDistribution": [{ "score": 5, "count": 450 }, { "score": 4, "count": 320 }, { "score": 3, "count": 180 }],
"hourlyHeatmap": [{ "hour": 9, "count": 45 }],
"escalationReasons": [
{ "reason": "Fiyatlandırma sorusu (agent cevaplayamıyor)", "percent": 34 },
{ "reason": "Teknik arıza (tool timeout)", "percent": 28 },
{ "reason": "Müşteri ısrarcı (insan istiyor)", "percent": 22 },
{ "reason": "Diğer", "percent": 16 }
]
}
}