Interface LLMProvider.LLMRequest
- All Superinterfaces:
Serializable
- Enclosing interface:
LLMProvider
Represents a request to the LLM containing all necessary context,
configuration, and tools. Requests are immutable.
-
Method Summary
Modifier and TypeMethodDescriptionGets the list of file attachments to include with the request.default List<LLMProvider.ToolSpec> Gets the explicit tool definitions for this request.default Consumer<ResponseMetadata> Gets the consumer that receives metadata about the model's response, such as the finish reason and token usage.default StringGets the session context for this turn: free-form text the application supplies throughAIOrchestrator.Builder.withMetadata, such as the current date and time, captured when the user sent the message.Gets the system prompt for this specific request.Object[]tools()Gets the tool objects for this request.Gets the user's message.
-
Method Details
-
userMessage
String userMessage()Gets the user's message.- Returns:
- the user message, never
null
-
attachments
List<AIAttachment> attachments()Gets the list of file attachments to include with the request. Attachments can be images, PDFs, text files, or other supported formats that the LLM can analyze and reference in its response.- Returns:
- the list of attachments, never
nullbut may be empty
-
systemPrompt
String systemPrompt()Gets the system prompt for this specific request. The system prompt defines the LLM's behavior, role, and constraints. Ifnull, the provider may use its own internal default system prompt.- Returns:
- the system prompt, or
nullif not specified
-
tools
Object[] tools()Gets the tool objects for this request. Tool objects are classes with vendor-specific annotations (e.g., LangChain4j's@Tool, Spring AI's@Tool) that the provider can introspect and convert to native tool definitions.These tools are executed by the vendor framework itself, so its own error handling decides what reaches the LLM when a tool throws; the
ToolExceptioncontract only applies to the tools returned byexplicitTools().- Returns:
- array of tool objects, never
nullbut may be empty
-
explicitTools
Gets the explicit tool definitions for this request. Unlike vendor-specific annotated tools returned bytools(), these are framework-agnostic tool definitions provided programmatically (typically byAIControllerinstances).- Returns:
- list of explicit tool definitions, never
nullbut may be empty
-
sessionContext
Gets the session context for this turn: free-form text the application supplies throughAIOrchestrator.Builder.withMetadata, such as the current date and time, captured when the user sent the message.Send it to the model together with the user message, after the user's text, so that the system prompt and the tool definitions stay identical from turn to turn and an LLM provider that caches the prompt prefix keeps hitting its cache. The built-in providers append it to the user message text in a delimited block. The default returns
null.- Returns:
- the session context for this turn, or
nullwhen there is none - Since:
- 25.3
-
metadataSink
Gets the consumer that receives metadata about the model's response, such as the finish reason and token usage. A provider that observes such metadata passes it to this consumer as the turn progresses — each call carries everything observed so far and replaces the value of any earlier call, so a turn that fails midway has still reported what was observed before the failure. A provider that observes no metadata never calls the consumer. The default implementation discards the metadata.- Returns:
- the metadata consumer, never
null - Since:
- 25.3
-