Liking cljdoc? Tell your friends :D

clj-oci.generative-ai

OCI Generative AI Service Management API wrapper — Models + Imported Models.

Provides full CRUD + list + compartment-move on the two control-plane resource types of the Generative AI service:

  • Model (BASE pretrained or CUSTOM fine-tuned): list-models, get-model, create-model, update-model, change-model-compartment, delete-model.

  • ImportedModel (externally sourced from Object Storage or Hugging Face): list-imported-models, get-imported-model, create-imported-model, update-imported-model, change-imported-model-compartment, delete-imported-model.

Plus helpers for the polymorphic input slots; the OCI SDK exposes these as abstract base classes with multiple concrete subclasses, and oci-build does not auto-dispatch on JSON discriminators. Callers compose pre-built Java instances via the helpers below and pass them through:

  • object-storage-datasetDatasetObjectStorageDataset
  • t-few-training-configTrainingConfigTFewTrainingConfig
  • vanilla-training-configTrainingConfigVanillaTrainingConfig
  • lora-training-configTrainingConfigLoraTrainingConfig
  • object-storage-data-sourceModelDataSourceObjectStorageObject
  • hugging-face-data-sourceModelDataSourceHuggingFaceModel
  • fine-tune-details — composes a dataset + cluster + config

The service is regional (12 endpoint regions). Operations route via clients/generativeai-client-for, which resolves the region from (:region opts) > the resource OCID's region segment > the singleton default — same precedence as Compute and FileStorage.

Async operations (create-model, delete-model, create-imported-model, update-imported-model, delete-imported-model) return an :opcWorkRequestId in :data. The Generative AI work-request polling API (GetWorkRequest/ListWorkRequests/etc.) is not wrapped in this slice; callers query externally if they need to wait.

Note: oci/http-request discards response headers, so this namespace accepts :if-match outbound but cannot surface etag or opc-request-id inbound — same limitation as compute.clj.

OCI Generative AI Service Management API wrapper — Models + Imported Models.

Provides full CRUD + list + compartment-move on the two control-plane
resource types of the Generative AI service:

- **Model** (BASE pretrained or CUSTOM fine-tuned):
  `list-models`, `get-model`, `create-model`, `update-model`,
  `change-model-compartment`, `delete-model`.

- **ImportedModel** (externally sourced from Object Storage or Hugging Face):
  `list-imported-models`, `get-imported-model`, `create-imported-model`,
  `update-imported-model`, `change-imported-model-compartment`,
  `delete-imported-model`.

Plus helpers for the polymorphic input slots; the OCI SDK exposes these as
abstract base classes with multiple concrete subclasses, and `oci-build`
does not auto-dispatch on JSON discriminators. Callers compose pre-built
Java instances via the helpers below and pass them through:

- `object-storage-dataset`     — `Dataset` → `ObjectStorageDataset`
- `t-few-training-config`      — `TrainingConfig` → `TFewTrainingConfig`
- `vanilla-training-config`    — `TrainingConfig` → `VanillaTrainingConfig`
- `lora-training-config`       — `TrainingConfig` → `LoraTrainingConfig`
- `object-storage-data-source` — `ModelDataSource` → `ObjectStorageObject`
- `hugging-face-data-source`   — `ModelDataSource` → `HuggingFaceModel`
- `fine-tune-details`          — composes a dataset + cluster + config

The service is regional (12 endpoint regions). Operations route via
`clients/generativeai-client-for`, which resolves the region from
`(:region opts)` > the resource OCID's region segment > the singleton
default — same precedence as Compute and FileStorage.

Async operations (`create-model`, `delete-model`, `create-imported-model`,
`update-imported-model`, `delete-imported-model`) return an `:opcWorkRequestId`
in `:data`. The Generative AI work-request polling API
(`GetWorkRequest`/`ListWorkRequests`/etc.) is not wrapped in this slice;
callers query externally if they need to wait.

Note: `oci/http-request` discards response headers, so this namespace
accepts `:if-match` outbound but cannot surface `etag` or `opc-request-id`
inbound — same limitation as `compute.clj`.
raw docstring

change-imported-model-compartmentclj

(change-imported-model-compartment imported-model-id target-compartment-id)
(change-imported-model-compartment imported-model-id target-compartment-id opts)

Moves an ImportedModel to a different compartment. Synchronous (204).

Options: :if-match, :opc-retry-token, :region.

Moves an ImportedModel to a different compartment. Synchronous (204).

Options: `:if-match`, `:opc-retry-token`, `:region`.
raw docstring

change-model-compartmentclj

(change-model-compartment model-id target-compartment-id)
(change-model-compartment model-id target-compartment-id opts)

Moves a custom Model to a different compartment within the same tenancy. Synchronous (204 No Content from the API).

Options: :if-match, :opc-retry-token, :region.

Moves a custom Model to a different compartment within the same tenancy.
Synchronous (204 No Content from the API).

Options: `:if-match`, `:opc-retry-token`, `:region`.
raw docstring

create-imported-modelclj

(create-imported-model details)
(create-imported-model details opts)

Imports a model from an Object Storage bucket or a Hugging Face repository.

Async — the API returns 201 with an opc-work-request-id; the :opcWorkRequestId is surfaced in :data.

details is a Clojure map; required keys are :compartment-id and :data-source (pre-built via object-storage-data-source or hugging-face-data-source).

Options: :region, :opc-retry-token.

Imports a model from an Object Storage bucket or a Hugging Face repository.

Async — the API returns 201 with an `opc-work-request-id`; the
`:opcWorkRequestId` is surfaced in `:data`.

`details` is a Clojure map; required keys are `:compartment-id` and
`:data-source` (pre-built via `object-storage-data-source` or
`hugging-face-data-source`).

Options: `:region`, `:opc-retry-token`.
raw docstring

create-modelclj

(create-model details)
(create-model details opts)

Creates a custom Model by fine-tuning a BASE model with your own dataset.

Async — the API returns 201 with an opc-work-request-id header that tracks the fine-tune job. The :opcWorkRequestId is surfaced in :data.

details is a Clojure map; required keys are :compartment-id, :base-model-id, and :fine-tune-details (build via fine-tune-details, which composes a Dataset + DedicatedAiCluster + optional TrainingConfig).

Options: :region — region override; defaults to the singleton's region :opc-retry-token — idempotency token

Returns {:data {...new model... :opcWorkRequestId "..."}} or {:error ...}.

Creates a custom Model by fine-tuning a BASE model with your own dataset.

Async — the API returns 201 with an `opc-work-request-id` header that
tracks the fine-tune job. The `:opcWorkRequestId` is surfaced in `:data`.

`details` is a Clojure map; required keys are `:compartment-id`,
`:base-model-id`, and `:fine-tune-details` (build via `fine-tune-details`,
which composes a `Dataset` + DedicatedAiCluster + optional `TrainingConfig`).

Options:
  :region          — region override; defaults to the singleton's region
  :opc-retry-token — idempotency token

Returns `{:data {...new model... :opcWorkRequestId "..."}}` or `{:error ...}`.
raw docstring

delete-imported-modelclj

(delete-imported-model imported-model-id)
(delete-imported-model imported-model-id opts)

Deletes an ImportedModel. Cannot be deleted while active endpoints reference it (409 Conflict).

Async — 202 with opc-work-request-id surfaced in :data as :opcWorkRequestId.

Options: :if-match, :region.

Deletes an ImportedModel. Cannot be deleted while active endpoints
reference it (409 Conflict).

Async — 202 with `opc-work-request-id` surfaced in `:data` as
`:opcWorkRequestId`.

Options: `:if-match`, `:region`.
raw docstring

delete-modelclj

(delete-model model-id)
(delete-model model-id opts)

Deletes a custom Model. Cannot be deleted while active endpoints reference it (the API returns 409 Conflict).

Async — the API returns 202 with an opc-work-request-id; the :opcWorkRequestId is surfaced in :data.

Options: :if-match, :region.

Deletes a custom Model. Cannot be deleted while active endpoints reference
it (the API returns 409 Conflict).

Async — the API returns 202 with an `opc-work-request-id`; the
`:opcWorkRequestId` is surfaced in `:data`.

Options: `:if-match`, `:region`.
raw docstring

fine-tune-detailsclj

(fine-tune-details {:keys [training-dataset dedicated-ai-cluster-id
                           training-config]})

Composes a FineTuneDetails for use as :fineTuneDetails on create-model.

Required: :training-dataset — pre-built Dataset (use object-storage-dataset) :dedicated-ai-cluster-id — OCID of the fine-tuning DedicatedAiCluster Optional: :training-config — pre-built TrainingConfig (use t-few-/vanilla-/lora-training-config)

Composes a `FineTuneDetails` for use as `:fineTuneDetails` on
`create-model`.

Required:
  `:training-dataset`     — pre-built `Dataset` (use `object-storage-dataset`)
  `:dedicated-ai-cluster-id` — OCID of the fine-tuning DedicatedAiCluster
Optional:
  `:training-config`      — pre-built `TrainingConfig`
                            (use `t-few-/vanilla-/lora-training-config`)
raw docstring

get-imported-modelclj

(get-imported-model imported-model-id)
(get-imported-model imported-model-id opts)

Fetches a single ImportedModel by OCID. Region is OCID-derived; pass :region in opts to override.

Returns {:data {...}} or {:error ...}.

Fetches a single ImportedModel by OCID. Region is OCID-derived; pass
`:region` in opts to override.

Returns `{:data {...}}` or `{:error ...}`.
raw docstring

get-modelclj

(get-model model-id)
(get-model model-id opts)

Fetches a single Model by OCID (BASE or CUSTOM).

The region is resolved from the model OCID's region segment; pass :region "us-ashburn-1" in opts to override.

Returns {:data {...}} or {:error ...}.

Fetches a single Model by OCID (BASE or CUSTOM).

The region is resolved from the model OCID's region segment; pass
`:region "us-ashburn-1"` in opts to override.

Returns `{:data {...}}` or `{:error ...}`.
raw docstring

hugging-face-data-sourceclj

(hugging-face-data-source params)

Builds a HuggingFaceModel for use as :data-source on create-imported-model.

Required: :modelId (the Hugging Face model identifier). Optional: :accessToken, :branch, :commit.

Builds a `HuggingFaceModel` for use as `:data-source` on
`create-imported-model`.

Required: `:modelId` (the Hugging Face model identifier).
Optional: `:accessToken`, `:branch`, `:commit`.
raw docstring

list-imported-modelsclj

(list-imported-models compartment-id)
(list-imported-models compartment-id opts)

Lists ImportedModels in compartment-id, paginating automatically.

Returns {:data {:items [...]}} or {:error ...}.

Options (all optional unless noted): :region — region override; defaults to the singleton's region :vendor — exact match :capability — vector of keywords from [:text-to-text :image-text-to-text :embedding :rerank :text-to-image] (or Java enum constants) :lifecycle-state — keyword (:active, :creating, :updating, :deleting, :deleted, :failed) or Java constant :display-name — exact match :id — imported-model OCID :sort-by — :display-name, :lifecycle-state, or :time-created :sort-order — :asc or :desc :limit — page size (default 100)

Lists ImportedModels in `compartment-id`, paginating automatically.

Returns `{:data {:items [...]}}` or `{:error ...}`.

Options (all optional unless noted):
  :region          — region override; defaults to the singleton's region
  :vendor          — exact match
  :capability      — vector of keywords from
                     `[:text-to-text :image-text-to-text :embedding :rerank
                       :text-to-image]` (or Java enum constants)
  :lifecycle-state — keyword (`:active`, `:creating`, `:updating`,
                     `:deleting`, `:deleted`, `:failed`) or Java constant
  :display-name    — exact match
  :id              — imported-model OCID
  :sort-by         — `:display-name`, `:lifecycle-state`, or `:time-created`
  :sort-order      — `:asc` or `:desc`
  :limit           — page size (default 100)
raw docstring

list-modelsclj

(list-models compartment-id)
(list-models compartment-id opts)

Lists Models in compartment-id, paginating automatically. Includes both BASE pretrained models and CUSTOM fine-tuned models in the compartment.

Returns {:data {:items [model-maps...]}} or {:error ...}. Each map has camelCase keys via from-java.

Options (all optional unless noted): :region — region-id (e.g. "us-ashburn-1") or 3-letter code ("iad"); defaults to the singleton's region :vendor — exact match on vendor string :capability — vector of keywords from [:text-generation :text-summarization :text-embeddings :fine-tune :chat :text-rerank :text-to-image] (or Java enum constants) :lifecycle-state — keyword (:active, :creating, :deleting, :deleted, :failed) or Java constant :display-name — exact match (case-sensitive) :id — model OCID :sort-by — :display-name, :lifecycle-state, or :time-created :sort-order — :asc or :desc :limit — page size (default 100)

Lists Models in `compartment-id`, paginating automatically. Includes both
BASE pretrained models and CUSTOM fine-tuned models in the compartment.

Returns `{:data {:items [model-maps...]}}` or `{:error ...}`. Each map
has camelCase keys via `from-java`.

Options (all optional unless noted):
  :region          — region-id (e.g. "us-ashburn-1") or 3-letter code
                     ("iad"); defaults to the singleton's region
  :vendor          — exact match on vendor string
  :capability      — vector of keywords from
                     `[:text-generation :text-summarization :text-embeddings
                       :fine-tune :chat :text-rerank :text-to-image]`
                     (or Java enum constants)
  :lifecycle-state — keyword (`:active`, `:creating`, `:deleting`,
                     `:deleted`, `:failed`) or Java constant
  :display-name    — exact match (case-sensitive)
  :id              — model OCID
  :sort-by         — `:display-name`, `:lifecycle-state`, or `:time-created`
  :sort-order      — `:asc` or `:desc`
  :limit           — page size (default 100)
raw docstring

lora-training-configclj

(lora-training-config params)

Builds a LoraTrainingConfig for use as :training-config on fine-tune-details. LoRA (low-rank adaptation) is a parameter-efficient fine-tuning method.

Adds :loraR, :loraAlpha, :loraDropout to the common training fields.

Builds a `LoraTrainingConfig` for use as `:training-config` on
`fine-tune-details`. LoRA (low-rank adaptation) is a parameter-efficient
fine-tuning method.

Adds `:loraR`, `:loraAlpha`, `:loraDropout` to the common training fields.
raw docstring

object-storage-data-sourceclj

(object-storage-data-source params)

Builds an ObjectStorageObject for use as :data-source on create-imported-model.

Required: :namespaceName, :bucketName, :prefixName. Optional: :region (string region-id, defaults to the tenancy's home region).

Builds an `ObjectStorageObject` for use as `:data-source` on
`create-imported-model`.

Required: `:namespaceName`, `:bucketName`, `:prefixName`.
Optional: `:region` (string region-id, defaults to the tenancy's home region).
raw docstring

object-storage-datasetclj

(object-storage-dataset params)

Builds an ObjectStorageDataset for use as :training-dataset on fine-tune-details. The only concrete subclass of Dataset shipped by the SDK at present.

Required: :namespaceName, :bucketName, :objectName.

Builds an `ObjectStorageDataset` for use as `:training-dataset` on
`fine-tune-details`. The only concrete subclass of `Dataset` shipped by
the SDK at present.

Required: `:namespaceName`, `:bucketName`, `:objectName`.
raw docstring

t-few-training-configclj

(t-few-training-config params)

Builds a TFewTrainingConfig for use as :training-config on fine-tune-details. T-Few is a parameter-efficient fine-tuning method.

All fields optional: :totalTrainingEpochs, :learningRate, :trainingBatchSize, :earlyStoppingPatience, :earlyStoppingThreshold, :logModelMetricsIntervalInSteps.

Builds a `TFewTrainingConfig` for use as `:training-config` on
`fine-tune-details`. T-Few is a parameter-efficient fine-tuning method.

All fields optional: `:totalTrainingEpochs`, `:learningRate`,
`:trainingBatchSize`, `:earlyStoppingPatience`, `:earlyStoppingThreshold`,
`:logModelMetricsIntervalInSteps`.
raw docstring

update-imported-modelclj

(update-imported-model imported-model-id details)
(update-imported-model imported-model-id details opts)

Updates mutable fields on an ImportedModel.

Unlike update-model, this is async — the API returns 202 with an opc-work-request-id; the :opcWorkRequestId is surfaced in :data.

Mutable: :display-name, :description, :vendor, :version, :freeform-tags, :defined-tags.

Options: :if-match, :region.

Updates mutable fields on an ImportedModel.

Unlike `update-model`, this is **async** — the API returns 202 with an
`opc-work-request-id`; the `:opcWorkRequestId` is surfaced in `:data`.

Mutable: `:display-name`, `:description`, `:vendor`, `:version`,
`:freeform-tags`, `:defined-tags`.

Options: `:if-match`, `:region`.
raw docstring

update-modelclj

(update-model model-id details)
(update-model model-id details opts)

Updates mutable fields on a custom Model. Synchronous — returns the updated Model body.

Mutable: :display-name, :description, :vendor, :version, :freeform-tags, :defined-tags.

Options: :region — region override; defaults to OCID-derived :if-match — etag for optimistic concurrency

Returns {:data {...}} or {:error ...}.

Updates mutable fields on a custom Model. Synchronous — returns the
updated Model body.

Mutable: `:display-name`, `:description`, `:vendor`, `:version`,
`:freeform-tags`, `:defined-tags`.

Options:
  :region   — region override; defaults to OCID-derived
  :if-match — etag for optimistic concurrency

Returns `{:data {...}}` or `{:error ...}`.
raw docstring

vanilla-training-configclj

(vanilla-training-config params)

Builds a VanillaTrainingConfig for use as :training-config on fine-tune-details. Vanilla is full-parameter fine-tuning.

Same field set as t-few-training-config.

Builds a `VanillaTrainingConfig` for use as `:training-config` on
`fine-tune-details`. Vanilla is full-parameter fine-tuning.

Same field set as `t-few-training-config`.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close