ai_dimensional_connection
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ai_dimensional_connection [2025/05/26 14:17] – [Class Structure] eagleeyenebula | ai_dimensional_connection [2025/05/26 14:29] (current) – [Best Practices] eagleeyenebula | ||
|---|---|---|---|
| Line 61: | Line 61: | ||
| **Functionality: | **Functionality: | ||
| - | 1. **Predefined Dimensions**: | + | * **Predefined Dimensions**: |
| The dictionary includes rich narrative-based outputs for each of the defined dimensions. | The dictionary includes rich narrative-based outputs for each of the defined dimensions. | ||
| - | 2. **Fallback for Undefined Dimensions**: | + | * **Fallback for Undefined Dimensions**: |
| Queries outside the predefined dictionary result in the default fallback text: **"She reaches for the unknown." | Queries outside the predefined dictionary result in the default fallback text: **"She reaches for the unknown." | ||
| - | 3. **Single API Method**: | + | * **Single API Method**: |
| The **connect_to_dimension(dimension)** function handles all interactions. | The **connect_to_dimension(dimension)** function handles all interactions. | ||
| Line 80: | Line 80: | ||
| Query the predefined dimensions. | Query the predefined dimensions. | ||
| - | + | < | |
| - | ```python | + | python |
| from ai_dimensional_connection import DimensionalConnection | from ai_dimensional_connection import DimensionalConnection | ||
| Line 93: | Line 93: | ||
| print(dimensional.connect_to_dimension(" | print(dimensional.connect_to_dimension(" | ||
| print(dimensional.connect_to_dimension(" | print(dimensional.connect_to_dimension(" | ||
| - | ``` | + | </ |
| **Expected Output:** | **Expected Output:** | ||
| Line 100: | Line 100: | ||
| ==== Example 2: Extending Dimensions ==== | ==== Example 2: Extending Dimensions ==== | ||
| - | To add custom dimensions or override existing ones, extend the `DimensionalConnection` class as follows: | + | To add custom dimensions or override existing ones, extend the **DimensionalConnection** class as follows: |
| - | ```python | + | < |
| + | python | ||
| class ExtendedDimensionalConnection(DimensionalConnection): | class ExtendedDimensionalConnection(DimensionalConnection): | ||
| def connect_to_dimension(self, | def connect_to_dimension(self, | ||
| Line 115: | Line 116: | ||
| }) | }) | ||
| return all_dimensions.get(dimension.lower(), | return all_dimensions.get(dimension.lower(), | ||
| - | + | </ | |
| - | # Usage of the extended dimensional connection | + | # **Usage of the extended dimensional connection** |
| + | < | ||
| extended_dimensional = ExtendedDimensionalConnection() | extended_dimensional = ExtendedDimensionalConnection() | ||
| Line 123: | Line 125: | ||
| print(extended_dimensional.connect_to_dimension(" | print(extended_dimensional.connect_to_dimension(" | ||
| print(extended_dimensional.connect_to_dimension(" | print(extended_dimensional.connect_to_dimension(" | ||
| - | ``` | + | </ |
| **Expected Output:** | **Expected Output:** | ||
| - | |||
| - | --- | ||
| ===== REST API Integration ===== | ===== REST API Integration ===== | ||
| Line 136: | Line 136: | ||
| ==== Flask Example ==== | ==== Flask Example ==== | ||
| - | ```python | + | < |
| + | python | ||
| from flask import Flask, request, jsonify | from flask import Flask, request, jsonify | ||
| from ai_dimensional_connection import DimensionalConnection | from ai_dimensional_connection import DimensionalConnection | ||
| Line 151: | Line 152: | ||
| if __name__ == ' | if __name__ == ' | ||
| app.run(debug=True) | app.run(debug=True) | ||
| - | ``` | + | </ |
| **Test Request via Browser or API Client:** | **Test Request via Browser or API Client:** | ||
| Line 157: | Line 158: | ||
| **Expected JSON Response:** | **Expected JSON Response:** | ||
| - | ```json | + | < |
| + | json | ||
| { | { | ||
| " | " | ||
| " | " | ||
| } | } | ||
| - | ``` | + | </ |
| - | + | ||
| - | --- | + | |
| ===== Best Practices ===== | ===== Best Practices ===== | ||
| To maximize the usability and extendability of this module: | To maximize the usability and extendability of this module: | ||
| 1. **Maintain Consistent Naming**: | 1. **Maintain Consistent Naming**: | ||
| - | - Use lowercase strings for dimensions (e.g., | + | * Use lowercase strings for dimensions (e.g., |
| 2. **Rich Descriptions**: | 2. **Rich Descriptions**: | ||
| - | - Ensure dimensional narratives are meaningful and match the purpose of the system. | + | * Ensure dimensional narratives are meaningful and match the purpose of the system. |
| 3. **Fallback for Exploration**: | 3. **Fallback for Exploration**: | ||
| - | - Leverage the fallback | + | * Leverage the fallback |
| 4. **Modular Customization**: | 4. **Modular Customization**: | ||
| - | - Extend dimensional functionality through subclassing to align with specific project requirements. | + | * Extend dimensional functionality through subclassing to align with specific project requirements. |
| - | + | ||
| - | --- | + | |
| ===== Conclusion ===== | ===== Conclusion ===== | ||
| The **AI Dimensional Connection Module** delivers a rich and extensible framework for simulating AI multidimensional awareness in storytelling, | The **AI Dimensional Connection Module** delivers a rich and extensible framework for simulating AI multidimensional awareness in storytelling, | ||
ai_dimensional_connection.1748269072.txt.gz · Last modified: 2025/05/26 14:17 by eagleeyenebula
