aesthetikx / openai_pipe Goto Github PK
View Code? Open in Web Editor NEWA UNIX-ey interface to OpenAI
License: MIT License
A UNIX-ey interface to OpenAI
License: MIT License
It would be nice to be able to specify GPT4 for the model
This is probably a terminal issue and not something related to openai_pipe, but I figured I would open an issue anyways. It's annoying to remember to use quotes or escape special characters.
➜ ~ ai what is the command to search for a file on linux?
zsh: no matches found: linux?
➜ ~ ai "what is the command to search for a file on linux?"
The command to search for a file on Linux is "find".
➜ ~ ai what is the command to search for a file on linux\?
The command to search for a file on Linux is:
find / -name <filename>
Sorry for a noobie question, this is the very first contact with ruby for me.
I have successfuly installed both ruby
and openai_pipe
gem and setup token variable (returns value just fine), however when I run it any command, bash cannot find the command.
[sebastian@nuvo ~]$ openai_pipe what is two plus two
bash: openai_pipe: command not found
Did I install everything needed? Running gem update
didn't help.
[sebastian@nuvo ~]$ gem list
*** LOCAL GEMS ***
abbrev (default: 0.1.0)
addressable (2.8.1)
base64 (default: 0.1.1)
benchmark (default: 0.2.0)
bigdecimal (default: 3.1.2)
bundler (default: 2.4.1)
cgi (default: 0.3.6)
csv (default: 3.2.5)
date (default: 3.2.2)
dbm (default: 1.1.0)
debug (default: 0.2.1)
delegate (default: 0.2.0)
did_you_mean (default: 1.6.1)
digest (default: 3.1.1)
down (5.4.0)
drb (default: 2.1.0)
english (default: 0.7.1)
erb (default: 4.0.2)
etc (default: 1.3.0)
fcntl (default: 1.0.1)
fiddle (default: 1.1.0)
fileutils (default: 1.6.0)
find (default: 0.1.1)
forwardable (default: 1.3.2)
gdbm (default: 2.1.0)
getoptlong (default: 0.1.1)
httparty (0.21.0)
io-console (default: 0.5.11)
io-nonblock (default: 0.1.0)
io-wait (default: 0.2.3)
ipaddr (default: 1.2.4)
irb (default: 1.4.2)
json (default: 2.6.3)
logger (default: 1.5.1)
matrix (default: 0.3.1)
mini_mime (1.1.2)
minitest (5.16.3)
multi_xml (0.6.0)
mutex_m (default: 0.1.1)
net-ftp (default: 0.1.2)
net-http (default: 0.2.2)
net-imap (default: 0.1.1)
net-pop (default: 0.1.1)
net-protocol (default: 0.1.1)
net-smtp (default: 0.2.1)
nkf (default: 0.1.0)
observer (default: 0.1.1)
open-uri (default: 0.2.0)
open3 (default: 0.1.1)
openai_pipe (0.1.2)
openssl (default: 3.0.0)
optparse (default: 0.1.1)
ostruct (default: 0.3.1)
pathname (default: 0.1.0)
power_assert (2.0.2)
pp (default: 0.2.1)
prettyprint (default: 0.1.1)
prime (default: 0.1.2)
pstore (default: 0.1.1)
psych (default: 4.0.6)
public_suffix (5.0.1)
quick_openai (0.1.2)
racc (default: 1.6.0)
rake (13.0.6)
rdoc (default: 6.4.0)
readline (default: 0.0.2)
readline-ext (default: 0.1.1)
reline (default: 0.3.1)
resolv (default: 0.2.1)
resolv-replace (default: 0.1.0)
rexml (3.2.5)
rinda (default: 0.1.1)
ruby-openai (3.5.0)
ruby2_keywords (0.0.5)
securerandom (default: 0.1.0)
set (default: 1.0.1)
shellwords (default: 0.1.0)
singleton (default: 0.1.1)
stringio (default: 3.0.2)
strscan (default: 3.0.1)
syslog (default: 0.1.0)
tempfile (default: 0.1.1)
test-unit (3.5.7)
time (default: 0.2.0)
timeout (default: 0.1.1)
tmpdir (default: 0.1.2)
tracer (default: 0.1.1)
tsort (default: 0.1.0)
un (default: 0.1.0)
uri (default: 0.11.0)
weakref (default: 0.1.1)
yaml (default: 0.1.1)
zlib (default: 2.0.0)
After install openai_pipe (gem install openai_pipe) and providing the token
❯ gem install openai_pipe
❯ ruby -v
ruby 3.3.1 (2024-04-23 revision c56cd86388) [arm64-darwin23]
I get this error Unable to fetch response: undefined method
to_json' for an instance of Hash`
❯ openai_pipe hi
Unable to fetch response: undefined method `to_json' for an instance of Hash. /opt/homebrew/lib/ruby
/gems/3.3.0/gems/ruby-openai-3.7.0/lib/openai/client.rb:66:in `json_post'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/ruby-openai-3.7.0/lib/openai/client.rb:15:in `completions'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/quick_openai-0.1.3/lib/quick_openai/gpt3.rb:14:in `block in g
pt3'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/quick_openai-0.1.3/lib/quick_openai.rb:20:in `fetch_response_
from_client'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/quick_openai-0.1.3/lib/quick_openai/gpt3.rb:13:in `gpt3'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/quick_openai-0.1.3/lib/quick_openai/extensions/string.rb:7:in
`gpt3'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/openai_pipe-0.1.3/lib/openai_pipe.rb:17:in `exe'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/openai_pipe-0.1.3/exe/openai_pipe:5:in `<top (required)>'
/opt/homebrew/lib/ruby/gems/3.3.0/bin/openai_pipe:25:in `load'
/opt/homebrew/lib/ruby/gems/3.3.0/bin/openai_pipe:25:in `<main>'
when i try to check the application from CLI using Linux,
ai what is two plus two?
i get this:
Unable to fetch response: You exceeded your current quota, please check your plan and billing details.
I'm trying to pipe git diff output into a longer prompt, and get the error "Unable to fetch response." I would like to figure out what's causing the error, but I also wanted to suggest that more detailed errors be displayed when a problem is run into.
Here is the full command (I'm also open to suggestions on the prompt, although it seems to work well with some diffs)
git diff --cached | openai_pipe write a detailed commit message for this diff. Include a title summarizing with no more than 50 characters, and name each changed file with a list of changes of that file below with brief bullet points, preceded by a hyphen and a space
Hi there!
First over let me just say that I love this project
Just wanted to ask if you could maybe find a way to get the recent terminal output like all stdout that is currently present in the terminal + command history, and feed it as a preprompt primer.
For example of you ran some command and got your output Infront if you, and don't want to rerun and pipe, you could just say
$ ai save this text to file
It should get the filename and path and text from context - from the last few outputs. 🔥
maybe configure to preload N calls back (cmds+outputs) and or by setting token window
Let me know if you like it 🙏
Thanks and have a good one!
All the best
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.