A minmal API interface to the OpenAI API.
In your environment, set
OPENAI_API_KEY to the value of your API key. You can get one from here.
In your code
(:require [trivial-warning.core :as ai]))
models; returns a list of available models
completion; takes a prompt and a bunch of optional parameters and returns the completion
chat; takes a list of messages and a bunch of optional parameters and returns a chat response
moderation; takes a string or list of strings and optionally a model and returns a moderation assessment based on OpenAI TOS
transcription; takes an audio filename and a bunch of optional parameters and returns the transcribed text
translation; takes an audio filename and a bunch of optional paraeters and returns the translated text
image; takes a prompt and returns an image matching it
image-edit; takes an image filename and a prompt and edits the image in some way (also, include a mask if you don't want to just get a completely different image)
image-variations; takes an image and returns variations on it
image-url->file; takes a url and a pathnamae. Downloads the image at the given URL to the given local path.
Copyright © 2023 email@example.com
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License, v. 2.0 are satisfied: GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or (at your
option) any later version, with the GNU Classpath Exception which is available