Skip to content

Commit 810b3e2

Browse files
authored
Update userguides (#60)
* Update userguides * Change graph view to image * Extend evaluation and extender userguides * Update example info in README
1 parent 30043bc commit 810b3e2

18 files changed

Lines changed: 350 additions & 196 deletions

README.md

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ cd dialog2graph
4141
poetry install
4242
```
4343

44-
If you are planning to visualize your graphs consider installing **PyGraphviz** from [here](https://pygraphviz.github.io/) and also add it to the poetry environment.
44+
Consider installing **PyGraphviz** from [here](https://pygraphviz.github.io/), if you are planning to visualize your graphs. Then add it to the poetry environment.
4545

4646
```bash
4747
poetry add pygraphviz
@@ -59,48 +59,21 @@ Create `.env` file to store credentials
5959

6060
## How to Use
6161

62-
### Generate synthetic graph on certain topic
62+
See `dialog2graph` usage examples:
6363

64-
Choose LLMs for generating and validating dialog graph and invoke graph generation
64+
1. [Learn base classes usage](https://github.com/deeppavlov/dialog2graph/blob/dev/examples/basics/base_classes_usage.ipynb)
6565

66-
```python
67-
from dialog2graph.datasets.complex_dialogs.generation import LoopedGraphGenerator
68-
from langchain_community.chat_models import ChatOpenAI
66+
2. [Learn dialog2graph pipelines and model configuration](https://github.com/deeppavlov/dialog2graph/blob/dev/examples/pipeline_usage/pipeline_example.ipynb)
6967

68+
3. [Generate dialog graph using LLMs](https://github.com/deeppavlov/dialog2graph/blob/dev/examples/data_generation/LoopedGraphGenerator_example.ipynb)
7069

71-
gen_model = ChatOpenAI(
72-
model='gpt-4o',
73-
api_key=os.getenv("OPENAI_API_KEY"),
74-
base_url=os.getenv("OPENAI_BASE_URL"),
75-
)
76-
val_model = ChatOpenAI(
77-
model='gpt-3.5-turbo',
78-
api_key=os.getenv("OPENAI_API_KEY"),
79-
base_url=os.getenv("OPENAI_BASE_URL"),
80-
temperature=0,
81-
)
70+
4. [Evaluate graph and dialogs](https://github.com/deeppavlov/dialog2graph/blob/dev/examples/evaluation/examples_of_metrics_usage.ipynb)
8271

83-
pipeline = LoopedGraphGenerator(
84-
generation_model=gen_model,
85-
validation_model=val_model,
86-
)
72+
5. [Learn CLI interface](https://github.com/deeppavlov/dialog2graph/blob/dev/examples/cli_usage/main.ipynb)
8773

88-
generated_graph = pipeline.invoke(topic="restaurant reservation")
89-
```
90-
91-
### Sample dialogs from existing dialog graph
92-
93-
Create graph instance and invoke sampler to get dialog list
74+
6. [Augment dialogs on dialog graph](https://github.com/deeppavlov/dialog2graph/blob/dev/examples/dialog_augmentation/dialogue_augmentation_example.ipynb)
9475

95-
```python
96-
from dialog2graph.pipelines.core.dialog_sampling import RecursiveDialogSampler
97-
from dialog2graph.pipelines.core.graph import Graph
98-
99-
G = Graph(graph_dict={...})
100-
101-
sampler = RecursiveDialogSampler()
102-
sampler.invoke(graph=G) #-> list of Dialog objects
103-
```
76+
7. [Extend a dialog graph](https://github.com/deeppavlov/dialog2graph/blob/dev/examples/dialog_extension/dialog_extender_example.ipynb)
10477

10578
## How to Contribute
10679

dialog2graph/pipelines/helpers/__init__.py

Whitespace-only changes.
14.1 KB
Loading

docs/source/about_us.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
About us
22
=========
33

4-
Dialog2Graph is developed by `DeepPavlov <https://deeppavlov.ai>`_.
54
.. |deeppavlov| image:: _static/images/logo-deeppavlov.svg
65
:align: middle
7-
:width: 40
6+
:width: 40
87

98
Developed by
109
""""""""""""
11-
|deeppavlov| `DeepPavlov <https://deeppavlov.ai>`_, an open source conversational AI framework
10+
|deeppavlov| `DeepPavlov <https://deeppavlov.ai>`_, an open source conversational AI framework
1211

1312
Project founders
1413
""""""""""""""""

docs/source/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
"sphinx.ext.viewcode",
4444
"sphinx.ext.napoleon",
4545
"sphinx.ext.extlinks",
46-
"sphinx_autodoc_typehints",
47-
"sphinx.ext.graphviz",
46+
"sphinx_autodoc_typehints"
4847
]
4948

5049
autodoc_default_options = {

docs/source/research.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ Key Concepts
77
A **dialog graph** is a structured, graph-based representation of conversational data, where **nodes** represent key elements such
88
as utterances, intents, or states, and **edges** define the transitions between these elements.
99

10-
.. graphviz::
10+
.. figure:: _static/images/graph-example.png
11+
:width: 400
1112
:align: center
12-
:caption: Simple example of dialog graph
1313

14-
digraph graphexample {
15-
"['Hello! How can I assist you today?']" -> "['Great! What product are you interested in?']" [ label="['I want to place an order.']" ];
16-
}
14+
Simple example of dialog graph
1715

1816
:doc:`Data collections <./research/data_collections>`
1917
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/source/research/data_collections.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Datasets
2-
========
1+
Data collections
2+
================
33

44
We provide several datasets that can be utilized for your experiments.
55

@@ -11,22 +11,22 @@ Task oriented dialog datasets
1111
-------------------------------
1212

1313
+---------------+-------------------------------------------------------------------------------------------------------------------+
14-
|d2g_real_dialogs |
14+
|d2g_real_dialogs |
1515
+===============+===================================================================================================================+
1616
|**Description**| Reformatted task oriented dialog datasets |
1717
+---------------+-------------------------------------------------------------------------------------------------------------------+
18-
|**Datasets** | 1. WOZ, 2. MULTIWOZ2_2, 3. MetaLWOz, 4. Microsoft Dialog Challenge, 5. schema_guided_dialog, 6. Stanford |
18+
|**Datasets** | 1. WOZ, 2. MULTIWOZ2_2, 3. MetaLWOz, 4. Microsoft Dialog Challenge, 5. schema_guided_dialog, 6. Stanford |
1919
| | Multi-Domain, 7. TaskMaster3, 8. Frames |
2020
+---------------+-------------------------------------------------------------------------------------------------------------------+
21-
|**Format** |``['domain', 'dialog_id', 'dialog']`` |
21+
|**Format** |``['domain', 'dialog_id', 'dialog']`` |
2222
+---------------+-------------------------------------------------------------------------------------------------------------------+
23-
|**Link** | |huggingface| `d2g_real_dialogs on HuggingFace <https://huggingface.co/datasets/DeepPavlov/d2g_real_dialogs>`_|
23+
|**Link** | |huggingface| `d2g_real_dialogs on HuggingFace <https://huggingface.co/datasets/DeepPavlov/d2g_real_dialogs>`_ |
2424
+---------------+-------------------------------------------------------------------------------------------------------------------+
2525
|**Usage** |.. code-block:: python |
2626
| | |
2727
| | from datasets import load_dataset |
2828
| | |
29-
| | dataset = load_dataset("DeepPavlov/d2g_real_dialogs", |
29+
| | dataset = load_dataset("DeepPavlov/d2g_real_dialogs", |
3030
| | "MULTIWOZ2_2", token=True) |
3131
+---------------+-------------------------------------------------------------------------------------------------------------------+
3232

@@ -38,7 +38,7 @@ Synthetic dialog graph dataset
3838
+===============+=========================================================================================================+
3939
|**Description**| LLM generated dialog graphs |
4040
+---------------+---------------------------------------------------------------------------------------------------------+
41-
|**Format** |``['graph', 'topic', 'dialogs']`` |
41+
|**Format** |``['graph', 'topic', 'dialogs']`` |
4242
+---------------+---------------------------------------------------------------------------------------------------------+
4343
|**Link** | |huggingface| `d2g_generated on HuggingFace <https://huggingface.co/datasets/DeepPavlov/d2g_generated>`_|
4444
+---------------+---------------------------------------------------------------------------------------------------------+

docs/source/userguides.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,33 @@ This guide demonstrates usage of ``ModelStorage`` class and generating the dialo
1616

1717
This generation guide demonstrates how we can generate a dialog graph to a certain topic.
1818

19+
:doc:`Evaluate graph and dialogs <./userguides/evaluate_userguide>`
20+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21+
22+
This guide demonstrates how to evaluate single dialog graphs and dialog sets, how to compare graphs on various metrics.
23+
1924
:doc:`Learn how to use dialog2graph CLI <./userguides/cli_usage>`
2025
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2126

22-
This guide demonstrates how to use CLI interface of dialog2graph.
27+
This guide demonstrates how to use ``dialog2graph`` CLI interface.
2328

2429
:doc:`Augment dialogs <./userguides/augment_dialogs>`
2530
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2631

2732
This guide demonstrates how to augment existing dialogs using LLMs.
2833

34+
:doc:`Extend graphs <./userguides/extend_graphs>`
35+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36+
37+
This guide demonstrates how to extend existing dialog graph using LLMs.
38+
2939
.. toctree::
3040
:hidden:
3141

3242
userguides/basic_usage
3343
userguides/generate_graphs
3444
userguides/generate_synthetic
45+
userguides/evaluate_userguide
3546
userguides/cli_usage
36-
userguides/augment_dialogs
47+
userguides/augment_dialogs
48+
userguides/extend_graphs

docs/source/userguides/augment_dialogs.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
:tutorial_name: dialog_augmentation/dialog_augmentation_example.ipynb
1+
:tutorial_name: dialog_augmentation/dialogue_augmentation_example.ipynb
22

33
Generate augmented dialogs on one given dialog
44
==================================================
55

6-
Use :py:class:`~dialog2graph.datasets.augment_dialogs.augmentation.DialogAugmenter` to augment an original dialog by paraphrasing
7-
its lines while maintaining the structure and flow of the conversation.
6+
:py:class:`~dialog2graph.datasets.augment_dialogs.augmentation.DialogAugmenter` is a class used to augment an original dialog by paraphrasing
7+
dialog turns while maintaining dialog structure and flow of the conversation.
88

99
.. code-block:: python
1010
@@ -14,8 +14,9 @@ its lines while maintaining the structure and flow of the conversation.
1414
from dialog2graph.pipelines.model_storage import ModelStorage
1515
1616
17-
1. Create :py:class:`~dialog2graph.pipelines.model_storage.ModelStorage` instance and add choosen LLMs for dialog generation (i.e. dialog augmentation)
18-
and formatting LLM's output.
17+
First, LLM models should be configured for further use. So, :py:class:`~dialog2graph.pipelines.model_storage.ModelStorage` instance
18+
is created to which choosen LLMs are added for dialog generation (i.e. dialog augmentation)
19+
and formatting LLM's output. More information on ModelStorage usage may be found :doc:`in this userguide <./generate_graphs>`.
1920

2021
.. code-block:: python
2122
@@ -31,8 +32,11 @@ and formatting LLM's output.
3132
model_type=ChatOpenAI
3233
)
3334
34-
2. Create :py:class:`~dialog2graph.datasets.augment_dialogs.augmentation.DialogAugmenter` instance and use
35-
:py:class:`~dialog2graph.datasets.augment_dialogs.augmentation.DialogAugmenter.invoke` method to get augmented dialogs.
35+
Then, :py:class:`~dialog2graph.datasets.augment_dialogs.augmentation.DialogAugmenter` instance is created to use
36+
:py:class:`~dialog2graph.datasets.augment_dialogs.augmentation.DialogAugmenter.invoke` method for getting augmented dialogs.
37+
:py:class:`~dialog2graph.datasets.augment_dialogs.augmentation.DialogAugmenter` takes previously created
38+
:py:class:`~dialog2graph.pipelines.model_storage.ModelStorage` instance and the names given to models should be leveraged
39+
for new dialog generation and dialog formatting.
3640

3741
.. code-block:: python
3842

docs/source/userguides/basic_usage.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Learn base dialog2graph classes
44
=========================================
55

66
:py:class:`~dialog2graph.pipelines.core.graph.Graph` and :py:class:`~dialog2graph.pipelines.core.dialog.Dialog` are the base structures used in the
7-
``dialog2graph`` project. They are perfect to store information about your graphs and dialogs in a clear format.
7+
``dialog2graph`` project. They are perfect to store information about your graphs and dialogs in a clear format. This tutorial demonstrates these classes
8+
functional.
89

910
Create dialog2graph.Graph
1011
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)