-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathai-data-enrichment.yaml
More file actions
65 lines (61 loc) · 1.98 KB
/
Copy pathai-data-enrichment.yaml
File metadata and controls
65 lines (61 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: ai-data-enrichment
description: >
Fetches support tickets, uses an AI model to classify priority and
extract key entities, then stores the enriched data. Demonstrates
using AI for transforms that require interpretation rather than
simple structural mapping.
inputs:
ticket_api_url:
type: string
description: URL to fetch support tickets from
steps:
- name: fetch-tickets
action: http/request
timeout: "15s"
params:
method: GET
url: "{{ inputs.ticket_api_url }}"
headers:
Accept: "application/json"
- name: classify
action: ai/completion
credential: openai
timeout: "60s"
params:
model: gpt-4o
system_prompt: >
You are a support ticket classifier. Given a ticket, determine
the priority (critical, high, medium, low), category, and extract
any mentioned product names or error codes.
prompt: "Classify this ticket: {{ steps['fetch-tickets'].output.body }}"
output_schema:
type: object
properties:
priority:
type: string
enum: [critical, high, medium, low]
category:
type: string
products:
type: array
items:
type: string
error_codes:
type: array
items:
type: string
required: [priority, category, products, error_codes]
additionalProperties: false
- name: store-enriched
action: postgres/query
credential: app-db
if: "steps.classify.output.json.priority == 'critical' || steps.classify.output.json.priority == 'high'"
params:
query: >
INSERT INTO urgent_tickets (priority, category, products, raw_body)
VALUES ($1, $2, $3, $4)
params:
- "{{ steps.classify.output.json.priority }}"
- "{{ steps.classify.output.json.category }}"
- "{{ jsonEncode(steps.classify.output.json.products) }}"
- "{{ steps['fetch-tickets'].output.body }}"