Skip to main content

io.enterpriseai.resources.PromptsClient

Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/resources/PromptsClient.java. Back to the Java SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class PromptsClient​

Prompt registry, versions and rendering.

Constructor PromptsClient​

PromptsClient(Transport transport)

Creates the client on the shared transport; EnterpriseAIClient builds it and exposes it through the accessor of the same name.

NameTypeDefaultRequiredDescription
transportTransportyesTransport shared by the sub-clients of one client.

PromptsClient.create​

JsonNode create(Object body)

Publish a prompt version. Creates a prompt, or publishes a new version when the name exists; identical templates and variables are not duplicated (the current version is returned). The name is lowercase letters, digits, ., _, - (1 to 128 characters, 400 invalid_request otherwise). An unbalanced placeholder, an unknown variable type or a placeholder not declared in variables answers 422 template_error. Needs tenant_admin or developer. Audited as prompt.publish.

Route: /v1/prompts (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesName, template, description, variables and model hint.

Returns: JsonNode. Decoded JSON answer of the operation "Publish a prompt version".

Raises: the typed errors of the transport (Errors).

PromptsClient.create​

JsonNode create(Object body, RequestOptions options)

Publish a prompt version. Creates a prompt, or publishes a new version when the name exists; identical templates and variables are not duplicated (the current version is returned). The name is lowercase letters, digits, ., _, - (1 to 128 characters, 400 invalid_request otherwise). An unbalanced placeholder, an unknown variable type or a placeholder not declared in variables answers 422 template_error. Needs tenant_admin or developer. Audited as prompt.publish.

Route: /v1/prompts (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesName, template, description, variables and model hint.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Publish a prompt version".

Raises: the typed errors of the transport (Errors).

PromptsClient.list​

Page<JsonNode> list()

List the prompts. Prompts of the tenant in name order with their latest version number, paginated with cursor.

Route: /v1/prompts (GET).

This element takes no parameter.

Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Raises: the typed errors of the transport (Errors).

PromptsClient.list​

Page<JsonNode> list(Map<String, ?> query)

List the prompts. Prompts of the tenant in name order with their latest version number, paginated with cursor.

Route: /v1/prompts (GET).

NameTypeDefaultRequiredDescription
queryMap<String, ?>yesQuery string parameters of the route.

Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Raises: the typed errors of the transport (Errors).

PromptsClient.render​

JsonNode render(String name, Object body)

Render a prompt. Fills the template of a version (default: the latest) with the given values and returns text, chars and estimated_tokens (characters divided by 4). Missing required values, wrong types, values outside enum, values over max_length and, with strict, unknown variables answer 422 missing_variables with one entry per problem. 404 not_found for an unknown prompt or version. Nothing is stored.

Route: /v1/prompts/{name}/render (POST).

NameTypeDefaultRequiredDescription
nameStringyesName of the prompt.
bodyObjectyesValues of the variables, version and strict mode.

Returns: JsonNode. Decoded JSON answer of the operation "Render a prompt".

Raises: the typed errors of the transport (Errors).

PromptsClient.render​

JsonNode render(String name, Object body, RequestOptions options)

Render a prompt. Fills the template of a version (default: the latest) with the given values and returns text, chars and estimated_tokens (characters divided by 4). Missing required values, wrong types, values outside enum, values over max_length and, with strict, unknown variables answer 422 missing_variables with one entry per problem. 404 not_found for an unknown prompt or version. Nothing is stored.

Route: /v1/prompts/{name}/render (POST).

NameTypeDefaultRequiredDescription
nameStringyesName of the prompt.
bodyObjectyesValues of the variables, version and strict mode.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Render a prompt".

Raises: the typed errors of the transport (Errors).

PromptsClient.versions​

Page<JsonNode> versions(String name)

List the versions of a prompt. The prompt and every version, newest first, with template, variables, model hint, digest and author. 404 not_found.

Route: /v1/prompts/{name}/versions (GET).

NameTypeDefaultRequiredDescription
nameStringyesName of the prompt.

Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Raises: the typed errors of the transport (Errors).