我們在規則引擎前加入 LLM:保留了甚麼,又禁止了甚麼
We put an LLM in front of our rule engine. Here is what we kept and what we banned
clickSpecta 在規則引擎前加入 LLM,讓用戶以自然語言建立規則草稿、查詢數據,並在審批後才啟用。助手只呼叫產品現有的唯讀工具,不會自行執行規則;40 題測試全數答對,答案中 97% 的數字與來源吻合。客戶可選擇 Vertex AI、Azure OpenAI,或在自家網絡內運行的兼容模型。
I work on clickSpecta, a clickstream analytics platform with a real-time decision engine. Banks and insurers run it on their own servers. This post is about one change that turned out bigger than we expected: letting people write rules by describing them.
The old way
A real-time rule sounds simple when you say it out loud:
Show an offer to a customer who calculated a loan 3 times in 24 hours and did not apply within 2 days.
Building it is another story. That sentence hides a trigger event, a count inside a time window, an absence condition ("did not apply") and a filter on the customer. That is complex event processing, and for years it meant one of two things: a developer writes it, or the business team learns a rule editor that looks like a tax form.
We already had a no-code canvas and a set of templates. They helped. But people still had to translate a sentence in their head into boxes.
The new way
Now they type the sentence. The assistant returns a draft rule:
- trigger:
loan_calculated, amount 250,000 or more - count: 3 times in 24 hours
- absence: no
application_startedwithin 2 days - customer: intent score 60 or more
- action: in-app offer card and a lead in the CRM
They read it, fix what is off, run it against past data to see how often it would have fired, and switch it on with a control group.
The same goes for campaigns and for plain questions. "Which three screens were abandoned most in the last 30 days?" comes back with an answer and the numbers behind it.
So yes, rules and a good part of the strategy work now start from plain language. That part of the next-generation AI talk is real for us.
What we banned
This is the part I would pass on to anyone building something similar.
The model does not write queries. It calls read-only tools the product already has. If a number is wrong, our tool is wrong, and that is something we can test.
Every answer shows its work. Under each answer you see which figures were used. On our 40-question test set it answered all 40 correctly, and 97% of the figures in the answers checked out against the source.
Nothing goes live on its own. Rules and campaigns arrive as drafts. A person takes them live.
No personal data in prompts. And no questions about one individual. The assistant talks about patterns, not about a person.
The customer picks the model. Vertex AI, Azure OpenAI, or a compatible model running inside their own network. For on-prem customers that last option matters a lot.
Where the speed comes from
The AI helps you write the rule. Running it is plain engineering, and the model is not in the hot path. An event lands in the database within two seconds, the rule signal follows in two to five, and the Decision API answers in 15–25 ms when an app asks "what should I show this customer right now?". Underneath it is PostgreSQL and Kafka, nothing exotic.
Three things I would tell another team
- Start with read-only. Asking questions is where trust gets built. Writing rules comes after.
- Keep the human step. In a bank, an agent that acts alone will not survive the first risk review. A draft that needs approval will.
- Test the answers like you test code. A fixed set of questions with known answers tells you more than any demo.
If you want to see how the pieces fit together, the platform page has the longer version: https://clickspecta.com/platform/. And if "complex event processing" is new to you, the glossary explains it without the jargon: https://clickspecta.com/glossary/#complex-event-processing
Have you put an LLM in front of something that changes production behaviour? I would like to hear what you banned.
來源:DEV Community · dev.to