Lucee Function Reference

inquiryaisession()

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.

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:
  • A string: Plain text question
  • An array: Multipart content with text and binary data (images, PDFs, audio, etc.)
    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:
  • Simple: "What is the capital of France?"
  • Multipart: ["Analyze this image", imageBytes]
  • With paths: ["Summarize this PDF", "/path/to/document.pdf"]
  • Mixed: ["Compare these", image1Bytes, "/path/to/image2.jpg"]
  • Struct: ["do you like these", {"contenttype":"audio/mpeg","path":"/path/to/music.mp3"}]
  • Struct: ["do you like these", {"contenttype":"audio/mpeg","binary":bin,"metadata":metadata}]
    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.