using LLama.Web.Common;
using LLama.Web.Models;
namespace LLama.Web.Services
{
public interface IModelSessionService
{
///
/// Gets the ModelSession with the specified Id.
///
/// The session identifier.
/// The ModelSession if exists, otherwise null
Task GetAsync(string sessionId);
///
/// Gets all ModelSessions
///
/// A collection oa all Model instances
Task> GetAllAsync();
///
/// Creates a new ModelSession
///
/// The session identifier.
/// The session configuration.
/// The default inference configuration, will be used for all inference where no infer configuration is supplied.
/// The cancellation token.
///
///
/// Session with id {sessionId} already exists
/// or
/// Failed to create model session
///
Task CreateAsync(string sessionId, ISessionConfig sessionConfig, InferenceOptions inferenceOptions = null, CancellationToken cancellationToken = default);
///
/// Closes the session
///
/// The session identifier.
///
Task CloseAsync(string sessionId);
///
/// Runs inference on the current ModelSession
///
/// The session identifier.
/// The prompt.
/// The inference configuration, if null session default is used
/// The cancellation token.
/// Inference is already running for this session
IAsyncEnumerable InferAsync(string sessionId, string prompt, InferenceOptions inferenceConfig = null, CancellationToken cancellationToken = default);
///
/// Runs inference on the current ModelSession
///
/// The session identifier.
/// The prompt.
/// The inference configuration, if null session default is used
/// The cancellation token.
/// Streaming async result of
/// Inference is already running for this session
IAsyncEnumerable InferTextAsync(string sessionId, string prompt, InferenceOptions inferenceOptions = null, CancellationToken cancellationToken = default);
///
/// Queues inference on the current ModelSession
///
/// The session identifier.
/// The prompt.
/// The inference configuration, if null session default is used
/// The cancellation token.
/// Completed inference result as string
/// Inference is already running for this session
Task InferTextCompleteAsync(string sessionId, string prompt, InferenceOptions inferenceOptions = null, CancellationToken cancellationToken = default);
///
/// Cancels the current inference action.
///
/// The session identifier.
///
Task CancelAsync(string sessionId);
}
}