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 generation, 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 generation,
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
raw docstring

audio-speachclj

(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)
```
sourceraw 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.

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

completioncljdeprecated

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

editcljdeprecated

(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-tunecljdeprecated

(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!cljdeprecated

(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!cljdeprecated

(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!cljdeprecated

(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-eventscljdeprecated

(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-tunescljdeprecated

(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

fine-tuning-jobclj

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

fine-tuning-job-cancel!clj

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

fine-tuning-job-create!clj

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

fine-tuning-job-eventsclj

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

fine-tuning-jobsclj

(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)
```
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

model-delete!clj

(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)
```
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