▾
import { invokeTextPrompt, invokeStructuredPrompt, invokeToolPrompt } from "@arcgis/ai-components/orchestrator/models/prompts.js";Invokes text, structured-output, and tool-calling prompts.
Type definitions
ArcgisPromptOptions
Options for sending a prompt to an LLM.
modelTier
- Type
- ChatModelTier | undefined
The model tier to use for the prompt. See ChatModelTier for tier capabilities, current model mappings, and model-change considerations.
messages
- 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
- Type
- RunnableConfig | undefined
Optional runnable configuration used to derive runtime values (for example, conversation id and abort signal).
ArcgisStructuredPromptOptions
- Type parameters
- <T>
Options when sending a prompt to an LLM that expects a structured response validated against a Zod schema.
- Supertypes
- ArcgisPromptOptions
schema
- 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
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
Functions
invokeTextPrompt
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| opts | Options for the prompt, including the prompt text, model tier, chat history, and input variables. | |
invokeStructuredPrompt
- Type parameters
- <T>
Sends a prompt to an LLM and returns a structured response validated against a Zod schema.
- Signature
-
invokeStructuredPrompt <T>(opts: ArcgisStructuredPromptOptions<T>): Promise<T>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
Invokes a prompt with tools enabled and returns the model's tool call response. This function does not execute the returned tool calls.
- Signature
-
invokeToolPrompt (opts: ArcgisToolPromptOptions): Promise<AIMessage>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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.