ESM
import { invokeTextPrompt, invokeStructuredPrompt, invokeToolPrompt } from "@arcgis/ai-components/orchestrator/models/prompts.js";

Invokes text, structured-output, and tool-calling prompts.

Type definitions

ArcgisPromptOptions

Type definition

Options for sending a prompt to an LLM.

promptText

Property
Type
string

The input prompt text to send to the model.

modelTier

Property
Type
ChatModelTier | undefined

The model tier to use for the prompt. See ChatModelTier for tier capabilities, current model mappings, and model-change considerations.

messages

Property
Type
ChatHistory | undefined

The chat history used to provide context for the prompt. This should include the recent messages exchanged between the user and the assistant that are necessary for the model to generate an informed response. Providing chat history can help the model understand the conversation context and produce more accurate and relevant responses.

config

Property
Type
RunnableConfig | undefined

Optional runnable configuration used to derive runtime values (for example, conversation id and abort signal).

inputVariables

Property
Type
Record<string, unknown> | undefined

Input variables for the prompt. This can include any relevant variables related to the context provided to the agent. This may be necessary for determining tool parameters or for providing additional context to the model when generating a response.

ArcgisStructuredPromptOptions

Type definition
Type parameters
<T>

Options when sending a prompt to an LLM that expects a structured response validated against a Zod schema.

Supertypes
ArcgisPromptOptions

schema

Property
Type
ZodType

A Zod schema that defines the expected structure of the model's response. For example, if the expected result from a prompt sent to an LLM is parameters for a tool function that executes specific JS SDK core API calls, the schema should define the structure of those parameters. This allows the response from the model to be validated and parsed according to the defined schema, ensuring type safety and consistency.

See also

ArcgisToolPromptOptions

Type definition

Options when sending a prompt to an LLM when the node is expected to invoke tools (e.g. functions defined in the client). This includes the array of tools that the model can choose to invoke in response to the prompt.

Supertypes
ArcgisPromptOptions

tools

Property
Type
StructuredToolInterface[]

An array of tools that the model can choose to invoke in response to the prompt.

See also

Functions

invokeTextPrompt

Function

Sends a prompt to an LLM and returns a plain text response. This function should be used when you expect a simple text response from the model without the need for structured parsing or tool invocation.

See also
Signature
invokeTextPrompt (opts: ArcgisPromptOptions): Promise<string>

Parameters

ParameterTypeDescriptionRequired
opts

Options for the prompt, including the prompt text, model tier, chat history, and input variables.

Returns
Promise<string>

The model response.

invokeStructuredPrompt

Function
Type parameters
<T>

Sends a prompt to an LLM and returns a structured response validated against a Zod schema.

See also
Signature
invokeStructuredPrompt <T>(opts: ArcgisStructuredPromptOptions<T>): Promise<T>

Parameters

ParameterTypeDescriptionRequired
opts

Prompt options, including a Zod schema for response validation.

Returns
Promise

The model response parsed into the structure defined by the provided Zod schema.

invokeToolPrompt

Function

Invokes a prompt with tools enabled and returns the model's tool call response. This function does not execute the returned tool calls.

See also
Signature
invokeToolPrompt (opts: ArcgisToolPromptOptions): Promise<AIMessage>

Parameters

ParameterTypeDescriptionRequired
opts

Prompt options, including an array of tools the model can invoke.

Returns
Promise

Resolves to the model's response as an AIMessage as defined in LangChain.