API Reference - Main Package#
Init file for Intentional's sample tools.
GetCurrentDateTimeTool
#
Bases: Tool
Simple tool to get the current date and time.
Source code in intentional/sample_tools.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
run(params=None)
async
#
Returns the current time.
Source code in intentional/sample_tools.py
55 56 57 58 59 60 61 |
|
RescheduleInterviewTool
#
Bases: Tool
Mock tool to reschedule an interview.
Source code in intentional/sample_tools.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
run(params=None)
async
#
Returns the current time.
Source code in intentional/sample_tools.py
89 90 91 92 93 94 |
|
__about__
#
Package descriptors for intentional.
cli
#
Entry point for the Intentional CLI.
draw_intent_graph_from_config(path)
async
#
Load the intent router from the configuration file.
Source code in intentional/cli.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
main()
#
Entry point for the Intentional CLI.
Source code in intentional/cli.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
draw
#
Helpers that allow the user to draw the bot's graph.
to_bytes(intent_router, mermaid_domain='https://mermaid.ink/img/')
async
#
Uses mermaid.ink to render the intent's graph into an image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
intent_router
|
IntentRouter
|
the intents graph to draw. |
required |
mermaid_domain
|
str
|
the domain of your Mermaid instance, if you have your own. Defaults to the public mermaid.ink domain. |
'https://mermaid.ink/img/'
|
Returns:
Type | Description |
---|---|
bytes
|
The bytes of the resulting image. To save them into an image file, do: |
bytes
|
```python |
bytes
|
image = to_image(intent_router) |
bytes
|
with open(image_path, "wb") as imagefile: imagefile.write(image) |
bytes
|
``` |
Source code in intentional/draw.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
to_image(intent_router, image_path)
async
#
Saves an image of the intent's graph at the given path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
intent_router
|
IntentRouter
|
the intents graph to draw. |
required |
image_path
|
Path
|
where to save the resulting image |
required |
Source code in intentional/draw.py
27 28 29 30 31 32 33 34 35 36 37 |
|
to_mermaid_diagram(intent_router)
#
Creates a textual representation of the intents graph in a way that Mermaid.ink can render.
Keep in mind that this function should be able to render also malformed graphs as far as possible, because it can be used as a debugging tool to visualize bad bot configurations within error messages.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
intent_router
|
IntentRouter
|
the intents graph to draw. |
required |
Returns:
Type | Description |
---|---|
str
|
A string containing the description of the graph. |
Source code in intentional/draw.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
to_mermaid_link(intent_router, mermaid_domain='https://mermaid.ink/img/')
#
Generated a URL that contains a rendering of the graph of the intents into an image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
intent_router
|
IntentRouter
|
the intents graph to draw. |
required |
mermaid_domain
|
str
|
the domain of your Mermaid instance, if you have your own. Defaults to the public mermaid.ink domain. |
'https://mermaid.ink/img/'
|
Returns:
Type | Description |
---|---|
str
|
A URL on Mermaid.ink with the graph of the intents. |
Source code in intentional/draw.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
sample_tools
#
Sample tools for Intentional's examples.
GetCurrentDateTimeTool
#
Bases: Tool
Simple tool to get the current date and time.
Source code in intentional/sample_tools.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
run(params=None)
async
#
Returns the current time.
Source code in intentional/sample_tools.py
55 56 57 58 59 60 61 |
|
MockTool
#
Bases: Tool
Simple tool that returns a fixed response to a fixed parameter value.
Accepts a single parameter, "request", which is a string.
Source code in intentional/sample_tools.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
run(params=None)
async
#
Returns a fixed response to a fixed parameter value.
Source code in intentional/sample_tools.py
33 34 35 36 37 38 39 40 41 42 |
|
RescheduleInterviewTool
#
Bases: Tool
Mock tool to reschedule an interview.
Source code in intentional/sample_tools.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
run(params=None)
async
#
Returns the current time.
Source code in intentional/sample_tools.py
89 90 91 92 93 94 |
|