Android Question How to access Google Gemini Rest API

Google recently introduced "Gemini" as the successor to their "Bard" GPT assistant. There is a Rest API available. Has anybody used that API yet, and if so do you have an example how to communicate with Gemini? The good thing about Gemini is that it is free; its rival ChatGPT isn't free. See: https://gemini.google.com/app
 
Follow on question: Has anybody recently done anything with A.I. neural networks using B4A? For a highly important technology that is going to dominate the world soon, it is remarkable how few forum members are active in the field of A.I. (apart from some early stuff from around 2016).
By the way, if you want to learn about A.I. and neural networks, I strongly recommend Andrew Jones' Youtube channel: https://www.youtube.com/@andrew-jones-data-science/videos I would love to do some (self-learning) neural network experiments with B4A!
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
 
Upvote 0
I bought your library a moment ago. However, the B4X store did not ask me to register with a password, so I didn't have a password when I filled in my details and made the PayPal payment. After receiving the purchase email I cannot download the Gemini lib. My ordernumber is YAIK1710411994 What now??
 
Upvote 0
I understand, thanks. Fortunately the B4X store has solved the problem for me. I have now downloaded his Gemini lib but have instantly run into two problems:
1. I cannot get a Google Gemini API key here in the Netherlands (yet). Even when trying via the UK there are problems because all keys have been disabled there following legal issues. It seems I'll just have to wait a couple of months...
2. His lib uses JSON code that my older B4A version does not support (but I probably will be able to work around that).
PS: It was strange that the B4X store allowed me to complete a purchase without first asking me to register, including a password. It doesn't seem many developers are making use of this store yet, although it is a good initiative.
 
Upvote 0
I know, but I have heaps of old apps (from between 2012 and ca. 2018) that have huge problems when updating to version 12. So to be honest, I gave up.
I am happy as it is with my old work, but do run into some obstacles sometimes, like now. All my old apps still work fine on Android 13! (with sometimes a tweak here and there). FYI: I do not upload anything to the Playstore anymore: Google has made it too complicated (for me) and I am too old (nearly 70) to want to learn B4Xpages. Everything is now side loaded.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
given what the current version does (it does some things well and some things not so well),
it works perfectly fine with okhttputils2. but you need the key...

note: the server is currently overloaded, and you often have to place your query a
second time.

check the images below for an example (done using only okhttputils2) from my
little app.

we had a post today in the forum regarding the string trim() method. so i
asked gemini about that. as you can see, the answer failed to mention character
values < 21. technically, if you fully understand what whitespace is, you don't
need that information, but the answer is not great. i asked it a question about
@Erel, and gemini confused erel uziel with uziel gal (inventor of the uzi machine gun).
i ask gemini to clarify. it then said erel was a member of the israeli knesset. finally i
had to ask gemini who invented b4x. it said erel uziel. no mention of his earlier endeavors.
(i posted the uzi response on another gemini thread last night. you can look for it if you
like.)

it's good at stringing lots of words together.
 

Attachments

  • 1.png
    1.png
    10.2 KB · Views: 103
  • 2.png
    2.png
    10.5 KB · Views: 99
  • 3.png
    3.png
    28.9 KB · Views: 98
Upvote 0
given what the current version does (it does some things well and some things not so well),
it works perfectly fine with okhttputils2. but you need the key...

note: the server is currently overloaded, and you often have to place your query a
second time.

check the images below for an example (done using only okhttputils2) from my
little app.

we had a post today in the forum regarding the string trim() method. so i
asked gemini about that. as you can see, the answer failed to mention character
values < 21. technically, if you fully understand what whitespace is, you don't
need that information, but the answer is not great. i asked it a question about
@Erel, and gemini confused erel uziel with uziel gal (inventor of the uzi machine gun).
i ask gemini to clarify. it then said erel was a member of the israeli knesset. finally i
had to ask gemini who invented b4x. it said erel uziel. no mention of his earlier endeavors.
(i posted the uzi response on another gemini thread last night. you can look for it if you
like.)

it's good at stringing lots of words together.
Do you mind sharing the code?
 
Upvote 0
Top