ElasticSearch Relevance Engine (ESRE)
因為 ESRE 的出現,許多功能在 Elastic Stack 當中即可獨立完成,我們暫時不再需要 Python Client 的操作,接下來的操作步驟將透過 Kibana 進行。
6.1 使用 Kibana > Search > Machine Learning > Model Management > Trained Models 下載與佈署模型
打開 kibana
在上方搜尋框,搜尋
Machine Learning,並且點選第一個推薦的結果

進入 Machine Learning 頁面後,在左方選單中,點選 Model Management 底下的 Trained Models

點選 Add trained model
選擇 E5 模型,並點選下載。

等待下載完成。

點選 Deploy 的按鈕。

Start 完成後,會出現 Deployed 的狀態。

6.2 建立 Ingest Pipeline 配合 Inference Process 使用模型進行 Embedding 處理
6.3 搜尋時,也能直接使用 Elasticsearch 內部的 Model,不需再 Python Client 先進行 Embedding 的處理。
6.4 使用外部 OpenAI 的 Text Embedding 模型
:::info 這把 API Key 供大家試用,僅提供 gpt-4o-mini & text-embedding-3-small,並且在研討會結束後就會移除。 sk-proj-(已失效,請改用自己的 API Key) 可在 Kibana Dev Tools 的 Variables 設定中,加入 openai_api_key 名稱的變數,以方便直接執行以下的範例。 :::
:::success 這個透過 Inference API 建立好的 text_embedding 的 model id: openai-embeddings-3-small 就如同前面 Elasticsearch 載入的模型,可直接在 Inference Processor 或是 knn 的 query_vector_build 直接使用 :::
6.5 使用外部 OpenAI 的 Completion 推論模型
6.6 Ingest Pipeline 配合 OpenAI Completion 推論模型的使用
新聞摘要
擷取電影重要關鍵字
Last updated