Manipulate and visualize LLMs conversations
Project description
💬 Dialog
Library to manipulate and display conversations.
✨ Try it on Colab:
Features
-
Create and manipulate conversations with minimal boilerplate
conv = dialog.Conversation( dialog.User('What is this image ?\n', dialog.Image(data)), dialog.Model('This image represent a cat'), dialog.User('Thank you.'), )
-
Round-trip conversions between:
- Text:
conv.as_text() - Tokens:
conv.as_batch()
- Text:
-
Pretty Colab display
- For conversation:
- For text:
- For conversation:
-
Manipulations:
conv += dialog.User(): Append the next turnconv += [dialog.User(), dialog.Model()]: Append multiple turns.len(conv)list(conv)conv[-1][-1]: Slicing (last chunk of the last turn)
Thinking
dialog.Think(): In the System instructiondialog.Thought('Model thoughts...'): In the model answer
conv = dialog.Conversation(
dialog.System(dialog.Think()),
dialog.User('Hello'),
dialog.Model(
dialog.Thought('I need to greet the user'),
'Hello! What can I do for you?',
)
)
Function calling
Function calling is done through:
dialog.Tool: Tool definition in the system instructiondialog.ToolCalldialog.ToolResponse
conv = dialog.Conversation(
dialog.System(
dialog.Tool(tool0),
dialog.Tool(tool1),
),
dialog.User('Turn off the light in my bedroom'),
dialog.Model(
dialog.ToolCall(call0),
dialog.ToolResponse(response0),
'Lights have been turned off. Good night.',
)
)
Multi-modalities
dialog.Image: Image modalitydialog.Audio: Audio modality
Modalities supports anything which can be interpreted as image/audio, including urls, paths, numpy array,...
dialog.User(
'Describe those images:\n\n',
dialog.Image(np.zeros((256, 256, 3), np.uint8)),
dialog.Image('https://example.org/img.png'),
dialog.Image('/path/to/my_img.jpg'),
),
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dialog-1.0.0.tar.gz.
File metadata
- Download URL: dialog-1.0.0.tar.gz
- Upload date:
- Size: 305.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a0bbc5c48491942433fb2dde5db362f705385d36f975c316c2c9b9d71b999b5
|
|
| MD5 |
21a6987d8b839c15eda8fda3c9a19e9e
|
|
| BLAKE2b-256 |
6ce667e8e7f14f0ca9396c34ad5d762cf159a1e49fc2e1a1b29566d4132b749a
|
File details
Details for the file dialog-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dialog-1.0.0-py3-none-any.whl
- Upload date:
- Size: 318.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca3abbb059454993180c018e0acd12355365a4bb975d873b636599c7cd8b2d49
|
|
| MD5 |
beb1fd0c21b4a16ce135cbff873b6f07
|
|
| BLAKE2b-256 |
902cf7034927f6e6a6d97bec0d621674b8e62162f90d06474dd5fa11637b07cd
|