{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/OllamaService.php",
"limit": 60
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/AI\/OllamaService.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\AI;\n\nuse RuntimeException;\n\n\/**\n * Service for interacting with Ollama API for embeddings and text generation.\n *\n * Provides methods to:\n * - Generate embeddings from text using models like mxbai-embed-large\n * - Generate text responses using LLMs like gemma3:4b-it-qat\n * - Check API availability and health status\n *\n * This service uses cURL for HTTP requests without external dependencies.\n * All methods include proper timeout handling and exception management.\n *\n * @package Infrastructure\\AI\n * @author System Generated\n * @version 1.0.0\n *\/\nfinal readonly class OllamaService\n{\n \/**\n * Default timeout for HTTP requests in seconds.\n *\/\n private const int DEFAULT_TIMEOUT = 60;\n\n \/**\n * Health check timeout in seconds.\n *\/\n private const int HEALTH_CHECK_TIMEOUT = 5;\n\n \/**\n * Constructs a new OllamaService instance.\n *\n * @param string $host The Ollama API host URL (default: http:\/\/localhost:11434)\n *\/\n public function __construct(\n private string $host = 'http:\/\/localhost:11434'\n ) {\n }\n\n \/**\n * Generates an embedding vector for the given text.\n *\n * Uses the specified model to convert text into a numerical vector representation.\n * The default model mxbai-embed-large produces 1024-dimensional embeddings.\n *\n * @param string $text The text to embed\n * @param string $model The embedding model to use (default: mxbai-embed-large)\n *\n * @return array<int, float> The embedding vector as an array of floats\n *\n * @throws RuntimeException If the API request fails or returns invalid data\n *\n * @example\n * $service = new OllamaService();",
"numLines": 60,
"startLine": 1,
"totalLines": 240
}
}
}