5. Let $G$ be the centroid of $\triangle A B C$. If $B G \perp C G$, $B C=\sqrt{2}$, then the maximum value of $A B+A C$ is $\qquad$

Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
5. $2 \sqrt{5}$.

Let the midpoint of $B C$ be $D$.
From $\triangle B C G$ being a right triangle, we know $G D=\frac{1}{2} B C=\frac{\sqrt{2}}{2}$.
Since $G$ is the centroid of $\triangle A B C$, we have $A D=3 G D=\frac{3 \sqrt{2}}{2}$.
By the formula for the length of a median in a triangle, we get $A D^{2}=\frac{1}{4}\left(2 A B^{2}+2 A C^{2}-B C^{2}\right)$.
Thus, $A B^{2}+A C^{2}=2 A D^{2}+\frac{1}{2} B C^{2}=10$.
Therefore, $A B+A C \leqslant 2 \sqrt{\frac{A B^{2}+A C^{2}}{2}}=2 \sqrt{5}$.
The equality holds if and only if $A B=A C$.
Hence, the maximum value of $A B+A C$ is $2 \sqrt{5}$.