Skip to main content

poe2_agent/
knowledge.rs

1//! Pre-summarized PoE2 game knowledge for LLM context.
2//!
3//! Provides curated summaries of game mechanics optimized
4//! for inclusion in LLM prompts.
5
6use serde::{Deserialize, Serialize};
7use std::collections::HashMap;
8
9/// Knowledge base containing all summarized concepts.
10#[derive(Debug, Default, Serialize, Deserialize)]
11pub struct KnowledgeBase {
12    pub damage_types: Vec<DamageType>,
13    pub defense_layers: Vec<DefenseLayer>,
14    pub skill_tags: Vec<SkillTag>,
15    pub classes: Vec<ClassInfo>,
16    pub archetypes: Vec<BuildArchetype>,
17}
18
19#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct DamageType {
21    pub name: String,
22    pub description: String,
23    pub scaling_stats: Vec<String>,
24    pub conversion_sources: Vec<String>,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct DefenseLayer {
29    pub name: String,
30    pub description: String,
31    pub effective_against: Vec<String>,
32    pub sources: Vec<String>,
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
36pub struct SkillTag {
37    pub name: String,
38    pub description: String,
39    pub affected_by: Vec<String>,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
43pub struct ClassInfo {
44    pub name: String,
45    pub base_stats: HashMap<String, i32>,
46    pub ascendancies: Vec<AscendancyInfo>,
47    pub typical_archetypes: Vec<String>,
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
51pub struct AscendancyInfo {
52    pub name: String,
53    pub description: String,
54    pub key_nodes: Vec<String>,
55}
56
57#[derive(Debug, Clone, Serialize, Deserialize)]
58pub struct BuildArchetype {
59    pub name: String,
60    pub description: String,
61    pub typical_skills: Vec<String>,
62    pub key_uniques: Vec<String>,
63    pub defense_priorities: Vec<String>,
64}
65
66impl KnowledgeBase {
67    /// Load the knowledge base from embedded data.
68    pub fn load() -> Self {
69        // TODO: Load from embedded JSON or build at compile time
70        Self::default()
71    }
72
73    /// Get a summary for a specific topic.
74    pub fn get_summary(&self, topic: &str) -> Option<String> {
75        // TODO: Generate contextual summary for the topic
76        match topic.to_lowercase().as_str() {
77            "damage" => Some(self.summarize_damage_types()),
78            "defense" => Some(self.summarize_defenses()),
79            _ => None,
80        }
81    }
82
83    fn summarize_damage_types(&self) -> String {
84        // TODO: Generate LLM-friendly summary
85        "Damage types: Physical, Fire, Cold, Lightning, Chaos".to_owned()
86    }
87
88    fn summarize_defenses(&self) -> String {
89        // TODO: Generate LLM-friendly summary
90        "Defense layers: Life, ES, Armour, Evasion, Resistances, Block".to_owned()
91    }
92
93    /// Get context for a build prompt.
94    pub fn get_build_context(&self, _prompt: &str) -> String {
95        // TODO: Analyze prompt and return relevant knowledge
96        String::new()
97    }
98}