difficult-dialogs 0.3__tar.gz → 0.6.0a1__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.
- difficult_dialogs-0.6.0a1/LICENSE +203 -0
- difficult_dialogs-0.6.0a1/PKG-INFO +479 -0
- difficult_dialogs-0.6.0a1/README.md +430 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/__init__.py +144 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/arguments.py +490 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/builder.py +276 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/choices.py +461 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/cli.py +1058 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/exceptions.py +35 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/export/__init__.py +38 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/export/csv.py +114 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/export/graph.py +152 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/export/json.py +168 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/export/markdown.py +81 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/export/sqlite.py +388 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/export/transcript.py +107 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/graph.py +139 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/library.py +331 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/llm/__init__.py +6 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/llm/client.py +185 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/llm/enhancer.py +185 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/llm/generator.py +320 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/policy.py +1849 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/premises.py +399 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/py.typed +0 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/statements.py +45 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/validators.py +494 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/version.py +8 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs/yesno.py +217 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs.egg-info/PKG-INFO +479 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs.egg-info/SOURCES.txt +59 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs.egg-info/entry_points.txt +3 -0
- difficult_dialogs-0.6.0a1/difficult_dialogs.egg-info/requires.txt +33 -0
- difficult_dialogs-0.6.0a1/pyproject.toml +129 -0
- difficult_dialogs-0.6.0a1/test/test_arguments.py +462 -0
- difficult_dialogs-0.6.0a1/test/test_branching.py +225 -0
- difficult_dialogs-0.6.0a1/test/test_builder.py +147 -0
- difficult_dialogs-0.6.0a1/test/test_builder_choices.py +158 -0
- difficult_dialogs-0.6.0a1/test/test_choices.py +242 -0
- difficult_dialogs-0.6.0a1/test/test_cli.py +1233 -0
- difficult_dialogs-0.6.0a1/test/test_cooperative_policy.py +112 -0
- difficult_dialogs-0.6.0a1/test/test_csv_export.py +98 -0
- difficult_dialogs-0.6.0a1/test/test_export.py +622 -0
- difficult_dialogs-0.6.0a1/test/test_graph.py +262 -0
- difficult_dialogs-0.6.0a1/test/test_library.py +383 -0
- difficult_dialogs-0.6.0a1/test/test_llm.py +452 -0
- difficult_dialogs-0.6.0a1/test/test_llm_enhanced_policy.py +127 -0
- difficult_dialogs-0.6.0a1/test/test_multi_argument_policy.py +114 -0
- difficult_dialogs-0.6.0a1/test/test_multichoice_policy.py +511 -0
- difficult_dialogs-0.6.0a1/test/test_policies.py +1035 -0
- difficult_dialogs-0.6.0a1/test/test_policy.py +983 -0
- difficult_dialogs-0.6.0a1/test/test_premises.py +390 -0
- difficult_dialogs-0.6.0a1/test/test_sample_arguments.py +279 -0
- difficult_dialogs-0.6.0a1/test/test_server.py +247 -0
- difficult_dialogs-0.6.0a1/test/test_statements.py +65 -0
- difficult_dialogs-0.6.0a1/test/test_transcript_timestamp.py +79 -0
- difficult_dialogs-0.6.0a1/test/test_validators.py +768 -0
- difficult_dialogs-0.6.0a1/test/test_yesno.py +259 -0
- difficult_dialogs-0.3/PKG-INFO +0 -10
- difficult_dialogs-0.3/difficult_dialogs/__init__.py +0 -217
- difficult_dialogs-0.3/difficult_dialogs/arguments.py +0 -452
- difficult_dialogs-0.3/difficult_dialogs/exceptions.py +0 -42
- difficult_dialogs-0.3/difficult_dialogs/policy.py +0 -600
- difficult_dialogs-0.3/difficult_dialogs/premises.py +0 -280
- difficult_dialogs-0.3/difficult_dialogs/statements.py +0 -54
- difficult_dialogs-0.3/difficult_dialogs.egg-info/PKG-INFO +0 -10
- difficult_dialogs-0.3/difficult_dialogs.egg-info/SOURCES.txt +0 -11
- difficult_dialogs-0.3/setup.py +0 -13
- {difficult_dialogs-0.3 → difficult_dialogs-0.6.0a1}/difficult_dialogs.egg-info/dependency_links.txt +0 -0
- {difficult_dialogs-0.3 → difficult_dialogs-0.6.0a1}/difficult_dialogs.egg-info/top_level.txt +0 -0
- {difficult_dialogs-0.3 → difficult_dialogs-0.6.0a1}/setup.cfg +0 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 TigreGotico
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
203
|
+
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: difficult_dialogs
|
|
3
|
+
Version: 0.6.0a1
|
|
4
|
+
Summary: Structured argument framework for meaningful debates
|
|
5
|
+
Author-email: JarbasAl <jarbasai@protonmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/TigreGotico/difficult_dialogs
|
|
8
|
+
Project-URL: Documentation, https://github.com/TigreGotico/difficult_dialogs#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/TigreGotico/difficult_dialogs
|
|
10
|
+
Project-URL: Issues, https://github.com/TigreGotico/difficult_dialogs/issues
|
|
11
|
+
Keywords: argument,debate,dialog,llm,reasoning,logic
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: ovos-plugin-manager>=0.0.1
|
|
23
|
+
Requires-Dist: ovos-solver-yes-no-plugin
|
|
24
|
+
Requires-Dist: ovos-solver-bm25-plugin
|
|
25
|
+
Requires-Dist: rank-bm25>=0.2.2
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
32
|
+
Provides-Extra: cli
|
|
33
|
+
Requires-Dist: tqdm>=4.65.0; extra == "cli"
|
|
34
|
+
Provides-Extra: watch
|
|
35
|
+
Requires-Dist: watchdog>=3.0.0; extra == "watch"
|
|
36
|
+
Provides-Extra: export
|
|
37
|
+
Provides-Extra: web
|
|
38
|
+
Requires-Dist: streamlit>=1.28.0; extra == "web"
|
|
39
|
+
Provides-Extra: server
|
|
40
|
+
Requires-Dist: fastapi>=0.100.0; extra == "server"
|
|
41
|
+
Requires-Dist: uvicorn[standard]>=0.23.0; extra == "server"
|
|
42
|
+
Provides-Extra: all
|
|
43
|
+
Requires-Dist: tqdm>=4.65.0; extra == "all"
|
|
44
|
+
Requires-Dist: streamlit>=1.28.0; extra == "all"
|
|
45
|
+
Requires-Dist: fastapi>=0.100.0; extra == "all"
|
|
46
|
+
Requires-Dist: uvicorn[standard]>=0.23.0; extra == "all"
|
|
47
|
+
Requires-Dist: watchdog>=3.0.0; extra == "all"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# difficult_dialogs
|
|
51
|
+
|
|
52
|
+
**Structured argumentation framework — compile knowledge once, run debates forever.**
|
|
53
|
+
|
|
54
|
+
[]()
|
|
55
|
+
[]()
|
|
56
|
+
[]()
|
|
57
|
+
[]()
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## The Problem
|
|
62
|
+
|
|
63
|
+
LLMs are great for debates, but they:
|
|
64
|
+
- ❌ Hallucinate facts mid-conversation
|
|
65
|
+
- ❌ Cost money per call at scale
|
|
66
|
+
- ❌ Add 2–5 s latency per turn
|
|
67
|
+
- ❌ Require network access
|
|
68
|
+
|
|
69
|
+
## The Solution
|
|
70
|
+
|
|
71
|
+
**Generate arguments once with an LLM. Run them forever without one.**
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
┌──────────────────┐ ┌──────────────────────┐ ┌───────────────────┐
|
|
75
|
+
│ LLM (one-time) │ │ Plain-text files │ │ Policy engine │
|
|
76
|
+
│ generate once │────▶│ .premise .support │────▶│ deterministic │
|
|
77
|
+
│ ~60 s / topic │ │ .source .why .who │ │ <1 ms / turn │
|
|
78
|
+
└──────────────────┘ └──────────────────────┘ └───────────────────┘
|
|
79
|
+
Smart Auditable, git-friendly Offline, free
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Optionally layer an `LLMEnhancedPolicy` on top to rephrase responses at runtime — without changing the locked argument structure.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Install
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
uv pip install difficult-dialogs # core + OVOS yes/no solver
|
|
90
|
+
uv pip install "difficult-dialogs[server]" # + FastAPI REST server
|
|
91
|
+
uv pip install "difficult-dialogs[dev]" # + pytest, ruff, mypy
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Python 3.10+. Requires `ovos-plugin-manager`, `ovos-solver-yes-no-plugin`, `ovos-solver-bm25-plugin`, and `rank-bm25` (all installed automatically).
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Quick start
|
|
99
|
+
|
|
100
|
+
### CLI
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
dd debate examples/i_think_therefore_i_am # interactive debate
|
|
104
|
+
dd list examples/sample_arguments # browse library
|
|
105
|
+
dd validate examples/sample_arguments # quality report
|
|
106
|
+
dd serve --port 8080 # REST API server
|
|
107
|
+
dd generate "Solar energy is cost-effective" \
|
|
108
|
+
--server http://localhost:8000 # LLM-generate an argument
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Python
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from difficult_dialogs import Argument, KnowItAllPolicy
|
|
115
|
+
|
|
116
|
+
arg = Argument.from_directory("examples/i_think_therefore_i_am")
|
|
117
|
+
policy = KnowItAllPolicy(arg)
|
|
118
|
+
|
|
119
|
+
print(policy.start())
|
|
120
|
+
|
|
121
|
+
gen = policy.run_sync()
|
|
122
|
+
response = next(gen)
|
|
123
|
+
while response:
|
|
124
|
+
print("BOT:", response)
|
|
125
|
+
try:
|
|
126
|
+
response = gen.send(input("USER: "))
|
|
127
|
+
except StopIteration:
|
|
128
|
+
break
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Fluent builder
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from difficult_dialogs.builder import ArgumentBuilder
|
|
135
|
+
|
|
136
|
+
arg = (
|
|
137
|
+
ArgumentBuilder("climate_change")
|
|
138
|
+
.intro("Let's discuss climate change.")
|
|
139
|
+
.conclusion("The evidence is clear.")
|
|
140
|
+
.premise("human_causation")
|
|
141
|
+
.statement("97% of climate scientists agree.")
|
|
142
|
+
.support("See IPCC AR6.")
|
|
143
|
+
.source("https://www.ipcc.ch/")
|
|
144
|
+
.why("CO₂ traps heat in the atmosphere.")
|
|
145
|
+
.who("Climate scientists and IPCC working groups.")
|
|
146
|
+
.done()
|
|
147
|
+
.build()
|
|
148
|
+
)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## File format
|
|
154
|
+
|
|
155
|
+
Arguments are plain-text directories — one subdirectory per premise:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
argument_name/
|
|
159
|
+
├── intro.dialog # Opening statement
|
|
160
|
+
├── conclusion.conclusion # Closing statement
|
|
161
|
+
└── premise_name/
|
|
162
|
+
├── premise_name.premise # Core claims (one per line)
|
|
163
|
+
├── premise_name.support # Comeback arguments (optional)
|
|
164
|
+
├── premise_name.source # Citation URLs (optional)
|
|
165
|
+
├── premise_name.what # Six-Ws contextual fields (optional)
|
|
166
|
+
├── premise_name.why
|
|
167
|
+
├── premise_name.how
|
|
168
|
+
├── premise_name.when
|
|
169
|
+
├── premise_name.where
|
|
170
|
+
└── premise_name.who
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
UTF-8, one entry per line. Works with `git diff`, `grep`, any text editor.
|
|
174
|
+
Full reference: [docs/argument-format.md](docs/argument-format.md)
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Graph visualization
|
|
179
|
+
|
|
180
|
+
Arguments with branching (`.on_agree`/`.on_disagree`/`.choices`) form directed
|
|
181
|
+
graphs. Visualize with `did graph`:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
did graph examples/sample_arguments/technology/should_ai_be_regulated
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
```mermaid
|
|
188
|
+
graph TD
|
|
189
|
+
ai_risk(["ai_risk\n(2 stmts)"])
|
|
190
|
+
oversight{"oversight\n(2 stmts)"}
|
|
191
|
+
innovation["innovation\n(2 stmts)"]
|
|
192
|
+
balance["balance\n(2 stmts)"]
|
|
193
|
+
implementation["implementation\n(2 stmts)"]
|
|
194
|
+
ai_risk -->|"agree"| oversight
|
|
195
|
+
ai_risk -->|"disagree"| innovation
|
|
196
|
+
oversight -->|"choice:A"| implementation
|
|
197
|
+
oversight -->|"choice:B"| balance
|
|
198
|
+
innovation -->|"agree"| balance
|
|
199
|
+
innovation -->|"disagree"| oversight
|
|
200
|
+
style ai_risk stroke-width:3px
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Also available as DOT (`--format dot`) and JSON (`--format json`).
|
|
204
|
+
Browse all sample graphs: [docs/GRAPHS.md](docs/GRAPHS.md)
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Policies
|
|
209
|
+
|
|
210
|
+
Policies are the "personality" of the dialog. The argument content never changes.
|
|
211
|
+
|
|
212
|
+
| Policy | Style | Uses support | Asks questions |
|
|
213
|
+
|---|---|---|---|
|
|
214
|
+
| `KnowItAllPolicy` | Persuasive — corrects with evidence | ✅ | ❌ |
|
|
215
|
+
| `SilentPolicy` | Lecture — no interaction | ❌ | ❌ |
|
|
216
|
+
| `SocraticPolicy` | Questioning — Socratic method | ✅ | ✅ |
|
|
217
|
+
| `DebatePolicy` | Adversarial — challenges user | ✅ | ✅ |
|
|
218
|
+
| `ExploratoryPolicy` | Neutral — presents multiple sides | ✅ | ✅ |
|
|
219
|
+
| `MaieuticPolicy` | Guided discovery | ✅ | ✅ |
|
|
220
|
+
| `SkepticPolicy` | Doubting — user must prove it | ✅ | ✅ |
|
|
221
|
+
| `TeacherPolicy` | Educational — lesson structure | ✅ | ✅ |
|
|
222
|
+
| `DebaterPolicy` | Formal debate rules | ✅ | ✅ |
|
|
223
|
+
| `MinimalistPolicy` | Terse confirmations only | ❌ | ❌ |
|
|
224
|
+
| `AdaptivePolicy` | Switches policy after N disagreements | via inner | via inner |
|
|
225
|
+
| `WebhookPolicy` | Forwards to HTTP endpoint, local fallback | ✅ | ❌ |
|
|
226
|
+
| `LLMEnhancedPolicy` | Rephrases responses via LLM at runtime | via inner | via inner |
|
|
227
|
+
| `MultiArgumentPolicy` | Chains multiple arguments sequentially | via inner | via inner |
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
from difficult_dialogs import get_policy, Argument
|
|
231
|
+
|
|
232
|
+
arg = Argument.from_directory("my_argument")
|
|
233
|
+
policy = get_policy("socratic", arg) # by name via POLICY_REGISTRY
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Full reference: [docs/POLICIES.md](docs/POLICIES.md)
|
|
237
|
+
|
|
238
|
+
### LLMEnhancedPolicy
|
|
239
|
+
|
|
240
|
+
Add natural language variety to any policy without changing its argument logic:
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
from difficult_dialogs.policy import LLMEnhancedPolicy, KnowItAllPolicy
|
|
244
|
+
from difficult_dialogs.llm import LLMEnhancer
|
|
245
|
+
|
|
246
|
+
enhancer = LLMEnhancer("http://localhost:8000", model="qwen-7b")
|
|
247
|
+
policy = LLMEnhancedPolicy(
|
|
248
|
+
arg,
|
|
249
|
+
inner_policy=KnowItAllPolicy(arg),
|
|
250
|
+
enhancer=enhancer,
|
|
251
|
+
style="friendly", # "conversational" | "formal" | "friendly" | "academic"
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Falls back silently to original text if the LLM server is unreachable.
|
|
256
|
+
|
|
257
|
+
### AdaptivePolicy
|
|
258
|
+
|
|
259
|
+
Automatically softens approach when the user keeps disagreeing:
|
|
260
|
+
|
|
261
|
+
```python
|
|
262
|
+
from difficult_dialogs import AdaptivePolicy, KnowItAllPolicy, ExploratoryPolicy
|
|
263
|
+
|
|
264
|
+
policy = AdaptivePolicy(
|
|
265
|
+
arg,
|
|
266
|
+
initial_policy=KnowItAllPolicy(arg),
|
|
267
|
+
fallback_policy=ExploratoryPolicy(arg),
|
|
268
|
+
switch_threshold=3,
|
|
269
|
+
)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### MultiArgumentPolicy
|
|
273
|
+
|
|
274
|
+
Chain multiple arguments into one session:
|
|
275
|
+
|
|
276
|
+
```python
|
|
277
|
+
from difficult_dialogs import MultiArgumentPolicy
|
|
278
|
+
|
|
279
|
+
policy = MultiArgumentPolicy(
|
|
280
|
+
[(intro_arg, "silent"), (main_arg, "knowitall"), (close_arg, "minimalist")]
|
|
281
|
+
)
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Session state & transcripts
|
|
287
|
+
|
|
288
|
+
```python
|
|
289
|
+
# Save
|
|
290
|
+
state_dict = policy.state.to_dict() # JSON-safe dict
|
|
291
|
+
|
|
292
|
+
# Restore
|
|
293
|
+
policy.restore_state(state_dict)
|
|
294
|
+
|
|
295
|
+
# Export transcript
|
|
296
|
+
from difficult_dialogs.export.transcript import export_transcript_to_markdown
|
|
297
|
+
md = export_transcript_to_markdown(policy, title="Session 1")
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Argument library search
|
|
303
|
+
|
|
304
|
+
```python
|
|
305
|
+
from difficult_dialogs.library import ArgumentLibrary
|
|
306
|
+
|
|
307
|
+
lib = ArgumentLibrary("arguments/").scan()
|
|
308
|
+
results = lib.search("climate change", limit=5)
|
|
309
|
+
for r in results:
|
|
310
|
+
print(r.argument.name, r.score)
|
|
311
|
+
|
|
312
|
+
lib.by_category("health") # all arguments in a top-level subdirectory
|
|
313
|
+
lib.get("free_will_exists") # direct lookup by name
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Export
|
|
319
|
+
|
|
320
|
+
```python
|
|
321
|
+
from difficult_dialogs.export import export_to_json, export_to_markdown
|
|
322
|
+
from difficult_dialogs.export.sqlite import LibraryDatabase
|
|
323
|
+
|
|
324
|
+
export_to_json(arg, "argument.json")
|
|
325
|
+
export_to_markdown(arg, "argument.md")
|
|
326
|
+
|
|
327
|
+
db = LibraryDatabase("library.db")
|
|
328
|
+
db.add_argument(arg, category="philosophy")
|
|
329
|
+
db.close()
|
|
330
|
+
|
|
331
|
+
# Argument diff — review LLM-generated changes before committing
|
|
332
|
+
diff = original.diff(updated)
|
|
333
|
+
# {"meta": ..., "added_premises": [...], "removed_premises": [...], "modified_premises": {...}}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## LLM generation
|
|
339
|
+
|
|
340
|
+
Requires an OpenAI-compatible server (Ollama, llama.cpp, OpenAI API, etc.):
|
|
341
|
+
|
|
342
|
+
```python
|
|
343
|
+
from difficult_dialogs.llm import ArgumentGenerator
|
|
344
|
+
|
|
345
|
+
gen = ArgumentGenerator("http://localhost:8000", model="qwen-72b")
|
|
346
|
+
arg = gen.generate("Solar energy is cost-effective", stance="pro", depth=2)
|
|
347
|
+
arg.save("arguments/solar_energy")
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Or from the CLI:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
dd generate "Solar energy is cost-effective" \
|
|
354
|
+
--server http://localhost:11434 \
|
|
355
|
+
--model qwen-72b \
|
|
356
|
+
--output arguments/
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**Supported servers:**
|
|
360
|
+
```bash
|
|
361
|
+
ollama serve # http://localhost:11434
|
|
362
|
+
./llama-server -m model.gguf --host 0.0.0.0 --port 8000 # http://localhost:8000
|
|
363
|
+
# OpenAI: --server https://api.openai.com/v1 --model gpt-4o
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## REST server
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
dd serve --host 0.0.0.0 --port 8080
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
| Endpoint | Description |
|
|
375
|
+
|---|---|
|
|
376
|
+
| `POST /sessions` | Create session (`argument_path`, `policy`) |
|
|
377
|
+
| `POST /sessions/{id}/chat` | Send turn (`user_input`) |
|
|
378
|
+
| `GET /sessions/{id}` | Full session info |
|
|
379
|
+
| `GET /sessions/{id}/state` | Serialized `PolicyState` |
|
|
380
|
+
| `PUT /sessions/{id}/state` | Restore saved state |
|
|
381
|
+
| `DELETE /sessions/{id}` | End session |
|
|
382
|
+
| `GET /arguments` | List available argument directories |
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Validation
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
from difficult_dialogs.validators import validate_argument, get_quality_label
|
|
390
|
+
|
|
391
|
+
result = validate_argument(arg)
|
|
392
|
+
print(result.score) # 0.0–1.0
|
|
393
|
+
print(get_quality_label(result.score)) # "Excellent ⭐" | "Good 👍" | "Fair 😐" | "Poor ❌"
|
|
394
|
+
for issue in result.issues:
|
|
395
|
+
print(issue)
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## Testing
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
uv run pytest test/ -v
|
|
404
|
+
uv run pytest test/ --cov=difficult_dialogs --cov-report=term-missing
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**794 tests, 97% average coverage.**
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## Project layout
|
|
412
|
+
|
|
413
|
+
```
|
|
414
|
+
difficult_dialogs/
|
|
415
|
+
├── statements.py # Statement dataclass
|
|
416
|
+
├── premises.py # Premise — Six Ws: what/why/how/when/where/who
|
|
417
|
+
├── arguments.py # Argument — load/save/diff/merge
|
|
418
|
+
├── builder.py # ArgumentBuilder / PremiseBuilder fluent API
|
|
419
|
+
├── policy.py # BasePolicy + 14 concrete policies + registry
|
|
420
|
+
├── library.py # ArgumentLibrary — keyword search
|
|
421
|
+
├── validators.py # Quality scoring
|
|
422
|
+
├── server.py # FastAPI REST server
|
|
423
|
+
├── cli.py # dd / difficult-dialogs CLI
|
|
424
|
+
├── export/
|
|
425
|
+
│ ├── json.py # JSON export
|
|
426
|
+
│ ├── sqlite.py # SQLite export
|
|
427
|
+
│ ├── markdown.py # Markdown export
|
|
428
|
+
│ └── transcript.py # Session transcript export
|
|
429
|
+
└── llm/
|
|
430
|
+
├── client.py # OpenAI-compatible HTTP client
|
|
431
|
+
├── generator.py # Argument generation from topic string
|
|
432
|
+
└── enhancer.py # Runtime statement rephrasing
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Comparison
|
|
438
|
+
|
|
439
|
+
| | difficult_dialogs | Raw LLM | Other debate tools |
|
|
440
|
+
|---|---|---|---|
|
|
441
|
+
| Cost per debate | $0 (after generation) | $0.10–0.50 | Varies |
|
|
442
|
+
| Latency | <1 ms | 2–5 s | 1–3 s |
|
|
443
|
+
| Offline | ✅ | ❌ | ❌ |
|
|
444
|
+
| Hallucinations | ❌ none | ✅ possible | ⚠️ sometimes |
|
|
445
|
+
| Auditable content | ✅ plain text | ❌ black box | ⚠️ limited |
|
|
446
|
+
| Git-versionable | ✅ | ❌ | ⚠️ |
|
|
447
|
+
| LLM enhancement | optional | required | n/a |
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Documentation
|
|
452
|
+
|
|
453
|
+
- [docs/index.md](docs/index.md) — Overview and navigation
|
|
454
|
+
- [docs/argument-format.md](docs/argument-format.md) — File format reference
|
|
455
|
+
- [docs/USER_GUIDE.md](docs/USER_GUIDE.md) — End-user manual
|
|
456
|
+
- [docs/DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md) — API reference
|
|
457
|
+
- [docs/POLICIES.md](docs/POLICIES.md) — All 15 policies documented
|
|
458
|
+
- [docs/GRAPHS.md](docs/GRAPHS.md) — Premise graphs for all sample arguments
|
|
459
|
+
- [docs/cli.md](docs/cli.md) — CLI reference (`did graph`, `did stats`, `did debate`, …)
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## Contributing
|
|
464
|
+
|
|
465
|
+
```bash
|
|
466
|
+
git clone https://github.com/TigreGotico/difficult_dialogs
|
|
467
|
+
cd difficult_dialogs
|
|
468
|
+
uv pip install -e ".[dev]"
|
|
469
|
+
uv run pytest test/ -v
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
PRs target the `dev` branch.
|
|
473
|
+
Issues: https://github.com/TigreGotico/difficult_dialogs/issues
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## License
|
|
478
|
+
|
|
479
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|