Liking cljdoc? Tell your friends :D

oai-clj.models.responses

Mirrors com.openai.models.responses in openai-java

Mirrors com.openai.models.responses in openai-java
raw docstring

->java-jsonclj

(->java-json x)

Recursively turn a Clojure data structure into the Java‑friendly shape that JsonValue.from can digest:

• keyword keys ⇒ strings • keyword values ⇒ strings • Clojure maps ⇒ java.util.HashMap • Clojure vectors / lists / sets ⇒ java.util.ArrayList

Recursively turn a Clojure data structure into the Java‑friendly
shape that JsonValue.from can digest:

• keyword keys ⇒ strings
• keyword values ⇒ strings
• Clojure maps ⇒ java.util.HashMap
• Clojure vectors / lists / sets ⇒ java.util.ArrayList
sourceraw docstring

annotation->mapclj

(annotation->map a)
source

chat-modelclj

(chat-model x)
(chat-model x default)

Supports keywords and Java enums

Supports keywords and Java enums
sourceraw docstring

chat-modelsclj

source

chat-models'clj

source

create-responseclj

(create-response & {:keys [raw?] :or {raw? false} :as m})

Creates a response using the Responses API. All keys map to builder methods in the java sdk. Some extra keys are supported for convenience

Options: :model - (optional) The model to use for responses. Can be a keyword from chat-models or a Java enum from the open ai sdk. Defaults to :gpt-4o :input-of-response - (optional) :input - (optional) :metadata - (optional, map) :max-output-tokens - (optional, int) :format - (optional) - A var pointing to a Malli Schema or a [schema format-name] tuple. Used for structured outputs :easy-input-messages - (optional) A vector of {:role, :content} maps. Will be converted to an ArrayList of EasyInputMessage and passed to .inputOfResponse on the java builder :input-items - (optional) A vector of {:role, :content} maps. Supports more content types than easy-input-messages. :content itself should be a vector of content maps - .ie [{:type :image :detail :auto} {:type :text :text "Describe this image."] :raw? - (optional, boolean) If true, the Java type will be returned instead of a Clojure map. Defaults to false

Creates a response using the Responses API. All keys map to builder methods in the java sdk. Some extra keys are supported
for convenience

Options:
:model - (optional) The model to use for responses. Can be a keyword from chat-models or a Java enum from the open ai sdk. Defaults to :gpt-4o
:input-of-response - (optional)
:input  - (optional)
:metadata - (optional, map)
:max-output-tokens - (optional, int)
:format - (optional) - A var pointing to a Malli Schema or a [schema format-name] tuple. Used for structured outputs
:easy-input-messages - (optional) A vector of {:role, :content} maps. Will be converted to an ArrayList of EasyInputMessage and passed to .inputOfResponse on the java builder
:input-items - (optional) A vector of {:role, :content} maps. Supports more content types than easy-input-messages. :content itself should be a vector of content maps - .ie [{:type :image :detail :auto} {:type :text :text "Describe this image."]
:raw? - (optional, boolean) If true, the Java type will be returned instead of a Clojure map. Defaults to false
sourceraw docstring

create-response-streamclj

(create-response-stream on-event & {:keys [on-complete on-error] :as m})

Nearly identical to create-response except it uses the async client. The first argument is a function that will receive events as they become available. All other options are the same as create-response with the addition of two new options:

Additional options: :on-complete - (optional) - Called when the underlying future completes :on-error - (optional) - Called with any exceptions generated in the underlying future

Nearly identical to create-response except it uses the async client. The first argument
is a function that will receive events as they become available. All other options are the same
as create-response with the addition of two new options:

Additional options:
:on-complete - (optional) - Called when the underlying future completes
:on-error   - (optional)  - Called with any exceptions generated in the underlying future
sourceraw docstring

detailsclj

source

detect-mime-type-urlclj

(detect-mime-type-url url)

Guess the MIME type of the content at url. Tries, in order:

  1. Files.probeContentType (for file:// URLs)
  2. URLConnection/guessContentTypeFromName (by extension)
  3. URLConnection/guessContentTypeFromStream (content‑sniffing).
Guess the MIME type of the content at `url`. Tries, in order:
1. `Files.probeContentType` (for file:// URLs)
2. `URLConnection/guessContentTypeFromName` (by extension)
3. `URLConnection/guessContentTypeFromStream` (content‑sniffing).
sourceraw docstring

easy-input-messageclj

(easy-input-message m__1634__auto__)
source

easy-input-messagesclj

(easy-input-messages entries)

Create a response with easy input - that is entries is expected to be a vector of maps containing :role and :content keys. Supported roles are :user, :assistant, and :system. :content should be anyhing supported by the EasyInputMessage.Builder class

Create a response with easy input - that is entries is expected to be a vector
of maps containing :role and :content keys. Supported roles are :user, :assistant, and :system. :content
should be anyhing supported by the EasyInputMessage.Builder class
sourceraw docstring

easy-input-rolesclj

source

incomplete-details-reasonsclj

source

message-statusclj

source

metadataclj

(metadata m)
source

output->mapclj

(output->map o)
source

response->mapclj

(response->map r)
source

response-create-paramsclj

(response-create-params m__1634__auto__)
source

response-create-params'clj

(response-create-params' m)

Adds some defaults and support for Clojure only keys (like :easy-input-messages or :input-items)

Adds some defaults and support for Clojure only keys (like :easy-input-messages or :input-items)
sourceraw docstring

response-input-fileclj

(response-input-file m__1634__auto__)
source

response-input-imageclj

(response-input-image m__1634__auto__)
source

response-input-itemclj

(response-input-item m__1634__auto__)
source

response-input-item-rolesclj

source

response-input-itemsclj

(response-input-items entries)

Convert a vector into a valid builder call to inputOfResponse.

[{:role :user :content ["Describe this image."
                        {:type :image :detail :auto :image-url (io/resource "image.png")}]}
 {:role :user :content [{:type :text :text "Describe this file"}
                        {:type :file :filename "notes.pdf" :file-data (io/resource "notes.pdf")]}]
Convert a vector into a valid builder call to inputOfResponse.

```clojure
[{:role :user :content ["Describe this image."
                        {:type :image :detail :auto :image-url (io/resource "image.png")}]}
 {:role :user :content [{:type :text :text "Describe this file"}
                        {:type :file :filename "notes.pdf" :file-data (io/resource "notes.pdf")]}]
```
sourceraw docstring

response-input-textclj

(response-input-text m__1634__auto__)
source

response-statusclj

source

response-text-configclj

(response-text-config schema-var)
(response-text-config malli-schema format-name)

Return a ResponseTextConfig that uses the given Malli schema as a structured‑output format. Accepts either

(response-text-config ::my.ns/SomeSchema) or (response-text-config some-malli-schema "my-format")

When you pass a single var, its name becomes the format name.

Return a ResponseTextConfig that uses the given Malli schema as a
structured‑output format.  Accepts either

  (response-text-config ::my.ns/SomeSchema)
or
  (response-text-config some-malli-schema "my-format")

When you pass a single var, its *name* becomes the format name.
sourceraw docstring

schema->openai-schemaclj

(schema->openai-schema schema-map)
source

url->base64-data-urlclj

(url->base64-data-url url)

Read all bytes from url, Base64‑encode them, and return a data URL of the form "data:<mime-type>;base64,<base64‑data>".

Read all bytes from `url`, Base64‑encode them, and return a
data URL of the form
"data:<mime-type>;base64,<base64‑data>".
sourceraw docstring

with-url-supportclj

(with-url-support x)

Allows us to pass a java.net.URL to the :image-url property. Very convenient to be able to use (io/resource) as an input to openai-java

Allows us to pass a java.net.URL to the :image-url property. Very convenient
to be able to use (io/resource) as an input to openai-java
sourceraw docstring

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

× close