yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
ollama_ai_service.h
Go to the documentation of this file.
1#ifndef YAZE_SRC_CLI_OLLAMA_AI_SERVICE_H_
2#define YAZE_SRC_CLI_OLLAMA_AI_SERVICE_H_
3
4#include <string>
5#include <vector>
6
7#include "absl/status/status.h"
8#include "absl/status/statusor.h"
11
12namespace yaze {
13namespace cli {
14
15// Ollama configuration for local LLM inference
17 std::string base_url = "http://localhost:11434"; // Default Ollama endpoint
18 std::string model = "qwen2.5-coder:7b"; // Recommended for code generation
19 float temperature = 0.1; // Low temp for deterministic commands
20 int max_tokens = 2048; // Sufficient for command lists
21 std::string system_prompt; // Injected from resource catalogue
22 bool use_enhanced_prompting = true; // Enable few-shot examples
23};
24
25class OllamaAIService : public AIService {
26 public:
27 explicit OllamaAIService(const OllamaConfig& config);
28
29 void SetRomContext(Rom* rom) override;
30
31 // Generate z3ed commands from natural language prompt
32 absl::StatusOr<AgentResponse> GenerateResponse(
33 const std::string& prompt) override;
34 absl::StatusOr<AgentResponse> GenerateResponse(
35 const std::vector<agent::ChatMessage>& history) override;
36
37 // Health check: verify Ollama server is running and model is available
38 absl::Status CheckAvailability();
39
40 // List available models on Ollama server
41 absl::StatusOr<std::vector<std::string>> ListAvailableModels();
42
43 private:
46
47 // Build system prompt from resource catalogue
48 std::string BuildSystemPrompt();
49
50 // Parse JSON response from Ollama API
51 absl::StatusOr<std::string> ParseOllamaResponse(const std::string& json_response);
52};
53
54} // namespace cli
55} // namespace yaze
56
57#endif // YAZE_SRC_CLI_OLLAMA_AI_SERVICE_H_
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
void SetRomContext(Rom *rom) override
absl::StatusOr< AgentResponse > GenerateResponse(const std::string &prompt) override
absl::StatusOr< std::vector< std::string > > ListAvailableModels()
absl::StatusOr< std::string > ParseOllamaResponse(const std::string &json_response)
Main namespace for the application.