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 official OpenAI documentation for details about the parameters required for these functions.
OpenAI API Reference: https://platform.openai.com/docs/api-reference
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 official OpenAI documentation for details about the parameters required for these functions. OpenAI API Reference: https://platform.openai.com/docs/api-reference
(audio-speach params config)
Generates speach from input text.
Returns an input stream with the generated audio content.
Example:
(openai/audio-speach
{:model "tts-1"
:input "hello world!"
:voice "nova"}
config)
Generates speach from input text. Returns an input stream with the generated audio content. Example: ``` (openai/audio-speach {:model "tts-1" :input "hello world!" :voice "nova"} config) ```
(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.
Produces a streaming response when :stream true
in present in the params map. In
this case, the output will be a lazy sequence containing the streaming events.
Example:
(openai/chat
{:model "gpt-3.5-turbo"
:messages [{:role "user" :content "hello"}]}
config)
Generates a chat completion based on the given parameters. Produces a streaming response when `:stream true` in present in the params map. In this case, the output will be a lazy sequence containing the streaming events. 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
(optional).
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` (optional). 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) ```
(fine-tuning-job id config)
Retrieves the details of a specific fine-tuning by its id.
Example:
(openai/fine-tuning-job "ft-id" config)
Retrieves the details of a specific fine-tuning by its id. Example: ``` (openai/fine-tuning-job "ft-id" config) ```
(fine-tuning-job-cancel! id config)
Cancels a specific fine-tuning job by its id.
Example:
(openai/fine-tuning-job-cancel! "ft-id" config)
Cancels a specific fine-tuning job by its id. Example: ``` (openai/fine-tuning-job-cancel! "ft-id" config) ```
(fine-tuning-job-create! params config)
Creates a new fine-tuning job with the provided parameters.
Example:
(openai/fine-tuning-job-create!
{:training-file "file-id"
:model "model"}
config)
Creates a new fine-tuning job with the provided parameters. Example: ``` (openai/fine-tuning-job-create! {:training-file "file-id" :model "model"} config) ```
(fine-tuning-job-events id params config)
Retrieves events for a fine-tuning job.
Example:
(fine-tuning-job-events "td-id" nil config)
Retrieves events for a fine-tuning job. Example: ``` (fine-tuning-job-events "td-id" nil config) ```
(fine-tuning-jobs params config)
List fine-tuning jobs.
Example:
(openai/fine-tuning-jobs {} config)
List fine-tuning jobs. Example: ``` (openai/fine-tuning-jobs {} 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) ```
(model-delete! model-id config)
Deletes a specific fine-tuned model by its id.
Example:
(openai/model-delete! "model-id" config)
Deletes a specific fine-tuned model by its id. Example: ``` (openai/model-delete! "model-id" 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