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

com.volcengine.service.maas.v2.MaasConfig Maven / Gradle / Ivy

There is a newer version: 1.0.192
Show newest version
package com.volcengine.service.maas.v2;

import com.volcengine.helper.Const;
import com.volcengine.model.ApiInfo;
import com.volcengine.model.Credentials;
import com.volcengine.model.ServiceInfo;
import org.apache.http.Header;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MaasConfig {
    public static ServiceInfo getServiceInfo(String host, String region, int connectionTimeout, int socketTimeout) {
        return new ServiceInfo(new HashMap() {
            {
                put(Const.CONNECTION_TIMEOUT, connectionTimeout);
                put(Const.SOCKET_TIMEOUT, socketTimeout);
                put(Const.Scheme, Const.HTTPS);
                put(Const.Host, host);
                put(Const.Header, new ArrayList
() { { add(new BasicHeader("Accept", "application/json")); } }); put(Const.Credentials, new Credentials(region, "ml_maas")); } }); } public static Map getApiInfoList() { return new HashMap() { { put(Const.MaasApiChat, new ApiInfo(new HashMap() { { put(Const.Method, "post"); put(Const.Path, "/api/v2/endpoint/%s/chat"); } })); put(Const.MaasApiTokenization, new ApiInfo(new HashMap() { { put(Const.Method, "post"); put(Const.Path, "/api/v2/endpoint/%s/tokenization"); } })); put(Const.MaasApiClassification, new ApiInfo(new HashMap() { { put(Const.Method, "post"); put(Const.Path, "/api/v2/endpoint/%s/classification"); } })); put(Const.MaasApiEmbeddings, new ApiInfo(new HashMap() { { put(Const.Method, "post"); put(Const.Path, "/api/v2/endpoint/%s/embeddings"); } })); put(Const.MaasApiAudioSpeech, new ApiInfo(new HashMap() { { put(Const.Method, "post"); put(Const.Path, "/api/v2/endpoint/%s/audio/speech"); } })); put(Const.MaasApiImagesQuickGen, new ApiInfo(new HashMap() { { put(Const.Method, "post"); put(Const.Path, "/api/v2/endpoint/%s/images/quick-gen"); } })); put(Const.MaasApiImagesFlexGen, new ApiInfo(new HashMap() { { put(Const.Method, "post"); put(Const.Path, "/api/v2/endpoint/%s/images/flex-gen"); } })); } }; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy