Sends a question/message to an AI session and returns the response. The function maintains conversation context from previous interactions within the same session.
The response can either be returned as a complete string or streamed in chunks to a listener function for real-time processing.
Lucee Function Reference
inquiryaisession()
Example
inquiryaisession(any session,any question,[function listener]):string
Arguments
The arguments for this function are set. You can not use other arguments except the following ones.
| Name | Type | Required | Description |
|---|---|---|---|
| session | any | Yes | The AI session object returned by LuceeCreateAISession(). This session maintains the conversation history and configuration settings like temperature and system message. |
| question | any | Yes |
The question or message to send to the AI. Can be: Array elements can be: * String: Text content or file path (if path exists, file is read automatically) * Binary: File content as binary * Struct: Part object with content and metadata Examples: The question becomes part of the conversation history and provides context for future interactions within the same session. |
| listener | function | No |
A user-defined function that receives the response in chunks as they arrive from the AI. This enables real-time processing or display of the response. The listener function should accept a single argument which will contain the response chunk. When a listener is provided, the function still returns the complete response as a string, but also streams each chunk to the listener as it arrives. |