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

com.microsoft.semantickernel.services.chatcompletion.ChatCompletionService Maven / Gradle / Ivy

There is a newer version: 1.3.0
Show newest version
// Copyright (c) Microsoft. All rights reserved.
package com.microsoft.semantickernel.services.chatcompletion;

import com.microsoft.semantickernel.Kernel;
import com.microsoft.semantickernel.orchestration.InvocationContext;
import com.microsoft.semantickernel.services.TextAIService;
import java.util.List;
import javax.annotation.Nullable;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * Chat completion service interface.
 */
public interface ChatCompletionService extends TextAIService {
    /**
     * Gets the chat message contents asynchronously using {@code ChatHistory} to support a
     * turn-based conversation. Typically, the resulting chat message contents is appended to the
     * {@code chatHistory} to continue the conversation.
     *
     * @param chatHistory       the chat history
     * @param kernel            the kernel
     * @param invocationContext the invocation context
     * @return the chat message contents
     */
    Mono>> getChatMessageContentsAsync(
        ChatHistory chatHistory,
        @Nullable Kernel kernel,
        @Nullable InvocationContext invocationContext);

    /**
     * Gets the chat message contents asynchronously using a prompt.
     *
     * @param prompt            the prompt
     * @param kernel            the kernel
     * @param invocationContext the invocation context
     * @return the chat message contents
     */
    Mono>> getChatMessageContentsAsync(
        String prompt,
        @Nullable Kernel kernel,
        @Nullable InvocationContext invocationContext);

    /**
     * Gets the chat message contents asynchronously using {@code ChatHistory} to support a
     * turn-based conversation. Typically, the resulting chat message contents is appended to the
     * {@code chatHistory} to continue the conversation.
     *
     * @param chatHistory       the chat history
     * @param kernel            the kernel
     * @param invocationContext the invocation context
     * @return the chat message contents
     */
    Flux> getStreamingChatMessageContentsAsync(
        ChatHistory chatHistory,
        @Nullable Kernel kernel,
        @Nullable InvocationContext invocationContext);

    /**
     * Gets the chat message contents asynchronously using a prompt.
     *
     * @param prompt            the prompt
     * @param kernel            the kernel
     * @param invocationContext the invocation context
     * @return the chat message contents
     */
    Flux> getStreamingChatMessageContentsAsync(
        String prompt,
        @Nullable Kernel kernel,
        @Nullable InvocationContext invocationContext);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy