Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
Delete cookbook/introduction/02_Configuration_Basics.ipynb
Mohd Kaifb88dcaf79321
diff --git a/cookbook/introduction/02_Configuration_Basics.ipynb b/cookbook/introduction/02_Configuration_Basics.ipynbdeleted file mode 100644index bf3dea48..00000000--- a/cookbook/introduction/02_Configuration_Basics.ipynb+++ /dev/null@@ -1,214 +0,0 @@-{- "cells": [- {- "cell_type": "markdown",- "metadata": {},- "source": [- "[](https://colab.research.google.com/github/Hawksight-AI/semantica/blob/main/cookbook/introduction/02_Configuration_Basics.ipynb)\n",- "\n",- "# Configuration Basics\n",- "\n",- "## Overview\n",- "\n",- "This notebook teaches you how to configure Semantica using `ConfigManager`, environment variables, and configuration files. Proper configuration is essential for using Semantica effectively.\n",- "\n",- "**Documentation**: [Core API Reference](https://semantica.readthedocs.io/reference/core/) • [Installation Guide](https://semantica.readthedocs.io/installation/)\n",- "\n",- "### Learning Objectives\n",- "\n",- "- Understand how to use `ConfigManager` for configuration management\n",- "- Learn to set and use environment variables\n",- "- Create and load configuration files (YAML/JSON)\n",- "- Configure common settings for API keys, models, and processing\n",- "- Follow best practices for configuration management\n",- "\n",- "## Installation\n",- "\n",- "Install Semantica from PyPI:\n",- "\n",- "```bash\n",- "pip install semantica\n",- "# Or with all optional dependencies:\n",- "pip install semantica[all]\n",- "```\n",- "\n",- "This notebook teaches you how to configure Semantica using `ConfigManager`, environment variables, and configuration files. Proper configuration is essential for using Semantica effectively.\n",- "\n",- "**Documentation**: [Core API Reference](https://semantica.readthedocs.io/reference/core/) • [Installation Guide](https://semantica.readthedocs.io/installation/)\n",- "\n",- "### Learning Objectives\n",- "\n",- "- Understand how to use `ConfigManager` for configuration management\n",- "- Learn to set and use environment variables\n",- "- Create and load configuration files (YAML/JSON)\n",- "- Configure common settings for API keys, models, and processing\n",- "- Follow best practices for configuration management\n",- "\n",- "---\n",- "\n",- "## Configuration Methods\n",- "\n",- "Semantica supports three main configuration methods:\n",- "\n",- "1. **ConfigManager** - Programmatic configuration management\n",- "2. **Environment Variables** - For sensitive data like API keys\n",- "3. **Config Files** - YAML or JSON files for structured configuration\n",- "\n",- "Each method is demonstrated in the code cells below.\n",- "\n",- "---\n",- "\n",- "## Step 1: ConfigManager Basics\n",- "\n",- "`ConfigManager` is the primary way to manage configuration in Semantica. It provides a unified interface for loading and accessing configuration values.\n"- ]- },- {- "cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],- "source": [- "from semantica.core import ConfigManager\n",- "\n",- "config_manager = ConfigManager()\n",- "config_manager\n"- ]- },- {- "cell_type": "markdown",- "metadata": {},- "source": [- "## Step 2: Environment Variables\n",- "\n",- "Environment variables are the recommended way to store sensitive information like API keys. They're secure and don't get committed to version control.\n"- ]- },- {- "cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],- "source": [- "import os\n",- "\n",- "# Set environment variables (uncomment to use)\n",- "# os.environ['SEMANTICA_API_KEY'] = 'your_openai_key'\n",- "# os.environ['SEMANTICA_MODEL_NAME'] = 'gpt-4'\n",- "\n",- "api_key = os.getenv(\"SEMANTICA_API_KEY\")\n",- "model_name = os.getenv(\"SEMANTICA_MODEL_NAME\", \"default-model\")\n",- "\n",- "api_key is not None, model_name\n"- ]- },- {- "cell_type": "markdown",- "metadata": {},- "source": [- "## Step 3: Configuration Files\n",- "\n",- "Configuration files (YAML or JSON) are great for storing non-sensitive settings like model names, batch sizes, and processing parameters. They provide a structured way to manage configuration.\n"- ]- },- {- "cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],- "source": [- "from pathlib import Path\n",- "\n",- "# Example: Create a config file\n",- "sample_config = {\n",- " \"api_keys\": {\n",- " \"openai\": \"your_openai_key_here\"\n",- " },\n",- " \"llm_provider\": {\n",- " \"provider\": \"openai\",\n",- " \"model\": \"gpt-4\",\n",- " \"temperature\": 0.7\n",- " },\n",- " \"embedding\": {\n",- " \"provider\": \"openai\",\n",- " \"model\": \"text-embedding-3-large\",\n",- " \"dimensions\": 3072\n",- " }\n",- "}\n",- "\n",- "# Load from file (if exists)\n",- "# config = config_manager.load_from_file(\"config.yaml\")\n"- ]- },- {- "cell_type": "markdown",- "metadata": {},- "source": [- "## Step 4: Common Settings\n",- "\n",- "This section covers the most commonly used configuration settings, including API keys, model parameters, embedding settings, and processing options.\n"- ]- },- {- "cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],- "source": [- "from semantica.core import Config\n",- "\n",- "# Example: Create custom configuration\n",- "custom_config_dict = {\n",- " \"llm_provider\": {\n",- " \"provider\": \"openai\",\n",- " \"model\": \"gpt-4\",\n",- " \"temperature\": 0.7\n",- " },\n",- " \"embedding\": {\n",- " \"provider\": \"openai\",\n",- " \"model\": \"text-embedding-3-large\",\n",- " \"dimensions\": 3072\n",- " },\n",- " \"processing\": {\n",- " \"batch_size\": 32,\n",- " \"max_workers\": 4\n",- " }\n",- "}\n",- "\n",- "custom_config = Config(config_dict=custom_config_dict)\n",- "custom_config\n"- ]- },- {- "cell_type": "markdown",- "metadata": {},- "source": [- "## Step 5: Best Practices\n",- "\n",- "Follow these best practices to ensure secure, maintainable, and effective configuration management.\n"- ]- },- {- "cell_type": "code",- "execution_count": null,- "metadata": {},- "outputs": [],- "source": [- "# Check required configuration\n",- "required_settings = {\n",- " \"API Key\": os.getenv(\"SEMANTICA_API_KEY\"),\n",- " \"Model Name\": os.getenv(\"SEMANTICA_MODEL_NAME\", \"default\"),\n",- "}\n",- "\n",- "{name: (value is not None and value != \"default\") for name, value in required_settings.items()}\n"- ]- }- ],- "metadata": {- "language_info": {- "name": "python"- }- },- "nbformat": 4,- "nbformat_minor": 2-}