README.md in gen-ai-0.2.3 vs README.md in gen-ai-0.3.0
- old
+ new
@@ -19,33 +19,32 @@
$ gem install gen-ai
## Usage
Require it in you code:
+
```ruby
require 'gen_ai'
```
-
-
### Feature support
-✅ - Supported | ❌ - Not supported | 🛠️ - Work in progress
+✅ - Supported | ❌ - Not supported | 🛠️ - Work in progress
+
Language models capabilities
| Provider | Embedding | Completion | Conversation | Sentiment | Summarization |
| ---------------- | :-------: | :--------: | :----------: | :-------: | :-----------: |
-| **OpenAI** | ✅ | ✅ | ✅ | 🛠️ | 🛠️ |
-| **Google Palm2** | ✅ | ✅ | ✅ | 🛠️ | 🛠️ |
+| **OpenAI** | ✅ | ✅ | ✅ | 🛠️ | 🛠️ |
+| **Google Palm2** | ✅ | ✅ | ✅ | 🛠️ | 🛠️ |
-
Image generation model capabilities
-| Provider | Generate | Variations | Edit | Upscale |
-| ---------------- | :-------: | :--------: | :----------: | :-------: |
-| **OpenAI** | ✅ | ✅ | ✅ | ❌ |
-| **StabilityAI** | ✅ | ❌ | ✅ | ✅ |
+| Provider | Generate | Variations | Edit | Upscale |
+| --------------- | :------: | :--------: | :--: | :-----: |
+| **OpenAI** | ✅ | ✅ | ✅ | ❌ |
+| **StabilityAI** | ✅ | ❌ | ✅ | ✅ |
### Language
Instantiate a language model client by passing a provider name and an API token.
@@ -121,55 +120,63 @@
```ruby
result = model.generate('A painting of a dog')
# => #<GenAI::Result:0x0000000110be6f20...>
result.value
-# => Base64 encoded image
+# => image binary
+result.value(:base64)
+# => image in base64
+
# Save image to file
File.open('dog.jpg', 'wb') do |f|
- f.write(Base64.decode64(result.value))
+ f.write(result.value)
end
```
+
![dog](https://github.com/alchaplinsky/gen-ai/assets/695947/27a2af5d-530b-4966-94e8-6cdf628b6cac)
-
Get more **variations** of the same image
```ruby
result = model.variations('./dog.jpg')
# => #<GenAI::Result:0x0000000116a1ec50...>
result.value
-# => Base64 encoded image
+# => image binary
+result.value(:base64)
+# => image in base64
+
# Save image to file
File.open('dog_variation.jpg', 'wb') do |f|
- f.write(Base64.decode64(result.value))
+ f.write(result.value)
end
```
+
![dog_variation](https://github.com/alchaplinsky/gen-ai/assets/695947/977f5238-0114-4085-8e61-8f8b356ce308)
-
**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
+# => image binary
+result.value(:base64)
+# => image in base64
+
# Save image to file
File.open('dog_edited.jpg', 'wb') do |f|
- f.write(Base64.decode64(result.value))
+ f.write(result.value)
end
```
![llama](https://github.com/alchaplinsky/gen-ai/assets/695947/9c862c6c-428e-463c-b935-ca749a6a33df)
![llama_edited](https://github.com/alchaplinsky/gen-ai/assets/695947/070d8e6a-07a0-4ed2-826f-8b9aabd183ae)
-
## 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.