Skip to content

Commit cba6f13

Browse files
committed
Remove duplicate Mermaid example
1 parent 80b7789 commit cba6f13

2 files changed

Lines changed: 29 additions & 202 deletions

File tree

README.md

Lines changed: 8 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,18 @@
11
# dialoghelper
22

3-
A Python library for programmatic dialog manipulation in [Solveit](https://solve.it.com), fast.ai's Dialog Engineering web application. It provides both user-callable functions and AI-accessible tools for creating, reading, updating, and managing dialog messages.
43

5-
## What is Solveit?
4+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
65

7-
**Solveit** is a "Dialog Engineering" web application that combines interactive code execution with AI assistance. Unlike ChatGPT (pure chat) or Jupyter (pure code), Solveit merges both paradigms into a single workspace.
6+
## Usage
87

9-
### Core Concepts
8+
### Installation
109

11-
- **Instance**: A persistent Linux container with your files and running kernels. Each user can have multiple instances.
12-
- **Dialog**: An `.ipynb` file containing messages. Like a Jupyter notebook, but with AI integration. Each open dialog runs its own Python kernel.
13-
- **Message**: The fundamental unit—similar to a Jupyter cell, but with three types:
10+
Install from [pypi](https://pypi.org/project/dialoghelper/)
1411

15-
| Type | Purpose | Example |
16-
|------|---------|---------|
17-
| `code` | Python execution | `print("hello")` |
18-
| `note` | Markdown documentation | `# My Notes` |
19-
| `prompt` | AI interaction | "Explain this function" |
20-
21-
### How AI Context Works
22-
23-
When you send a prompt to the AI:
24-
25-
1. **All messages above** the current prompt are collected
26-
2. Messages marked as "hidden" (`skipped=True`) are excluded
27-
3. If context exceeds the model limit, oldest non-pinned messages are dropped
28-
4. The AI sees code, outputs, notes, and previous prompts/responses
29-
30-
Key implications:
31-
- Working at the **bottom** of a dialog = **more context** (all messages above)
32-
- Working **higher up** = less context
33-
- **Pinning** a message (`p` key) keeps it in context even when truncation occurs
34-
35-
### Tools: AI-Callable Functions
36-
37-
Solveit lets the AI call Python functions directly. Users declare tools in messages using `&` followed by backticks:
38-
39-
```
40-
&`my_function` # Expose single tool
41-
&`[func1, func2, func3]` # Expose multiple tools
42-
```
43-
44-
When the AI needs to use a tool, Solveit executes it in the kernel and returns the result.
45-
46-
## Installation
47-
48-
The latest version is always pre-installed in Solveit. To manually install (not recommended):
49-
50-
```bash
51-
pip install dialoghelper
12+
``` sh
13+
$ pip install dialoghelper
5214
```
5315

54-
## What is dialoghelper?
55-
56-
dialoghelper is a programmatic interface to Solveit dialogs. It enables:
57-
58-
- **Dialog manipulation**: Add, update, delete, and search messages
59-
- **AI tool integration**: Expose functions as tools the AI can call
60-
- **Context generation**: Convert folders, repos, and symbols into AI context
61-
- **Screen capture**: Capture browser screenshots for AI analysis
62-
- **Tmux integration**: Read terminal buffers from tmux sessions
63-
64-
## Modules
65-
66-
| Module | Source Notebook | Description |
67-
|--------|-----------------|-------------|
68-
| `core` | `nbs/00_core.ipynb` | Core dialog manipulation (add/update/delete messages, search, context helpers) |
69-
| `capture` | `nbs/01_capture.ipynb` | Screen capture functionality for AI vision |
70-
| `inspecttools` | `nbs/02_inspecttools.ipynb` | Symbol inspection (`symsrc`, `getval`, `getdir`, etc.) |
71-
| `tmux` | `nbs/03_tmux.ipynb` | Tmux buffer reading tools |
72-
| `stdtools` || Re-exports all tools from dialoghelper + fastcore.tools |
73-
74-
## Solveit Tools
75-
76-
**Tools** are functions the AI can call directly during a conversation. A function is usable as a tool if it has:
77-
78-
1. **Type annotations** for ALL parameters
79-
2. **A docstring** describing what it does
80-
81-
```python
82-
# Valid tool
83-
def greet(name: str) -> str:
84-
"Greet someone by name"
85-
return f"Hello, {name}!"
86-
87-
# Not a tool (missing type annotation)
88-
def greet(name):
89-
"Greet someone by name"
90-
return f"Hello, {name}!"
91-
92-
# Not a tool (missing docstring)
93-
def greet(name: str) -> str: return f"Hello, {name}!"
94-
```
95-
96-
### Exposing Tools to the AI
97-
98-
In a Solveit dialog, reference tools using `&` followed by backticks:
99-
100-
```
101-
&`greet` # Single tool
102-
&`[add_msg, update_msg, del_msg]` # Multiple tools
103-
```
104-
105-
### Tool Info Functions
106-
107-
These functions add notes to your dialog listing available tools:
108-
109-
| Function | Lists tools from |
110-
|----------|------------------|
111-
| `tool_info()` | `dialoghelper.core` |
112-
| `fc_tool_info()` | `fastcore.tools` (rg, sed, view, create, etc.) |
113-
| `inspect_tool_info()` | `dialoghelper.inspecttools` |
114-
| `tmux_tool_info()` | `dialoghelper.tmux` |
115-
116-
### Tools vs Programmatic Functions
117-
118-
Some functions are designed for AI tool use; others are meant to be called directly from code:
119-
120-
| AI Tools | Programmatic Use |
121-
|----------|------------------|
122-
| `add_msg`, `update_msg`, `del_msg` | |
123-
| `find_msgs`, `read_msg`, `view_dlg` | `call_endp` (raw endpoint access) |
124-
| `symsrc`, `getval`, `getdir` | `resolve` (returns actual Python object) |
125-
126-
## Usage Examples
127-
128-
```python
129-
from dialoghelper import *
130-
131-
# Add a note message
132-
add_msg("Hello from code!", msg_type='note')
133-
134-
# Add a code message
135-
add_msg("print('Hello')", msg_type='code')
136-
137-
# Search for messages
138-
results = find_msgs("pattern", msg_type='code')
139-
140-
# View entire dialog structure
141-
print(view_dlg())
142-
143-
# Generate context from a folder
144-
ctx_folder('.', types='py', max_total=5000)
145-
```
146-
147-
## Development: nbdev Project Structure
148-
149-
dialoghelper is an [nbdev](https://nbdev.fast.ai) project. **Notebooks are the source of truth**—the `.py` files are auto-generated.
150-
151-
### Notebook ↔ Python File Mapping
152-
153-
| Notebook | Generated File |
154-
|----------|----------------|
155-
| `nbs/00_core.ipynb` | `dialoghelper/core.py` |
156-
| `nbs/01_capture.ipynb` | `dialoghelper/capture.py` |
157-
| `nbs/02_inspecttools.ipynb` | `dialoghelper/inspecttools.py` |
158-
| `nbs/03_tmux.ipynb` | `dialoghelper/tmux.py` |
159-
160-
### Workflow
161-
162-
1. Edit notebooks in `nbs/`
163-
2. Run `nbdev_export()` to generate `.py` files
164-
3. Never edit `.py` files directly—they'll be overwritten
165-
166-
## License
167-
168-
Apache 2.0
16+
### Documentation
16917

18+
Documentation can be found hosted on this GitHub [repository](https://github.com/AnswerDotAI/dialoghelper)’s [pages](https://AnswerDotAI.github.io/dialoghelper/).

nbs/00_core.ipynb

Lines changed: 21 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -693,16 +693,16 @@
693693
"data": {
694694
"text/html": [
695695
"<script>\n",
696-
"if (Date.now() - 1783171401393 < 5000 && !window[\"_trig_1783171401393\"]) {\n",
697-
" window[\"_trig_1783171401393\"]=1;\n",
698-
" htmx.trigger(document.body, 'test_evt', {\"data\": {\"hello\": \"world\"}, \"idx\": \"6c62b5be-f92d-4ccd-ab93-ff94ea445ee2\"});\n",
696+
"if (Date.now() - 1783722087723 < 5000 && !window[\"_trig_1783722087723\"]) {\n",
697+
" window[\"_trig_1783722087723\"]=1;\n",
698+
" htmx.trigger(document.body, 'test_evt', {\"data\": {\"hello\": \"world\"}, \"idx\": \"fd7894b1-0f4f-4354-b84f-15f55fefa177\"});\n",
699699
"}</script>"
700700
],
701701
"text/plain": [
702702
"HTML(<script>\n",
703-
"if (Date.now() - 1783171401393 < 5000 && !window[\"_trig_1783171401393\"]) {\n",
704-
" window[\"_trig_1783171401393\"]=1;\n",
705-
" htmx.trigger(document.body, 'test_evt', {\"data\": {\"hello\": \"world\"}, \"idx\": \"6c62b5be-f92d-4ccd-ab93-ff94ea445ee2\"});\n",
703+
"if (Date.now() - 1783722087723 < 5000 && !window[\"_trig_1783722087723\"]) {\n",
704+
" window[\"_trig_1783722087723\"]=1;\n",
705+
" htmx.trigger(document.body, 'test_evt', {\"data\": {\"hello\": \"world\"}, \"idx\": \"fd7894b1-0f4f-4354-b84f-15f55fefa177\"});\n",
706706
"}</script>)"
707707
]
708708
},
@@ -715,13 +715,13 @@
715715
"<div class=\"prose\" markdown=\"1\">\n",
716716
"\n",
717717
"```python\n",
718-
"{'data_id': '6c62b5be-f92d-4ccd-ab93-ff94ea445ee2', 'reply': 'it worked!'}\n",
718+
"{'data_id': 'fd7894b1-0f4f-4354-b84f-15f55fefa177', 'reply': 'it worked!'}\n",
719719
"```\n",
720720
"\n",
721721
"</div>"
722722
],
723723
"text/plain": [
724-
"{'data_id': '6c62b5be-f92d-4ccd-ab93-ff94ea445ee2', 'reply': 'it worked!'}"
724+
"{'data_id': 'fd7894b1-0f4f-4354-b84f-15f55fefa177', 'reply': 'it worked!'}"
725725
]
726726
},
727727
"execution_count": null,
@@ -767,15 +767,15 @@
767767
"<div class=\"prose\" markdown=\"1\">\n",
768768
"\n",
769769
"```python\n",
770-
"{ 'data_id': 'a9ef4f9c-cd07-49b7-b63f-1a2235425b31',\n",
770+
"{ 'data_id': 'b1f60cf1-1497-411e-8a25-4e1839c3240d',\n",
771771
" 'error': 'No active dialog',\n",
772772
" 'ready': True}\n",
773773
"```\n",
774774
"\n",
775775
"</div>"
776776
],
777777
"text/plain": [
778-
"{'data_id': 'a9ef4f9c-cd07-49b7-b63f-1a2235425b31',\n",
778+
"{'data_id': 'b1f60cf1-1497-411e-8a25-4e1839c3240d',\n",
779779
" 'ready': True,\n",
780780
" 'error': 'No active dialog'}"
781781
]
@@ -822,13 +822,13 @@
822822
"<div class=\"prose\" markdown=\"1\">\n",
823823
"\n",
824824
"```python\n",
825-
"{'data_id': '445ba2fe-a240-4e04-8c86-17f2c1c29adf', 'result': {'width': 1512}}\n",
825+
"{'data_id': '3168861d-99e1-4fb8-8bd9-cf21dc8d9d9e', 'result': {'width': 1512}}\n",
826826
"```\n",
827827
"\n",
828828
"</div>"
829829
],
830830
"text/plain": [
831-
"{'data_id': '445ba2fe-a240-4e04-8c86-17f2c1c29adf', 'result': {'width': 1512}}"
831+
"{'data_id': '3168861d-99e1-4fb8-8bd9-cf21dc8d9d9e', 'result': {'width': 1512}}"
832832
]
833833
},
834834
"execution_count": null,
@@ -852,13 +852,13 @@
852852
"<div class=\"prose\" markdown=\"1\">\n",
853853
"\n",
854854
"```python\n",
855-
"{'data_id': '8a9361ac-c0ff-4152-b188-35dc193d0435', 'result': 0}\n",
855+
"{'data_id': 'ee2d13ef-24d7-4893-ada4-05089b7620a0', 'result': 0}\n",
856856
"```\n",
857857
"\n",
858858
"</div>"
859859
],
860860
"text/plain": [
861-
"{'data_id': '8a9361ac-c0ff-4152-b188-35dc193d0435', 'result': 0}"
861+
"{'data_id': 'ee2d13ef-24d7-4893-ada4-05089b7620a0', 'result': 0}"
862862
]
863863
},
864864
"execution_count": null,
@@ -882,13 +882,13 @@
882882
"<div class=\"prose\" markdown=\"1\">\n",
883883
"\n",
884884
"```python\n",
885-
"{'data_id': '50c36037-96d5-443e-86e3-a2e5dac2c28c', 'result': 2}\n",
885+
"{'data_id': 'f3676d77-6bc3-49a6-9951-42fa57596130', 'result': 2}\n",
886886
"```\n",
887887
"\n",
888888
"</div>"
889889
],
890890
"text/plain": [
891-
"{'data_id': '50c36037-96d5-443e-86e3-a2e5dac2c28c', 'result': 2}"
891+
"{'data_id': 'f3676d77-6bc3-49a6-9951-42fa57596130', 'result': 2}"
892892
]
893893
},
894894
"execution_count": null,
@@ -913,14 +913,14 @@
913913
"<div class=\"prose\" markdown=\"1\">\n",
914914
"\n",
915915
"```python\n",
916-
"{ 'data_id': '047d5b12-73bb-4aca-bbd2-916d792a3938',\n",
916+
"{ 'data_id': 'b1171611-bb1a-4f88-8c33-057f182cba78',\n",
917917
" 'result': {'error': 'No active dialog'}}\n",
918918
"```\n",
919919
"\n",
920920
"</div>"
921921
],
922922
"text/plain": [
923-
"{'data_id': '047d5b12-73bb-4aca-bbd2-916d792a3938',\n",
923+
"{'data_id': 'b1171611-bb1a-4f88-8c33-057f182cba78',\n",
924924
" 'result': {'error': 'No active dialog'}}"
925925
]
926926
},
@@ -1417,7 +1417,7 @@
14171417
{
14181418
"data": {
14191419
"text/plain": [
1420-
"'_bb853987'"
1420+
"'_31644180'"
14211421
]
14221422
},
14231423
"execution_count": null,
@@ -1779,7 +1779,7 @@
17791779
{
17801780
"data": {
17811781
"text/plain": [
1782-
"'_c3c4a60a'"
1782+
"'_ee9b8296'"
17831783
]
17841784
},
17851785
"execution_count": null,
@@ -1823,7 +1823,7 @@
18231823
{
18241824
"data": {
18251825
"text/plain": [
1826-
"'_450a6e12'"
1826+
"'_5092a78d'"
18271827
]
18281828
},
18291829
"execution_count": null,
@@ -2251,28 +2251,6 @@
22512251
"```"
22522252
]
22532253
},
2254-
{
2255-
"cell_type": "markdown",
2256-
"id": "e7821a9b",
2257-
"metadata": {},
2258-
"source": [
2259-
"You can also add to a note:\n",
2260-
"\n",
2261-
" ```mermaid\n",
2262-
" graph LR\n",
2263-
" A[Start] --> B[Process]\n",
2264-
" B --> C[End]\n",
2265-
" ```\n",
2266-
"\n",
2267-
"This renders as: \n",
2268-
"\n",
2269-
"```\n",
2270-
"graph LR\n",
2271-
"A[Start] --> B[Process]\n",
2272-
"B --> C[End]\n",
2273-
"```"
2274-
]
2275-
},
22762254
{
22772255
"cell_type": "code",
22782256
"execution_count": null,

0 commit comments

Comments
 (0)