This namespace 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.
Refer to the function specs and the official OpenAI documentation for details about the parameters required for these functions.
This namespace 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. Refer to the function specs and the official OpenAI documentation for details about the parameters required for these functions.
(audio-transcription params config)
Transcribes audio based on the given parameters.
Example: (openai/audio-transcription {:model "whisper-1" :file (io/file "audio.m4a")} config)
Transcribes audio based on the given parameters. Example: (openai/audio-transcription {:model "whisper-1" :file (io/file "audio.m4a")} config)
(audio-translation params config)
Translates audio based on the given parameters.
Example: (openai/audio-translation {:model "whisper-1" :file (io/file "audio.m4a")} config)
Translates audio based on the given parameters. Example: (openai/audio-translation {:model "whisper-1" :file (io/file "audio.m4a")} config)
(chat params config)
Generates a chat completion based on the given parameters.
Example: (openai/chat {:model "gpt-3.5-turbo" :messages [{:role "user" :content "hello"}]} config)
Generates a chat completion based on the given parameters. Example: (openai/chat {:model "gpt-3.5-turbo" :messages [{:role "user" :content "hello"}]} config)
(completion params config)
Generates a completion based on the given parameters.
Example: (openai/completion {:model "ada" :prompt "hello"} config)
Generates a completion based on the given parameters. Example: (openai/completion {:model "ada" :prompt "hello"} config)
(config & {:as params})
Creates a config map for accessing the API.
The parameters are a map with the following keys: :api-key (required), :base-url and :org-id.
An :http-opts entry is also accepted as a map with the following keys: :connection-timeout and :socket-timeout (both in msec).
Example: (openai/config :api-key api-key)
Creates a config map for accessing the API. The parameters are a map with the following keys: :api-key (required), :base-url and :org-id. An :http-opts entry is also accepted as a map with the following keys: :connection-timeout and :socket-timeout (both in msec). Example: (openai/config :api-key api-key)
(edit params config)
Generates an edit based on the given parameters.
Example: (openai/edit {:model "code-davinci-edit-001" :instruction "fix" :input "println hello"} config)
Generates an edit based on the given parameters. Example: (openai/edit {:model "code-davinci-edit-001" :instruction "fix" :input "println hello"} config)
(embedding params config)
Generates an embedding based on the given parameters.
Example: (openai/embedding {:model "text-embedding-ada-002" :input "hello"} config)
Generates an embedding based on the given parameters. Example: (openai/embedding {:model "text-embedding-ada-002" :input "hello"} config)
(file id config)
Retrieves the details of a specific file by its id.
Example: (openai/file "file-id" config)
Retrieves the details of a specific file by its id. Example: (openai/file "file-id" config)
(file-content id config)
Retrieves the content of a specific file by its id.
Example: (openai/file-content "file-id" config)
Retrieves the content of a specific file by its id. Example: (openai/file-content "file-id" config)
(file-delete! id config)
Deletes a specific file by its id.
Example: (openai/file-delete! "file-id" config)
Deletes a specific file by its id. Example: (openai/file-delete! "file-id" config)
(file-upload! params config)
Uploads a file with the provided parameters.
Example: (openai/file-upload! {:file (io/file "file.txt") :purpose "fine-tune"} config)
Uploads a file with the provided parameters. Example: (openai/file-upload! {:file (io/file "file.txt") :purpose "fine-tune"} config)
(files config)
Retrieves the list of files associated with the provided config.
Example: (openai/files config)
Retrieves the list of files associated with the provided config. Example: (openai/files config)
(fine-tune id config)
Retrieves the details of a specific fine-tune by its id.
Example: (openai/fine-tune "ft-id" config)
Retrieves the details of a specific fine-tune by its id. Example: (openai/fine-tune "ft-id" config)
(fine-tune-cancel! id config)
Cancels a specific fine-tune by its id.
Example: (openai/fine-tune-cancel! "ft-id" config)
Cancels a specific fine-tune by its id. Example: (openai/fine-tune-cancel! "ft-id" config)
(fine-tune-create! params config)
Creates a new fine-tune with the provided parameters.
Example: (openai/fine-tune-create! {:training-file "file-id" :model "ada"} config)
Creates a new fine-tune with the provided parameters. Example: (openai/fine-tune-create! {:training-file "file-id" :model "ada"} config)
(fine-tune-delete! model-id config)
Deletes a specific fine-tuned model by its id.
Example: (openai/fine-tune-delete! "model-id" config)
Deletes a specific fine-tuned model by its id. Example: (openai/fine-tune-delete! "model-id" config)
(fine-tune-events id config)
Retrieves the list of events for a specific fine-tune by its id.
Example: (openai/fine-tune-events "ft-id" config)
Retrieves the list of events for a specific fine-tune by its id. Example: (openai/fine-tune-events "ft-id" config)
(fine-tunes config)
Retrieves the list of fine-tunes associated with the provided config.
Example: (openai/fine-tunes config)
Retrieves the list of fine-tunes associated with the provided config. Example: (openai/fine-tunes config)
(image-edit params config)
Edits an image based on the given parameters.
Example: (openai/image-edit {:image (io/file "wall.png") :prompt "add brick"} config)
Edits an image based on the given parameters. Example: (openai/image-edit {:image (io/file "wall.png") :prompt "add brick"} config)
(image-generation params config)
Generates an image based on the given parameters.
Example: (openai/image-generation {:prompt "wall"} config)
Generates an image based on the given parameters. Example: (openai/image-generation {:prompt "wall"} config)
(image-variation params config)
Generates image variations based on the given parameters.
Example: (openai/image-variation {:image (io/file "image.png")} config)
Generates image variations based on the given parameters. Example: (openai/image-variation {:image (io/file "image.png")} config)
(model id config)
Retrieves the details of a specific model by its id.
Example: (openai/model "gpt-3.5-turbo" config)
Retrieves the details of a specific model by its id. Example: (openai/model "gpt-3.5-turbo" config)
(models config)
Retrieves the list of available models.
Example: (openai/models config)
Retrieves the list of available models. Example: (openai/models config)
(moderation params config)
Performs content moderation with the provided parameters.
Example: (openai/moderation {:input "some text"} config)
Performs content moderation with the provided parameters. Example: (openai/moderation {:input "some text"} config)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close