Example 6 Let positive integers $a, b$ satisfy $a b>1$. Find all positive integer values that the algebraic expression
$$f(a, b)=\frac{a^{2}+a b+b^{2}}{a b-1}$$

can take.
Let $a, b \in \mathbf{N}^{*}$ satisfy $a b>1$, and such that
$$f(a, b)=\frac{a^{2}+a b+b^{2}}{a b-1}=k \in \mathbf{N}^{*},$$

with the conditions: $a \geqslant b$ and $b$ is the smallest positive integer.
From this, we know that the quadratic equation in $x$

i.e., $\square$
$$\begin{aligned}
x^{2}+b x+b^{2}-k(b x-1) & =0 \\
x^{2}+(1-k) b x+b^{2}+k & =0
\end{aligned}$$

has one solution $a$. Let the other solution be $\bar{a}$, then by Vieta's formulas we have
$$\bar{a}=(k-1) b-a \in \mathbf{Z}$$

Since $a \cdot \bar{a}=b^{2}+k>0$, it follows that $\bar{a} \in \mathbf{N}^{\top}$.
Using the fact that $\bar{a}$ is a solution to (5), we know $f(\bar{a}, b)=k$. Since $f$ is symmetric in $a$ and $b$, we have $f(b, \bar{a})=k$. Given $\bar{a}, b \in \mathbf{N}^{*}$ and the minimality of $b$, we have
$$\bar{a}=\frac{b^{2}+k}{a} \geqslant b$$

This implies
$$\frac{a+b+b^{3}}{a b-1} \geqslant b$$

If $a=b$, then $k=\frac{3 a^{2}}{a^{2}-1}=3+\frac{3}{a^{2}-1}$, hence
$$\left(a^{2}-1\right) \mid 3,$$

which means $a^{2}-1=1$ or 3, solving for $a=2$, thus $b=2, k=4$.
If $a>b$, we classify the values of $b$.
(1) If $b \geqslant 4$, then
$$\begin{aligned}
& (a b-1) b-\left(a+b+b^{3}\right)=a\left(b^{2}-1\right)-\left(b^{3}+2 b\right) \\
\geqslant & (b+1)\left(b^{2}-1\right)-\left(b^{3}+2 b\right)=b^{2}-3 b-1 \\
= & (b-2)(b-1)-3>0
\end{aligned}$$

This contradicts (6), so it does not meet the requirements.
(2) If $b=3$, then
$$\begin{aligned}
(a b-1) b-\left(a+b+b^{3}\right) & =3(3 a-1)-(a+3+27) \\
& =8 a-33
\end{aligned}$$

In this case, if $a \geqslant 5$, then $8 a-33>0$, contradicting (6). Therefore, $a=4$, leading to $k=\frac{37}{11}$, which does not meet the conditions.
(3) If $b=2$, then $k=\frac{a^{2}+2 a+4}{2 a-1} \in \mathbf{N}^{*}$, hence
$$\frac{4 a^{2}+8 a+16}{2 a-1} \in \mathbf{N}^{*}$$

i.e., $\square$
$$2 a+5+\frac{21}{2 a-1} \in \mathbf{N}^{\cdot}$$

Thus, $(2 a-1) \mid 21$, so $a \in\{1,2,4,11\}$. Combining $a>b$, we have $a \in\{4, 11\}$, yielding $k \in\{4,7\}$.
(4) If $b=1$, then
$$k=\frac{a^{2}+a+1}{a-1}=a+2+\frac{3}{a-1} \in \mathbf{N}^{*},$$

hence $(a-1) \mid 3$, so $a \in\{2,4\}$, giving $k=7$.
In summary, the positive integer values that $f(a, b)$ can take are 4 or 7.