Kirk Bowerman
Published © Apache-2.0

The Oracles of Damas

Oracles tell eco-stories & empower action! AI + storytelling gamifies sustainability. Build a greener future with The Nexus!

IntermediateWork in progressOver 14 days108
The Oracles of Damas

Things used in this project

Story

Read more

Schematics

The Oracles of Damas

The Oracles of Damas project primarily focuses on software development and utilizes cloud-based resources for processing and data storage, hence schematics and circuit diagrams wouldn't be applicable in this case.

The project relies on the AMD Ryzen™ AI-enabled mini-PC as the core hardware component, which is a pre-built computer and doesn't require circuit-level design or component selection.

If the project were to incorporate additional sensors in the future for functionalities like environmental monitoring or user interaction detection, then specific schematics and circuit diagrams would be required for those functionalities. However, for the core functionalities of the chatbot, such schematics wouldn't be relevant.

Code

The Oracles of Damas

Python
The provided code snippet represents a core building block for the conversational logic behind The Oracles of Damas chatbots. Here's how it works:

Functionality:

This code utilizes the Rasa framework, a popular open-source platform for building chatbots.
It defines a template for chatbot responses using Rasa's Template class. This template allows for dynamic population with different characters, actions, and benefits based on the conversation context.
The code includes dictionaries containing pre-defined information about characters, actions, goals, benefits, and suggestions related to sustainable practices.
The core function, generate_response, takes user input as input (in this simplified example, it's assumed to be a single word representing an action).
It attempts to match the user input with an action from the available options in the dictionary.
If a match is found, the story template is populated with relevant information retrieved from the corresponding dictionaries (character, action, goal, benefit, suggestion), and the populated template is returned as the chatbot response.
If no match is found, the chatbot provides a generic response acknowledging it's still learning and inviting the user to explore their interests in sustainability.
How to Use:

This code snippet serves as a demonstration of the logic behind the chatbot's responses. In a complete implementation, this code would be integrated into a larger Rasa project with additional functionalities:

Natural Language Processing (NLP): A real-world chatbot would use NLP techniques to understand the intent and meaning behind the user's input, going beyond simple keyword matching. This would involve training the chatbot on a dataset of conversations and user queries related to sustainability.
Dialogue Management: The chatbot would need a dialogue management system to track the conversation flow, remember past interactions, and guide the conversation towards achieving specific goals (e.g., providing information, offering personalized recommendations).
Integration with External Data Sources: The chatbot could be extended to connect with external APIs or databases to access real-time environmental data, local regulations, or personalized recommendations based on the user's location and preferences.
Overall, this code snippet provides a glimpse into the underlying logic of how The Oracles of Damas chatbots would use pre-defined information and story templates to construct dynamic and engaging responses, tailored to the user's input and the ongoing conversation context.
import rasa
from rasa.nlg import Template

# Define story template for chatbot responses
story_template = Template(
    text="In the vibrant solar city of Damas, {character} is {action} to {goal}. This helps to {benefit} the environment. How about you? You could {suggestion} to make a positive impact."
)

# Define actions and goals for different characters
actions = {
    "researching": "learning about sustainable practices",
    "installing": "setting up solar panels",
    "composting": "reducing their food waste",
}

goals = {
    "researching": "become more eco-friendly",
    "installing": "power their home with renewable energy",
    "composting": "enrich their soil and reduce landfill waste",
}

benefits = {
    "researching": "educate yourself and others",
    "installing": "fight climate change and save money on energy bills",
    "composting": "create nutrient-rich fertilizer and reduce greenhouse gas emissions",
}

suggestions = {
    "researching": "look up sustainable living tips online",
    "installing": "contact a local solar panel installer",
    "composting": "start a small compost bin at home",
}


# Function to generate chatbot responses based on user input
def generate_response(user_input):
    # Extract relevant information from user input (replace with actual NLP processing)
    character = "Anya"  # Example character
    action = actions.get(user_input)  # Assuming user input matches an action

    if action:
        # Apply story template with retrieved information
        return story_template.render(
            character=character, action=action, goal=goals[action], benefit=benefits[action], suggestion=suggestions[action]
        )
    else:
        # Handle cases where user input doesn't match an action
        return "I'm still learning, but I'm happy to chat about sustainability! What are you interested in?"

# Example usage
user_input = "composting"
response = generate_response(user_input)
print(response)

Credits

Kirk Bowerman

Kirk Bowerman

1 project • 0 followers

Comments