Integrate with a vector model from OpenSearch

更新时间:
复制 MD 格式

This topic describes how to use a custom text vectorization model deployed in OpenSearch in OpenSearch - Industry Algorithm Edition. This integration helps reduce cross-region network latency and offers a wider selection of models.

Prerequisites

  • You have activated OpenSearch. For more information, see Activate and configure the service.

  • You have deployed a text vectorization model in OpenSearch.

  • Only an Industry Algorithm Edition - exclusive cluster can create a custom vector analyzer. The purchased instance must be in the same region as the model deployed in OpenSearch.

Limitations

  • You can create a maximum of 10 custom vector analyzers for a single instance.

  • You can configure a maximum of two vector indexes in the application structure for a single version.

Procedure

Create a custom model

  1. Log on to the OpenSearch - Industry Algorithm Edition console.

  2. In the left-side navigation pane, choose Search Algorithm Center > Retrieval Configuration, select Custom Retrieval Model, and then click Create.

    Note

    The Create button is disabled if the instance is not an exclusive cluster.

  3. Configure the following settings and click OK. The form also includes a Target Application drop-down list, which cannot be changed after creation. A message at the bottom of the form indicates that custom vector analyzers do not incur extra charges, but creating a vector index increases storage usage based on the vector dimension. Custom models consume the instance's storage capacity and computing resources.

    Important
    • After you create the model, you can only modify the access token. All other parameters cannot be changed.

    • If the Service name drop-down list is empty, it means no text vectorization model is deployed in OpenSearch in the current region.

    Parameter

    Description

    Model name

    The name must be 1 to 30 characters long, start with a letter, and can contain uppercase letters, lowercase letters, digits, and underscores (_). The name must be unique.

    Function type

    Options include Analyzer, Term Weight, and Synonyms. The content displayed below varies based on your selection.

    Model type

    Options include Vector Model and Text Model. To use a model from OpenSearch, select Vector Model.

    Model source

    Currently, only OpenSearch is supported.

    Service name

    Select a vector model service that you have already deployed from the workspace.

    Access token

    Obtain the access token from the deployed service in OpenSearch.

    Vector dimension

    The vector dimension is the number of values in a dense vector. This vector is generated when an embedding model converts unstructured data, such as text and images. These values represent the features of the data and are used for tasks such as similarity search and classification.

    • OpenSearch Universal Text Embedding Service-001 (ops-text-embedding-001) output vector dimension: 1536

    • OpenSearch Text Embedding Service-Chinese-001 (ops-text-embedding-zh-001) output vector dimension: 768

    • OpenSearch Text Embedding Service-English-001 (ops-text-embedding-en-001) output vector dimension: 768

    • OpenSearch Universal Text Embedding Service-002 (ops-text-embedding-002) output vector dimension: 1024

    • GTE Text Embedding-Multilingual-Base (ops-gte-sentence-embedding-multilingual-base) output vector dimension: 768

    For more information about text vector services in OpenSearch, see Text vectorization.

    Note

    If you enter an incorrect vector dimension, an error occurs during search, and text vectorization fails.

  4. After the model is created, it appears in the custom retrieval model list. The Model Status of the new model is Available. In the Actions column, you can click Details to view model information or click Train Model to train the model.

Test the vector analyzer

  1. In the left-side navigation pane, choose Search Algorithm Center > Retrieval Configuration > Analyzer Management > Vector Analyzer. Find the target analyzer and click Test.

  2. This step verifies connectivity and checks for configuration issues. A valid configuration returns the correct dimensions and results. In the Analyzer Effect Test dialog box, enter a test text such as "company", and click Test. The analysis results display the analyzer name, vector dimension (for example, 1024), and the corresponding floating-point embedding vector values.

    Note

    If an "Invalid embedding size" error is reported, check whether the vector dimension was entered correctly.

Configure and test the model

  1. Go to Instance Management, find the target application, open its details page, and then click Offline Change.

  2. On the Configure Index Structure page, find the target index and select the model version to apply. In the index structure step, find the Index Fields list. For the vector index field, such as ai_vector, set the Analysis Method to Vector Analysis, and select your deployed vector model, such as test_model, from the expanded menu.

  3. Complete the offline change and wait for the index to be rebuilt. When the application status changes to Normal, the index build is complete.

    The status of the Offline Application changes to Initializing. Wait for the status to change to Normal.

  4. To configure the vector model for search retrieval, choose Search Algorithm Center > Retrieval Configuration > Query Analyzer Configuration > Create. In the Function Selection section, choose Text Vectorization and set the vector index value to the index name configured in Step 2. For more information, see Query Analyzer Configuration.

  5. Go to Feature Extensions > Search Test to test the model's performance. After running a query on the Search Test page, click Query Analysis Process to view the text vectorization results. The results include the vector index name, the vector dimension (for example, 768), and the resulting vector.

    Note

    When testing the model, the raw_query field is required. If this field is not provided, text vectorization will not take effect.

Details page

  • The details page of a vector analyzer contains Basic Information and Configuration Information sections.

  • Basic Information includes the creation time and the model status.

  • Configuration Information includes Model source, Service name, access token, and vector dimension, which are the parameters you set during creation. Calling Information shows the API domain name of the deployed service in OpenSearch.