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

com.konfigthis.carbonai.client.api.EmbeddingsApiGenerated Maven / Gradle / Ivy

Go to download

Connect external data to LLMs, no matter the source. This library was generated by https://konfigthis.com

There is a newer version: 0.1.34
Show newest version
/*
 * Carbon
 * Connect external data to LLMs, no matter the source.
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by Konfig (https://konfigthis.com).
 * Do not edit the class manually.
 */


package com.konfigthis.carbonai.client.api;

import com.konfigthis.carbonai.client.ApiCallback;
import com.konfigthis.carbonai.client.ApiClient;
import com.konfigthis.carbonai.client.ApiException;
import com.konfigthis.carbonai.client.ApiResponse;
import com.konfigthis.carbonai.client.Configuration;
import com.konfigthis.carbonai.client.Pair;
import com.konfigthis.carbonai.client.ProgressRequestBody;
import com.konfigthis.carbonai.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.konfigthis.carbonai.client.model.ChunksAndEmbeddingsUploadInput;
import com.konfigthis.carbonai.client.model.DocumentResponseList;
import com.konfigthis.carbonai.client.model.EmbeddingGenerators;
import com.konfigthis.carbonai.client.model.EmbeddingGeneratorsNullable;
import com.konfigthis.carbonai.client.model.EmbeddingsAndChunksFilters;
import com.konfigthis.carbonai.client.model.EmbeddingsAndChunksOrderByColumns;
import com.konfigthis.carbonai.client.model.EmbeddingsAndChunksQueryInput;
import com.konfigthis.carbonai.client.model.EmbeddingsAndChunksQueryInputV2;
import com.konfigthis.carbonai.client.model.EmbeddingsAndChunksResponse;
import com.konfigthis.carbonai.client.model.FileContentTypesNullable;
import com.konfigthis.carbonai.client.model.GenericSuccessResponse;
import com.konfigthis.carbonai.client.model.GetEmbeddingDocumentsBody;
import com.konfigthis.carbonai.client.model.HelpdeskFileTypes;
import com.konfigthis.carbonai.client.model.HybridSearchTuningParamsNullable;
import com.konfigthis.carbonai.client.model.OrderDir;
import com.konfigthis.carbonai.client.model.OrganizationUserFilesToSyncFilters;
import com.konfigthis.carbonai.client.model.OrganizationUserFilesToSyncOrderByTypes;
import com.konfigthis.carbonai.client.model.Pagination;
import com.konfigthis.carbonai.client.model.RerankParamsNullable;
import com.konfigthis.carbonai.client.model.SingleChunksAndEmbeddingsUploadInput;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;

public class EmbeddingsApiGenerated {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public EmbeddingsApiGenerated() throws IllegalArgumentException {
        this(Configuration.getDefaultApiClient());
    }

    public EmbeddingsApiGenerated(ApiClient apiClient) throws IllegalArgumentException {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    private okhttp3.Call getDocumentsCall(GetEmbeddingDocumentsBody getEmbeddingDocumentsBody, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = getEmbeddingDocumentsBody;

        // create path and map variables
        String localVarPath = "/embeddings";

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "accessToken", "apiKey", "customerId" };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getDocumentsValidateBeforeCall(GetEmbeddingDocumentsBody getEmbeddingDocumentsBody, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'getEmbeddingDocumentsBody' is set
        if (getEmbeddingDocumentsBody == null) {
            throw new ApiException("Missing the required parameter 'getEmbeddingDocumentsBody' when calling getDocuments(Async)");
        }

        return getDocumentsCall(getEmbeddingDocumentsBody, _callback);

    }


    private ApiResponse getDocumentsWithHttpInfo(GetEmbeddingDocumentsBody getEmbeddingDocumentsBody) throws ApiException {
        okhttp3.Call localVarCall = getDocumentsValidateBeforeCall(getEmbeddingDocumentsBody, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call getDocumentsAsync(GetEmbeddingDocumentsBody getEmbeddingDocumentsBody, final ApiCallback _callback) throws ApiException {

        okhttp3.Call localVarCall = getDocumentsValidateBeforeCall(getEmbeddingDocumentsBody, _callback);
        Type localVarReturnType = new TypeToken(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public abstract class GetDocumentsRequestBuilderGenerated {
        final String query;
        final Integer k;
        Map tags;
        List queryVector;
        List fileIds;
        List parentFileIds;
        Boolean includeAllChildren;
        Object tagsV2;
        Boolean includeTags;
        Boolean includeVectors;
        Boolean includeRawFile;
        Boolean hybridSearch;
        HybridSearchTuningParamsNullable hybridSearchTuningParameters;
        FileContentTypesNullable mediaType;
        EmbeddingGeneratorsNullable embeddingModel;
        Boolean includeFileLevelMetadata;
        Boolean highAccuracy;
        RerankParamsNullable rerank;
        List fileTypesAtSource;

        public GetDocumentsRequestBuilderGenerated(String query, Integer k) {
            this.query = query;
            this.k = k;
        }

        /**
         * Set tags
         * @param tags A set of tags to limit the search to. Deprecated and may be removed in the future. (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder tags(Map tags) {
            this.tags = tags;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set queryVector
         * @param queryVector Optional query vector for which to get related chunks and embeddings. It must have been         generated by the same model used to generate the embeddings across which the search is being conducted. Cannot         provide both `query` and `query_vector`. (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder queryVector(List queryVector) {
            this.queryVector = queryVector;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set fileIds
         * @param fileIds Optional list of file IDs to limit the search to (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder fileIds(List fileIds) {
            this.fileIds = fileIds;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set parentFileIds
         * @param parentFileIds Optional list of parent file IDs to limit the search to. A parent file describes a file to which         another file belongs (e.g. a folder) (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder parentFileIds(List parentFileIds) {
            this.parentFileIds = parentFileIds;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set includeAllChildren
         * @param includeAllChildren Flag to control whether or not to include all children of filtered files in the embedding search. (optional, default to false)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder includeAllChildren(Boolean includeAllChildren) {
            this.includeAllChildren = includeAllChildren;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set tagsV2
         * @param tagsV2 A set of tags to limit the search to. Use this instead of `tags`, which is deprecated. (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder tagsV2(Object tagsV2) {
            this.tagsV2 = tagsV2;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set includeTags
         * @param includeTags Flag to control whether or not to include tags for each chunk in the response. (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder includeTags(Boolean includeTags) {
            this.includeTags = includeTags;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set includeVectors
         * @param includeVectors Flag to control whether or not to include embedding vectors in the response. (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder includeVectors(Boolean includeVectors) {
            this.includeVectors = includeVectors;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set includeRawFile
         * @param includeRawFile Flag to control whether or not to include a signed URL to the raw file containing each chunk         in the response. (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder includeRawFile(Boolean includeRawFile) {
            this.includeRawFile = includeRawFile;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set hybridSearch
         * @param hybridSearch Flag to control whether or not to perform hybrid search. (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder hybridSearch(Boolean hybridSearch) {
            this.hybridSearch = hybridSearch;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set hybridSearchTuningParameters
         * @param hybridSearchTuningParameters  (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder hybridSearchTuningParameters(HybridSearchTuningParamsNullable hybridSearchTuningParameters) {
            this.hybridSearchTuningParameters = hybridSearchTuningParameters;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set mediaType
         * @param mediaType  (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder mediaType(FileContentTypesNullable mediaType) {
            this.mediaType = mediaType;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set embeddingModel
         * @param embeddingModel  (optional, default to OPENAI)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder embeddingModel(EmbeddingGeneratorsNullable embeddingModel) {
            this.embeddingModel = embeddingModel;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set includeFileLevelMetadata
         * @param includeFileLevelMetadata Flag to control whether or not to include file-level metadata in the response. This metadata         will be included in the `content_metadata` field of each document along with chunk/embedding level metadata. (optional, default to false)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder includeFileLevelMetadata(Boolean includeFileLevelMetadata) {
            this.includeFileLevelMetadata = includeFileLevelMetadata;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set highAccuracy
         * @param highAccuracy Flag to control whether or not to perform a high accuracy embedding search. By default, this is set to false.         If true, the search may return more accurate results, but may take longer to complete. (optional, default to false)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder highAccuracy(Boolean highAccuracy) {
            this.highAccuracy = highAccuracy;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set rerank
         * @param rerank  (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder rerank(RerankParamsNullable rerank) {
            this.rerank = rerank;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Set fileTypesAtSource
         * @param fileTypesAtSource Filter files based on their type at the source (for example help center tickets and articles) (optional)
         * @return EmbeddingsApi.GetDocumentsRequestBuilder
         */
        public EmbeddingsApi.GetDocumentsRequestBuilder fileTypesAtSource(List fileTypesAtSource) {
            this.fileTypesAtSource = fileTypesAtSource;
            return (EmbeddingsApi.GetDocumentsRequestBuilder) this;
        }
        
        /**
         * Build call for getDocuments
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         
Status Code Description Response Headers
200 Successful Response -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { GetEmbeddingDocumentsBody getEmbeddingDocumentsBody = buildBodyParams(); return getDocumentsCall(getEmbeddingDocumentsBody, _callback); } private GetEmbeddingDocumentsBody buildBodyParams() { GetEmbeddingDocumentsBody getEmbeddingDocumentsBody = new GetEmbeddingDocumentsBody(); getEmbeddingDocumentsBody.tags(this.tags); getEmbeddingDocumentsBody.query(this.query); getEmbeddingDocumentsBody.queryVector(this.queryVector); getEmbeddingDocumentsBody.k(this.k); getEmbeddingDocumentsBody.fileIds(this.fileIds); getEmbeddingDocumentsBody.parentFileIds(this.parentFileIds); getEmbeddingDocumentsBody.includeAllChildren(this.includeAllChildren); getEmbeddingDocumentsBody.tagsV2(this.tagsV2); getEmbeddingDocumentsBody.includeTags(this.includeTags); getEmbeddingDocumentsBody.includeVectors(this.includeVectors); getEmbeddingDocumentsBody.includeRawFile(this.includeRawFile); getEmbeddingDocumentsBody.hybridSearch(this.hybridSearch); getEmbeddingDocumentsBody.hybridSearchTuningParameters(this.hybridSearchTuningParameters); getEmbeddingDocumentsBody.mediaType(this.mediaType); getEmbeddingDocumentsBody.embeddingModel(this.embeddingModel); getEmbeddingDocumentsBody.includeFileLevelMetadata(this.includeFileLevelMetadata); getEmbeddingDocumentsBody.highAccuracy(this.highAccuracy); getEmbeddingDocumentsBody.rerank(this.rerank); getEmbeddingDocumentsBody.fileTypesAtSource(this.fileTypesAtSource); return getEmbeddingDocumentsBody; } /** * Execute getDocuments request * @return DocumentResponseList * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public DocumentResponseList execute() throws ApiException { GetEmbeddingDocumentsBody getEmbeddingDocumentsBody = buildBodyParams(); ApiResponse localVarResp = getDocumentsWithHttpInfo(getEmbeddingDocumentsBody); return localVarResp.getResponseBody(); } /** * Execute getDocuments request with HTTP info returned * @return ApiResponse<DocumentResponseList> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { GetEmbeddingDocumentsBody getEmbeddingDocumentsBody = buildBodyParams(); return getDocumentsWithHttpInfo(getEmbeddingDocumentsBody); } /** * Execute getDocuments request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { GetEmbeddingDocumentsBody getEmbeddingDocumentsBody = buildBodyParams(); return getDocumentsAsync(getEmbeddingDocumentsBody, _callback); } } /** * Embeddings * For pre-filtering documents, using `tags_v2` is preferred to using `tags` (which is now deprecated). If both `tags_v2` and `tags` are specified, `tags` is ignored. `tags_v2` enables building complex filters through the use of \"AND\", \"OR\", and negation logic. Take the below input as an example: ```json { \"OR\": [ { \"key\": \"subject\", \"value\": \"holy-bible\", \"negate\": false }, { \"key\": \"person-of-interest\", \"value\": \"jesus christ\", \"negate\": false }, { \"key\": \"genre\", \"value\": \"religion\", \"negate\": true } { \"AND\": [ { \"key\": \"subject\", \"value\": \"tao-te-ching\", \"negate\": false }, { \"key\": \"author\", \"value\": \"lao-tzu\", \"negate\": false } ] } ] } ``` In this case, files will be filtered such that: 1. \"subject\" = \"holy-bible\" OR 2. \"person-of-interest\" = \"jesus christ\" OR 3. \"genre\" != \"religion\" OR 4. \"subject\" = \"tao-te-ching\" AND \"author\" = \"lao-tzu\" Note that the top level of the query must be either an \"OR\" or \"AND\" array. Currently, nesting is limited to 3. For tag blocks (those with \"key\", \"value\", and \"negate\" keys), the following typing rules apply: 1. \"key\" isn't optional and must be a `string` 2. \"value\" isn't optional and can be `any` or list[`any`] 3. \"negate\" is optional and must be `true` or `false`. If present and `true`, then the filter block is negated in the resulting query. It is `false` by default. When querying embeddings, you can optionally specify the `media_type` parameter in your request. By default (if not set), it is equal to \"TEXT\". This means that the query will be performed over files that have been parsed as text (for now, this covers all files except image files). If it is equal to \"IMAGE\", the query will be performed over image files (for now, `.jpg` and `.png` files). You can think of this field as an additional filter on top of any filters set in `file_ids` and When `hybrid_search` is set to true, a combination of keyword search and semantic search are used to rank and select candidate embeddings during information retrieval. By default, these search methods are weighted equally during the ranking process. To adjust the weight (or \"importance\") of each search method, you can use the `hybrid_search_tuning_parameters` property. The description for the different tuning parameters are: - `weight_a`: weight to assign to semantic search - `weight_b`: weight to assign to keyword search You must ensure that `sum(weight_a, weight_b,..., weight_n)` for all *n* weights is equal to 1. The equality has an error tolerance of 0.001 to account for possible floating point issues. In order to use hybrid search for a customer across a set of documents, two flags need to be enabled: 1. Use the `/modify_user_configuration` endpoint to to enable `sparse_vectors` for the customer. The payload body for this request is below: ``` { \"configuration_key_name\": \"sparse_vectors\", \"value\": { \"enabled\": true } } ``` 2. Make sure hybrid search is enabled for the documents across which you want to perform the search. For the `/uploadfile` endpoint, this can be done by setting the following query parameter: `generate_sparse_vectors=true` Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0. The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing embedding queries, embeddings from files that used the specified model will be considered in the query. For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with `COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not** set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file. * @param getEmbeddingDocumentsBody (required) * @return GetDocumentsRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public EmbeddingsApi.GetDocumentsRequestBuilder getDocuments(String query, Integer k) throws IllegalArgumentException { if (query == null) throw new IllegalArgumentException("\"query\" is required but got null"); if (query != null && query.length() < 1) { throw new IllegalArgumentException("Invalid value for query. Length must be greater than or equal to 1."); } if (k == null) throw new IllegalArgumentException("\"k\" is required but got null"); return ((EmbeddingsApi) this).new GetDocumentsRequestBuilder(query, k); } private okhttp3.Call getEmbeddingsAndChunksCall(EmbeddingsAndChunksQueryInput embeddingsAndChunksQueryInput, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = embeddingsAndChunksQueryInput; // create path and map variables String localVarPath = "/text_chunks"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "accessToken", "apiKey", "customerId" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getEmbeddingsAndChunksValidateBeforeCall(EmbeddingsAndChunksQueryInput embeddingsAndChunksQueryInput, final ApiCallback _callback) throws ApiException { // verify the required parameter 'embeddingsAndChunksQueryInput' is set if (embeddingsAndChunksQueryInput == null) { throw new ApiException("Missing the required parameter 'embeddingsAndChunksQueryInput' when calling getEmbeddingsAndChunks(Async)"); } return getEmbeddingsAndChunksCall(embeddingsAndChunksQueryInput, _callback); } private ApiResponse getEmbeddingsAndChunksWithHttpInfo(EmbeddingsAndChunksQueryInput embeddingsAndChunksQueryInput) throws ApiException { okhttp3.Call localVarCall = getEmbeddingsAndChunksValidateBeforeCall(embeddingsAndChunksQueryInput, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call getEmbeddingsAndChunksAsync(EmbeddingsAndChunksQueryInput embeddingsAndChunksQueryInput, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getEmbeddingsAndChunksValidateBeforeCall(embeddingsAndChunksQueryInput, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class GetEmbeddingsAndChunksRequestBuilderGenerated { final EmbeddingsAndChunksFilters filters; Pagination pagination; EmbeddingsAndChunksOrderByColumns orderBy; OrderDir orderDir; Boolean includeVectors; public GetEmbeddingsAndChunksRequestBuilderGenerated(EmbeddingsAndChunksFilters filters) { this.filters = filters; } /** * Set pagination * @param pagination (optional) * @return EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder */ public EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder pagination(Pagination pagination) { this.pagination = pagination; return (EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder) this; } /** * Set orderBy * @param orderBy (optional) * @return EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder */ public EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder orderBy(EmbeddingsAndChunksOrderByColumns orderBy) { this.orderBy = orderBy; return (EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder) this; } /** * Set orderDir * @param orderDir (optional) * @return EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder */ public EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder orderDir(OrderDir orderDir) { this.orderDir = orderDir; return (EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder) this; } /** * Set includeVectors * @param includeVectors (optional, default to false) * @return EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder */ public EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder includeVectors(Boolean includeVectors) { this.includeVectors = includeVectors; return (EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder) this; } /** * Build call for getEmbeddingsAndChunks * @param _callback ApiCallback API callback * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { EmbeddingsAndChunksQueryInput embeddingsAndChunksQueryInput = buildBodyParams(); return getEmbeddingsAndChunksCall(embeddingsAndChunksQueryInput, _callback); } private EmbeddingsAndChunksQueryInput buildBodyParams() { EmbeddingsAndChunksQueryInput embeddingsAndChunksQueryInput = new EmbeddingsAndChunksQueryInput(); embeddingsAndChunksQueryInput.pagination(this.pagination); embeddingsAndChunksQueryInput.orderBy(this.orderBy); embeddingsAndChunksQueryInput.orderDir(this.orderDir); embeddingsAndChunksQueryInput.filters(this.filters); embeddingsAndChunksQueryInput.includeVectors(this.includeVectors); return embeddingsAndChunksQueryInput; } /** * Execute getEmbeddingsAndChunks request * @return EmbeddingsAndChunksResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public EmbeddingsAndChunksResponse execute() throws ApiException { EmbeddingsAndChunksQueryInput embeddingsAndChunksQueryInput = buildBodyParams(); ApiResponse localVarResp = getEmbeddingsAndChunksWithHttpInfo(embeddingsAndChunksQueryInput); return localVarResp.getResponseBody(); } /** * Execute getEmbeddingsAndChunks request with HTTP info returned * @return ApiResponse<EmbeddingsAndChunksResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { EmbeddingsAndChunksQueryInput embeddingsAndChunksQueryInput = buildBodyParams(); return getEmbeddingsAndChunksWithHttpInfo(embeddingsAndChunksQueryInput); } /** * Execute getEmbeddingsAndChunks request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { EmbeddingsAndChunksQueryInput embeddingsAndChunksQueryInput = buildBodyParams(); return getEmbeddingsAndChunksAsync(embeddingsAndChunksQueryInput, _callback); } } /** * Retrieve Embeddings And Content * * @param embeddingsAndChunksQueryInput (required) * @return GetEmbeddingsAndChunksRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public EmbeddingsApi.GetEmbeddingsAndChunksRequestBuilder getEmbeddingsAndChunks(EmbeddingsAndChunksFilters filters) throws IllegalArgumentException { if (filters == null) throw new IllegalArgumentException("\"filters\" is required but got null"); return ((EmbeddingsApi) this).new GetEmbeddingsAndChunksRequestBuilder(filters); } private okhttp3.Call listCall(EmbeddingsAndChunksQueryInputV2 embeddingsAndChunksQueryInputV2, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = embeddingsAndChunksQueryInputV2; // create path and map variables String localVarPath = "/list_chunks_and_embeddings"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "accessToken", "apiKey", "customerId" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call listValidateBeforeCall(EmbeddingsAndChunksQueryInputV2 embeddingsAndChunksQueryInputV2, final ApiCallback _callback) throws ApiException { // verify the required parameter 'embeddingsAndChunksQueryInputV2' is set if (embeddingsAndChunksQueryInputV2 == null) { throw new ApiException("Missing the required parameter 'embeddingsAndChunksQueryInputV2' when calling list(Async)"); } return listCall(embeddingsAndChunksQueryInputV2, _callback); } private ApiResponse listWithHttpInfo(EmbeddingsAndChunksQueryInputV2 embeddingsAndChunksQueryInputV2) throws ApiException { okhttp3.Call localVarCall = listValidateBeforeCall(embeddingsAndChunksQueryInputV2, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call listAsync(EmbeddingsAndChunksQueryInputV2 embeddingsAndChunksQueryInputV2, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = listValidateBeforeCall(embeddingsAndChunksQueryInputV2, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class ListRequestBuilderGenerated { final OrganizationUserFilesToSyncFilters filters; Pagination pagination; OrganizationUserFilesToSyncOrderByTypes orderBy; OrderDir orderDir; Boolean includeVectors; public ListRequestBuilderGenerated(OrganizationUserFilesToSyncFilters filters) { this.filters = filters; } /** * Set pagination * @param pagination (optional) * @return EmbeddingsApi.ListRequestBuilder */ public EmbeddingsApi.ListRequestBuilder pagination(Pagination pagination) { this.pagination = pagination; return (EmbeddingsApi.ListRequestBuilder) this; } /** * Set orderBy * @param orderBy (optional) * @return EmbeddingsApi.ListRequestBuilder */ public EmbeddingsApi.ListRequestBuilder orderBy(OrganizationUserFilesToSyncOrderByTypes orderBy) { this.orderBy = orderBy; return (EmbeddingsApi.ListRequestBuilder) this; } /** * Set orderDir * @param orderDir (optional) * @return EmbeddingsApi.ListRequestBuilder */ public EmbeddingsApi.ListRequestBuilder orderDir(OrderDir orderDir) { this.orderDir = orderDir; return (EmbeddingsApi.ListRequestBuilder) this; } /** * Set includeVectors * @param includeVectors (optional, default to false) * @return EmbeddingsApi.ListRequestBuilder */ public EmbeddingsApi.ListRequestBuilder includeVectors(Boolean includeVectors) { this.includeVectors = includeVectors; return (EmbeddingsApi.ListRequestBuilder) this; } /** * Build call for list * @param _callback ApiCallback API callback * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { EmbeddingsAndChunksQueryInputV2 embeddingsAndChunksQueryInputV2 = buildBodyParams(); return listCall(embeddingsAndChunksQueryInputV2, _callback); } private EmbeddingsAndChunksQueryInputV2 buildBodyParams() { EmbeddingsAndChunksQueryInputV2 embeddingsAndChunksQueryInputV2 = new EmbeddingsAndChunksQueryInputV2(); embeddingsAndChunksQueryInputV2.pagination(this.pagination); embeddingsAndChunksQueryInputV2.orderBy(this.orderBy); embeddingsAndChunksQueryInputV2.orderDir(this.orderDir); embeddingsAndChunksQueryInputV2.filters(this.filters); embeddingsAndChunksQueryInputV2.includeVectors(this.includeVectors); return embeddingsAndChunksQueryInputV2; } /** * Execute list request * @return EmbeddingsAndChunksResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public EmbeddingsAndChunksResponse execute() throws ApiException { EmbeddingsAndChunksQueryInputV2 embeddingsAndChunksQueryInputV2 = buildBodyParams(); ApiResponse localVarResp = listWithHttpInfo(embeddingsAndChunksQueryInputV2); return localVarResp.getResponseBody(); } /** * Execute list request with HTTP info returned * @return ApiResponse<EmbeddingsAndChunksResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { EmbeddingsAndChunksQueryInputV2 embeddingsAndChunksQueryInputV2 = buildBodyParams(); return listWithHttpInfo(embeddingsAndChunksQueryInputV2); } /** * Execute list request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { EmbeddingsAndChunksQueryInputV2 embeddingsAndChunksQueryInputV2 = buildBodyParams(); return listAsync(embeddingsAndChunksQueryInputV2, _callback); } } /** * Retrieve Embeddings And Content V2 * * @param embeddingsAndChunksQueryInputV2 (required) * @return ListRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public EmbeddingsApi.ListRequestBuilder list(OrganizationUserFilesToSyncFilters filters) throws IllegalArgumentException { if (filters == null) throw new IllegalArgumentException("\"filters\" is required but got null"); return ((EmbeddingsApi) this).new ListRequestBuilder(filters); } private okhttp3.Call uploadChunksAndEmbeddingsCall(ChunksAndEmbeddingsUploadInput chunksAndEmbeddingsUploadInput, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = chunksAndEmbeddingsUploadInput; // create path and map variables String localVarPath = "/upload_chunks_and_embeddings"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "accessToken", "apiKey", "customerId" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call uploadChunksAndEmbeddingsValidateBeforeCall(ChunksAndEmbeddingsUploadInput chunksAndEmbeddingsUploadInput, final ApiCallback _callback) throws ApiException { // verify the required parameter 'chunksAndEmbeddingsUploadInput' is set if (chunksAndEmbeddingsUploadInput == null) { throw new ApiException("Missing the required parameter 'chunksAndEmbeddingsUploadInput' when calling uploadChunksAndEmbeddings(Async)"); } return uploadChunksAndEmbeddingsCall(chunksAndEmbeddingsUploadInput, _callback); } private ApiResponse uploadChunksAndEmbeddingsWithHttpInfo(ChunksAndEmbeddingsUploadInput chunksAndEmbeddingsUploadInput) throws ApiException { okhttp3.Call localVarCall = uploadChunksAndEmbeddingsValidateBeforeCall(chunksAndEmbeddingsUploadInput, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call uploadChunksAndEmbeddingsAsync(ChunksAndEmbeddingsUploadInput chunksAndEmbeddingsUploadInput, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = uploadChunksAndEmbeddingsValidateBeforeCall(chunksAndEmbeddingsUploadInput, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class UploadChunksAndEmbeddingsRequestBuilderGenerated { final EmbeddingGenerators embeddingModel; final List chunksAndEmbeddings; Boolean overwriteExisting; Boolean chunksOnly; Map customCredentials; public UploadChunksAndEmbeddingsRequestBuilderGenerated(EmbeddingGenerators embeddingModel, List chunksAndEmbeddings) { this.embeddingModel = embeddingModel; this.chunksAndEmbeddings = chunksAndEmbeddings; } /** * Set overwriteExisting * @param overwriteExisting (optional, default to false) * @return EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder */ public EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder overwriteExisting(Boolean overwriteExisting) { this.overwriteExisting = overwriteExisting; return (EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder) this; } /** * Set chunksOnly * @param chunksOnly (optional, default to false) * @return EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder */ public EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder chunksOnly(Boolean chunksOnly) { this.chunksOnly = chunksOnly; return (EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder) this; } /** * Set customCredentials * @param customCredentials (optional) * @return EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder */ public EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder customCredentials(Map customCredentials) { this.customCredentials = customCredentials; return (EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder) this; } /** * Build call for uploadChunksAndEmbeddings * @param _callback ApiCallback API callback * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { ChunksAndEmbeddingsUploadInput chunksAndEmbeddingsUploadInput = buildBodyParams(); return uploadChunksAndEmbeddingsCall(chunksAndEmbeddingsUploadInput, _callback); } private ChunksAndEmbeddingsUploadInput buildBodyParams() { ChunksAndEmbeddingsUploadInput chunksAndEmbeddingsUploadInput = new ChunksAndEmbeddingsUploadInput(); chunksAndEmbeddingsUploadInput.embeddingModel(this.embeddingModel); chunksAndEmbeddingsUploadInput.chunksAndEmbeddings(this.chunksAndEmbeddings); chunksAndEmbeddingsUploadInput.overwriteExisting(this.overwriteExisting); chunksAndEmbeddingsUploadInput.chunksOnly(this.chunksOnly); chunksAndEmbeddingsUploadInput.customCredentials(this.customCredentials); return chunksAndEmbeddingsUploadInput; } /** * Execute uploadChunksAndEmbeddings request * @return GenericSuccessResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public GenericSuccessResponse execute() throws ApiException { ChunksAndEmbeddingsUploadInput chunksAndEmbeddingsUploadInput = buildBodyParams(); ApiResponse localVarResp = uploadChunksAndEmbeddingsWithHttpInfo(chunksAndEmbeddingsUploadInput); return localVarResp.getResponseBody(); } /** * Execute uploadChunksAndEmbeddings request with HTTP info returned * @return ApiResponse<GenericSuccessResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { ChunksAndEmbeddingsUploadInput chunksAndEmbeddingsUploadInput = buildBodyParams(); return uploadChunksAndEmbeddingsWithHttpInfo(chunksAndEmbeddingsUploadInput); } /** * Execute uploadChunksAndEmbeddings request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { ChunksAndEmbeddingsUploadInput chunksAndEmbeddingsUploadInput = buildBodyParams(); return uploadChunksAndEmbeddingsAsync(chunksAndEmbeddingsUploadInput, _callback); } } /** * Upload Chunks And Embeddings * * @param chunksAndEmbeddingsUploadInput (required) * @return UploadChunksAndEmbeddingsRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public EmbeddingsApi.UploadChunksAndEmbeddingsRequestBuilder uploadChunksAndEmbeddings(EmbeddingGenerators embeddingModel, List chunksAndEmbeddings) throws IllegalArgumentException { if (embeddingModel == null) throw new IllegalArgumentException("\"embeddingModel\" is required but got null"); if (chunksAndEmbeddings == null) throw new IllegalArgumentException("\"chunksAndEmbeddings\" is required but got null"); return ((EmbeddingsApi) this).new UploadChunksAndEmbeddingsRequestBuilder(embeddingModel, chunksAndEmbeddings); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy