/**
 * Databricks AI Agent Node - Version 2.2
 * An AI agent that exports its runs to MLflow Tracing in Databricks
 */


export interface LcDatabricksAiAgentV22Params {
/**
 * Source for Prompt (User Message)
 * @builderHint Use 'auto' when following a chat trigger, 'define' when custom prompt needed
 * @default auto
 */
    promptType?: 'auto' | 'define' | Expression<string>;
/**
 * Prompt (User Message)
 * @builderHint Use expressions to include dynamic data from previous nodes (e.g., expr('{{ $json.input }}')). Static text prompts ignore incoming data.
 * @placeholderSupported false
 * @displayOptions.show { promptType: ["define"] }
 * @required when the displayOptions conditions above match
 */
    text?: string | Expression<string>;
  hasOutputParser?: boolean;
/**
 * Enable Fallback Model
 * @default false
 */
    needsFallback?: boolean;
/**
 * Whether to send each run to MLflow Tracing in your Databricks workspace. Needs the Databricks credential above. Traces include prompts, model outputs and tool results.
 * @default false
 */
    exportTraces?: boolean;
/**
 * Where traces are stored. Leave the name empty to create one for this workflow automatically.
 * @displayOptions.show { exportTraces: [true] }
 * @default {"mode":"name","value":""}
 */
    experiment?: { __rl: true; mode: 'name' | 'id'; value: string; cachedResultName?: string };
/**
 * Options
 * @default {}
 */
    options?: {
    /** The message that will be sent to the agent before the conversation starts
     * @builderHint Must include: agent's purpose, exact names of connected tools, and response instructions
     * @default You are a helpful assistant
     */
    systemMessage?: string | Expression<string>;
    /** The maximum number of iterations the agent will run before stopping
     * @default 10
     */
    maxIterations?: number | Expression<number>;
    /** Whether or not the output should include intermediate steps the agent took
     * @default false
     */
    returnIntermediateSteps?: boolean | Expression<boolean>;
    /** Whether or not binary images should be automatically passed through to the agent as image type messages
     * @default true
     */
    passthroughBinaryImages?: boolean | Expression<boolean>;
    /** Whether or not binary PDF documents should be automatically passed through to the agent. Useful for models that natively support PDF input (e.g. Google Gemini).
     * @default false
     */
    passthroughBinaryPdfs?: boolean | Expression<boolean>;
    /** Custom metadata added to tracing events
     * @default {}
     */
    tracingMetadata?: {
        /** Metadata
     */
    values?: Array<{
      /** Key
       */
      key?: string | Expression<string>;
      /** The field value type
       * @default stringValue
       */
      type?: 'arrayValue' | 'booleanValue' | 'numberValue' | 'objectValue' | 'stringValue' | Expression<string>;
      /** Value
       * @displayOptions.show { type: ["stringValue"] }
       */
      stringValue?: string | Expression<string>;
      /** Value
       * @displayOptions.show { type: ["numberValue"] }
       */
      numberValue?: string | Expression<string>;
      /** Value
       * @displayOptions.show { type: ["booleanValue"] }
       * @default true
       */
      booleanValue?: 'true' | 'false' | Expression<string>;
      /** Value
       * @displayOptions.show { type: ["arrayValue"] }
       */
      arrayValue?: string | Expression<string>;
      /** Value
       * @displayOptions.show { type: ["objectValue"] }
       * @default ={}
       */
      objectValue?: IDataObject | string | Expression<string>;
    }>;
  };
    /** Batch processing options for rate limiting
     * @default {}
     */
    batching?: {
    /** How many items to process in parallel. This is useful for rate limiting, but might impact the log output ordering.
     * @default 1
     */
    batchSize?: number | Expression<number>;
    /** Delay in milliseconds between batches. This is useful for rate limiting.
     * @default 0
     */
    delayBetweenBatches?: number | Expression<number>;
  };
    /** Whether this agent will stream the response in real-time as it generates text
     * @default true
     */
    enableStreaming?: boolean | Expression<boolean>;
  };
}

export interface LcDatabricksAiAgentV22SubnodeConfig {
  model?: LanguageModelInstance | LanguageModelInstance[];
  memory?: MemoryInstance;
  outputParser?: OutputParserInstance;
  tools?: ToolInstance[];
}

export interface LcDatabricksAiAgentV22Credentials {
  databricksOAuth2Api?: CredentialReference;
}

interface LcDatabricksAiAgentV22NodeBase {
  type: '@n8n/n8n-nodes-langchain.databricksAiAgent';
  version: 2.2;
  isTrigger: true;
}

export type LcDatabricksAiAgentV22ParamsNode = LcDatabricksAiAgentV22NodeBase & {
  config: NodeConfig<LcDatabricksAiAgentV22Params> & { credentials?: LcDatabricksAiAgentV22Credentials } & { subnodes?: LcDatabricksAiAgentV22SubnodeConfig };
};

export type LcDatabricksAiAgentV22Node = LcDatabricksAiAgentV22ParamsNode;