Skip to content

Commit

Permalink
Generator is for Rails apps
Browse files Browse the repository at this point in the history
  • Loading branch information
drnic committed Apr 26, 2024
1 parent 5b1792e commit 4240e1d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ gem install groq
- Place in env var `GROQ_API_KEY`, or explicitly pass into configuration below.
- Use the `Groq::Client` to interact with Groq and your favourite model.

```plain
rails g groq:install
```
to generate inializer file

```ruby
client = Groq::Client.new # uses ENV["GROQ_API_KEY"] and "llama3-8b-8192"
client = Groq::Client.new(api_key: "...", model_id: "llama3-8b-8192")
Expand All @@ -91,6 +86,12 @@ end
client = Groq::Client.new
```

In a Rails application, you can generate a `config/initializer/groq.rb` file with:

```plain
rails g groq:install
```

There is a simple chat function to send messages to a model:

```ruby
Expand All @@ -109,8 +110,10 @@ client.chat([

### Interactive console (IRb)

> bin/console
```plain
bin/console
```

This repository has a `bin/console` script to start an interactive console to play with the Groq API. The `@client` variable is setup using `$GROQ_API_KEY` environment variable; and the `U`, `A`, `T` helpers are already included.

```ruby
Expand Down

0 comments on commit 4240e1d

Please sign in to comment.