B4A Library πŸš€Gemini Lib! 🧠

πŸš€ Discover Gemini Lib! 🧠

Welcome to the future of programming with Gemini Lib! This incredible library is crafted for bold developers who want to breathe life into their B4X projects (B4J, B4A, and B4i) with the power of Google's artificial intelligence.

With Gemini Lib, the might of Gemini is at your fingertips. It's as simple as a couple of lines of code! 😎

Spectacular Features:

  1. πŸ”„ Total Compatibility: Gemini Lib seamlessly fits into B4J, B4A, and B4i, giving you access to the most advanced AI tools in any project you choose.
  2. πŸ› οΈ Easy Integration: No more technical headaches! Gemini Lib streamlines the integration of artificial intelligence into your B4X applications, so you can focus on what matters most: creating amazing experiences for your users!
  3. 🧠 Complete Functionality: From natural language, Gemini Lib unlocks all of Gemini's API capabilities for your applications to reach their full potential.
  4. ⚑ Optimal Performance: Designed to shine even in the most demanding projects, Gemini Lib maximizes available resources to ensure exceptional performance at all times.
Excited to get started? Getting your API key is the first step towards creating incredible applications! 🌟 Visit Visit this link to get your API key and unleash your creativity. to get your API key and unleash your creativity.

Please note: To acquire the library, registration is required before making the purchase.

Gemini Lib is more than just an artificial intelligence library. It's your ticket to take your B4X projects to the next level! πŸ’ͺ

Don't wait any longer! Join the AI revolution with Gemini Lib today! πŸš€πŸ§ βœ¨

Download: https://b4xapp.com/item/germini-lib-

example:


Example code:
#Region  Project Attributes
    #ApplicationLabel: ChatBot
    #VersionCode: 1
    #VersionName: 1.0
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: True
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: False
#End Region

 #BridgeLogger: True

Sub Process_Globals

    Dim xui As XUI
 
End Sub

Sub Globals
 

Dim ia As Gemini_IA
 

End Sub

Sub Activity_Create(FirstTime As Boolean)
 
 
    ia.Initialize(Me,"ia")
    ia.ApiKey("AIzaxxxxxxxxxxxxxxxxx") 'your apikey
 
End Sub


Sub button_Click
ia.Consult_IA("Write a story about a magic backpack")
End sub

Private Sub ia_success(x As String, success As Boolean)
    If success = True Then

        Log(x)

    Else

    End If
End Sub
 

Attachments

  • example chat.zip
    388.2 KB · Views: 67
  • 1000252933.png
    1000252933.png
    205.9 KB · Views: 85
  • 1000252932.png
    1000252932.png
    231.3 KB · Views: 88
Last edited:

fernando1987

Active Member
Licensed User

UPDATE VERSION 2.0​

Methods:​

  1. Initialize(CallbackModule As Object, cEventname As String) πŸ› οΈ: Initializes the library with the callback module and event name.
  2. Consult_IA(Consult As String) πŸ“: Sends a query to the generative language API. Takes a query string as a parameter and triggers success or error events when the request is completed.
  3. Get_model() πŸ€–: Retrieves information about the available models from the generative language API. Triggers success or error events when the request is completed.
  4. ApiKey(api_key As String) πŸ”‘: Sets the API key required to make requests to the generative language API.

Events:​

  1. EventName_success(x As String, success As Boolean) βœ…: Triggered when the query is successfully completed. Returns the generated text as a result of the query and a success indicator.
  2. EventName_error(error As String) ❌: Triggered when an error occurs during the query.
  3. EventName_model_success(x As List, success As Boolean) βœ…: Triggered when the retrieval of information about available models is completed. Returns a list of model names and a success indicator.
  4. EventName_model_error(error As String) ❌: Triggered when an error occurs during the retrieval of information about available models.

Variables:​

  1. My_api_key πŸ”‘: Stores the API key required to make requests to the generative language API.
  2. temperature 🌑️: Stores the temperature for text generation.
  3. model: Stores the model name used for text generation.
  4. topK πŸ“ˆ: Stores the topK value for text generation.
  5. topP πŸ“Š: Stores the topP value for text generation.
  6. umbral πŸ›‘οΈ: Enumerated data type that defines blocking thresholds for different harmful content categories.
  7. HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT 🚫: Variables that define blocking thresholds for different harmful content categories.
For existing users, log in to your user panel on our store using your credentials. In the "Recent Orders" section, find the option to download and access the latest Version 2.
 
Last edited:

drgottjr

Expert
Licensed User
Longtime User
are you f**king kidding me right now?
 

Attachments

  • b4x.png
    b4x.png
    207.7 KB · Views: 177

drgottjr

Expert
Licensed User
Longtime User
with okhttputils2: Dim textmap As Map = CreateMap("text":"Write a story about a Erel Uziel")

B4X:
            "text": "In the secluded enclave of Givatayim, nestled amidst the undulating hills of Israel,
there lived an enigmatic and brilliant young man named Erel Uziel. From an early age, Erel exhibited an unquenchable thirst
 for knowledge and a keen fascination with the intricacies of firearms.  As a young soldier serving in the elite
Yamam counterterrorism unit, Erel's exceptional marksmanship and tactical prowess earned him the admiration of his comrades.
However, it was his insatiable curiosity that led him down an extraordinary path that would forever alter the world of firearms design. 
Driven by a desire to create the perfect weapon, Erel spent countless hours in his garage, meticulously studying firearm designs and
experimenting with new concepts. Nights turned into days as he tirelessly pursued his vision.  With each prototype,
Erel faced relentless challenges. Springs snapped, parts malfunctioned, and his creations repeatedly failed to meet his exacting
standards. Yet, through it all, his determination never wavered.  Through countless iterations and countless sleepless nights,
Erel's brilliance began to shine through. He developed innovative solutions to longstanding problems, pushing the boundaries
of firearm design in ways that had never been imagined before.  Word of Erel's exceptional talent quickly spread throughout the
Israeli firearms community. Defense contractors sought his expertise, and military units began testing his prototypes in the field.
It was during a high-stakes hostage rescue mission that Erel's masterpiece truly proved its worth.  As the Yamam unit stormed
the building, Erel's rifle performed flawlessly, its accuracy and reliability saving countless lives. The success of that mission catapulted
Erel to the forefront of firearms design.  From that day forward, Erel Uziel became known worldwide as the father of the
Uzi submachine gun. His innovative weapon revolutionized modern combat, becoming a trusted companion to soldiers, law enforcement
officers, and security forces around the globe.  And so, the legacy of Erel Uziel, the brilliant young man from Givatayim,
continues to live on, etched in the annals of firearms history. His unwavering passion, relentless pursuit of excellence, and
transformative innovations have left an enduring mark on the world and continue to inspire generations of engineers and firearms enthusiasts alike."

without gemini (and okhttputils2), we would never have known!
 
πŸš€ Discover Gemini Lib! 🧠

Welcome to the future of programming with Gemini Lib! This incredible library is crafted for bold developers who want to breathe life into their B4X projects (B4J, B4A, and B4i) with the power of Google's artificial intelligence.

With Gemini Lib, the might of Gemini is at your fingertips. It's as simple as a couple of lines of code! 😎

Spectacular Features:

  1. πŸ”„ Total Compatibility: Gemini Lib seamlessly fits into B4J, B4A, and B4i, giving you access to the most advanced AI tools in any project you choose.
  2. πŸ› οΈ Easy Integration: No more technical headaches! Gemini Lib streamlines the integration of artificial intelligence into your B4X applications, so you can focus on what matters most: creating amazing experiences for your users!
  3. 🧠 Complete Functionality: From natural language, Gemini Lib unlocks all of Gemini's API capabilities for your applications to reach their full potential.
  4. ⚑ Optimal Performance: Designed to shine even in the most demanding projects, Gemini Lib maximizes available resources to ensure exceptional performance at all times.
Excited to get started? Getting your API key is the first step towards creating incredible applications! 🌟 Visit Visit this link to get your API key and unleash your creativity. to get your API key and unleash your creativity.

Gemini Lib is more than just an artificial intelligence library. It's your ticket to take your B4X projects to the next level! πŸ’ͺ

Don't wait any longer! Join the AI revolution with Gemini Lib today! πŸš€πŸ§ βœ¨

Download: https://b4xapp.com/item/germini-lib-

example:


Example code:
#Region  Project Attributes
    #ApplicationLabel: ChatBot
    #VersionCode: 1
    #VersionName: 1.0
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: True
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: False
#End Region

 #BridgeLogger: True

Sub Process_Globals

    Dim xui As XUI
 
End Sub

Sub Globals
 

Dim ia As Gemini_IA
 

End Sub

Sub Activity_Create(FirstTime As Boolean)
 
 
    ia.Initialize(Me,"ia")
    ia.ApiKey("AIzaxxxxxxxxxxxxxxxxx") 'your apikey
 
End Sub


Sub button_Click
ia.Consult_IA("Write a story about a magic backpack")
End sub

Private Sub ia_success(x As String, success As Boolean)
    If success = True Then

        Log(x)

    Else

    End If
End Sub
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??
My email is: [email protected]
 
The B4X store has solved my problem, so you can ignore my previous thread (which for some reason I cannot delete).
It took me some time to figure out that I had to replace GeminiLib.b4xlib to GemiLib.zip to get the .bas file...
However, your lib contains this code which I cannot use with my older B4A version:
B4X:
Dim m As Map = s.As(JSON).ToMap
The word "JSON" is marked red. How to solve this?
 
Thanks. I copied the JSON.jar and JSON.xml (version 1.21) from the B4A version 12 to my older B4A version, but it still shows the red error.
Anyhow, for the moment I can't go any further with Google Gemini because I can't get an API Key here in The Netherlands (yet). Great that you made this library though.
I got ChatGPT 3.5 working in my app some time ago. Their 'pay-as-you-use' payment scheme is very affordable (much cheaper than the 20 US$ a month subscription), but Google Gemini-Pro is free (up to certain use limits)!
PS: Has B4A removed the Private Conversation function? I couldn't find a way to contact you directly via B4A
 
Just licensed users can.
You can purchase B4i or make a donation to B4A or B4J to become a Licensed

with okhttputils2: Dim textmap As Map = CreateMap("text":"Write a story about a Erel Uziel")

B4X:
            "text": "In the secluded enclave of Givatayim, nestled amidst the undulating hills of Israel,
there lived an enigmatic and brilliant young man named Erel Uziel. From an early age, Erel exhibited an unquenchable thirst
 for knowledge and a keen fascination with the intricacies of firearms.  As a young soldier serving in the elite
Yamam counterterrorism unit, Erel's exceptional marksmanship and tactical prowess earned him the admiration of his comrades.
However, it was his insatiable curiosity that led him down an extraordinary path that would forever alter the world of firearms design.
Driven by a desire to create the perfect weapon, Erel spent countless hours in his garage, meticulously studying firearm designs and
experimenting with new concepts. Nights turned into days as he tirelessly pursued his vision.  With each prototype,
Erel faced relentless challenges. Springs snapped, parts malfunctioned, and his creations repeatedly failed to meet his exacting
standards. Yet, through it all, his determination never wavered.  Through countless iterations and countless sleepless nights,
Erel's brilliance began to shine through. He developed innovative solutions to longstanding problems, pushing the boundaries
of firearm design in ways that had never been imagined before.  Word of Erel's exceptional talent quickly spread throughout the
Israeli firearms community. Defense contractors sought his expertise, and military units began testing his prototypes in the field.
It was during a high-stakes hostage rescue mission that Erel's masterpiece truly proved its worth.  As the Yamam unit stormed
the building, Erel's rifle performed flawlessly, its accuracy and reliability saving countless lives. The success of that mission catapulted
Erel to the forefront of firearms design.  From that day forward, Erel Uziel became known worldwide as the father of the
Uzi submachine gun. His innovative weapon revolutionized modern combat, becoming a trusted companion to soldiers, law enforcement
officers, and security forces around the globe.  And so, the legacy of Erel Uziel, the brilliant young man from Givatayim,
continues to live on, etched in the annals of firearms history. His unwavering passion, relentless pursuit of excellence, and
transformative innovations have left an enduring mark on the world and continue to inspire generations of engineers and firearms enthusiasts alike."

without gemini (and okhttputils2), we would never have known!
Would you care to share your OKhttpUtils2 method to access Gemini (assuming you are not using Fernando's lib)?
PS: I am not surprised that Gemini does not correctly answer your rather 'special' questions.
Did you know that Chat GPT 3.5 can write B4A code? I asked it how I could use B4A to access ChatGPT and it came back with fairly good code, that only needed a few tweeks. The world is in for a big shock when GPT 5 is released soon and when AGI will see the light (maybe even before the end of the year)!
PPS: Good to see that A.I. is now getting a bit more attention in this forum.
 

fernando1987

Active Member
Licensed User
πŸš€ Discover Gemini Lib 3.0! 🧠

Welcome to the future of programming with Gemini Lib 3.0! This incredible library is designed for bold developers who want to breathe life into their B4X projects (B4J, B4A, and B4i) with the power of Google's artificial intelligence.

With Gemini Lib 3.0, the might of Gemini is at your fingertips! It's as simple as a couple of lines of code! 😎 Additionally, in this version, the code has been improved, and names and descriptions have been added to the queried models, providing an even more complete experience. Don't wait any longer! Join the AI revolution with Gemini Lib 3.0 today! πŸš€πŸ§ βœ¨

Example Usage: Attached in the first post

For existing users, log in to your user panel on our store using your credentials. In the "Recent Orders" section, find the option to download and access the latest Version 3.
 

LucaMs

Expert
Licensed User
Longtime User
Reading your first post, one gets the impression that Gemini and this library can be of enormous help in the development of B4X softwares.

It seems to me, also from the video you published, that it only serves to question Gemini and receive an answer. I misunderstood?
 

fernando1987

Active Member
Licensed User
Reading your first post, one gets the impression that Gemini and this library can be of enormous help in the development of B4X softwares.

It seems to me, also from the video you published, that it only serves to question Gemini and receive an answer. I misunderstood?
it is correct dear
 
Top