dialectical-framework 0.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dialectical_framework-0.4.4/LICENSE +21 -0
- dialectical_framework-0.4.4/PKG-INFO +123 -0
- dialectical_framework-0.4.4/README.md +97 -0
- dialectical_framework-0.4.4/pyproject.toml +64 -0
- dialectical_framework-0.4.4/src/dialectical_framework/__init__.py +43 -0
- dialectical_framework-0.4.4/src/dialectical_framework/ai_dto/__init__.py +0 -0
- dialectical_framework-0.4.4/src/dialectical_framework/ai_dto/causal_cycle_assessment_dto.py +16 -0
- dialectical_framework-0.4.4/src/dialectical_framework/ai_dto/causal_cycle_dto.py +16 -0
- dialectical_framework-0.4.4/src/dialectical_framework/ai_dto/causal_cycles_deck_dto.py +11 -0
- dialectical_framework-0.4.4/src/dialectical_framework/ai_dto/dialectical_component_dto.py +16 -0
- dialectical_framework-0.4.4/src/dialectical_framework/ai_dto/dialectical_components_deck_dto.py +12 -0
- dialectical_framework-0.4.4/src/dialectical_framework/ai_dto/dto_mapper.py +103 -0
- dialectical_framework-0.4.4/src/dialectical_framework/ai_dto/reciprocal_solution_dto.py +24 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/__init__.py +1 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/audit/__init__.py +0 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/consultant.py +30 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/decorator_action_reflection.py +28 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/decorator_discrete_spiral.py +30 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/__init__.py +0 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/assessable_cycle.py +128 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/cycle.py +133 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/interpretation.py +16 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/rationale.py +116 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/spiral.py +47 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/transformation.py +24 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/transition.py +160 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/transition_cell_to_cell.py +29 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/domain/transition_segment_to_segment.py +16 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/strategic_consultant.py +32 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/think_action_reflection.py +217 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/think_constructive_convergence.py +87 -0
- dialectical_framework-0.4.4/src/dialectical_framework/analyst/wheel_builder_transition_calculator.py +157 -0
- dialectical_framework-0.4.4/src/dialectical_framework/brain.py +81 -0
- dialectical_framework-0.4.4/src/dialectical_framework/dialectical_analysis.py +14 -0
- dialectical_framework-0.4.4/src/dialectical_framework/dialectical_component.py +111 -0
- dialectical_framework-0.4.4/src/dialectical_framework/dialectical_components_deck.py +48 -0
- dialectical_framework-0.4.4/src/dialectical_framework/dialectical_reasoning.py +105 -0
- dialectical_framework-0.4.4/src/dialectical_framework/directed_graph.py +419 -0
- dialectical_framework-0.4.4/src/dialectical_framework/enums/__init__.py +0 -0
- dialectical_framework-0.4.4/src/dialectical_framework/enums/causality_type.py +10 -0
- dialectical_framework-0.4.4/src/dialectical_framework/enums/di.py +11 -0
- dialectical_framework-0.4.4/src/dialectical_framework/enums/dialectical_reasoning_mode.py +9 -0
- dialectical_framework-0.4.4/src/dialectical_framework/enums/predicate.py +9 -0
- dialectical_framework-0.4.4/src/dialectical_framework/protocols/__init__.py +0 -0
- dialectical_framework-0.4.4/src/dialectical_framework/protocols/assessable.py +141 -0
- dialectical_framework-0.4.4/src/dialectical_framework/protocols/causality_sequencer.py +111 -0
- dialectical_framework-0.4.4/src/dialectical_framework/protocols/content_fidelity_evaluator.py +16 -0
- dialectical_framework-0.4.4/src/dialectical_framework/protocols/has_brain.py +18 -0
- dialectical_framework-0.4.4/src/dialectical_framework/protocols/has_config.py +18 -0
- dialectical_framework-0.4.4/src/dialectical_framework/protocols/ratable.py +79 -0
- dialectical_framework-0.4.4/src/dialectical_framework/protocols/reloadable.py +7 -0
- dialectical_framework-0.4.4/src/dialectical_framework/protocols/thesis_extractor.py +15 -0
- dialectical_framework-0.4.4/src/dialectical_framework/settings.py +77 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesis.py +7 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/__init__.py +1 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/causality/__init__.py +0 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/causality/causality_sequencer_balanced.py +398 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/causality/causality_sequencer_desirable.py +55 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/causality/causality_sequencer_feasible.py +55 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/causality/causality_sequencer_realistic.py +56 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/concepts/__init__.py +0 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/concepts/thesis_extractor_basic.py +135 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/polarity/__init__.py +0 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/polarity/polarity_reasoner.py +700 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/polarity/reason_blind.py +62 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/polarity/reason_conversational.py +91 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/polarity/reason_fast.py +177 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/polarity/reason_fast_and_simple.py +52 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/polarity/reason_fast_polarized_conflict.py +55 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/reverse_engineer.py +401 -0
- dialectical_framework-0.4.4/src/dialectical_framework/synthesist/wheel_builder.py +337 -0
- dialectical_framework-0.4.4/src/dialectical_framework/utils/__init__.py +1 -0
- dialectical_framework-0.4.4/src/dialectical_framework/utils/dc_replace.py +42 -0
- dialectical_framework-0.4.4/src/dialectical_framework/utils/decompose_probability_uniformly.py +15 -0
- dialectical_framework-0.4.4/src/dialectical_framework/utils/extend_tpl.py +12 -0
- dialectical_framework-0.4.4/src/dialectical_framework/utils/gm.py +12 -0
- dialectical_framework-0.4.4/src/dialectical_framework/utils/is_async.py +13 -0
- dialectical_framework-0.4.4/src/dialectical_framework/utils/use_brain.py +80 -0
- dialectical_framework-0.4.4/src/dialectical_framework/validator/__init__.py +1 -0
- dialectical_framework-0.4.4/src/dialectical_framework/validator/basic_checks.py +75 -0
- dialectical_framework-0.4.4/src/dialectical_framework/validator/check.py +12 -0
- dialectical_framework-0.4.4/src/dialectical_framework/wheel.py +395 -0
- dialectical_framework-0.4.4/src/dialectical_framework/wheel_segment.py +203 -0
- dialectical_framework-0.4.4/src/dialectical_framework/wisdom_unit.py +185 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Dialexity
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,123 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: dialectical-framework
|
3
|
+
Version: 0.4.4
|
4
|
+
Summary: A dialectical framework for augmented intelligence. AI reasoning powered with dialectics supports humans in: system optimization (psychology, engineering, business, politics, etc.); dispute resolution (mediation, conflicts, negotiations, etc.); decision-making (dilemmas, challenging situations, win-win, etc.).
|
5
|
+
License: MIT
|
6
|
+
Keywords: dialectics,reasoning,ai,philosophy,logic
|
7
|
+
Author: Evaldas Taroza
|
8
|
+
Author-email: evaldas@dialexity.com
|
9
|
+
Requires-Python: >=3.11,<4.0
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
19
|
+
Requires-Dist: dependency-injector (>=4.48.1,<5.0.0)
|
20
|
+
Requires-Dist: mirascope[anthropic,azure,bedrock,langfuse,litellm,openai,tenacity] (>=1.25.6,<2.0.0)
|
21
|
+
Requires-Dist: python-dotenv (>=1.1.1,<2.0.0)
|
22
|
+
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
|
23
|
+
Project-URL: Homepage, https://github.com/dialexity/dialectical-framework
|
24
|
+
Project-URL: Repository, https://github.com/dialexity/dialectical-framework
|
25
|
+
Description-Content-Type: text/markdown
|
26
|
+
|
27
|
+
# Dialectical Framework
|
28
|
+
Turn stories, strategies, or systems into insight. Auto-generate Dialectical Wheels (DWs) from any text to reveal blind spots, surface polarities, and trace dynamic paths toward synthesis.
|
29
|
+
DWs are semantic maps that expose tension, transformation, and coherence within a system—whether narrative, ethical, organizational, or technological.
|
30
|
+
|
31
|
+
## What It Does:
|
32
|
+
- Converts natural language into Dialectical Wheels (DWs)
|
33
|
+
- Highlights thesis–antithesis tensions and feedback loops
|
34
|
+
- Reveals overlooked leverage points and systemic blind-spots
|
35
|
+
- Maps decisions, ethics, or mindsets across dialectical structures
|
36
|
+
|
37
|
+
## Built for:
|
38
|
+
- Systems optimization
|
39
|
+
- Wisdom mining & decision diagnostics
|
40
|
+
- Augmented intelligence / narrative AI
|
41
|
+
- Ethical modeling & polarity navigation
|
42
|
+
|
43
|
+
## Useful for:
|
44
|
+
- Consultants, coaches, facilitators, and system designers
|
45
|
+
- Storytellers, educators, and regenerative thinkers
|
46
|
+
- Strategists, SDD/BIMA practitioners, values-driven innovators
|
47
|
+
|
48
|
+
## Learn more:
|
49
|
+
- [Dialectical Wheels Overview](https://dialexity.com/blog/dialectical-wheels-for-systems-optimization/)
|
50
|
+
- [Wisdom Mining & Tokenomics](https://dialexity.com/blog/dialectical-token-dlt/)
|
51
|
+
- [Dialectical Ethics](https://dialexity.com/blog/dialectical-ethics/)
|
52
|
+
- [Earlier Work](https://dialexity.com/blog/wp-content/uploads/2023/11/Moral-Wisdom-from-Ontology-1.pdf)
|
53
|
+
|
54
|
+
# Development
|
55
|
+
|
56
|
+
## Contributors Welcome!
|
57
|
+
|
58
|
+
We invite developers, philosophers, cognitive scientists, and regenerative ecosystem builders to co-create with us.
|
59
|
+
|
60
|
+
## Setup
|
61
|
+
|
62
|
+
Behind the scenes we heavily rely on [Mirascope](https://mirascope.com/)
|
63
|
+
|
64
|
+
## Environment Variables
|
65
|
+
|
66
|
+
| Variable Name | Description | Example Value |
|
67
|
+
|----------------------------------|--------------------------------------|---------------|
|
68
|
+
| DIALEXITY_DEFAULT_MODEL | Default model name for the framework | gpt-4 |
|
69
|
+
| DIALEXITY_DEFAULT_MODEL_PROVIDER | Model provider (required) | openai |
|
70
|
+
|
71
|
+
You can store these in a `.env` file or export them in your environment.
|
72
|
+
|
73
|
+
These will specify the default "brain" for your reasoning.
|
74
|
+
|
75
|
+
## Architecture
|
76
|
+
|
77
|
+
At the core of the dialectical framework is a dialectical wheel. It is a fancy semantic graph where nodes are statements or concepts and edges are relationships such as "opposite of," "complementary to," etc. To make the graph more readable, it's depicted as a 2D wheel.
|
78
|
+
|
79
|
+
| Simple | More Complicated |
|
80
|
+
|-----------------------------------------------------|------------------------------------------------------|
|
81
|
+
|  |  |
|
82
|
+
|
83
|
+
The main architectural parts are:
|
84
|
+
- Wheel
|
85
|
+
- Wheel Segment
|
86
|
+
- Wisdom Unit
|
87
|
+
- Dialectical Component
|
88
|
+
- Transition
|
89
|
+
|
90
|
+
|
91
|
+
**Wheel** is composed of segments. Think of a dialectical wheel as a pizza, a segment is a slice of pizza. In the simplest case it represents some thesis (a statement, a concept, an action, a thought, an idea, etc.). A thesis can have positive and negative things related to it. Hence, a segment of a wheel is composed of these dialectical components: a thesis (T), positive side of that thesis (T+) and a negative side of that thesis (T-). In more detailed wheels, a segment could have more than 3 layers.
|
92
|
+
|
93
|
+
If we take two opposite segments, we get the basic (and the most important) structure: **Wisdom Unit** (half-wheel, verified by diagonal constraints: control statements). It's composed of:
|
94
|
+
|
95
|
+
| Dialectical Component | Description |
|
96
|
+
|-----------------------|----------------------------------|
|
97
|
+
| T- | Negative side of the main thesis |
|
98
|
+
| T | The thesis |
|
99
|
+
| T+ | Positive side of the main thesis |
|
100
|
+
| A+ | Positive side of the antithesis |
|
101
|
+
| A | The antithesis |
|
102
|
+
| A- | Negative side of the antithesis |
|
103
|
+
|
104
|
+
In a Wheel, segments next to each other are related. We wrap that relationship into a **Transition**. Practically, a Transition is a recipe for how to go from one segment to another in a way that we approach synthesis. Essentially, it shows how the negative side of a given thesis (Tn-) converts into the positive side of the following thesis (T(n+1)+). If we were to look at a wheel as a sliced pizza, the lines that separate the slices would be Transitions.
|
105
|
+
|
106
|
+
If we derive Transitions in a Wheel with only 2 segments (aka half-wheel), they are symmetrical and represent a special kind of Wisdom Unit, we call it Action (Ac) and Reflection (Re). As any Wisdom Unit, Action and Reflection must be verified by diagonal constraints as well.
|
107
|
+
|
108
|
+
## Prototyping & App Ideas
|
109
|
+
|
110
|
+
### Simple Win-Win Finder
|
111
|
+

|
112
|
+
|
113
|
+
### Eye-Opener
|
114
|
+
Working beta product [Eye Opener](https://app.dialexity.com/aiapps/eye-opener). It's a tool that analyzes text and generates a visual map of its underlying structure and hidden assumptions. The core feature is a graph-like interface we call the Dialectical Wheel, that shows the delayed dialectical responses ("blind spots").
|
115
|
+
|
116
|
+
### Argument Inspector
|
117
|
+
Working beta product [Argument Inspector](https://dialexity.com/start). Useful for analysts and mediators/facilitators to deeper understand the case.
|
118
|
+
|
119
|
+
### Atlas of Feelings
|
120
|
+
[The Atlas of Feelings](https://dialexity.com/blog/atlas-of-feelings-character-qualities/) is the Plutchik's wheel converted into the „vortex“ model, whereby the most gentle emotions are inside of the wheel, whereas the rudest are outside. As everything is interconnected with dialectical rules, we can understand human nature better.
|
121
|
+
|
122
|
+
### "Spiral" Lila game
|
123
|
+
In [this blog post](https://dialexity.com/blog/spiral-lila-with-character-traits/) we explain how the ancient Lila (Leela) game has been elevated to a new level.
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# Dialectical Framework
|
2
|
+
Turn stories, strategies, or systems into insight. Auto-generate Dialectical Wheels (DWs) from any text to reveal blind spots, surface polarities, and trace dynamic paths toward synthesis.
|
3
|
+
DWs are semantic maps that expose tension, transformation, and coherence within a system—whether narrative, ethical, organizational, or technological.
|
4
|
+
|
5
|
+
## What It Does:
|
6
|
+
- Converts natural language into Dialectical Wheels (DWs)
|
7
|
+
- Highlights thesis–antithesis tensions and feedback loops
|
8
|
+
- Reveals overlooked leverage points and systemic blind-spots
|
9
|
+
- Maps decisions, ethics, or mindsets across dialectical structures
|
10
|
+
|
11
|
+
## Built for:
|
12
|
+
- Systems optimization
|
13
|
+
- Wisdom mining & decision diagnostics
|
14
|
+
- Augmented intelligence / narrative AI
|
15
|
+
- Ethical modeling & polarity navigation
|
16
|
+
|
17
|
+
## Useful for:
|
18
|
+
- Consultants, coaches, facilitators, and system designers
|
19
|
+
- Storytellers, educators, and regenerative thinkers
|
20
|
+
- Strategists, SDD/BIMA practitioners, values-driven innovators
|
21
|
+
|
22
|
+
## Learn more:
|
23
|
+
- [Dialectical Wheels Overview](https://dialexity.com/blog/dialectical-wheels-for-systems-optimization/)
|
24
|
+
- [Wisdom Mining & Tokenomics](https://dialexity.com/blog/dialectical-token-dlt/)
|
25
|
+
- [Dialectical Ethics](https://dialexity.com/blog/dialectical-ethics/)
|
26
|
+
- [Earlier Work](https://dialexity.com/blog/wp-content/uploads/2023/11/Moral-Wisdom-from-Ontology-1.pdf)
|
27
|
+
|
28
|
+
# Development
|
29
|
+
|
30
|
+
## Contributors Welcome!
|
31
|
+
|
32
|
+
We invite developers, philosophers, cognitive scientists, and regenerative ecosystem builders to co-create with us.
|
33
|
+
|
34
|
+
## Setup
|
35
|
+
|
36
|
+
Behind the scenes we heavily rely on [Mirascope](https://mirascope.com/)
|
37
|
+
|
38
|
+
## Environment Variables
|
39
|
+
|
40
|
+
| Variable Name | Description | Example Value |
|
41
|
+
|----------------------------------|--------------------------------------|---------------|
|
42
|
+
| DIALEXITY_DEFAULT_MODEL | Default model name for the framework | gpt-4 |
|
43
|
+
| DIALEXITY_DEFAULT_MODEL_PROVIDER | Model provider (required) | openai |
|
44
|
+
|
45
|
+
You can store these in a `.env` file or export them in your environment.
|
46
|
+
|
47
|
+
These will specify the default "brain" for your reasoning.
|
48
|
+
|
49
|
+
## Architecture
|
50
|
+
|
51
|
+
At the core of the dialectical framework is a dialectical wheel. It is a fancy semantic graph where nodes are statements or concepts and edges are relationships such as "opposite of," "complementary to," etc. To make the graph more readable, it's depicted as a 2D wheel.
|
52
|
+
|
53
|
+
| Simple | More Complicated |
|
54
|
+
|-----------------------------------------------------|------------------------------------------------------|
|
55
|
+
|  |  |
|
56
|
+
|
57
|
+
The main architectural parts are:
|
58
|
+
- Wheel
|
59
|
+
- Wheel Segment
|
60
|
+
- Wisdom Unit
|
61
|
+
- Dialectical Component
|
62
|
+
- Transition
|
63
|
+
|
64
|
+
|
65
|
+
**Wheel** is composed of segments. Think of a dialectical wheel as a pizza, a segment is a slice of pizza. In the simplest case it represents some thesis (a statement, a concept, an action, a thought, an idea, etc.). A thesis can have positive and negative things related to it. Hence, a segment of a wheel is composed of these dialectical components: a thesis (T), positive side of that thesis (T+) and a negative side of that thesis (T-). In more detailed wheels, a segment could have more than 3 layers.
|
66
|
+
|
67
|
+
If we take two opposite segments, we get the basic (and the most important) structure: **Wisdom Unit** (half-wheel, verified by diagonal constraints: control statements). It's composed of:
|
68
|
+
|
69
|
+
| Dialectical Component | Description |
|
70
|
+
|-----------------------|----------------------------------|
|
71
|
+
| T- | Negative side of the main thesis |
|
72
|
+
| T | The thesis |
|
73
|
+
| T+ | Positive side of the main thesis |
|
74
|
+
| A+ | Positive side of the antithesis |
|
75
|
+
| A | The antithesis |
|
76
|
+
| A- | Negative side of the antithesis |
|
77
|
+
|
78
|
+
In a Wheel, segments next to each other are related. We wrap that relationship into a **Transition**. Practically, a Transition is a recipe for how to go from one segment to another in a way that we approach synthesis. Essentially, it shows how the negative side of a given thesis (Tn-) converts into the positive side of the following thesis (T(n+1)+). If we were to look at a wheel as a sliced pizza, the lines that separate the slices would be Transitions.
|
79
|
+
|
80
|
+
If we derive Transitions in a Wheel with only 2 segments (aka half-wheel), they are symmetrical and represent a special kind of Wisdom Unit, we call it Action (Ac) and Reflection (Re). As any Wisdom Unit, Action and Reflection must be verified by diagonal constraints as well.
|
81
|
+
|
82
|
+
## Prototyping & App Ideas
|
83
|
+
|
84
|
+
### Simple Win-Win Finder
|
85
|
+

|
86
|
+
|
87
|
+
### Eye-Opener
|
88
|
+
Working beta product [Eye Opener](https://app.dialexity.com/aiapps/eye-opener). It's a tool that analyzes text and generates a visual map of its underlying structure and hidden assumptions. The core feature is a graph-like interface we call the Dialectical Wheel, that shows the delayed dialectical responses ("blind spots").
|
89
|
+
|
90
|
+
### Argument Inspector
|
91
|
+
Working beta product [Argument Inspector](https://dialexity.com/start). Useful for analysts and mediators/facilitators to deeper understand the case.
|
92
|
+
|
93
|
+
### Atlas of Feelings
|
94
|
+
[The Atlas of Feelings](https://dialexity.com/blog/atlas-of-feelings-character-qualities/) is the Plutchik's wheel converted into the „vortex“ model, whereby the most gentle emotions are inside of the wheel, whereas the rudest are outside. As everything is interconnected with dialectical rules, we can understand human nature better.
|
95
|
+
|
96
|
+
### "Spiral" Lila game
|
97
|
+
In [this blog post](https://dialexity.com/blog/spiral-lila-with-character-traits/) we explain how the ancient Lila (Leela) game has been elevated to a new level.
|
@@ -0,0 +1,64 @@
|
|
1
|
+
[tool.poetry]
|
2
|
+
name = "dialectical-framework"
|
3
|
+
version = "0.4.4"
|
4
|
+
description = "A dialectical framework for augmented intelligence. AI reasoning powered with dialectics supports humans in: system optimization (psychology, engineering, business, politics, etc.); dispute resolution (mediation, conflicts, negotiations, etc.); decision-making (dilemmas, challenging situations, win-win, etc.)."
|
5
|
+
authors = ["Evaldas Taroza <evaldas@dialexity.com>"]
|
6
|
+
readme = "README.md"
|
7
|
+
license = "MIT"
|
8
|
+
homepage = "https://github.com/dialexity/dialectical-framework"
|
9
|
+
repository = "https://github.com/dialexity/dialectical-framework"
|
10
|
+
keywords = ["dialectics", "reasoning", "ai", "philosophy", "logic"]
|
11
|
+
classifiers = [
|
12
|
+
"Development Status :: 4 - Beta",
|
13
|
+
"Intended Audience :: Developers",
|
14
|
+
"License :: OSI Approved :: MIT License",
|
15
|
+
"Programming Language :: Python :: 3",
|
16
|
+
"Programming Language :: Python :: 3.11",
|
17
|
+
"Programming Language :: Python :: 3.12",
|
18
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
19
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
20
|
+
]
|
21
|
+
|
22
|
+
[[tool.poetry.packages]]
|
23
|
+
include = "dialectical_framework"
|
24
|
+
from = "src"
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
[tool.poetry.dependencies]
|
29
|
+
python = "^3.11"
|
30
|
+
mirascope = {extras = [
|
31
|
+
"azure",
|
32
|
+
"openai",
|
33
|
+
"anthropic",
|
34
|
+
"litellm",
|
35
|
+
"bedrock",
|
36
|
+
"langfuse",
|
37
|
+
"tenacity"
|
38
|
+
], version = "^1.25.6"}
|
39
|
+
python-dotenv = "^1.1.1"
|
40
|
+
tabulate = "^0.9.0"
|
41
|
+
dependency-injector = "^4.48.1"
|
42
|
+
|
43
|
+
[tool.poetry.group.dev.dependencies]
|
44
|
+
pytest = "^8.4.1"
|
45
|
+
black = "^25.1.0"
|
46
|
+
isort = "^6.0.1"
|
47
|
+
#flake8 = "^7.1.2"
|
48
|
+
pytest-asyncio = "^1.1.0"
|
49
|
+
autoflake = "^2.3.1"
|
50
|
+
|
51
|
+
[build-system]
|
52
|
+
requires = ["poetry-core"]
|
53
|
+
build-backend = "poetry.core.masonry.api"
|
54
|
+
|
55
|
+
[tool.pytest.ini_options]
|
56
|
+
asyncio_mode = "auto"
|
57
|
+
asyncio_default_fixture_loop_scope = "function"
|
58
|
+
filterwarnings = [
|
59
|
+
"ignore::DeprecationWarning:mirascope.*",
|
60
|
+
"ignore::UserWarning:mirascope.*",
|
61
|
+
"ignore::DeprecationWarning:pydantic._internal._config",
|
62
|
+
"ignore::DeprecationWarning:httpx._models",
|
63
|
+
"ignore::UserWarning:pydantic.main"
|
64
|
+
]
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
# Import all core Pydantic models that participate in potential circular dependencies.
|
4
|
+
# The order of imports here ensures classes are defined before their `.model_rebuild()`
|
5
|
+
# methods are called below.
|
6
|
+
from .analyst.domain.assessable_cycle import AssessableCycle
|
7
|
+
from .analyst.domain.cycle import Cycle
|
8
|
+
from .analyst.domain.rationale import Rationale
|
9
|
+
from .analyst.domain.spiral import Spiral
|
10
|
+
from .analyst.domain.transformation import Transformation
|
11
|
+
from .analyst.domain.transition import Transition
|
12
|
+
from .analyst.domain.transition_cell_to_cell import TransitionCellToCell
|
13
|
+
from .analyst.domain.transition_segment_to_segment import \
|
14
|
+
TransitionSegmentToSegment
|
15
|
+
from .dialectical_component import DialecticalComponent
|
16
|
+
from .protocols.assessable import Assessable
|
17
|
+
from .protocols.ratable import Ratable
|
18
|
+
from .synthesis import Synthesis
|
19
|
+
from .wheel import Wheel
|
20
|
+
from .wheel_segment import WheelSegment
|
21
|
+
from .wisdom_unit import WisdomUnit
|
22
|
+
|
23
|
+
# Explicitly call `model_rebuild()` on all models that might have forward references
|
24
|
+
# or be part of circular dependencies. This forces Pydantic to resolve their schemas
|
25
|
+
# after all classes are defined in the module.
|
26
|
+
# The order of these rebuild calls is generally from base classes to derived classes,
|
27
|
+
# or simply ensuring all interdependent models are covered.
|
28
|
+
|
29
|
+
Assessable.model_rebuild()
|
30
|
+
Ratable.model_rebuild()
|
31
|
+
DialecticalComponent.model_rebuild()
|
32
|
+
Rationale.model_rebuild()
|
33
|
+
Synthesis.model_rebuild()
|
34
|
+
Wheel.model_rebuild()
|
35
|
+
WheelSegment.model_rebuild()
|
36
|
+
Transition.model_rebuild()
|
37
|
+
TransitionCellToCell.model_rebuild()
|
38
|
+
TransitionSegmentToSegment.model_rebuild()
|
39
|
+
AssessableCycle.model_rebuild()
|
40
|
+
Cycle.model_rebuild()
|
41
|
+
Spiral.model_rebuild()
|
42
|
+
Transformation.model_rebuild()
|
43
|
+
WisdomUnit.model_rebuild()
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
from pydantic import BaseModel, Field
|
3
|
+
|
4
|
+
|
5
|
+
class CausalCycleAssessmentDto(BaseModel):
|
6
|
+
probability: float = Field(
|
7
|
+
default=0,
|
8
|
+
description="The probability 0 to 1 of the arranged cycle to exist in reality.",
|
9
|
+
)
|
10
|
+
reasoning_explanation: str = Field(
|
11
|
+
default="", description="Explanation why/how this cycle might occur."
|
12
|
+
)
|
13
|
+
argumentation: str = Field(
|
14
|
+
default="",
|
15
|
+
description="Circumstances or contexts where this cycle would be most applicable or useful.",
|
16
|
+
)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
from pydantic import Field
|
3
|
+
|
4
|
+
from dialectical_framework.ai_dto.causal_cycle_assessment_dto import \
|
5
|
+
CausalCycleAssessmentDto
|
6
|
+
|
7
|
+
|
8
|
+
class CausalCycleDto(CausalCycleAssessmentDto):
|
9
|
+
"""
|
10
|
+
Causal circular sequence of statements, where aliases reference each statement
|
11
|
+
"""
|
12
|
+
|
13
|
+
aliases: list[str] = Field(
|
14
|
+
...,
|
15
|
+
description="Aliases (not the explicit statements) arranged in the circular causality sequence (cycle) where the last element points to the first",
|
16
|
+
)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
from pydantic import BaseModel, Field
|
3
|
+
|
4
|
+
from dialectical_framework.ai_dto.causal_cycle_dto import CausalCycleDto
|
5
|
+
|
6
|
+
|
7
|
+
class CausalCyclesDeckDto(BaseModel):
|
8
|
+
causal_cycles: list[CausalCycleDto] = Field(
|
9
|
+
...,
|
10
|
+
description="A list of causal circular sequences (cycles). It might also be filled with only one if only one is to be found.",
|
11
|
+
)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from pydantic import BaseModel, Field
|
2
|
+
|
3
|
+
|
4
|
+
class DialecticalComponentDto(BaseModel):
|
5
|
+
alias: str = Field(
|
6
|
+
...,
|
7
|
+
description="The user friendly name of the dialectical component such as T, A, T+, A+, etc.",
|
8
|
+
)
|
9
|
+
statement: str = Field(
|
10
|
+
...,
|
11
|
+
description="The dialectical component value that is provided after analysis.",
|
12
|
+
)
|
13
|
+
explanation: str = Field(
|
14
|
+
default="",
|
15
|
+
description="The explanation how the dialectical component (statement) is derived.",
|
16
|
+
)
|
dialectical_framework-0.4.4/src/dialectical_framework/ai_dto/dialectical_components_deck_dto.py
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
from pydantic import BaseModel, Field
|
3
|
+
|
4
|
+
from dialectical_framework.ai_dto.dialectical_component_dto import \
|
5
|
+
DialecticalComponentDto
|
6
|
+
|
7
|
+
|
8
|
+
class DialecticalComponentsDeckDto(BaseModel):
|
9
|
+
dialectical_components: list[DialecticalComponentDto] = Field(
|
10
|
+
...,
|
11
|
+
description="A list of dialectical components. It can be empty when no dialectical components are found. It might also be filled with only one dialectical component if only one is to be found.",
|
12
|
+
)
|
@@ -0,0 +1,103 @@
|
|
1
|
+
from typing import Dict, Generic, Type, TypeVar
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
from dialectical_framework import DialecticalComponent, Rationale
|
6
|
+
from dialectical_framework.ai_dto.dialectical_component_dto import DialecticalComponentDto
|
7
|
+
|
8
|
+
# Type variables for generic mapping
|
9
|
+
DtoType = TypeVar('DtoType', bound=BaseModel)
|
10
|
+
ModelType = TypeVar('ModelType', bound=BaseModel)
|
11
|
+
|
12
|
+
|
13
|
+
class DtoMapper(Generic[DtoType, ModelType]):
|
14
|
+
"""
|
15
|
+
Generic auto-mapper that uses field introspection to map between DTOs and models.
|
16
|
+
Works when models have compatible field names.
|
17
|
+
"""
|
18
|
+
|
19
|
+
def __init__(self, dto_class: Type[DtoType], model_class: Type[ModelType]):
|
20
|
+
self.dto_class = dto_class
|
21
|
+
self.model_class = model_class
|
22
|
+
|
23
|
+
def map_from_dto(self, dto: DtoType, **kwargs) -> ModelType:
|
24
|
+
"""
|
25
|
+
Auto-maps from DTO to model using common fields plus any additional kwargs.
|
26
|
+
"""
|
27
|
+
# Get DTO field values
|
28
|
+
dto_data = dto.model_dump()
|
29
|
+
|
30
|
+
# Merge with additional kwargs (kwargs take precedence)
|
31
|
+
merged_data = {**dto_data, **kwargs}
|
32
|
+
|
33
|
+
# Filter to only include fields that exist in the target model
|
34
|
+
model_fields = self.model_class.model_fields.keys()
|
35
|
+
filtered_data = {k: v for k, v in merged_data.items() if k in model_fields}
|
36
|
+
|
37
|
+
return self.model_class(**filtered_data)
|
38
|
+
|
39
|
+
def map_list_from_dto(self, dtos: list[DtoType], **kwargs) -> list[ModelType]:
|
40
|
+
"""
|
41
|
+
Maps a list of DTOs to domain models.
|
42
|
+
|
43
|
+
Args:
|
44
|
+
dtos: List of DTO instances to convert
|
45
|
+
**kwargs: Additional parameters for mapping
|
46
|
+
|
47
|
+
Returns:
|
48
|
+
List of domain model instances
|
49
|
+
"""
|
50
|
+
return [self.map_from_dto(dto, **kwargs) for dto in dtos]
|
51
|
+
|
52
|
+
class DialecticalComponentMapper(DtoMapper[DialecticalComponentDto, DialecticalComponent]):
|
53
|
+
def map_from_dto(self, dto: DialecticalComponentDto, **kwargs) -> ModelType:
|
54
|
+
mapped: DialecticalComponent = super().map_from_dto(dto, **kwargs)
|
55
|
+
if dto.explanation:
|
56
|
+
mapped.rationales.append(Rationale(
|
57
|
+
text=dto.explanation,
|
58
|
+
))
|
59
|
+
return mapped
|
60
|
+
|
61
|
+
# Registry for mappers
|
62
|
+
_mapper_registry: Dict[tuple[Type, Type], DtoMapper] = {
|
63
|
+
# Use default DtoMapper if no specific mapper is registered
|
64
|
+
|
65
|
+
(DialecticalComponentDto, DialecticalComponent): DialecticalComponentMapper(DialecticalComponentDto, DialecticalComponent),
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
def register_mapper(dto_class: Type[DtoType], model_class: Type[ModelType], mapper: DtoMapper[DtoType, ModelType]):
|
70
|
+
"""
|
71
|
+
Register a mapper for a specific DTO-Model pair.
|
72
|
+
"""
|
73
|
+
_mapper_registry[(dto_class, model_class)] = mapper
|
74
|
+
|
75
|
+
|
76
|
+
def get_mapper(dto_class: Type[DtoType], model_class: Type[ModelType]) -> DtoMapper[DtoType, ModelType]:
|
77
|
+
"""
|
78
|
+
Get a mapper for a specific DTO-Model pair.
|
79
|
+
If no specific mapper is registered, returns an AutoMapper.
|
80
|
+
"""
|
81
|
+
key = (dto_class, model_class)
|
82
|
+
if key in _mapper_registry:
|
83
|
+
return _mapper_registry[key]
|
84
|
+
|
85
|
+
# Return auto-mapper as fallback
|
86
|
+
return DtoMapper(dto_class, model_class)
|
87
|
+
|
88
|
+
|
89
|
+
def map_from_dto(dto: DtoType, model_class: Type[ModelType], **kwargs) -> ModelType:
|
90
|
+
"""
|
91
|
+
Convenience function to map from DTO to model.
|
92
|
+
"""
|
93
|
+
mapper = get_mapper(type(dto), model_class)
|
94
|
+
return mapper.map_from_dto(dto, **kwargs)
|
95
|
+
|
96
|
+
def map_list_from_dto(dtos: list[DtoType], model_class: Type[ModelType], **kwargs) -> list[ModelType]:
|
97
|
+
"""
|
98
|
+
Convenience function to map a list of DTOs to domain models.
|
99
|
+
"""
|
100
|
+
if not dtos:
|
101
|
+
return []
|
102
|
+
mapper = get_mapper(type(dtos[0]), model_class)
|
103
|
+
return mapper.map_list_from_dto(dtos, **kwargs)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from pydantic import BaseModel, ConfigDict, Field
|
2
|
+
|
3
|
+
|
4
|
+
class ReciprocalSolutionDto(BaseModel):
|
5
|
+
model_config = ConfigDict(
|
6
|
+
extra="forbid",
|
7
|
+
)
|
8
|
+
problem: str | None = Field(default=None, description="Problem statement")
|
9
|
+
linear_action: str | None = Field(
|
10
|
+
default=None, description="Solution(s) that transforms T- into A+"
|
11
|
+
)
|
12
|
+
dialectical_reflection: str | None = Field(
|
13
|
+
default=None, description="Complementary solution(s) that transforms A- into T+"
|
14
|
+
)
|
15
|
+
|
16
|
+
def __str__(self):
|
17
|
+
str_pieces = []
|
18
|
+
if self.problem:
|
19
|
+
str_pieces.append(f"Problem: {self.problem}")
|
20
|
+
if self.linear_action:
|
21
|
+
str_pieces.append(f"Linear action: {self.linear_action}")
|
22
|
+
if self.dialectical_reflection:
|
23
|
+
str_pieces.append(f"Dialectical reflection: {self.dialectical_reflection}")
|
24
|
+
return "\n".join(str_pieces)
|
@@ -0,0 +1 @@
|
|
1
|
+
|
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
from typing import Optional
|
3
|
+
|
4
|
+
from dialectical_framework.analyst.domain.transition import Transition
|
5
|
+
from dialectical_framework.brain import Brain
|
6
|
+
from dialectical_framework.protocols.has_brain import HasBrain
|
7
|
+
from dialectical_framework.wheel import Wheel
|
8
|
+
|
9
|
+
|
10
|
+
class Consultant(ABC, HasBrain):
|
11
|
+
def __init__(
|
12
|
+
self,
|
13
|
+
*,
|
14
|
+
text: str,
|
15
|
+
wheel: Wheel,
|
16
|
+
brain: Optional[Brain] = None,
|
17
|
+
):
|
18
|
+
self._text = text
|
19
|
+
self._wheel = wheel
|
20
|
+
self._brain = brain
|
21
|
+
|
22
|
+
@property
|
23
|
+
def brain(self) -> Brain:
|
24
|
+
return super().brain if self._brain is None else self._brain
|
25
|
+
|
26
|
+
@abstractmethod
|
27
|
+
async def rationalize(self, transition: Transition) -> Transition: ...
|
28
|
+
"""
|
29
|
+
The main method of the class. It should return an enriched Transition with the new rationale.
|
30
|
+
"""
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from dialectical_framework.analyst.domain.transition_segment_to_segment import \
|
2
|
+
TransitionSegmentToSegment
|
3
|
+
from dialectical_framework.analyst.think_action_reflection import \
|
4
|
+
ThinkActionReflection
|
5
|
+
from dialectical_framework.analyst.wheel_builder_transition_calculator import \
|
6
|
+
WheelBuilderTransitionCalculator
|
7
|
+
from dialectical_framework.wheel import Wheel
|
8
|
+
from dialectical_framework.wheel_segment import WheelSegment
|
9
|
+
|
10
|
+
|
11
|
+
class DecoratorActionReflection(WheelBuilderTransitionCalculator):
|
12
|
+
async def _do_calculate_transitions(
|
13
|
+
self, wheel: Wheel, at: WheelSegment
|
14
|
+
) -> list[TransitionSegmentToSegment]:
|
15
|
+
consultant = ThinkActionReflection(
|
16
|
+
text=self.text, wheel=wheel, brain=self.reasoner.brain
|
17
|
+
)
|
18
|
+
|
19
|
+
return await consultant.think(focus=at)
|
20
|
+
|
21
|
+
async def _do_calculate_transitions_all(
|
22
|
+
self, wheel: Wheel
|
23
|
+
) -> list[TransitionSegmentToSegment]:
|
24
|
+
result: list[TransitionSegmentToSegment] = []
|
25
|
+
for wu in wheel.wisdom_units:
|
26
|
+
tr = await self._do_calculate_transitions(wheel, wu)
|
27
|
+
result.extend(tr)
|
28
|
+
return result
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
from dialectical_framework.analyst.domain.transition_segment_to_segment import \
|
3
|
+
TransitionSegmentToSegment
|
4
|
+
from dialectical_framework.analyst.think_constructive_convergence import \
|
5
|
+
ThinkConstructiveConvergence
|
6
|
+
from dialectical_framework.analyst.wheel_builder_transition_calculator import \
|
7
|
+
WheelBuilderTransitionCalculator
|
8
|
+
from dialectical_framework.wheel import Wheel
|
9
|
+
from dialectical_framework.wheel_segment import WheelSegment
|
10
|
+
|
11
|
+
|
12
|
+
class DecoratorDiscreteSpiral(WheelBuilderTransitionCalculator):
|
13
|
+
async def _do_calculate_transitions(
|
14
|
+
self, wheel: Wheel, at: WheelSegment
|
15
|
+
) -> list[TransitionSegmentToSegment]:
|
16
|
+
consultant = ThinkConstructiveConvergence(
|
17
|
+
text=self.text, wheel=wheel, brain=self.reasoner.brain
|
18
|
+
)
|
19
|
+
|
20
|
+
return [await consultant.think(at)]
|
21
|
+
|
22
|
+
async def _do_calculate_transitions_all(
|
23
|
+
self, wheel: Wheel
|
24
|
+
) -> list[TransitionSegmentToSegment]:
|
25
|
+
# TODO: use a single prompt to derive all transitions faster?
|
26
|
+
result: list[TransitionSegmentToSegment] = []
|
27
|
+
for i in range(wheel.degree):
|
28
|
+
tr = await self._do_calculate_transitions(wheel, wheel.wheel_segment_at(i))
|
29
|
+
result.extend(tr)
|
30
|
+
return result
|
File without changes
|