1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//! # 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:
//!
//! **👉 [KIP Specification](https://github.com/ldclabs/KIP)**
//!
//! ## Architecture
//!
//! The crate is organized into several key modules:
//!
//! - [`ast`]: Abstract Syntax Tree definitions for all KIP language constructs
//! - [`error`]: Comprehensive error types and structured error handling
//! - [`executor`]: Execution framework with async traits for implementing KIP backends
//! - [`parser`]: High-performance nom-based parsers for KQL, KML, and META commands
//! - [`request`]: Standardized JSON-based request/response structures for communication
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! 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.
use LazyLock;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub static SELF_INSTRUCTIONS: &str = include_str!;
pub static SYSTEM_INSTRUCTIONS: &str = include_str!;
/// JSON schema definition for the `execute_kip` function
pub static KIP_FUNCTION_DEFINITION: =
new;