The chords in the riff are A, B, C, D, E, F# and G - so it looks like we're in the key of G.
In that second bar, the G# note doesn't belong in that key.
So - in this riff we have a great example of modal interchange!?
I hope that's right - if so, I've definitely learned something new this week.
c.