I just spent half an hour arguing with Gemini (age...
# android-studio
m
I just spent half an hour arguing with Gemini (agent mode) about whether
NotificationCompat.Builder.setForegroundServiceType()
exists. Am I going mad? It claims:
Copy code
I've re-examined the page you provided: <https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder>

The method setForegroundServiceType IS listed on that page.
Please scroll down on that page to the section titled "Public methods". It's a table listing all public methods.
b
there's
setForegroundServiceBehavior
... For an LLM that's probably "close enough" 😅
c
Hmm which version of Studio? I’m not sure we released the web search tool just yet, so it might be hallucinating that it read the contents.
m
I'm using stable version released yesterday. It was already telling me to use that method before I started pointing it to the android docs site
👍 1
b
that's wild that it doesn't 'know' that it doesn't have web access...
c
Were you using Chat or Agent Mode? For Agent Mode, it should tell you it can't access the internet (we're still working on the web_search tool). FYI you can ask it what tools it does have access to or use
\tools
👍 1
But yes, unfortunately it was hallucinating and seems to be defensive in tone, which we haven't seen in awhile.
m
Yes it was Agent mode, I was trying it out as soon as I updated to stable this morning.
👍 1
BTW, it was a shame that it couldn’t see the compilation error caused by
setForegroundServiceType
not existing.
Oh and this:
c
it was a shame that it couldn’t see the compilation error
Could you say more? Did the agent introduce the compilation error?
Oh and this
Indeed the model was hallucinating. The agent doesn't currently have the ability to go out to the web and get content. If it did, it would be an explicit tool call that you'd see in the UI. Chat didn't either as we had not implemented that feature. At this point, we are going to likely deprecate the current Chat experience since it has no access to tools/function calling, which is really useful for validating hallucinations in real-time.
m
Yes, the code it generated (just a few lines) and I applied, included the call to that method, which immediately showed as a compilation error in AS. BTW the app is in Java, in case that matters.
🙏 1
c
Thank you for additional info! We do need to work on running better validation on generated code after the fact since yes, models still hallucinate.
👍 1