All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.honhimw.ms.api.EmbeddersSettings Maven / Gradle / Ivy

There is a newer version: 1.11.0.0
Show newest version
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.github.honhimw.ms.api;

import io.github.honhimw.ms.Experimental;
import io.github.honhimw.ms.model.Embedder;
import io.github.honhimw.ms.model.Pagination;
import io.github.honhimw.ms.model.TaskInfo;
import io.github.honhimw.ms.support.MapBuilder;
import io.github.honhimw.ms.api.annotation.Operation;
import jakarta.annotation.Nullable;

import java.util.Map;
import java.util.function.Consumer;

/**
 * Deactivate vector search
 *
 * @author hon_him
 * @see Pagination
 * @since 2024-01-18 V1.6
 */

@Experimental(features = Experimental.Features.VECTOR_SEARCH)
public interface EmbeddersSettings {

    /**
     * Get current embedders configuration from your index:
     *
     * @return current embedders
     */
    @Nullable
    @Operation(method = "GET", paths = "/indexes/{index_uid}/settings/embedders")
    Map get();

    /**
     * Update all embedder configuration from your index:
     *
     * @param embedders new embedders
     * @return update task
     */
    @Operation(method = "PATCH", paths = "/indexes/{index_uid}/settings/embedders")
    TaskInfo update(Map embedders);

    /**
     * Update all embedder configuration from your index:
     * @param embedders new embedders builder
     * @return update task
     */
    @Operation(method = "PATCH", paths = "/indexes/{index_uid}/settings/embedders")
    default TaskInfo update(Consumer> embedders) {
        MapBuilder builder = MapBuilder.builder();
        embedders.accept(builder);
        return update(builder.build());
    }

    /**
     * Manually remove all embedder configuration from your index:
     * 

WARNING

*
     * If you don't remove all embedders, Meilisearch will continue auto-generating embeddings for you documents. This will happen even if vectorStore has been set to false and may lead to unexpected expenses when using OpenAI's paid tiers.
     * 
* * @return reset task */ @Operation(method = "DELETE", paths = "/indexes/{index_uid}/settings/embedders") TaskInfo reset(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy