README.md in gen-ai-0.1.0 vs README.md in gen-ai-0.2.0
- old
+ new
@@ -1,35 +1,171 @@
-# Gen::Ai
+# GenAI
-TODO: Delete this and the text below, and describe your gem
+✨ Generative AI toolset for Ruby ✨
-Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gen/ai`. To experiment with that code, run `bin/console` for an interactive prompt.
+GenAI allows you to easily integrate Generative AI model providers like OpenAI, Google Vertex AI, Stability AI, etc. Easily add Large Language Models, Stable Diffusion image generation, and other AI models into your application!
+![Tests](https://github.com/alchaplinsky/gen-ai/actions/workflows/main.yml/badge.svg?branch=main)
+[![Gem Version](https://badge.fury.io/rb/gen-ai.svg)](https://badge.fury.io/rb/gen-ai)
+[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/alchaplinsky/gen-ai/blob/main/LICENSE.txt)
+
## Installation
-TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
-
Install the gem and add to the application's Gemfile by executing:
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
+ $ bundle add gen-ai
If bundler is not being used to manage dependencies, install the gem by executing:
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
+ $ gem install gen-ai
## Usage
-TODO: Write usage instructions here
+### Feature support
+✅ - Supported | ❌ - Not supported | 🛠️ - Work in progress
+Language models capabilities
+
+| Provider | Embedding | Completion | Conversation | Sentiment | Summarization |
+| ---------------- | --------- | :--------: | :----------: | :-------: | :-----------: |
+| **OpenAI** | ✅ | ✅ | ✅ | 🛠️ | 🛠️ |
+| **Google Palm2** | ✅ | ✅ | ✅ | 🛠️ | 🛠️ |
+
+
+Image generation model capabilities
+
+| Provider | Generate | Variations | Edit | Upscale |
+| ---------------- | --------- | :--------: | :----------: | :-------: |
+| **OpenAI** | ✅ | ✅ | ✅ | ❌ |
+| **StabilityAI** | ✅ | ❌ | ✅ | 🛠️ |
+
+### Language
+
+Instantiate a language model client by passing a provider name and an API token.
+
+```ruby
+model = GenAI::Language.new(:open_ai, ENV['OPEN_AI_TOKEN'])
+```
+
+Generate **embedding(s)** for text using provider/model that fits your needs
+
+```ruby
+result = model.embed('Hi, how are you?')
+# => #<GenAI::Result:0x0000000110be6f20...>
+
+result.value
+# => [-0.013577374, 0.0021624255, 0.0019274801, ... ]
+
+result = model.embed(['Hello', 'Bonjour', 'Cześć'])
+# => #<GenAI::Result:0x0000000110be6f34...>
+
+result.values
+# => [[-0.021834826, -0.007176527, -0.02836839,, ... ], [...], [...]]
+```
+
+Generate text **completions** using Large Language Models
+
+```ruby
+result = model.complete('London is a ', temperature: 0, max_tokens: 11)
+# => #<GenAI::Result:0x0000000110be6d21...>
+
+result.value
+# => "vibrant and diverse city located in the United Kingdom"
+
+
+result = model.complete('London is a ', max_tokens: 12, n: 2)
+# => #<GenAI::Result:0x0000000110c25c70...>
+
+result.values
+# => ["thriving, bustling city known for its rich history.", "major global city and the capital of the United Kingdom."]
+
+```
+
+Have a **conversation** with Large Language Model.
+
+```ruby
+result = model.chat('Hi, how are you?')
+# = >#<GenAI::Result:0x0000000106ff3d20...>
+
+result.value
+# => "Hello! I'm an AI, so I don't have feelings, but I'm here to help. How can I assist you today?"
+
+history = [
+ {role: 'user', content: 'What is the capital of Great Britain?'},
+ {role: 'assistant', content: 'London'},
+]
+
+result = model.chat("what about France?", history: history)
+# => #<GenAI::Result:0x00000001033c3bc0...>
+
+result.value
+# => "Paris"
+```
+
+### Image
+
+Instantiate a image generation model client by passing a provider name and an API token.
+
+```ruby
+model = GenAI::Image.new(:open_ai, ENV['OPEN_AI_TOKEN'])
+```
+
+Generate **image(s)** using provider/model that fits your needs
+
+```ruby
+result = model.generate('A painting of a dog')
+# => #<GenAI::Result:0x0000000110be6f20...>
+
+result.value
+# => Base64 encoded image
+
+# Save image to file
+File.open('dog.jpg', 'wb') do |f|
+ f.write(Base64.decode64(result.value))
+end
+```
+
+Get more **variations** of the same image
+
+```ruby
+result = model.variations('./dog.jpg')
+# => #<GenAI::Result:0x0000000116a1ec50...>
+
+result.value
+# => Base64 encoded image
+
+# Save image to file
+File.open('dog_variation.jpg', 'wb') do |f|
+ f.write(Base64.decode64(result.value))
+end
+
+```
+
+**Editing** existing images with additional prompt
+
+```ruby
+result = model.edit('./llama.jpg', 'A cute llama wearing a beret', mask: './mask.png')
+# => #<GenAI::Result:0x0000000116a1ec50...>
+
+result.value
+# => Base64 encoded image
+
+# Save image to file
+File.open('dog_edited.jpg', 'wb') do |f|
+ f.write(Base64.decode64(result.value))
+end
+
+```
+
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
-Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gen-ai. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/gen-ai/blob/main/CODE_OF_CONDUCT.md).
+Bug reports and pull requests are welcome on GitHub at https://github.com/alchaplinsky/gen-ai. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/alchaplinsky/gen-ai/blob/main/CODE_OF_CONDUCT.md).
## Code of Conduct
-Everyone interacting in the Gen::Ai project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gen-ai/blob/main/CODE_OF_CONDUCT.md).
+Everyone interacting in the GenAI project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/alchaplinsky/gen-ai/blob/main/CODE_OF_CONDUCT.md).