awesome_chatgpt_actors 0.1.1 → 0.1.2

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: 32fe37cedd30787d20eaf95c4851cc99c4ec4102fae81f88743a071021e88479
4
- data.tar.gz: f003f44265f1ead45eb6ea6141a00ba1e8c198015f5403c2e5abb7686d4c4ebb
3
+ metadata.gz: fa3b750ff0ed54b5b0fc6285e035b2102151e5fefe5ced9fba4e79d618b7670f
4
+ data.tar.gz: 4bf6b83919c681119a2d3bea8a93d6ae890d7ab2c3b51906259cb1f39703d1d5
5
5
  SHA512:
6
- metadata.gz: ed506787224dab1fea674f0007caa582fd00a79e5d1d4bb2d2615397265f6b9f04e7c3871fd88d6920014517bd09c6abf90e553b16dce833d89bb6bf422b0ffd
7
- data.tar.gz: 3aefa40ed4abcf6f55cedc02b7963bee4de5477779e5235eafa96fa536e9cadd0e176114f00e5f3b01ba0049630c616f93f8b9d258d374653c47bb5a16fb124b
6
+ metadata.gz: 8a16d8f04ef470fb087c392a434b2c51ba38efbd83f77115ed5adaa913bff138e7dc06f3bad8b439a1110899c82bb0e06359631240e1fd5dbb49220e816fdb3b
7
+ data.tar.gz: 628c814c692e08169fd7ac9ebf8fa0b2aa2b8740efd1b7f1ba2a55ef788555219b5b9f1dc1344befb33b7d65e2a2edac524768aa30ecc3dd4ade94ac312d837d
data/Gemfile CHANGED
@@ -12,7 +12,7 @@ gem "rubocop", "~> 1.21"
12
12
 
13
13
  gem "csv"
14
14
 
15
- gem "openai"
15
+ gem "ruby-openai"
16
16
 
17
17
  gem "rails", require: false
18
18
 
data/Gemfile.lock CHANGED
@@ -84,6 +84,9 @@ GEM
84
84
  erubi (1.12.0)
85
85
  globalid (1.1.0)
86
86
  activesupport (>= 5.0)
87
+ httparty (0.21.0)
88
+ mini_mime (>= 1.0.0)
89
+ multi_xml (>= 0.5.2)
87
90
  i18n (1.12.0)
88
91
  concurrent-ruby (~> 1.0)
89
92
  json (2.6.3)
@@ -99,6 +102,7 @@ GEM
99
102
  method_source (1.0.0)
100
103
  mini_mime (1.1.2)
101
104
  minitest (5.16.3)
105
+ multi_xml (0.6.0)
102
106
  net-imap (0.3.4)
103
107
  date
104
108
  net-protocol
@@ -174,6 +178,8 @@ GEM
174
178
  unicode-display_width (>= 2.4.0, < 3.0)
175
179
  rubocop-ast (1.28.0)
176
180
  parser (>= 3.2.1.0)
181
+ ruby-openai (3.7.0)
182
+ httparty (>= 0.18.1)
177
183
  ruby-progressbar (1.13.0)
178
184
  simplecov (0.22.0)
179
185
  docile (~> 1.1)
@@ -197,11 +203,11 @@ PLATFORMS
197
203
  DEPENDENCIES
198
204
  awesome_chatgpt_actors!
199
205
  csv
200
- openai
201
206
  rails
202
207
  rake (~> 13.0)
203
208
  rspec (~> 3.0)
204
209
  rubocop (~> 1.21)
210
+ ruby-openai
205
211
  simplecov
206
212
 
207
213
  BUNDLED WITH
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # AwesomeChatgptActors
1
+ # Awesome Chatgpt Actors
2
2
 
3
- This gem is a collection of actors made for use the [AwesomeChatgptPrompts](https://github.com/f/awesome-chatgpt-prompts) in ruby.
3
+ This gem is a collection of actors made for use the [Awesome Chatgpt Prompts](https://github.com/f/awesome-chatgpt-prompts) in ruby.
4
4
  So for prompts information, please refer to that repository.
5
5
 
6
6
  ## Installation
@@ -38,7 +38,7 @@ actor = AwesomeChatgptActors::Actor.new
38
38
 
39
39
  # Initialize a new actor with options
40
40
  actor = AwesomeChatgptActors::Actor.new(
41
- actor: 'Linux Terminal', # The type of actor to use, check the list in https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv
41
+ prompt_type: 'Linux Terminal', # The type of actor to use, check the list in https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv
42
42
  language: 'en', # The language of the prompt, if other language is specified, it will requirean openai api key to perform the translation
43
43
  )
44
44
 
@@ -48,18 +48,13 @@ actor = AwesomeChatgptActors::Actor.new(
48
48
  openai_api_key: 'Your OpenAI API Key' # it can be nil if you provide it as an environment variable OPENAI_API_KEY
49
49
  )
50
50
 
51
- # Initialize a new actor with options
52
- actor = AwesomeChatgptActors::Actor.new(
53
- prompt: 'I want you to act as a virtual assistant. I will give you tasks and you will reply with the results of the tasks. I want you to only reply with the results of the tasks, and nothing else. Do not write explanations. My first task is ""I want you to write a short story about a cat"""'
54
- )
55
-
56
51
  # Initialize a random actor
57
52
  actor = AwesomeChatgptActors::Actor.new(
58
53
  random: true
59
54
  )
60
55
 
61
56
  # Change the actor
62
- actor.act_as(actor: 'Virtual Assistant', language: 'ru') # it will return the same actor with the new options, check the list in https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv
57
+ actor.act_as('Virtual Assistant') # it will return the same actor with the new options, check the list in https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv
63
58
 
64
59
  # Add a new actor to csv file
65
60
  AwesomeChatgptActors::CastControl.add_actor(actor: 'Virtual Assistant', prompt: 'I want you to act as a virtual assistant. I will give you tasks and you will reply with the results of the tasks. I want you to only reply with the results of the tasks, and nothing else. Do not write explanations. My first task is ""I want you to write a short story about a cat"""')
@@ -68,7 +63,7 @@ AwesomeChatgptActors::CastControl.add_actor(actor: 'Virtual Assistant', prompt:
68
63
  AwesomeChatgptActors::CastControl.remove_actor(actor: 'Virtual Assistant')
69
64
 
70
65
  # Get a list of all actors
71
- AwesomeChatgptActors::CastoControl.actors
66
+ AwesomeChatgptActors::CastControl.actors
72
67
 
73
68
  # Check if an actor exists
74
69
  AwesomeChatgptActors::CastControl.actor_exists?(actor: 'Virtual Assistant')
@@ -88,6 +83,7 @@ This gem was tested with Rspec. To run the tests, execute:
88
83
 
89
84
  <!-- Coverage: -->
90
85
  <!-- local image path: coverage-image/simplecov-actors.png -->
86
+ [![Coverage Status](https://raw.githubusercontent.com/JesusGautamah/awesome-chatgpt-actors/master/coverage-image/simplecov-actors.png)]( https://raw.githubusercontent.com/JesusGautamah/awesome-chatgpt-actors/master/coverage-image/simplecov-actors.png)
91
87
 
92
88
  ## Contributing
93
89
 
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
 
31
31
  spec.add_dependency "csv"
32
- spec.add_dependency "openai"
32
+ spec.add_dependency "ruby-openai"
33
33
  end
@@ -52,14 +52,16 @@ module AwesomeChatgptActors
52
52
 
53
53
  def translate_prompt(text: nil, language: nil)
54
54
  text = "Translate the following text from English to #{language}: \n\n#{text}\n\n"
55
- client = OpenAI::Client.new(api_key: openai_api_key)
55
+ client = OpenAI::Client.new(access_token: openai_api_key)
56
56
  response = client.completions(
57
- engine: "text-davinci-003", prompt: text,
58
- temperature: 0.1, max_tokens: 200,
59
- top_p: 1, frequency_penalty: 0,
60
- presence_penalty: 0, stop: ["\n\n"]
57
+ parameters: {
58
+ model: "text-davinci-003", prompt: text,
59
+ temperature: 0.1, max_tokens: 200,
60
+ top_p: 1, frequency_penalty: 0,
61
+ presence_penalty: 0, stop: ["\n\n"]
62
+ }
61
63
  )
62
- response.choices.first.text
64
+ response["choices"].first["text"]
63
65
  end
64
66
  end
65
67
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AwesomeChatgptActors
4
- VERSION = "0.1.1"
5
- end
4
+ VERSION = "0.1.2"
5
+ end
@@ -3,10 +3,12 @@
3
3
  namespace :chatgpt_actors do
4
4
  desc "Copy $GEM/prompts-data/awesome-chatgpt-prompts.csv to ./prompts-data/awesome-chatgpt-prompts.csv"
5
5
  task :install do
6
- path = Gem::Specification.find_by_name("awesome_chatgpt_actors") # rubocop:disable Style/StringConcatenation
6
+ path = Gem::Specification.find_by_name("awesome_chatgpt_actors")
7
7
  .gem_dir + "/prompts-data/awesome-chatgpt-prompts.csv"
8
8
  raise "File not found: #{path}" unless File.exist?(path)
9
- raise "File already exists: prompts-data/awesome-chatgpt-prompts.csv" if File.exist?("prompts-data/awesome-chatgpt-prompts.csv")
9
+ if File.exist?("prompts-data/awesome-chatgpt-prompts.csv")
10
+ raise "File already exists: prompts-data/awesome-chatgpt-prompts.csv"
11
+ end
10
12
 
11
13
  FileUtils.mkdir_p("prompts-data") unless Dir.exist?("prompts-data")
12
14
  FileUtils.cp(path, "prompts-data/awesome-chatgpt-prompts.csv")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_chatgpt_actors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - JesusGautamah
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-11 00:00:00.000000000 Z
11
+ date: 2023-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: csv
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: openai
28
+ name: ruby-openai
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.4.10
91
+ rubygems_version: 3.2.32
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: This gem is the implementation of Awesome Chatgpt Prompts with improvements