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

org.devlive.sdk.openai.utils.HttpUrlUtils Maven / Gradle / Ivy

Go to download

Provides an easy-to-use SDK for Java developers to interact with the APIs of open AI models.

There is a newer version: 2024.01.3
Show newest version
package org.devlive.sdk.openai.utils;

import okhttp3.HttpUrl;

import java.util.List;

public class HttpUrlUtils
{
    private HttpUrlUtils()
    {}

    /**
     * Removes all path segments from the given HttpUrl.
     *
     * @param httpUrl the HttpUrl from which to remove path segments
     * @return the modified HttpUrl with all path segments removed
     */
    public static HttpUrl removePathSegment(HttpUrl httpUrl)
    {
        List pathSegments = httpUrl.pathSegments();
        for (int i = 0; i < pathSegments.size(); i++) {
            httpUrl = httpUrl.newBuilder()
                    .removePathSegment(0)
                    .build();
        }
        return httpUrl;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy