Skip to main content

cognee_lib/api/notebooks/
tutorial.rs

1//! Tutorial notebook seeder — thin re-export from `cognee-database`.
2//!
3//! The actual implementation (including the `include_dir!` bundling of cell
4//! assets) lives in `cognee_database::ops::tutorial_seeder` so that both
5//! `cognee-lib` AND `cognee-http-server` can invoke the seeder without
6//! introducing a dependency on `cognee-lib` from the HTTP server.
7
8pub use cognee_database::{
9    TUTORIAL_BASICS_ID, TUTORIAL_PYTHON_DEV_ID, seed_tutorials_if_first_call,
10};
11
12// ─── Tests ───────────────────────────────────────────────────────────────────
13
14#[cfg(test)]
15mod tests {
16    use super::*;
17    use uuid::Uuid;
18
19    #[test]
20    fn tutorial_ids_are_deterministic() {
21        let basics = Uuid::new_v5(
22            &Uuid::NAMESPACE_OID,
23            "Cognee Basics - tutorial 🧠".as_bytes(),
24        );
25        assert_eq!(
26            basics, TUTORIAL_BASICS_ID,
27            "TUTORIAL_BASICS_ID must match uuid5(NAMESPACE_OID, 'Cognee Basics - tutorial 🧠')"
28        );
29
30        let python_dev = Uuid::new_v5(
31            &Uuid::NAMESPACE_OID,
32            "Python Development with Cognee - tutorial 🧠".as_bytes(),
33        );
34        assert_eq!(
35            python_dev, TUTORIAL_PYTHON_DEV_ID,
36            "TUTORIAL_PYTHON_DEV_ID must match uuid5(NAMESPACE_OID, 'Python Development with Cognee - tutorial 🧠')"
37        );
38    }
39}