Example 3 Suppose there is a function $f(x)=\log _{3} \frac{x^{2}+a x+b}{x^{2}+x+1}(x \in \mathbf{R})$, find $a, b$ such that the function $f(x)$ simultaneously satisfies the following conditions:
(1) The graph of the function passes through the origin;
(2) The function $f(x)$ is monotonically increasing on $[1,+\infty)$;
(3) The maximum value of the function $f(x)$ is 1.
From (1) we know $f(0)=0$, so $b=1$
$$
f(x)=\log _{3} \frac{x^{2}+a x+1}{x^{2}+x+1}=\log _{3}\left[1+\frac{(a-1) x}{x^{2}+x+1}\right]=\log _{3}\left[1+\frac{a-1}{x+\frac{1}{x}+1}\right](x \neq 0)
$$

Let $1 \leqslant x_{1}<x_{2}$
and by the given, $f(x)$ is monotonically increasing on $[1,+\infty)$, then
$$
1+\frac{a-1}{x_{2}+\frac{1}{x_{2}}+1}>1+\frac{a-1}{x_{1}+\frac{1}{x_{1}}+1}
$$

Thus, it is easy to get $a-1<0$, i.e., $a<1$
Also, when $x \geqslant 0$, $1+\frac{(a-1) x}{x^{2}+x+1} \leqslant 1$, i.e., $f(x) \leqslant 0$, which contradicts the given condition;
When $x<0$, $x+\frac{1}{x}+1 \leqslant-1$, and $a<1$, then
$$
1+\frac{a-1}{x+\frac{1}{x}+1} \leqslant 1+(1-a)=2-a . f(x) \leqslant \log _{3}(2-a)=1, a=-1
$$

In summary, $a=-1, b=1$