Liking cljdoc? Tell your friends :D

me.pmatiello.openai-api.api

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.
raw docstring

audio-transcriptionclj

(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)
sourceraw docstring

audio-translationclj

(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)
sourceraw docstring

chatclj

(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)
sourceraw docstring

completionclj

(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)
sourceraw docstring

configclj

(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)
sourceraw docstring

editclj

(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)
sourceraw docstring

embeddingclj

(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)
sourceraw docstring

fileclj

(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)
sourceraw docstring

file-contentclj

(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)
sourceraw docstring

file-delete!clj

(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)
sourceraw docstring

file-upload!clj

(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)
sourceraw docstring

filesclj

(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)
sourceraw docstring

fine-tuneclj

(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)
sourceraw docstring

fine-tune-cancel!clj

(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)
sourceraw docstring

fine-tune-create!clj

(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)
sourceraw docstring

fine-tune-delete!clj

(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)
sourceraw docstring

fine-tune-eventsclj

(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)
sourceraw docstring

fine-tunesclj

(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)
sourceraw docstring

image-editclj

(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)
sourceraw docstring

image-generationclj

(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)
sourceraw docstring

image-variationclj

(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)
sourceraw docstring

modelclj

(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)
sourceraw docstring

modelsclj

(models config)

Retrieves the list of available models.

Example: (openai/models config)

Retrieves the list of available models.

Example:
(openai/models config)
sourceraw docstring

moderationclj

(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)
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close