openai-python
openai-python copied to clipboard
Support `openai api --json completions.create ...`
Describe the feature or improvement you're requesting
I have this tool I made which I'm using day to day now: https://github.com/backus/ai.sh
It is super useful and I actually like that it is written in pure bash because it is very portable and it is also a testament to just how easy it is to add some AI magic to your application. That said, one thing I'd like to add to the tool is the ability to see why the completion finished generating (did it hit a stop token or did it hit the token limit?).
I could do this to switching to a pure cURL, but I'd love if I could just tell the client to give me JSON instead of just the .choices[0].text
. Would be really easy then to use jq
to manipulate the response inside of scripts.
Additional context
No response
The whole JSON can be accessed through completion
variable
@Arthavruksha I'm talking about the CLI. For example:
$ openai api completions.create -p 'Say hello' -m 'text-ada-001'
Say hello
Hello!%
On it!
@backus does this PR do what you were hoping for? https://github.com/openai/openai-python/pull/1068