💬 Dialog
Library to manipulate and display conversations.
✨ Try it on Colab: https://colab.research.google.com/github/google-deepmind/dialog/blob/main/colab/dialog.ipynb ✨
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'),
),
Release files for dialog 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dialog-1.1.0.tar.gz | 35.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dialog-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 83.2 kB
Release files / dialog-1.1.0.tar.gz
| Download URL | dialog-1.1.0.tar.gz |
|---|---|
| Size | 35.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3739815cb702ae7b95f2f4732d9dbb2e98574764e54c2f2f5f5db6bbe6a04688
|
|
BLAKE2b-256 checksum How to use checksums |
efa5da62d764788bbbab4d313ddba6d84a535b0cb32ffce60901aa15363b9d67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / dialog-1.1.0-py3-none-any.whl
| Download URL | dialog-1.1.0-py3-none-any.whl |
|---|---|
| Size | 48.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
179d3742e95c53175790eb728e63702abce52fbfc6dc8502d8e6cffdd4b581aa
|
|
BLAKE2b-256 checksum How to use checksums |
9038bcfc52b2fec0d1cadfde15b0948864170c7f241b50889673d73c7ed786e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|