1#ifndef YAZE_AI_RUNTIME_AVAILABLE
3#include "absl/flags/declare.h"
4#include "absl/flags/flag.h"
5#include "absl/status/status.h"
6#include "absl/status/statusor.h"
7#include "absl/strings/ascii.h"
8#include "absl/strings/match.h"
25bool IsLikelyOracleRomPath(::absl::string_view rom_path) {
26 if (rom_path.empty()) {
29 const std::string lowered = ::absl::AsciiStrToLower(std::string(rom_path));
30 return ::absl::StrContains(lowered,
"oracle") ||
31 ::absl::StrContains(lowered,
"oos");
37 AIServiceConfig config;
38 config.
provider = ::absl::GetFlag(FLAGS_ai_provider);
39 config.model = ::absl::GetFlag(FLAGS_ai_model);
40 config.gemini_api_key = ::absl::GetFlag(FLAGS_gemini_api_key);
41 config.anthropic_api_key = ::absl::GetFlag(FLAGS_anthropic_api_key);
42 config.ollama_host = ::absl::GetFlag(FLAGS_ollama_host);
43 config.openai_base_url = ::absl::GetFlag(FLAGS_openai_base_url);
44 config.rom_path_hint = ::absl::GetFlag(FLAGS_rom);
49 if (config.rom_context !=
nullptr &&
50 IsLikelyOracleRomPath(config.rom_context->filename())) {
59 const AIServiceConfig& base_config) {
60 if (base_config.provider.empty() || base_config.provider ==
kProviderAuto) {
67 return std::make_unique<MockAIService>();
71 return std::make_unique<MockAIService>();
75 const AIServiceConfig&) {
76 return ::absl::FailedPreconditionError(
77 "AI runtime features are disabled in this build");
bool IsLikelyOracleRomPath(absl::string_view rom_path)
Namespace for the command line interface.
std::unique_ptr< AIService > CreateAIService()
AgentPromptProfile DetectPromptProfile(const AIServiceConfig &config)
absl::StatusOr< std::unique_ptr< AIService > > CreateAIServiceStrict(const AIServiceConfig &config)
constexpr char kProviderAuto[]
AIServiceConfig BuildAIServiceConfigFromFlags()
std::vector< AIServiceConfig > DiscoverModelRegistryConfigs(const AIServiceConfig &base_config)
ABSL_DECLARE_FLAG(std::string, ai_provider)