using Codex.Dal.Entities;
namespace Codex.Dal.Services;
///
/// Service for interacting with Ollama LLM endpoints
///
public interface IOllamaService
{
///
/// Generates a response from an Ollama model given conversation context
///
/// Ollama endpoint URL (e.g., "http://localhost:11434")
/// Model name (e.g., "phi", "codellama:7b")
/// System prompt defining agent behavior
/// Previous conversation messages for context
/// Current user message to respond to
/// Temperature parameter (0.0 to 2.0)
/// Maximum tokens to generate
/// Cancellation token
/// Response from the model with token counts
Task GenerateAsync(
string endpoint,
string model,
string systemPrompt,
List contextMessages,
string userMessage,
double temperature,
int maxTokens,
CancellationToken cancellationToken = default
);
}
///
/// Response from Ollama generation request
///
public record OllamaResponse
{
///
/// Generated response content
///
public string Content { get; init; } = string.Empty;
///
/// Number of tokens in the input prompt
///
public int? InputTokens { get; init; }
///
/// Number of tokens in the generated output
///
public int? OutputTokens { get; init; }
}