yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
ai_service.h
Go to the documentation of this file.
1#ifndef YAZE_SRC_CLI_SERVICE_AI_AI_SERVICE_H_
2#define YAZE_SRC_CLI_SERVICE_AI_AI_SERVICE_H_
3
4#include <memory>
5#include <string>
6#include <vector>
7
8#include "absl/status/statusor.h"
10
11namespace yaze {
12class Rom;
13
14namespace cli {
15namespace agent {
16struct ChatMessage;
17}
18// Abstract interface for AI services
19class AIService {
20 public:
21 virtual ~AIService() = default;
22
23 // Provide the AI service with the active ROM so prompts can include
24 // project-specific context.
25 virtual void SetRomContext(Rom* rom) { (void)rom; }
26
27 // Generate a response from a single prompt.
28 virtual absl::StatusOr<AgentResponse> GenerateResponse(
29 const std::string& prompt) = 0;
30
31 // Generate a response from a conversation history.
32 virtual absl::StatusOr<AgentResponse> GenerateResponse(
33 const std::vector<agent::ChatMessage>& history) = 0;
34
35 // List available models for this service
36 virtual absl::StatusOr<std::vector<ModelInfo>> ListAvailableModels() {
37 return std::vector<ModelInfo>{};
38 }
39
40 // Get the provider name
41 virtual std::string GetProviderName() const = 0;
42};
43
44// Mock implementation for testing
45class MockAIService : public AIService {
46 public:
47 void SetRomContext(Rom* rom) override { (void)rom; }
48 absl::StatusOr<AgentResponse> GenerateResponse(
49 const std::string& prompt) override;
50 absl::StatusOr<AgentResponse> GenerateResponse(
51 const std::vector<agent::ChatMessage>& history) override;
52
53 std::string GetProviderName() const override { return "mock"; }
54
55 absl::StatusOr<std::vector<ModelInfo>> ListAvailableModels() override {
56 std::vector<ModelInfo> models;
57 models.push_back({.name = "mock-model",
58 .display_name = "Mock Model",
59 .provider = "mock",
60 .description = "A mock model for testing",
61 .is_local = true});
62 return models;
63 }
64};
65
66} // namespace cli
67} // namespace yaze
68
69#endif // YAZE_SRC_CLI_SERVICE_AI_AI_SERVICE_H_
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
virtual std::string GetProviderName() const =0
virtual ~AIService()=default
virtual absl::StatusOr< AgentResponse > GenerateResponse(const std::vector< agent::ChatMessage > &history)=0
virtual absl::StatusOr< AgentResponse > GenerateResponse(const std::string &prompt)=0
virtual absl::StatusOr< std::vector< ModelInfo > > ListAvailableModels()
Definition ai_service.h:36
virtual void SetRomContext(Rom *rom)
Definition ai_service.h:25
void SetRomContext(Rom *rom) override
Definition ai_service.h:47
absl::StatusOr< AgentResponse > GenerateResponse(const std::string &prompt) override
Definition ai_service.cc:91
absl::StatusOr< std::vector< ModelInfo > > ListAvailableModels() override
Definition ai_service.h:55
std::string GetProviderName() const override
Definition ai_service.h:53