> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# add_pattern_hint

> Add a speech recognition hint with pattern matching and replacement.

[ref-agentbase]: /docs/server-sdks/reference/python/agents/agent-base

Add a hint with pattern matching and replacement. This allows you to intercept
specific ASR output and rewrite it before it reaches the AI -- useful for correcting
consistent misrecognitions or normalizing variations.

## **Parameters**

**`hint`** `str` — required

The hint string to match against ASR output.

---

**`pattern`** `str` — required

Regular expression pattern to match.

---

**`replace`** `str` — required

Replacement text to substitute when the pattern matches.

---

**`ignore_case`** `bool` — default: False

Whether to ignore case when matching the pattern.

---

## **Returns**

[`AgentBase`][ref-agentbase] -- Returns self for method chaining.

## **Example**

```python {6}
from signalwire import AgentBase

agent = AgentBase(name="support", route="/support")
agent.set_prompt_text("You are a helpful assistant.")
# Correct common ASR misrecognition
agent.add_pattern_hint(
    hint="SignalWire",
    pattern=r"signal\s*wire|signal\s*wired",
    replace="SignalWire",
    ignore_case=True
)
agent.serve()
```