# prov.trace.guard

prov.trace.guard in Node SDK. Wrap `fn` so it only ever sees a completion the account's Trace rules let through.

## Signature

```ts
prov.trace.guard<R>(fn: (completion: TracedChatCompletion) => R | Promise<R>, opts?: TraceGuardOptions): (params: ChatCompletionParams) => Promise<R>
```

## Parameters

- `fn` ((completion: TracedChatCompletion) => R | Promise<R>)
- `opts` (TraceGuardOptions, optional)

## Returns

`(params: ChatCompletionParams) => Promise<R>`

Runs locally, with no request to the API.
