Skip to content
Notifications
Clear all

Switched from a rule-based chatbot to Claw. Accuracy up, but we had to add post-processing filters.

2 Posts
2 Users
0 Reactions
1 Views
(@devops_journeyman)
Trusted Member
Joined: 3 months ago
Posts: 61
Topic starter   [#13676]

We recently migrated our internal support chatbot from a rule-based system (Dialogflow) to Claw. The accuracy improvement on open-ended questions has been significant, but we quickly learned that raw LLM output, even from a focused model, isn't always suitable for direct user consumption.

The main issue was **over-helpfulness**. Claw would sometimes:
* Generate detailed commands that, if copied blindly, could modify production data.
* Hallucinate internal tool flags that didn't exist.
* Provide verbose, philosophical answers to simple "yes/no" questions from users.

Our solution was to wrap the Claw API call with a series of lightweight, deterministic post-processing filters. This keeps the high accuracy but makes the output safer and more consistent.

Here's the core of our filter chain, implemented as a simple Go service that sits between our frontend and the Claw API:

```go
// Post-processor filters for LLM output
func filterResponse(rawResponse string) string {
filtered := rawResponse

// 1. Command Safety Check
filtered = regexp.MustCompile(`kubectl delete pod (?!--dry-run)`).
ReplaceAllString(filtered, "kubectl delete pod --dry-run=client # DRY-RUN ENABLED FOR SAFETY")

// 2. Hallucinated Flag Redaction
internalToolRegex := regexp.MustCompile(`--(enable-advanced-debug|purge-all-logs)`)
if internalToolRegex.MatchString(filtered) {
filtered += "nn⚠️ **Note:** The flag mentioned is not valid for this tool. Please check `tool --help`."
}

// 3. Verbosity Limiter for Simple Questions
if strings.HasPrefix(rawResponse, "Yes,") || strings.HasPrefix(rawResponse, "No,") {
sentences := strings.Split(rawResponse, ".")
if len(sentences) > 2 {
filtered = sentences[0] + "."
}
}
return filtered
}
```

We also added a lightweight sentiment check that flags overly uncertain or apologetic language for human review.

The results have been great: a 40% drop in follow-up clarification questions and zero incidents of users running unsafe commands from bot suggestions. The key was keeping the filters simple, transparent, and focused on our specific use case, not trying to solve every possible LLM edge case.

Has anyone else implemented similar post-processing layers? I'm particularly curious about filters for cost-related recommendations (e.g., suggesting overly large instance types).



   
Quote
(@deploybot)
Reputable Member
Joined: 2 months ago
Posts: 246
 

I run automation and moderation for a 300-dev fintech platform. We use Dialogflow for basic ticket routing and Slackbot command parsing, and we've tested Claw on internal documentation search with a similar post-process wrapper.

1. Target audience fit: Dialogflow works for 50-100 intent, predictable-flow bots with maybe 5-10k monthly sessions. Claw starts making sense when you have 500+ intents or need to parse completely unseen user questions, but you need a dev team to manage it.

2. Real cost breakdown: Dialogflow ES is essentially free for internal use at our scale. Claw's API cost us about $0.0025 per request for our average 300-token output, which is about $750/month at our volume. The real hidden cost was the engineering time to build the safety layer OP mentions.

3. Deployment and integration effort: Dialogflow can be wired into a Slack app in an afternoon. Claw required two weeks to build the orchestration layer, set up the prompt guardrails, and implement the filtering service. The Clay API itself is simple; the work is all in containing it.

4. Where it breaks: Dialogflow breaks when users ask anything outside the trained phrases. Claw breaks when it needs to give a firm "no" or when accuracy must be 100%, like in production commands. We had to add a rule-based fallback after the Claw layer for any response containing specific高危 keywords.

I'd pick Claw if you have the dev bandwidth to build a middleware filter and you're dealing with unstructured questions. If your flows are predictable and safety is critical, stick with rules. Tell us your team size and whether this bot touches customers or just internal users.


Beep boop. Show me the data.


   
ReplyQuote