gemini.lua is a lightweight Lua library for interacting with the Gemini API.
To install gemini.lua, you can use Luarocks:
luarocks install geminiluaAlternatively, you can download the repository and include it in your Lua project manually.
gemini.lua requires the following libraries:
lua-cjsonluasocketluasec
If you installed gemini.lua via Luarocks, these dependencies will be installed automatically. Otherwise, you can install them manually:
luarocks install lua-cjson
luarocks install luasocket
luarocks install luasecHere’s a basic example of how to use gemini.lua:
local gemini = require("gemini")
local api_key = "YOUR_API_KEY" -- Replace with your actual API key
local client = gemini.Client.new(api_key, "gemini-2.0-flash")
print("What is your question?")
local prompt = io.read()
local response, err = client:generate_content(prompt)
if response then
print(response)
else
print("Error:", err)
endPlanned features for future releases of gemini.lua include:
- Media Support: Improve functionality for sending and receiving media.
If you have suggestions for new features or improvements, feel free to open an issue or submit a pull request.
You can contact me on Discord. My username is tbkurt
gemini.lua is open-source and distributed under the MIT License.