***

title: addPatternHint
slug: /reference/typescript/agents/agent-base/add-pattern-hint
description: Add a speech recognition hint with pattern matching and replacement.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[ref-agentbase]: /docs/server-sdks/reference/typescript/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**

<ParamField path="opts" type="object" required={true} toc={true}>
  Pattern hint configuration object with the following fields:
</ParamField>

<Indent>
  <ParamField path="opts.pattern" type="string" required={true} toc={true}>
    Regular expression pattern to match.
  </ParamField>

  <ParamField path="opts.replace" type="string" required={true} toc={true}>
    Replacement text to substitute when the pattern matches.
  </ParamField>

  <ParamField path="opts.ignoreCase" type="boolean" toc={true}>
    Whether to ignore case when matching the pattern.
  </ParamField>
</Indent>

## **Returns**

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

## **Example**

```typescript {6}
import { AgentBase } from '@signalwire/sdk';

const agent = new AgentBase({ name: 'support', route: '/support' });
agent.setPromptText('You are a helpful assistant.');
// Correct common ASR misrecognition
agent.addPatternHint({
  pattern: 'signal\\s*wire|signal\\s*wired',
  replace: 'SignalWire',
  ignoreCase: true,
});
await agent.serve();
```