pato-gpt 0.1.5 → 0.1.6

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: d0af4e029b168ba4e6646694855b86a2fb570179d35f5dc78a88f723ee8a5c18
4
- data.tar.gz: 2ac8961194ff2382fb7252d13b1c2e42be182f00b92f67c95ffef26b9c61d33d
3
+ metadata.gz: eb24277d2c643912b0d0c37ccf9c17bcff08306660d5acec00e6fd048493690a
4
+ data.tar.gz: 18805500fb7ca6037aeb687182119a2314fb29e866541100648640464ffb8d1b
5
5
  SHA512:
6
- metadata.gz: dd38b195117931267b9596fa4979158989640b269282f25e97ebc1aa47f813934e592c107c4225e8c03713bde0c1dcdb50d1ff67ee7c74180e9730e4856c6afe
7
- data.tar.gz: ffe9eda3bcece1e921c1af07c6d6d1236a24e3bbb263ce4af2b0eed9d8a98a4dadb3006463b1b74c4876680e73257a9df8212f2d0b8e924b4f6738b4ed6cc7ee
6
+ metadata.gz: d60d96792ce3d1db305039691d606bef2057a98693c0a89be3fdc964c429ac61b62cbbc4bd53984ce1bf5443340a3fc85b9e6d6eede2faeb9fc1e70a66012da5
7
+ data.tar.gz: 490fe62068575d0e01ac2b487de7f36ab795e5d564f00a53b39e6a7ac8543e0fbd89aef18c6a713e84c6507b14c7a9f34d262922b312c2e6661f64fab1004070
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at andrewaguiar6@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in pato-gpt.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pato-gpt (0.1.0)
5
+ pastel (~> 0.8)
6
+ tty-markdown (~> 0.7)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ kramdown (2.4.0)
12
+ rexml
13
+ pastel (0.8.0)
14
+ tty-color (~> 0.5)
15
+ rexml (3.2.5)
16
+ rouge (4.1.0)
17
+ strings (0.2.1)
18
+ strings-ansi (~> 0.2)
19
+ unicode-display_width (>= 1.5, < 3.0)
20
+ unicode_utils (~> 1.4)
21
+ strings-ansi (0.2.0)
22
+ tty-color (0.6.0)
23
+ tty-markdown (0.7.2)
24
+ kramdown (>= 1.16.2, < 3.0)
25
+ pastel (~> 0.8)
26
+ rouge (>= 3.14, < 5.0)
27
+ strings (~> 0.2.0)
28
+ tty-color (~> 0.5)
29
+ tty-screen (~> 0.8)
30
+ tty-screen (0.8.1)
31
+ unicode-display_width (2.4.2)
32
+ unicode_utils (1.4.0)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ pato-gpt!
39
+
40
+ BUNDLED WITH
41
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Andrew S Aguiar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # PatoGpt
2
+
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ $ bundle install
9
+
10
+
11
+ ## Usage
12
+
13
+ $ ./pato-gpt
14
+
15
+ ## Development
16
+
17
+ 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.
18
+
19
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
20
+
21
+ ## Contributing
22
+
23
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pato-gpt. 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]/pato-gpt/blob/master/CODE_OF_CONDUCT.md).
24
+
25
+ ## License
26
+
27
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
28
+
29
+ ## Code of Conduct
30
+
31
+ Everyone interacting in the Pato::Gpt project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/pato-gpt/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/patogpt ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "patogpt"
5
+
6
+ Patogpt.start(ARGV)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/generate-gem ADDED
@@ -0,0 +1,3 @@
1
+ rm *.gem
2
+ gem build pato-gpt.gemspec
3
+ gem push *.gem
data/lib/patogpt.rb ADDED
@@ -0,0 +1,53 @@
1
+ require 'net/http'
2
+ require 'json'
3
+ require 'tty-markdown'
4
+ require 'pastel'
5
+
6
+ class Patogpt
7
+ def self.ask(q)
8
+ payload = {
9
+ model: 'gpt-3.5-turbo',
10
+ messages: [{ role: 'user', content: q }]
11
+ }
12
+
13
+ uri = URI("https://api.openai.com/v1/chat/completions")
14
+
15
+ https = Net::HTTP.new(uri.host, uri.port)
16
+ https.use_ssl = true
17
+
18
+ request = Net::HTTP::Post.new(uri)
19
+ request["Content-Type"] = "application/json"
20
+ request["Authorization"] = "Bearer #{ENV['OPENAI_API_KEY']}"
21
+ request.body = JSON.generate(payload)
22
+
23
+ response = https.request(request)
24
+
25
+ resp_json = JSON.parse(response.read_body)
26
+
27
+ resp_json['choices'][0].dig('message', 'content')
28
+ end
29
+
30
+ def self.start(_args)
31
+ q = ''
32
+
33
+ pastel = Pastel.new
34
+
35
+ while true
36
+ puts '..........................................................................................'
37
+ puts ''
38
+ print "@You: "
39
+
40
+ q = gets.chomp
41
+
42
+ break if q == "exit"
43
+
44
+ if q.strip.length > 0
45
+ a = ask(q)
46
+
47
+ puts ''
48
+ print '@PatoGtp: '
49
+ puts TTY::Markdown.parse(a)
50
+ end
51
+ end
52
+ end
53
+ end
data/pato-gpt.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pato-gpt"
8
+ spec.version = "0.1.6"
9
+ spec.authors = ["Andrew S Aguiar"]
10
+ spec.email = ["andrewaguiar6@gmail.com"]
11
+ spec.summary = 'Pato assistente'
12
+ spec.description = 'Pato assistente que usa ChatGpt'
13
+ spec.homepage = 'https://github.com/andrewaguiar/patogpt'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|gem)/}) }
21
+ end
22
+
23
+ spec.bindir = 'bin'
24
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
25
+ spec.require_paths = ['lib']
26
+
27
+ spec.add_dependency 'pastel', '~> 0.8'
28
+ spec.add_dependency 'tty-markdown', '~> 0.7'
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pato-gpt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew S Aguiar
@@ -41,15 +41,29 @@ dependencies:
41
41
  description: Pato assistente que usa ChatGpt
42
42
  email:
43
43
  - andrewaguiar6@gmail.com
44
- executables: []
44
+ executables:
45
+ - patogpt
46
+ - setup
45
47
  extensions: []
46
48
  extra_rdoc_files: []
47
- files: []
49
+ files:
50
+ - ".gitignore"
51
+ - ".rspec"
52
+ - CODE_OF_CONDUCT.md
53
+ - Gemfile
54
+ - Gemfile.lock
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - bin/patogpt
59
+ - bin/setup
60
+ - generate-gem
61
+ - lib/patogpt.rb
62
+ - pato-gpt.gemspec
48
63
  homepage: https://github.com/andrewaguiar/patogpt
49
64
  licenses:
50
65
  - MIT
51
- metadata:
52
- homepage_uri: https://github.com/andrewaguiar/patogpt
66
+ metadata: {}
53
67
  post_install_message:
54
68
  rdoc_options: []
55
69
  require_paths: