object Form8: TForm8
  Left = 0
  Top = 0
  Caption = 'Form8'
  ClientHeight = 815
  ClientWidth = 1221
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  OnCreate = FormCreate
  DesignerMasterStyle = 0
  object Layout1: TLayout
    Align = Top
    Size.Width = 1221.000000000000000000
    Size.Height = 73.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 0
    object Text1: TText
      Align = Center
      Size.Width = 521.000000000000000000
      Size.Height = 50.000000000000000000
      Size.PlatformDefault = False
      Text = 
        'Este demo muestra como adicionar informaci'#243'n a una base de datos' +
        ' postgres con pgvector de diferentes tipos de documentos'
      TextSettings.Font.Size = 14.000000000000000000
    end
  end
  object BtnAddText: TButton
    Position.X = 32.000000000000000000
    Position.Y = 96.000000000000000000
    Size.Width = 217.000000000000000000
    Size.Height = 22.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 3
    Text = 'Add Text'
    TextSettings.Trimming = None
    OnClick = BtnAddTextClick
  end
  object MemoTextToAdd: TMemo
    Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
    DataDetectorTypes = []
    OnChange = MemoTextToAddChange
    Position.X = 8.000000000000000000
    Position.Y = 152.000000000000000000
    Size.Width = 289.000000000000000000
    Size.Height = 633.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 6
    Viewport.Width = 285.000000000000000000
    Viewport.Height = 629.000000000000000000
  end
  object Grid1: TGrid
    CanFocus = True
    ClipChildren = True
    Position.X = 320.000000000000000000
    Position.Y = 152.000000000000000000
    Size.Width = 536.000000000000000000
    Size.Height = 337.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 11
    RowCount = 0
    Viewport.Width = 532.000000000000000000
    Viewport.Height = 312.000000000000000000
  end
  object EditPrompt: TEdit
    Touch.InteractiveGestures = [LongTap, DoubleTap]
    TabOrder = 14
    Position.X = 456.000000000000000000
    Position.Y = 110.000000000000000000
    Size.Width = 553.000000000000000000
    Size.Height = 22.000000000000000000
    Size.PlatformDefault = False
    TextPrompt = 'Digita aqu'#237' tu consulta'
  end
  object Label1: TLabel
    Position.X = 456.000000000000000000
    Position.Y = 85.000000000000000000
    Text = 'Buscar'
    TabOrder = 15
  end
  object BtnBuscar: TButton
    Position.X = 1017.000000000000000000
    Position.Y = 110.000000000000000000
    Size.Width = 97.000000000000000000
    Size.Height = 22.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 16
    Text = 'Buscar'
    TextSettings.Trimming = None
    OnClick = BtnBuscarClick
  end
  object Memo1: TMemo
    Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
    DataDetectorTypes = []
    TextSettings.WordWrap = True
    Position.X = 864.000000000000000000
    Position.Y = 152.000000000000000000
    Size.Width = 321.000000000000000000
    Size.Height = 337.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 17
    Viewport.Width = 317.000000000000000000
    Viewport.Height = 333.000000000000000000
  end
  object MemoRes: TMemo
    Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
    DataDetectorTypes = []
    TextSettings.WordWrap = True
    Position.X = 320.000000000000000000
    Position.Y = 497.000000000000000000
    Size.Width = 865.000000000000000000
    Size.Height = 296.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 20
    Viewport.Width = 861.000000000000000000
    Viewport.Height = 292.000000000000000000
  end
  object DbConn: TFDConnection
    Params.Strings = (
      'Database=lunaidb'
      'User_Name=postgres'
      'Server=localhost'
      'Password=masterkey'
      'DriverID=PG')
    Connected = True
    LoginPrompt = False
    Left = 212
    Top = 32
  end
  object RAGVectorAdicion: TAiRAGVector
    OnDataVecAddItem = RAGVectorAdicionDataVecAddItem
    Embeddings = AiOllamaEmbeddings1
    LexicalLanguage = alSpanish
    OwnsObjects = True
    SearchOptions.UseBM25 = False
    SearchOptions.BM25Weight = 0.700000000000000000
    SearchOptions.EmbeddingWeight = 0.300000000000000000
    Left = 128
    Top = 288
  end
  object BusQuery: TFDQuery
    Connection = DbConn
    SQL.Strings = (
      'SELECT id, FechaDoc, Categoria, PathDoc, FileName, Resumen,'
      '  0.345::double precision AS distancia'
      'FROM anexos'
      'WHERE id IN (1, 2);')
    Left = 392
    Top = 256
    object BusQueryid: TLargeintField
      DisplayWidth = 4
      FieldName = 'id'
      Origin = 'id'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object BusQueryfechadoc: TSQLTimeStampField
      FieldName = 'fechadoc'
      Origin = 'fechadoc'
      ProviderFlags = [pfInUpdate]
      Visible = False
    end
    object BusQuerycategoria: TWideStringField
      DisplayWidth = 15
      FieldName = 'categoria'
      Origin = 'categoria'
      Size = 300
    end
    object BusQuerypathdoc: TWideStringField
      DisplayWidth = 15
      FieldName = 'pathdoc'
      Origin = 'pathdoc'
      Size = 300
    end
    object BusQueryfilename: TWideStringField
      DisplayWidth = 20
      FieldName = 'filename'
      Origin = 'filename'
      Size = 300
    end
    object BusQueryresumen: TWideMemoField
      FieldName = 'resumen'
      Origin = 'resumen'
      Visible = False
      BlobType = ftWideMemo
    end
    object BusQuerydistancia: TFloatField
      AutoGenerateValue = arDefault
      FieldName = 'distancia'
      Origin = 'distancia'
      ReadOnly = True
    end
  end
  object BindSourceDB1: TBindSourceDB
    DataSet = BusQuery
    ScopeMappings = <>
    Left = 88
    Top = 16
  end
  object BindingsList1: TBindingsList
    Methods = <>
    OutputConverters = <>
    Left = 20
    Top = 5
    object LinkGridToDataSourceBindSourceDB1: TLinkGridToDataSource
      Category = 'Quick Bindings'
      DataSource = BindSourceDB1
      GridControl = Grid1
      Columns = <>
    end
    object LinkControlToField1: TLinkControlToField
      Category = 'Quick Bindings'
      DataSource = BindSourceDB1
      FieldName = 'resumen'
      Control = Memo1
      Track = False
    end
  end
  object RAGVectorConsulta: TAiRAGVector
    OnDataVecSearch = RAGVectorConsultaDataVecSearch
    Embeddings = AiOllamaEmbeddings1
    InMemoryIndexType = TAIEuclideanIndex
    LexicalLanguage = alSpanish
    OwnsObjects = True
    SearchOptions.UseBM25 = False
    SearchOptions.BM25Weight = 0.700000000000000000
    SearchOptions.EmbeddingWeight = 0.300000000000000000
    Left = 520
    Top = 560
  end
  object AiChatConnection1: TAiChatConnection
    DriverName = 'OpenAi'
    Model = 'gpt-4o'
    Params.Strings = (
      'ApiKey=@OPENAI_API_KEY'
      'Model=gpt-4o'
      'MaxTokens=4096'
      'Temperature=1.1'
      'TopP=1.0'
      'TopK=5'
      'BaseURL=http://localhost:11434/'
      'Max_Tokens=8000'
      'NativeInputFiles=[]'
      'NativeOutupFiles=[]'
      'ChatMediaSupports=[]'
      'Tool_Active=False'
      'Asynchronous=False'
      'URL=https://api.openai.com/v1/'
      'NativeOutputFiles=[]')
    Prompt_tokens = 0
    Completion_tokens = 0
    Total_tokens = 0
    OnReceiveData = AiChatConnection1ReceiveData
    Left = 816
    Top = 520
  end
  object AiOllamaEmbeddings1: TAiOllamaEmbeddings
    Model = 'snowflake-arctic-embed'
    Dimensions = 1024
    ApiKey = '@OLLAMA_API_KEY'
    Url = 'http://localhost:11434/'
    Left = 616
    Top = 360
  end
  object AIWhisper1: TAIWhisper
    ApiKey = '@OPENAI_API_KEY'
    Url = 'https://api.openai.com/v1/'
    Model = 'whisper-1'
    Voice = 'nova'
    Format = 'mp3'
    Languaje = 'es'
    Speed = 1.000000000000000000
    ResponseFormat = 'text'
    Quality = 'tts-1'
    Left = 968
    Top = 632
  end
  object AiOllamaChat1: TAiOllamaChat
    ApiKey = '@OLLAMA_API_KEY'
    Model = 'gpt-oss:20b'
    Logprobs = False
    Max_tokens = 3000
    N = 1
    Response_format = tiaChatRfText
    Seed = 0
    Asynchronous = False
    Temperature = 1.000000000000000000
    Top_p = 1.000000000000000000
    K = 0
    Tool_choice = 'auto'
    Tool_Active = False
    User = 'user'
    SystemPrompt.Strings = (
      'Eres un asistente muy '#250'til y servicial')
    Prompt_tokens = 0
    Completion_tokens = 0
    Total_tokens = 0
    Thinking_tokens = 0
    Url = 'http://localhost:11434/'
    ResponseTimeOut = 61000
    Stream_Usage = False
    NativeInputFiles = []
    NativeOutputFiles = []
    ChatMediaSupports = []
    EnabledFeatures = []
    ThinkingLevel = tlDefault
    MediaResolution = mrDefault
    keep_alive = '1m'
    Left = 800
    Top = 632
  end
end
