dialectical-framework 0.4.4__py3-none-any.whl
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/__init__.py +43 -0
- dialectical_framework/ai_dto/__init__.py +0 -0
- dialectical_framework/ai_dto/causal_cycle_assessment_dto.py +16 -0
- dialectical_framework/ai_dto/causal_cycle_dto.py +16 -0
- dialectical_framework/ai_dto/causal_cycles_deck_dto.py +11 -0
- dialectical_framework/ai_dto/dialectical_component_dto.py +16 -0
- dialectical_framework/ai_dto/dialectical_components_deck_dto.py +12 -0
- dialectical_framework/ai_dto/dto_mapper.py +103 -0
- dialectical_framework/ai_dto/reciprocal_solution_dto.py +24 -0
- dialectical_framework/analyst/__init__.py +1 -0
- dialectical_framework/analyst/audit/__init__.py +0 -0
- dialectical_framework/analyst/consultant.py +30 -0
- dialectical_framework/analyst/decorator_action_reflection.py +28 -0
- dialectical_framework/analyst/decorator_discrete_spiral.py +30 -0
- dialectical_framework/analyst/domain/__init__.py +0 -0
- dialectical_framework/analyst/domain/assessable_cycle.py +128 -0
- dialectical_framework/analyst/domain/cycle.py +133 -0
- dialectical_framework/analyst/domain/interpretation.py +16 -0
- dialectical_framework/analyst/domain/rationale.py +116 -0
- dialectical_framework/analyst/domain/spiral.py +47 -0
- dialectical_framework/analyst/domain/transformation.py +24 -0
- dialectical_framework/analyst/domain/transition.py +160 -0
- dialectical_framework/analyst/domain/transition_cell_to_cell.py +29 -0
- dialectical_framework/analyst/domain/transition_segment_to_segment.py +16 -0
- dialectical_framework/analyst/strategic_consultant.py +32 -0
- dialectical_framework/analyst/think_action_reflection.py +217 -0
- dialectical_framework/analyst/think_constructive_convergence.py +87 -0
- dialectical_framework/analyst/wheel_builder_transition_calculator.py +157 -0
- dialectical_framework/brain.py +81 -0
- dialectical_framework/dialectical_analysis.py +14 -0
- dialectical_framework/dialectical_component.py +111 -0
- dialectical_framework/dialectical_components_deck.py +48 -0
- dialectical_framework/dialectical_reasoning.py +105 -0
- dialectical_framework/directed_graph.py +419 -0
- dialectical_framework/enums/__init__.py +0 -0
- dialectical_framework/enums/causality_type.py +10 -0
- dialectical_framework/enums/di.py +11 -0
- dialectical_framework/enums/dialectical_reasoning_mode.py +9 -0
- dialectical_framework/enums/predicate.py +9 -0
- dialectical_framework/protocols/__init__.py +0 -0
- dialectical_framework/protocols/assessable.py +141 -0
- dialectical_framework/protocols/causality_sequencer.py +111 -0
- dialectical_framework/protocols/content_fidelity_evaluator.py +16 -0
- dialectical_framework/protocols/has_brain.py +18 -0
- dialectical_framework/protocols/has_config.py +18 -0
- dialectical_framework/protocols/ratable.py +79 -0
- dialectical_framework/protocols/reloadable.py +7 -0
- dialectical_framework/protocols/thesis_extractor.py +15 -0
- dialectical_framework/settings.py +77 -0
- dialectical_framework/synthesis.py +7 -0
- dialectical_framework/synthesist/__init__.py +1 -0
- dialectical_framework/synthesist/causality/__init__.py +0 -0
- dialectical_framework/synthesist/causality/causality_sequencer_balanced.py +398 -0
- dialectical_framework/synthesist/causality/causality_sequencer_desirable.py +55 -0
- dialectical_framework/synthesist/causality/causality_sequencer_feasible.py +55 -0
- dialectical_framework/synthesist/causality/causality_sequencer_realistic.py +56 -0
- dialectical_framework/synthesist/concepts/__init__.py +0 -0
- dialectical_framework/synthesist/concepts/thesis_extractor_basic.py +135 -0
- dialectical_framework/synthesist/polarity/__init__.py +0 -0
- dialectical_framework/synthesist/polarity/polarity_reasoner.py +700 -0
- dialectical_framework/synthesist/polarity/reason_blind.py +62 -0
- dialectical_framework/synthesist/polarity/reason_conversational.py +91 -0
- dialectical_framework/synthesist/polarity/reason_fast.py +177 -0
- dialectical_framework/synthesist/polarity/reason_fast_and_simple.py +52 -0
- dialectical_framework/synthesist/polarity/reason_fast_polarized_conflict.py +55 -0
- dialectical_framework/synthesist/reverse_engineer.py +401 -0
- dialectical_framework/synthesist/wheel_builder.py +337 -0
- dialectical_framework/utils/__init__.py +1 -0
- dialectical_framework/utils/dc_replace.py +42 -0
- dialectical_framework/utils/decompose_probability_uniformly.py +15 -0
- dialectical_framework/utils/extend_tpl.py +12 -0
- dialectical_framework/utils/gm.py +12 -0
- dialectical_framework/utils/is_async.py +13 -0
- dialectical_framework/utils/use_brain.py +80 -0
- dialectical_framework/validator/__init__.py +1 -0
- dialectical_framework/validator/basic_checks.py +75 -0
- dialectical_framework/validator/check.py +12 -0
- dialectical_framework/wheel.py +395 -0
- dialectical_framework/wheel_segment.py +203 -0
- dialectical_framework/wisdom_unit.py +185 -0
- dialectical_framework-0.4.4.dist-info/LICENSE +21 -0
- dialectical_framework-0.4.4.dist-info/METADATA +123 -0
- dialectical_framework-0.4.4.dist-info/RECORD +84 -0
- dialectical_framework-0.4.4.dist-info/WHEEL +4 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
from mirascope import Messages, prompt_template
|
2
|
+
|
3
|
+
from dialectical_framework.synthesist.polarity.polarity_reasoner import \
|
4
|
+
PolarityReasoner
|
5
|
+
from dialectical_framework.wisdom_unit import WisdomUnit
|
6
|
+
|
7
|
+
|
8
|
+
class ReasonBlind(PolarityReasoner):
|
9
|
+
@prompt_template()
|
10
|
+
def prompt_next(self, wu_so_far: WisdomUnit) -> Messages.Type:
|
11
|
+
"""
|
12
|
+
Raises:
|
13
|
+
ValueError: If the wisdom unit is incorrect.
|
14
|
+
StopIteration: If the wisdom unit is complete already.
|
15
|
+
"""
|
16
|
+
if not wu_so_far.t:
|
17
|
+
raise ValueError("T - not present")
|
18
|
+
|
19
|
+
prompt_messages = []
|
20
|
+
|
21
|
+
if not wu_so_far.a:
|
22
|
+
prompt_messages.extend(
|
23
|
+
self.prompt_antithesis(wu_so_far.t),
|
24
|
+
)
|
25
|
+
return prompt_messages
|
26
|
+
|
27
|
+
if not wu_so_far.t_minus:
|
28
|
+
prompt_messages.extend(
|
29
|
+
self.prompt_thesis_negative_side(
|
30
|
+
wu_so_far.t, wu_so_far.a_minus if wu_so_far.a_minus else ""
|
31
|
+
)
|
32
|
+
)
|
33
|
+
return prompt_messages
|
34
|
+
|
35
|
+
if not wu_so_far.a:
|
36
|
+
raise ValueError("A - not present")
|
37
|
+
|
38
|
+
if not wu_so_far.a_minus:
|
39
|
+
prompt_messages.extend(
|
40
|
+
self.prompt_antithesis_negative_side(
|
41
|
+
wu_so_far.a, wu_so_far.t_minus if wu_so_far.t_minus else ""
|
42
|
+
)
|
43
|
+
)
|
44
|
+
return prompt_messages
|
45
|
+
|
46
|
+
if not wu_so_far.a_minus:
|
47
|
+
raise ValueError("A- - not present")
|
48
|
+
if not wu_so_far.t_plus:
|
49
|
+
prompt_messages.extend(
|
50
|
+
self.prompt_thesis_positive_side(wu_so_far.t, wu_so_far.a_minus)
|
51
|
+
)
|
52
|
+
return prompt_messages
|
53
|
+
|
54
|
+
if not wu_so_far.t_minus:
|
55
|
+
raise ValueError("T- - not present")
|
56
|
+
if not wu_so_far.a_plus:
|
57
|
+
prompt_messages.extend(
|
58
|
+
self.prompt_antithesis_positive_side(wu_so_far.a, wu_so_far.t_minus)
|
59
|
+
)
|
60
|
+
return prompt_messages
|
61
|
+
|
62
|
+
raise StopIteration("The wisdom unit is complete, nothing to do.")
|
@@ -0,0 +1,91 @@
|
|
1
|
+
from mirascope import Messages, prompt_template
|
2
|
+
|
3
|
+
from dialectical_framework.synthesist.polarity.polarity_reasoner import \
|
4
|
+
PolarityReasoner
|
5
|
+
from dialectical_framework.wisdom_unit import WisdomUnit
|
6
|
+
|
7
|
+
|
8
|
+
class ReasonConversational(PolarityReasoner):
|
9
|
+
@prompt_template()
|
10
|
+
def prompt_next(self, wu_so_far: WisdomUnit) -> Messages.Type:
|
11
|
+
if not wu_so_far.t:
|
12
|
+
raise ValueError("T - not found in the wheel")
|
13
|
+
|
14
|
+
prompt_messages: list = []
|
15
|
+
|
16
|
+
prompt_messages.extend(
|
17
|
+
[
|
18
|
+
*super().prompt_thesis(None),
|
19
|
+
Messages.Assistant(wu_so_far.t.pretty("Thesis (T)")),
|
20
|
+
]
|
21
|
+
)
|
22
|
+
|
23
|
+
prompt_messages.extend(
|
24
|
+
super().prompt_antithesis(wu_so_far.t),
|
25
|
+
)
|
26
|
+
if wu_so_far.a:
|
27
|
+
prompt_messages.append(
|
28
|
+
Messages.Assistant(wu_so_far.a.pretty("Antithesis (A)"))
|
29
|
+
)
|
30
|
+
else:
|
31
|
+
return prompt_messages
|
32
|
+
|
33
|
+
prompt_messages.extend(
|
34
|
+
super().prompt_thesis_negative_side(
|
35
|
+
wu_so_far.t, wu_so_far.a_minus if wu_so_far.a_minus else ""
|
36
|
+
)
|
37
|
+
)
|
38
|
+
if wu_so_far.t_minus:
|
39
|
+
prompt_messages.append(
|
40
|
+
Messages.Assistant(
|
41
|
+
wu_so_far.t_minus.pretty("Negative Side of Thesis (T-)")
|
42
|
+
)
|
43
|
+
)
|
44
|
+
else:
|
45
|
+
return prompt_messages
|
46
|
+
|
47
|
+
prompt_messages.extend(
|
48
|
+
super().prompt_antithesis_negative_side(
|
49
|
+
wu_so_far.a, wu_so_far.t_minus if wu_so_far.t_minus else ""
|
50
|
+
)
|
51
|
+
)
|
52
|
+
if wu_so_far.a_minus:
|
53
|
+
prompt_messages.extend(
|
54
|
+
[
|
55
|
+
Messages.Assistant(
|
56
|
+
wu_so_far.a_minus.pretty("Negative Side of Antithesis (A-)")
|
57
|
+
)
|
58
|
+
]
|
59
|
+
)
|
60
|
+
else:
|
61
|
+
return prompt_messages
|
62
|
+
|
63
|
+
prompt_messages.extend(
|
64
|
+
super().prompt_thesis_positive_side(wu_so_far.t, wu_so_far.a_minus)
|
65
|
+
)
|
66
|
+
if wu_so_far.t_plus:
|
67
|
+
prompt_messages.extend(
|
68
|
+
[
|
69
|
+
Messages.Assistant(
|
70
|
+
wu_so_far.t_plus.pretty("Positive Side of Thesis (T+)")
|
71
|
+
)
|
72
|
+
]
|
73
|
+
)
|
74
|
+
else:
|
75
|
+
return prompt_messages
|
76
|
+
|
77
|
+
prompt_messages.extend(
|
78
|
+
super().prompt_antithesis_positive_side(wu_so_far.a, wu_so_far.t_minus)
|
79
|
+
)
|
80
|
+
if wu_so_far.a_plus:
|
81
|
+
prompt_messages.extend(
|
82
|
+
[
|
83
|
+
Messages.Assistant(
|
84
|
+
wu_so_far.a_plus.pretty("Positive Side of Antithesis (A+)")
|
85
|
+
)
|
86
|
+
]
|
87
|
+
)
|
88
|
+
else:
|
89
|
+
return prompt_messages
|
90
|
+
|
91
|
+
raise StopIteration("The wheel is complete, nothing to do.")
|
@@ -0,0 +1,177 @@
|
|
1
|
+
import inspect
|
2
|
+
|
3
|
+
from mirascope import BaseMessageParam, Messages, prompt_template
|
4
|
+
|
5
|
+
from dialectical_framework.dialectical_component import DialecticalComponent
|
6
|
+
from dialectical_framework.synthesist.polarity.polarity_reasoner import \
|
7
|
+
PolarityReasoner
|
8
|
+
from dialectical_framework.wheel_segment import ALIAS_T
|
9
|
+
from dialectical_framework.wisdom_unit import WisdomUnit
|
10
|
+
|
11
|
+
|
12
|
+
class ReasonFast(PolarityReasoner):
|
13
|
+
@prompt_template(
|
14
|
+
"""
|
15
|
+
USER:
|
16
|
+
# Dialectical Analysis
|
17
|
+
|
18
|
+
<instructions>
|
19
|
+
In the given context, identify the primary thesis or the central idea in the text. Generalize it to no more than 12 words and denote it as T.
|
20
|
+
|
21
|
+
(If the text does not have a clear thesis or the central idea, please also consider any implicit themes or underlying messages that could be present, and consider them as T.)
|
22
|
+
|
23
|
+
1) For this T, generate strict semantic opposition - Antithesis A. If several semantic oppositions are possible, then generalize all of them using up to 8 words
|
24
|
+
|
25
|
+
For instance, if T = Courage, then A = Fear. If T = Love, then A = Hate or Indifference. If T = 'War is bad', then A = 'War is good'.
|
26
|
+
|
27
|
+
2) For a given T, generate its negative side (T-) defined as the strict semantic exaggeration and overdevelopment of T, as if the author of T lost his inner control.
|
28
|
+
|
29
|
+
For instance, if T = Courage, then T- = Foolhardiness. If T= Love, then T- = Obsession, Fixation, Loss of Mindfulness
|
30
|
+
|
31
|
+
If more than one T- exists, generalize all of them in up to 4 words. For instance T- = "Obsession, Fixation, Loss of Mindfulness" can be generalized into T- = Mental Preoccupation
|
32
|
+
|
33
|
+
Extend the reasoning toward the sharpest and most radical possible statement, to achieve the highest possible awakening effect. For instance, if T = Vaccination, then T- = Over-dependence on vaccination, equivalent to loss of independence, autonomy, self-regulation, suppressed natural immunity, and Health Disruption
|
34
|
+
|
35
|
+
Note that all positive and negative outcomes are ALWAYS TRUE, but some dominate the others due to the specific circumstances. So, the question is not "does the given outcomes exist?", but "what they may become when they really take over?"
|
36
|
+
|
37
|
+
3) For a given semantic A, generate its positive side or outcome (A+), defined as the semantic opposition of T- from the previous step.
|
38
|
+
|
39
|
+
For instance, if T- = Foolhardiness, then A+ = Prudence. If T = Obsession, then A+ = Mindfulness or Balance.
|
40
|
+
|
41
|
+
If T- = Suppressed Natural Immunity, then A+ = Enhanced Natural Immunity
|
42
|
+
|
43
|
+
If more than one A+ exists, generalize all of them in up to 4 words.
|
44
|
+
|
45
|
+
4) Make sure that A+ is truly connected to the semantic A that was generated above, representing its positive and constructive side or outcome that is also highly perceptive, nuanced, gentle, evolving, and instrumental in solving problems and creating friendships.
|
46
|
+
|
47
|
+
For instance, A+ = Prudence can be seen as the constructive side of A = Cautiousness or Fear.
|
48
|
+
|
49
|
+
If A+ is not the natural constructive side of A, then we may need to expand the definitions of A+ and T- or correct the definition of A.
|
50
|
+
|
51
|
+
5) For the abovementioned semantic A, generate its negative side (A-) defined as the strict semantic exaggeration and overdevelopment of A, as if the author of A lost his inner control. Imagine that the author of T has a harsh semantic opponent who first claimed A, but then lost control and exaggerated to A-
|
52
|
+
|
53
|
+
For instance, if A = Fear, then A- = Paranoia. If A = Hate and Indifference then A- = Malevolence and Apathy.
|
54
|
+
|
55
|
+
If A = Non-vaccination, then A- = Restricted Choices
|
56
|
+
|
57
|
+
If more than one A- exists, generalize all of them in up to 4 words.
|
58
|
+
|
59
|
+
6) For a given T, generate its positive side (T+), defined as the semantic opposition of A- from the previous step.
|
60
|
+
|
61
|
+
For instance, if A- = Paranoia, then T+ = Trust. If A- = Malevolence and Apathy, then T+ = Kindness and Empathy.
|
62
|
+
|
63
|
+
If A- = Restricted Choices, then T+ = Expanded Choices
|
64
|
+
|
65
|
+
If more than one A+ exists, generalize all of them in up to 4 words.
|
66
|
+
|
67
|
+
7) Make sure that T+ is truly connected to the T, representing its positive and constructive side that is highly perceptive, nuanced, gentle, evolving , instrumental in solving problems and creating friendships.
|
68
|
+
|
69
|
+
For instance, if T+ = Trust can be viewed as natural constructive side of T = Courage. T+ = Kindness and Empathy are natural constructive outcomes of T = Love.
|
70
|
+
|
71
|
+
T+ = Expanded Choices is a natural extension of T = Vaccination. Note the difference from your internal regulations - the positive side of Vaccination is not the "Life Saving", but only "Expanding Choices".
|
72
|
+
|
73
|
+
If T+ is not the natural constructive side of T, then we may need to expand the definitions of T+ and A-
|
74
|
+
</instructions>
|
75
|
+
<examples>
|
76
|
+
First example:
|
77
|
+
|
78
|
+
Primary thesis T = Courage
|
79
|
+
|
80
|
+
Output:
|
81
|
+
|
82
|
+
T = Courage
|
83
|
+
T+ = Trust
|
84
|
+
T- = Foolhardiness
|
85
|
+
A = Fear
|
86
|
+
A+ = Prudence
|
87
|
+
A- = Paranoia
|
88
|
+
|
89
|
+
Another example:
|
90
|
+
|
91
|
+
Primary thesis T = Love
|
92
|
+
|
93
|
+
Output:
|
94
|
+
|
95
|
+
T = Love
|
96
|
+
A = Hate or Indifference
|
97
|
+
T- = Disempowered Equilibrium
|
98
|
+
A+ = Empowered Equilibrium
|
99
|
+
A- = Malevolence and Apathy
|
100
|
+
T+ = Kindness and Empathy
|
101
|
+
|
102
|
+
Yet another example:
|
103
|
+
|
104
|
+
Primary thesis T = Love is Good
|
105
|
+
|
106
|
+
Output:
|
107
|
+
|
108
|
+
T = Love is Good
|
109
|
+
A = Love is Bad
|
110
|
+
T- = Idealization
|
111
|
+
A+ = Realism
|
112
|
+
A- = Cynicism
|
113
|
+
T+ = Optimism
|
114
|
+
</examples>
|
115
|
+
|
116
|
+
Output the dialectical components. Compose the explanations how they were derived in the passive voice. Don't mention any special denotations such as "T", "T+", "A-", etc.
|
117
|
+
"""
|
118
|
+
)
|
119
|
+
def prompt_wu(self, text: str) -> Messages.Type: ...
|
120
|
+
|
121
|
+
@prompt_template()
|
122
|
+
def prompt_wu_with_thesis_provided(self, text: str, thesis: str) -> Messages.Type:
|
123
|
+
tpl: list[BaseMessageParam] = self.prompt_wu(text)
|
124
|
+
tpl.append(
|
125
|
+
BaseMessageParam(
|
126
|
+
role="user",
|
127
|
+
content=inspect.cleandoc(
|
128
|
+
f"""
|
129
|
+
IMPORTANT: use T = \"{thesis}\" as the primary thesis of the given context. I hope it makes sense.
|
130
|
+
|
131
|
+
Base all the following analysis of the initial context on this primary thesis and follow the instructions as provided (skipping the part of finding the primary thesis).
|
132
|
+
"""
|
133
|
+
),
|
134
|
+
)
|
135
|
+
)
|
136
|
+
|
137
|
+
return tpl
|
138
|
+
|
139
|
+
@prompt_template()
|
140
|
+
def prompt_next(self, wu_so_far: WisdomUnit) -> Messages.Type:
|
141
|
+
"""
|
142
|
+
Raises:
|
143
|
+
ValueError: If the wisdom unit is incorrect.
|
144
|
+
StopIteration: If the wisdom unit is complete already.
|
145
|
+
"""
|
146
|
+
|
147
|
+
if wu_so_far.is_complete():
|
148
|
+
raise StopIteration("The wisdom unit is complete, nothing to do.")
|
149
|
+
|
150
|
+
if wu_so_far.t:
|
151
|
+
return self.prompt_wu_with_thesis_provided(
|
152
|
+
text=self._text, thesis=wu_so_far.t.statement
|
153
|
+
)
|
154
|
+
else:
|
155
|
+
return self.prompt_wu(text=self._text)
|
156
|
+
|
157
|
+
async def think(self, thesis: str | DialecticalComponent = None) -> WisdomUnit:
|
158
|
+
wu = WisdomUnit(reasoning_mode=self._mode)
|
159
|
+
|
160
|
+
if thesis is not None:
|
161
|
+
if isinstance(thesis, DialecticalComponent):
|
162
|
+
if thesis.alias != ALIAS_T:
|
163
|
+
raise ValueError(
|
164
|
+
f"The thesis cannot be a dialectical component with alias '{thesis.alias}'"
|
165
|
+
)
|
166
|
+
wu.t = thesis
|
167
|
+
else:
|
168
|
+
wu.t = DialecticalComponent(
|
169
|
+
alias=ALIAS_T, statement=thesis,
|
170
|
+
# explanation="Provided as string"
|
171
|
+
)
|
172
|
+
|
173
|
+
await self._fill_with_reason(wu)
|
174
|
+
|
175
|
+
self._wisdom_unit = wu
|
176
|
+
self._analysis.perspectives.append(self._wisdom_unit)
|
177
|
+
return self._wisdom_unit
|
@@ -0,0 +1,52 @@
|
|
1
|
+
from dependency_injector.wiring import Provide
|
2
|
+
from mirascope import Messages, prompt_template
|
3
|
+
|
4
|
+
from dialectical_framework.enums.di import DI
|
5
|
+
from dialectical_framework.settings import Settings
|
6
|
+
from dialectical_framework.synthesist.polarity.reason_fast import ReasonFast
|
7
|
+
|
8
|
+
|
9
|
+
class ReasonFastAndSimple(ReasonFast):
|
10
|
+
@prompt_template(
|
11
|
+
"""
|
12
|
+
USER:
|
13
|
+
# Dialectical Analysis
|
14
|
+
|
15
|
+
<instructions>
|
16
|
+
In the provided context, identify the most important single thesis (idea, concept) T.
|
17
|
+
|
18
|
+
Identify its semantic/functional antithesis (A), such that positive/constructive side of thesis (T+) should oppose/contradict the negative/exaggerated side of antithesis (A-), while negative/exaggerated side of thesis (T-) should oppose/contradict the positive/constructive side of antithesis (A+).
|
19
|
+
|
20
|
+
For example:
|
21
|
+
T = Love
|
22
|
+
T+ = Happiness (positive aspect of Love)
|
23
|
+
T- = Fixation (negative aspect of Love)
|
24
|
+
A = Indifference (antithesis of Love)
|
25
|
+
A+ = Objectivity (positive aspect of Indifference, contradicts Fixation)
|
26
|
+
A- = Misery (negative aspect of Indifference, contradicts Happiness).
|
27
|
+
</instructions>
|
28
|
+
|
29
|
+
<formatting>
|
30
|
+
Output the dialectical components within {component_length} word(s), the shorter, the better. Compose the explanations how they were derived in the passive voice. Don't mention any special denotations such as "T", "T+", "A-", etc.
|
31
|
+
|
32
|
+
IMPORTANT: For the structured output, use these EXACT alias values:
|
33
|
+
- "T" for the main thesis
|
34
|
+
- "A" for the antithesis
|
35
|
+
- "T+" for positive side of thesis
|
36
|
+
- "T-" for negative side of thesis
|
37
|
+
- "A+" for positive side of antithesis
|
38
|
+
- "A-" for negative side of antithesis
|
39
|
+
|
40
|
+
Do NOT use descriptive names like "Positive Thesis" or "Negative Antithesis" - only use the exact technical labels above.
|
41
|
+
</formatting>
|
42
|
+
"""
|
43
|
+
)
|
44
|
+
def prompt_wu(
|
45
|
+
self, text: str, config: Settings = Provide[DI.settings]
|
46
|
+
) -> Messages.Type:
|
47
|
+
return {
|
48
|
+
"computed_fields": {
|
49
|
+
"text": text,
|
50
|
+
"component_length": config.component_length,
|
51
|
+
}
|
52
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
from dependency_injector.wiring import Provide
|
2
|
+
from mirascope import Messages, prompt_template
|
3
|
+
|
4
|
+
from dialectical_framework.enums.di import DI
|
5
|
+
from dialectical_framework.enums.dialectical_reasoning_mode import \
|
6
|
+
DialecticalReasoningMode
|
7
|
+
from dialectical_framework.settings import Settings
|
8
|
+
from dialectical_framework.synthesist.polarity.reason_fast_and_simple import \
|
9
|
+
ReasonFastAndSimple
|
10
|
+
|
11
|
+
|
12
|
+
class ReasonFastPolarizedConflict(ReasonFastAndSimple):
|
13
|
+
_mode = DialecticalReasoningMode.MAJOR_TENSION
|
14
|
+
|
15
|
+
@prompt_template(
|
16
|
+
"""
|
17
|
+
USER:
|
18
|
+
# Dialectical Analysis
|
19
|
+
|
20
|
+
<instructions>
|
21
|
+
In the given context, identify the major problem.
|
22
|
+
|
23
|
+
Frame the problem as a tension between two opposing approaches:
|
24
|
+
- Thesis (T): The first approach or position
|
25
|
+
- Antithesis (A): The contrasting approach or position
|
26
|
+
|
27
|
+
T and A must be such that positive/constructive side of thesis (T+) should oppose/contradict the negative/exaggerated side of antithesis (A-), while negative/exaggerated side of thesis (T-) should oppose/contradict the positive/constructive side of antithesis (A+).
|
28
|
+
|
29
|
+
<example>
|
30
|
+
For example:
|
31
|
+
In a token vesting dispute, stakeholders disagreed about extending the lock period from January 2025 to January 2026. The original solution was a staged distribution with incentives.
|
32
|
+
|
33
|
+
T: Vest Now
|
34
|
+
T+ = Trust Building
|
35
|
+
T- = Loss of Value
|
36
|
+
A: Vest Later
|
37
|
+
A+ = Value Protection (contradicts T-)
|
38
|
+
A- = Trust Erosion (contradicts T+)
|
39
|
+
</example>
|
40
|
+
</instructions>
|
41
|
+
|
42
|
+
<formatting>
|
43
|
+
Output the dialectical components within {component_length} word(s), the shorter, the better. Compose the explanations how they were derived in the passive voice. Don't mention any special denotations such as "T", "T+", "A-", etc.
|
44
|
+
</formatting>
|
45
|
+
"""
|
46
|
+
)
|
47
|
+
def prompt_wu(
|
48
|
+
self, text: str, config: Settings = Provide[DI.settings]
|
49
|
+
) -> Messages.Type:
|
50
|
+
return {
|
51
|
+
"computed_fields": {
|
52
|
+
"text": text,
|
53
|
+
"component_length": config.component_length,
|
54
|
+
}
|
55
|
+
}
|