Crystal implementations of various Google API clients.
Currently supported APIs:
- Auth (limited)
- Calendar (getting there)
- Cloud Storage
- Drive (limited)
- People (self-identification only)
Installation
-
Add the dependency to your
shard.yml
:dependencies: google: github: jgaskins/google
-
Run
shards install
Usage
require "google"
Load the specific Google API you need to use:
require "google/auth"
require "google/calendar"
require "google/cloud/storage"
require "google/drive"
require "google/people"
require "google/gemini"
API docs are forthcoming.
Using the GenerativeAI API (Gemini)
require "google/gemini"
client = Google::GenerativeAI::Client.new(gemini_api_key)
gemini = client.model(
"models/gemini-2.0-flash-exp",
system_instruction: [<<-MALAKAI],
You are a helpful assistant.
MALAKAI
temperature: 0.4,
)
puts gemini.generate(<<-PROMPT)
Write a limerick about the Crystal programming language.
PROMPT
## Contributing
1. Fork it (<https://github.com/jgaskins/google/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [Jamie Gaskins](https://github.com/jgaskins) - creator and maintainer