Expand description
§Anda KIP - Knowledge Interaction Protocol Implementation
A comprehensive Rust implementation of KIP (Knowledge Interaction Protocol) for building sustainable AI knowledge memory systems and enabling sophisticated interactions between Large Language Models (LLMs) and knowledge graphs.
§Overview
🧬 KIP (Knowledge Interaction Protocol) is a knowledge memory interaction protocol designed specifically for Large Language Models (LLMs), aimed at building sustainable learning and self-evolving knowledge memory systems for AI Agents.
This crate provides a complete, type-safe Rust implementation of the KIP specification, offering robust parsing, execution, and communication capabilities for knowledge graph operations.
§Standards Compliance
This implementation follows the official KIP specification. For detailed information about the protocol, syntax, and semantics, please refer to:
§Architecture
The crate is organized into several key modules:
ast: Abstract Syntax Tree definitions for all KIP language constructserror: Comprehensive error types and structured error handlingexecutor: Execution framework with async traits for implementing KIP backendsparser: High-performance nom-based parsers for KQL, KML, and META commandsrequest: Standardized JSON-based request/response structures for communication
§Quick Start
use anda_kip::{parse_kip, Command, Executor, Response};
// Parse a KQL query
let query = parse_kip(r#"
FIND(?drug.name, ?drug.attributes.risk_level)
WHERE {
?drug {type: "Drug"}
?headache {name: "Headache"}
(?drug, "treats", ?headache)
FILTER(?drug.attributes.risk_level < 3)
}
ORDER BY ?drug.attributes.risk_level ASC
LIMIT 10
"#).unwrap();
// Parse a KML statement
let statement = parse_kip(r#"
UPSERT {
CONCEPT ?new_drug {
{ type: "Drug", name: "Aspirin" }
SET ATTRIBUTES {
molecular_formula: "C9H8O4",
risk_level: 1
}
}
}
"#).unwrap();§Examples
For comprehensive examples and usage patterns, see the individual module documentation and the project’s examples directory.
Re-exports§
pub use ast::*;pub use capsule::*;pub use error::*;pub use executor::*;pub use parser::*;pub use request::*;pub use types::*;
Modules§
- ast
- Abstract Syntax Tree definitions for all KIP constructs
- capsule
- KIP Genesis Capsules
- error
- Comprehensive error types and handling
- executor
- Execution framework and traits
- parser
- Nom-based parsers for KQL, KML, and META commands
- request
- Request/Response structures for JSON-based communication
- types
- KIP Entity Types
Statics§
- KIP_
FUNCTION_ DEFINITION - JSON schema definition for the
execute_kipfunction - SELF_
INSTRUCTIONS - SYSTEM_
INSTRUCTIONS