ai-engine 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 243780cd32368a63bf16fef0f89a122c2877d338fa196c885925aee25161e060
4
- data.tar.gz: a41343a78d3bfe8098c4fa8b169dbc85c789351ba710f16da927ca7b609b654b
3
+ metadata.gz: 02cef4cd33bb5b92f49695151fa4aa9e4004c9b5383745a977f3a9dfe0e46838
4
+ data.tar.gz: 8f01799a009e77481da633e93c9e2a6a73101ca0c2c98004a34bdb6ecc42152b
5
5
  SHA512:
6
- metadata.gz: ab48e0f806a2b4171e16b567c819c6d759cd453b525bc9d4152b689ab195922fc7eafc691e222cad13f05682226a5e8a9e836c11da610062378cf24478116acf
7
- data.tar.gz: 25826ebd894a27f9b0599e2fde6586acc76bc496de3ec9a98d0f1a3178fac780ac11358dbe9735dcd0e9d892aa27bc22199eaed3713c744a1fae7f693f5619b6
6
+ metadata.gz: a4e1801c40ba227499902b2475cd5ff06097c3d51eb3d26f417bb62e1ca17da7786934815fa251298bd62b8d066a44a574aee9073f213d2b53e4d18423edc1eb
7
+ data.tar.gz: 1b9960397d6bf0f234272aa21dc3780740f33de76dc39ce030d737a9cf45ec538c559d5401d362db5daafad528898a18fac86e7532a8f04f00471455c1750eb1
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # AI::Engine
2
2
 
3
- An experimental, easy-ish way to add AI assistants to your Rails app!
3
+ AI::Engine is the fastest way to get AI Assistants into your Rails app! It's a Rails Engine which sets up everything you need to start streaming from OpenAI Assistants in your Rails app.
4
+
5
+ Full docs can be found at [RailsAI.com](https://railsai.com/docs/installation).
6
+
7
+ A demo app can be found [here](https://github.com/alexrudall/ai-engine-starter-kit/).
4
8
 
5
9
  ## Usage
6
10
 
@@ -22,7 +26,7 @@ And run them:
22
26
  bundle exec rails db:migrate
23
27
  ```
24
28
 
25
- Full usage documentation can be found at [RailsAI.com](https://railsai.com/docs/installation).
29
+ Full docs can be found at [RailsAI.com](https://railsai.com/docs/installation).
26
30
 
27
31
  ## Engine Development
28
32
 
@@ -29,7 +29,7 @@ module AI
29
29
  def create_openai_assistant
30
30
  build_assistant
31
31
  begin
32
- assistant.remote_id = AI::Engine::OpenAI::Assistants::Create.call(**ai_engine_assistant)
32
+ assistant.remote_id = AI::Engine::OpenAI::Assistants::Create.call(ai_engine_assistant)
33
33
  rescue Faraday::Error => e
34
34
  errors.add(:base, e.message)
35
35
  throw(:abort)
@@ -37,7 +37,7 @@ module AI
37
37
  end
38
38
 
39
39
  def update_openai_assistant
40
- AI::Engine::OpenAI::Assistants::Update.call(remote_id: assistant&.remote_id, **ai_engine_assistant)
40
+ AI::Engine::OpenAI::Assistants::Update.call(remote_id: assistant&.remote_id, parameters: ai_engine_assistant)
41
41
  rescue Faraday::Error => e
42
42
  errors.add(:base, e.message)
43
43
  throw(:abort)
@@ -1,14 +1,9 @@
1
1
  class AI::Engine::OpenAI::Assistants::Create
2
2
  # Creates a new Assistant on the OpenAI API.
3
3
  # Returns the OpenAI ID of the new Assistant.
4
- def self.call(name:, model:, description:, instructions:)
4
+ def self.call(parameters)
5
5
  response = client.assistants.create(
6
- parameters: {
7
- name: name,
8
- model: model,
9
- description: description,
10
- instructions: instructions
11
- }
6
+ parameters: parameters
12
7
  )
13
8
 
14
9
  response["id"]
@@ -1,12 +1,7 @@
1
1
  class AI::Engine::OpenAI::Assistants::Update
2
2
  # Updates an OpenAI Assistant with the given parameters.
3
- def self.call(remote_id:, name: nil, model: nil, description: nil, instructions: nil)
4
- parameters = {
5
- name: name,
6
- model: model,
7
- description: description,
8
- instructions: instructions
9
- }.compact
3
+ def self.call(remote_id:, parameters:)
4
+ parameters = parameters.compact
10
5
 
11
6
  client.assistants.modify(
12
7
  id: remote_id,
@@ -7,6 +7,6 @@ class CreateAIEngineAssistants < ActiveRecord::Migration[7.1]
7
7
  t.timestamps
8
8
  end
9
9
 
10
- add_index :ai_engine_assistants, %i[assistable_type assistable_id remote_id], unique: true
10
+ add_index :ai_engine_assistants, %i[assistable_type assistable_id remote_id], unique: true, name: "ai_engine_assistants_unique_index"
11
11
  end
12
12
  end
@@ -1,5 +1,5 @@
1
1
  module AI
2
2
  module Engine
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ai-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rudall
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 7.1.0
27
- description: A Rails Engine from the creator of ruby-openai.
27
+ description: The fastest way to get AI Assistants into your Rails app!
28
28
  email:
29
29
  - hello@alexrudall.com
30
30
  executables: []
@@ -86,5 +86,5 @@ requirements: []
86
86
  rubygems_version: 3.5.11
87
87
  signing_key:
88
88
  specification_version: 4
89
- summary: The easiest way to get AI into your Rails app.
89
+ summary: The fastest way to get AI Assistants into your Rails app!
90
90
  test_files: []