This library provides a wrapper around the OpenAI API, offering various functions for interacting with the API's capabilities. These include text generation, image generation and editing, embeddings, audio transcription and translation, file management, fine-tuning, and content moderation.
Notice: This is not an official OpenAI project nor is it affiliated with OpenAI in any way.
The functions for interacting with the OpenAI API are located in the
pmatiello.openai-api.api
namespace. An API key is required for usage.
(require '[me.pmatiello.openai-api.api :as openai])
(def credentials
(openai/credentials api-key))
(openai/chat {:model "gpt-3.5-turbo"
:messages [{:role "user"
:content "Fix: (println \"hello"}]}
credentials)
Refer to the function specs and the official OpenAI API reference for details about the parameters required for these functions.
Information for developing this library.
The following command will execute the unit tests:
% clj -X:test
The following command will build a jar file:
% clj -T:build jar
To clean a previous build, run:
% clj -T:build clean
Before releasing, update the library version in the build.clj file.
Make a commit and generate a new tag:
% git commit -a -m "Release: ${VERSION}"
% git tag -a "v${VERSION}" -m "Release: ${VERSION}"
% git push
% git push origin "v${VERSION}"
To release to clojars, run:
% mvn deploy:deploy-file \
-Dfile=target/openai-api-${VERSION}.jar \
-DrepositoryId=clojars \
-Durl=https://clojars.org/repo \
-DpomFile=target/classes/META-INF/maven/me.pmatiello/openai-api/pom.xml
Notice that this step requires clojars to be configured as a server in the local
~/.m2/settings.xml
file.
This software is open-source, but closed to contributions.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close