luceeinquiryaisession,aiinquirysession()

edit

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.

luceeinquiryaisession,aiinquirysession( session=any, question=any, listener=function );

Returns: String

Argument Description
session
any, required
edit

The AI session object returned by LuceeCreateAISession(). This session maintains the conversation history and configuration settings like temperature and system message.

Alias: aiSession

question
any, required
edit

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.

Alias: message, parts

listener
function, optional
edit

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.

Examples

There are currently no examples for this function 33,043ms WARN No examples for function luceeinquiryaisession,aiinquirysession

See also