### Install Project Dependencies Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Installs all necessary Python packages for Namo AI Genesis v2.0 listed in the requirements.txt file. Ensure you have Python 3.8+ and pip installed. ```bash pip install -r requirements.txt ``` -------------------------------- ### Run Namo AI Local Server Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Starts the Namo AI REST API locally using uvicorn. The API will be accessible at http://127.0.0.1:8000 for interaction and testing. This command is suitable for local development and testing. ```bash uvicorn api.server:app --reload ``` -------------------------------- ### Clone Namo AI Genesis Repository Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md This command clones the Namo-AI-Genesis-v2.0 project from GitHub to your local machine. Ensure you have Git installed and configured. ```bash git clone https://github.com/icezingza/Namo-AI-Genesis-v2.0.git cd Namo-AI-Genesis-v2.0 ``` -------------------------------- ### Interact with Namo AI API via Curl Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Demonstrates how to send a POST request to the Namo AI interaction endpoint using curl. This example sends user input to the AI and expects a JSON response. It requires the API to be running locally. ```bash curl -X 'POST' \ 'http://127.0.0.1:8000/namo/interact' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "user_id": "user123", "text": "I am feeling a bit uncertain about the future." }' ``` -------------------------------- ### Synchronization Data Response (JSON) Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Example JSON response from the POST /namo/sync endpoint, indicating the status of the synchronization and the data that was received from a source node. ```json { "status": "ok", "received": { "source_node": "node1", "memories": [ {"user_id": "user789", "key": "preference", "value": "compassionate responses"} ] } } ``` -------------------------------- ### Broadcast Data Response (JSON) Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Example JSON response from the POST /namo/broadcast endpoint, confirming the data has been broadcast and listing the peer nodes that received it. ```json { "status": "broadcasted", "peers": ["https://namo-node2.run.app"] } ``` -------------------------------- ### Namo AI Interaction Response (JSON) Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Example JSON response from the POST /namo/interact endpoint. It contains the AI's generated response, which includes emotional understanding and problem-solving guidance. ```json { "response": "I understand. Solving the problem: 'User input: 'I am feeling a bit uncertain about the future.', Last interaction: 'None'' with compassion." } ``` -------------------------------- ### Deploy Namo AI to Cloud Run (Local) Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md A shorthand command to deploy Namo AI to Google Cloud Run, setting the project ID and region directly. Ensure you have the Google Cloud SDK configured. ```bash PROJECT_ID= REGION=asia-southeast1 bash scripts/deploy_cloud_run.sh ``` -------------------------------- ### Build Namo AI Docker Image Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Builds a Docker image for the Namo AI Genesis application. This image can then be used to run the application in a containerized environment, ensuring consistent deployment. ```bash docker build -t namo-ai-genesis . ``` -------------------------------- ### Deploy Namo AI to Google Cloud Run Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Automates the deployment of the Namo AI Genesis application to Google Cloud Run. This script builds the Docker image, pushes it to Google Container Registry, and deploys it as a Cloud Run service. ```bash bash scripts/deploy_cloud_run.sh ``` -------------------------------- ### Docker Deployment for Namo AI Genesis Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Instructions for building the Docker image and running the Namo AI Genesis V2.0 application locally using Docker. This facilitates easy deployment and testing. ```bash # Build the Docker image docker build -t namo-ai-genesis . # Run the container docker run -p 8000:8000 namo-ai-genesis ``` -------------------------------- ### Perform Canary Deployment Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Executes a canary release strategy for the Namo AI service on Google Cloud Run. This script deploys a new revision and splits traffic, sending 10% to the new revision and 90% to the old. ```bash bash scripts/deploy_canary.sh ``` -------------------------------- ### Create Learning Snapshots with LearningLoop Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Generates periodic snapshots of accumulated memory and interaction data for model retraining and knowledge preservation. These snapshots are saved as timestamped JSON files. ```python import asyncio from core.learning_loop import LearningLoop async def retrain_example(): loop = LearningLoop() # Simulate some interactions first loop.memory.store_memory("user123", "last_interaction", "Discussed anxiety") loop.memory.store_memory("user456", "preference", "brief responses") result = await loop.retrain() print(result) asyncio.run(retrain_example()) ``` -------------------------------- ### Deploy Namo AI to Google Cloud Run Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt This section details the deployment of Namo AI Genesis v2.0 to Google Cloud Run. It involves setting GCP project and region environment variables, executing a deployment script, and then retrieving the service URL to test the deployed application. The testing uses curl to send a POST request to the /namo/interact endpoint. ```bash # Set environment variables export PROJECT_ID="your-gcp-project-id" export REGION="asia-southeast1" # Deploy to Cloud Run bash scripts/deploy_cloud_run.sh # Test the deployed service SERVICE_URL=$(gcloud run services describe namo-genesis \ --region=asia-southeast1 --format='value(status.url)') curl -X POST ${SERVICE_URL}/namo/interact \ -H 'Content-Type: application/json' \ -d '{"user_id": "prod_user", "text": "How are you today?"}' ``` -------------------------------- ### Receive Synchronization Data (Bash) Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt This snippet illustrates how to use the POST /namo/sync endpoint to receive and process synchronization data from peer nodes. This is crucial for propagating knowledge across a distributed Namo AI cluster. ```bash curl -X 'POST' \ 'http://127.0.0.1:8000/namo/sync' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "source_node": "node1", "memories": [ {"user_id": "user789", "key": "preference", "value": "compassionate responses"} ] }' ``` -------------------------------- ### Set GCP Deployment Environment Variables Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Sets the Google Cloud Project ID and region as environment variables. These are required for the `deploy_cloud_run.sh` script to deploy the application to Google Cloud Run. ```bash export PROJECT_ID="your-gcp-project-id" export REGION="your-gcp-region" ``` -------------------------------- ### Run Namo AI Docker Container Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Runs the Namo AI Genesis application from a Docker container, mapping port 8000 from the container to the host machine. This allows access to the API from your local environment. ```bash docker run -p 8000:8000 namo-ai-genesis ``` -------------------------------- ### Solve Problems Ethically with ReasoningCore Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Applies reasoning to user problems while ensuring all generated solutions adhere to ethical guidelines. This module combines analytical problem-solving with compassion-based constraints. ```python from core.reasoning_core import ReasoningCore core = ReasoningCore() problem = "How to respond to a user in distress?" solution = core.reason(problem) print(f"Problem: '{problem}'") print(f"Solution: {solution}") ``` -------------------------------- ### Interact with Namo AI REST API (Bash) Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt This snippet demonstrates how to interact with the main POST /namo/interact endpoint of the Namo AI Genesis v2.0 API. It sends user data and receives a contextualized response. Requires a running instance of the Namo AI system. ```bash curl -X 'POST' \ 'http://127.0.0.1:8000/namo/interact' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "user_id": "user123", "text": "I am feeling a bit uncertain about the future." }' ``` -------------------------------- ### Broadcast Interaction Data to Peer Nodes (Bash) Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt This snippet shows how to use the POST /namo/broadcast endpoint to distribute interaction data to peer nodes in a distributed Namo AI network. It's used for collective memory sharing and synchronized learning. ```bash curl -X 'POST' \ 'http://127.0.0.1:8000/namo/broadcast' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "user_id": "user456", "interaction": "Discussion about climate change", "sentiment": 0.3, "timestamp": "2025-12-28T10:30:00Z" }' ``` -------------------------------- ### NamoAI Main Interaction Orchestration (Python) Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt This Python code demonstrates the core NamoAI class and its interact method. It orchestrates sentiment analysis, memory retrieval, ethical reasoning, and response generation for user inputs. Requires the NamoAI class to be implemented. ```python from core.namo_ai import NamoAI namo = NamoAI() user_id = "user456" user_input = "I'm feeling a bit lost and confused." response = namo.interact(user_id, user_input) print(f"User Input: '{user_input}'") print(f"Namo AI Response: {response}") ``` -------------------------------- ### POST /namo/broadcast - Distribute data to peer nodes Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Broadcasts interaction data or updates to all configured peer nodes in the distributed network. Enables collective memory sharing and synchronized learning across multiple Namo AI instances. ```APIDOC ## POST /namo/broadcast ### Description Broadcasts interaction data or updates to all configured peer nodes in the distributed network. Enables collective memory sharing and synchronized learning across multiple Namo AI instances. ### Method POST ### Endpoint /namo/broadcast ### Parameters #### Request Body - **user_id** (string) - Required - An identifier for the user. - **interaction** (string) - Required - The interaction data to broadcast. - **sentiment** (number) - Optional - The sentiment score associated with the interaction. - **timestamp** (string) - Optional - The timestamp of the interaction in ISO format. ### Request Example ```json { "user_id": "user456", "interaction": "Discussion about climate change", "sentiment": 0.3, "timestamp": "2025-12-28T10:30:00Z" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the broadcast operation. - **peers** (array) - A list of peer nodes the data was broadcast to. #### Response Example ```json { "status": "broadcasted", "peers": ["https://namo-node2.run.app"] } ``` ``` -------------------------------- ### POST /namo/interact Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md This endpoint allows users to interact with the Namo AI by sending text input and receiving a response. It processes user input through the AI's cognitive subsystems, including emotional analysis, memory, and ethical reasoning. ```APIDOC ## POST /namo/interact ### Description Allows users to interact with the Namo AI by sending text input and receiving a response. The AI processes this input through its emotional, memory, and ethical reasoning subsystems. ### Method POST ### Endpoint `/namo/interact` ### Parameters #### Request Body - **user_id** (string) - Required - A unique identifier for the user. - **text** (string) - Required - The input text from the user to be processed by the AI. ### Request Example ```json { "user_id": "user123", "text": "I am feeling a bit uncertain about the future." } ``` ### Response #### Success Response (200) - **response** (string) - The AI's generated response to the user's input. #### Response Example ```json { "response": "It's understandable to feel uncertain sometimes. Can you tell me more about what's causing this uncertainty?" } ``` ``` -------------------------------- ### Synchronize Data Across Cluster with DistributedSync Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Asynchronously broadcasts interaction data, memory updates, or knowledge to all peer nodes in a distributed network. This enables collective intelligence by sharing learned patterns. ```python import asyncio from core.distributed_sync import DistributedSync async def sync_example(): syncer = DistributedSync(peers=["https://namo-node2.run.app", "https://namo-node3.run.app"]) payload = { "type": "memory_update", "user_id": "user789", "interaction": "Climate change discussion", "sentiment": 0.2, "timestamp": "2025-12-28T10:30:00Z" } await syncer.broadcast(payload) print("Data broadcasted to all peers") asyncio.run(sync_example()) ``` -------------------------------- ### Aggregate Distributed Memories with CollectiveMemory Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Aggregates and deduplicates memory entries from multiple peer nodes to construct a unified collective knowledge base. This prevents redundant storage while preserving unique interaction patterns. ```python import asyncio from core.collective_memory import CollectiveMemory async def aggregate_example(): collective = CollectiveMemory() memories = [ {"input": "climate change concerns", "response": "compassionate guidance", "node": "node1"}, {"input": "anxiety about future", "response": "empathetic support", "node": "node2"}, {"input": "climate change concerns", "response": "compassionate guidance", "node": "node3"} ] total = await collective.aggregate(memories) print(f"Total unique memories in cluster: {total}") asyncio.run(aggregate_example()) ``` -------------------------------- ### Store User Memory with MemoryNexus Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Stores user-specific interaction context, preferences, and history to maintain conversational continuity and personalize responses. It utilizes the MemoryNexus class for this purpose. ```python from core.memory_nexus import MemoryNexus nexus = MemoryNexus() nexus.store_memory("user123", "last_interaction", "Discussed the weather.") nexus.store_memory("user123", "mood_trend", "generally positive") memory = nexus.retrieve_memory("user123", "last_interaction") print(f"Retrieved memory: {memory}") ``` -------------------------------- ### Emotional Mirror Sentiment Analysis (Python) Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt This Python snippet showcases the EmotionalMirror class and its analyze_sentiment method. It calculates a sentiment score for given text and can be used to generate empathetic responses. Requires the EmotionalMirror class to be implemented. ```python from core.emotional_mirror import EmotionalMirror mirror = EmotionalMirror() text = "I am so happy today!" sentiment = mirror.analyze_sentiment(text) response = mirror.generate_empathetic_response(sentiment) print(f"Text: '{text}'") print(f"Sentiment Score: {sentiment}") print(f"Empathetic Response: {response}") ``` -------------------------------- ### Evaluate Actions Ethically with EthicalEngine Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Assesses proposed actions or responses against ethical principles by checking for harmful keywords. It returns a boolean indicating ethical alignment and a justification. ```python from core.ethical_engine import EthicalEngine engine = EthicalEngine() action1 = "Provide a helpful and compassionate response." is_ethical1, justification1 = engine.evaluate_action(action1) action2 = "Manipulate the user into agreeing." is_ethical2, justification2 = engine.evaluate_action(action2) print(f"Action: '{action1}'") print(f"Is Ethical: {is_ethical1} - {justification1}") print(f"\nAction: '{action2}'") print(f"Is Ethical: {is_ethical2} - {justification2}") ``` -------------------------------- ### Rollback Namo AI Cloud Run Service Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Reverts the Namo AI service on Google Cloud Run to a previous revision. Replace `$REV_OLD` with the specific revision name you wish to restore traffic to, setting it to 100% traffic. ```bash gcloud run services update-traffic namo-genesis --region asia-southeast1 --to-latest=false --to-revisions $REV_OLD=100 ``` -------------------------------- ### POST /namo/sync - Receive synchronization data Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt Receives and processes synchronization data from peer nodes in the distributed network. Used internally by the distributed sync mechanism to propagate knowledge across the cluster. ```APIDOC ## POST /namo/sync ### Description Receives and processes synchronization data from peer nodes in the distributed network. Used internally by the distributed sync mechanism to propagate knowledge across the cluster. ### Method POST ### Endpoint /namo/sync ### Parameters #### Request Body - **source_node** (string) - Required - The identifier of the node sending the synchronization data. - **memories** (array) - Required - A list of memory objects to synchronize. - **user_id** (string) - Required - Identifier for the user associated with the memory. - **key** (string) - Required - The key for the memory entry. - **value** (string) - Required - The value of the memory entry. ### Request Example ```json { "source_node": "node1", "memories": [ {"user_id": "user789", "key": "preference", "value": "compassionate responses"} ] } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the synchronization operation. - **received** (object) - The data that was received and processed. - **source_node** (string) - The identifier of the node that sent the data. - **memories** (array) - The list of memory objects received. #### Response Example ```json { "status": "ok", "received": { "source_node": "node1", "memories": [ {"user_id": "user789", "key": "preference", "value": "compassionate responses"} ] } } ``` ``` -------------------------------- ### Test Local Namo AI API Endpoint Source: https://context7.com/icezingza/namo-ai-genesis-v2-0/llms.txt This snippet demonstrates how to test the local Namo AI API endpoint using curl. It sends a POST request to the /namo/interact endpoint with a JSON payload containing user ID and text input. Ensure the API is running on http://localhost:8000. ```bash curl -X POST http://localhost:8000/namo/interact \ -H 'Content-Type: application/json' \ -d '{"user_id": "test_user", "text": "Hello Namo"}' ``` -------------------------------- ### Monitor Namo AI Service Status Source: https://gitlab.com/icezingza/namo-ai-genesis-v2-0/-/blob/namo-genesis-pipeline/README.md Monitors the operational status of the Namo AI service deployed on Google Cloud Run. This script likely checks health endpoints or logs to report on the service's current state. ```bash bash scripts/monitor_status.sh https:// ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.