Skip to content

Commit 1ab28e0

Browse files
deploy: 7caea8b
0 parents  commit 1ab28e0

26 files changed

Lines changed: 8145 additions & 0 deletions

.nojekyll

Whitespace-only changes.

core.html

Lines changed: 1439 additions & 0 deletions
Large diffs are not rendered by default.

core.html.md

Lines changed: 913 additions & 0 deletions
Large diffs are not rendered by default.

index.html

Lines changed: 663 additions & 0 deletions
Large diffs are not rendered by default.

index.html.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# dialoghelper
2+
3+
4+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
5+
6+
This file will become your README and also the index of your
7+
documentation.
8+
9+
## Developer Guide
10+
11+
If you are new to using `nbdev` here are some useful pointers to get you
12+
started.
13+
14+
### Install dialoghelper in Development mode
15+
16+
``` sh
17+
# make sure dialoghelper package is installed in development mode
18+
$ pip install -e .
19+
20+
# make changes under nbs/ directory
21+
# ...
22+
23+
# compile to have changes apply to dialoghelper
24+
$ nbdev_prepare
25+
```
26+
27+
## Usage
28+
29+
### Installation
30+
31+
Install latest from the GitHub
32+
[repository](https://github.com/AnswerDotAI/dialoghelper):
33+
34+
``` sh
35+
$ pip install git+https://github.com/AnswerDotAI/dialoghelper.git
36+
```
37+
38+
or from [conda](https://anaconda.org/AnswerDotAI/dialoghelper)
39+
40+
``` sh
41+
$ conda install -c AnswerDotAI dialoghelper
42+
```
43+
44+
or from [pypi](https://pypi.org/project/dialoghelper/)
45+
46+
``` sh
47+
$ pip install dialoghelper
48+
```
49+
50+
### Documentation
51+
52+
Documentation can be found hosted on this GitHub
53+
[repository](https://github.com/AnswerDotAI/dialoghelper)’s
54+
[pages](https://AnswerDotAI.github.io/dialoghelper/). Additionally you
55+
can find package manager specific guidelines on
56+
[conda](https://anaconda.org/AnswerDotAI/dialoghelper) and
57+
[pypi](https://pypi.org/project/dialoghelper/) respectively.
58+
59+
## How to use
60+
61+
Fill me in please! Don’t forget code examples:
62+
63+
``` python
64+
1+1
65+
```
66+
67+
2

robots.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sitemap: https://AnswerDotAI.github.io/dialoghelper/sitemap.xml

search.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
[
2+
{
3+
"objectID": "core.html",
4+
"href": "core.html",
5+
"title": "dialoghelper",
6+
"section": "",
7+
"text": "Re-export asdict:\nsource",
8+
"crumbs": [
9+
"dialoghelper"
10+
]
11+
},
12+
{
13+
"objectID": "core.html#gists",
14+
"href": "core.html#gists",
15+
"title": "dialoghelper",
16+
"section": "Gists",
17+
"text": "Gists\n\nsource\n\nload_gist\n\n load_gist (gist_id:str)\n\nRetrieve a gist\n\ngistid = 'jph00/e7cfd4ded593e8ef6217e78a0131960c'\ngist = load_gist(gistid)\ngist.html_url\n\n'https://gist.github.com/jph00/e7cfd4ded593e8ef6217e78a0131960c'\n\n\n\nsource\n\n\ngist_file\n\n gist_file (gist_id:str)\n\nGet the first file from a gist\n\ngfile = gist_file(gistid)\nprint(gfile.content[:100]+\"…\")\n\n\"This is a test module which makes some simple tools available.\"\n__all__ = [\"hi\",\"whoami\"]\n\ntestfoo=…\n\n\n\nsource\n\n\nimport_string\n\n import_string (code:str, name:str)\n\n\n\n\n\nType\nDetails\n\n\n\n\ncode\nstr\nCode to import as a module\n\n\nname\nstr\nName of module to create\n\n\n\n\nsource\n\n\nis_usable_tool\n\n is_usable_tool (func:&lt;built-infunctioncallable&gt;)\n\nTrue if the function has a docstring and all parameters have types, meaning that it can be used as an LLM tool.\n\ndef hi(who:str):\n \"Say hi to `who`\"\n return f\"Hello {who}\"\n\ndef hi2(who):\n \"Say hi to `who`\"\n return f\"Hello {who}\"\n\ndef hi3(who:str):\n return f\"Hello {who}\"\n\nbye = \"bye\"\n\n\nassert is_usable_tool(hi)\nassert not is_usable_tool(hi2)\nassert not is_usable_tool(hi3)\nassert not is_usable_tool(bye)\n\n\nsource\n\n\nmk_toollist\n\n mk_toollist (syms)\n\n\nMarkdown(mk_toollist([hi]))\n\n\n&hi: Say hi to who\n\n\n\n\nsource\n\n\nimport_gist\n\n import_gist (gist_id:str, mod_name:str=None, add_global:bool=True,\n import_wildcard:bool=False, create_msg:bool=False)\n\nImport gist directly from string without saving to disk\n\n\n\n\n\n\n\n\n\n\nType\nDefault\nDetails\n\n\n\n\ngist_id\nstr\n\nuser/id or just id of gist to import as a module\n\n\nmod_name\nstr\nNone\nmodule name to create (taken from gist filename if not passed)\n\n\nadd_global\nbool\nTrue\nadd module to caller’s globals?\n\n\nimport_wildcard\nbool\nFalse\nimport all exported symbols to caller’s globals\n\n\ncreate_msg\nbool\nFalse\nAdd a message that lists usable tools\n\n\n\n\nimport_gist(gistid)\nimporttest.testfoo\n\n'testbar'\n\n\n\nimport_gist.__doc__\n\n'Import gist directly from string without saving to disk'\n\n\n\nimport_gist(gistid, import_wildcard=True)\nimporttest.testfoo\n\n'testbar'\n\n\n\nhi(\"Sarah\")\n\n'Hello Sarah'\n\n\n\nimporttest.__all__\n\n['hi', 'whoami']",
18+
"crumbs": [
19+
"dialoghelper"
20+
]
21+
},
22+
{
23+
"objectID": "core.html#importing-and-exporting-dialogs",
24+
"href": "core.html#importing-and-exporting-dialogs",
25+
"title": "dialoghelper",
26+
"section": "Importing and Exporting Dialogs",
27+
"text": "Importing and Exporting Dialogs\nWe use json serialization of list[dict] to represent a dialogue where dict is a serialized solveit.db_dc Message.\n\nSupported Fields\n\nfrom dialoghelper.db_dc import Message\n\n\nMessage.__annotations__\n\n{'sid': str | None,\n 'mid': str | None,\n 'content': str | None,\n 'output': str | None,\n 'input_tokens': int | None,\n 'output_tokens': int | None,\n 'msg_type': str | None,\n 'time_run': str | None,\n 'is_exported': int | None,\n 'skipped': int | None,\n 'did': int | None,\n 'i_collapsed': int | None,\n 'o_collapsed': int | None,\n 'header_collapsed': int | None,\n 'pinned': int | None}\n\n\nWhen exporting and importing we intentionally leave out these fields: - sid - to avoid duplicating sids across dialogues - mid - to ensure mid respects ordering in the new dialogue - did - since the dialogue will be imported into a different dialogue - time_run - since a dialogue may be imported/exported to other environments where execution time is not comparable.\nThe following are required: - content - msg_type - output\nAll other fields (i_collapsed, header_collapsed, … etc) are technically optional. By default we read them on import if they are available. However, there may be other dialog-consuming applications (shell sage, discord buddy, others) we want to share dialogues with where these fields are not supported by the interface.\n\n\nAttachments\nFor now attachments are not included in the importing and exporting.\nAttachments could be added as a future enhanement but would add some additional design considerations - if attachments refer to external artifacts, do the artifacts get copied? Do they get bundled as part of the export artifact? Do we create a new artifact entry with a new sid for the new dialogue or do we share artifacts?\n\n\nImplementation\n\nsource\n\n\nexport_dialog\n\n export_dialog (filename:str, did:int=None)\n\nExport dialog messages and optionally attachments to JSON\n\ntry:\n test_path = Path('test.json')\n export_dialog(test_path)\n test_msgs = test_path.read_json()\n print(test_msgs['messages'][1]['content'])\nfinally: test_path.unlink(missing_ok=True)\n\n1+1\n\n\n\nsource\n\n\nimport_dialog\n\n import_dialog (fname, add_header=True)\n\nImport dialog messages from JSON file using add_msg",
28+
"crumbs": [
29+
"dialoghelper"
30+
]
31+
},
32+
{
33+
"objectID": "core.html#tool-info",
34+
"href": "core.html#tool-info",
35+
"title": "dialoghelper",
36+
"section": "Tool info",
37+
"text": "Tool info\nThis is how we get a superset of tools to include:\n\nfor o in _all:\n s = globals()[o]\n if s.__name__[0]=='_' or not s.__doc__: continue\n print(f'- {s.__name__}: {s.__doc__}')\n\n- find_var: Search for var in all frames of the call stack\n- find_dialog_id: Get the dialog id by searching the call stack for __dialog_id.\n- find_msgs: Find messages in current specific dialog that contain the given information. To refer to a message found later, use its `sid` field (which is the pk).\n- find_msg_id: Get the message id by searching the call stack for __dialog_id.\n- read_msg_ids: Get all ids in current dialog.\n- msg_idx: Get relative index of current message in dialog.\n- read_msg: Get the message indexed in the current dialog.\n- del_msg: Delete a message from the dialog. Be sure to pass a `sid`, not a `mid`.\n- add_msg: Add/update a message to the queue to show after code execution completes. Be sure to pass a `sid` (stable id) not a `mid` (which is used only for sorting, and can change).\n- update_msg: Update an existing message. Provide either `msg` OR field key/values to update.\n Use `content` param to update contents. Be sure to pass a `sid` (stable id -- the pk) not a `mid`\n (which is used only for sorting, and can change).\n Only include parameters to update--missing ones will be left unchanged.\n- load_gist: Retrieve a gist\n- gist_file: Get the first file from a gist\n- is_usable_tool: True if the function has a docstring and all parameters have types, meaning that it can be used as an LLM tool.\n- import_gist: Import gist directly from string without saving to disk\n- export_dialog: Export dialog messages and optionally attachments to JSON\n- import_dialog: Import dialog messages from JSON file using `add_msg`\n- asdict: Convert `o` to a `dict`, supporting dataclasses, namedtuples, iterables, and `__dict__` attrs.\n\n\n\nsource\n\ntool_info\n\n tool_info ()",
38+
"crumbs": [
39+
"dialoghelper"
40+
]
41+
},
42+
{
43+
"objectID": "index.html",
44+
"href": "index.html",
45+
"title": "dialoghelper",
46+
"section": "",
47+
"text": "This file will become your README and also the index of your documentation.",
48+
"crumbs": [
49+
"dialoghelper"
50+
]
51+
},
52+
{
53+
"objectID": "index.html#developer-guide",
54+
"href": "index.html#developer-guide",
55+
"title": "dialoghelper",
56+
"section": "Developer Guide",
57+
"text": "Developer Guide\nIf you are new to using nbdev here are some useful pointers to get you started.\n\nInstall dialoghelper in Development mode\n# make sure dialoghelper package is installed in development mode\n$ pip install -e .\n\n# make changes under nbs/ directory\n# ...\n\n# compile to have changes apply to dialoghelper\n$ nbdev_prepare",
58+
"crumbs": [
59+
"dialoghelper"
60+
]
61+
},
62+
{
63+
"objectID": "index.html#usage",
64+
"href": "index.html#usage",
65+
"title": "dialoghelper",
66+
"section": "Usage",
67+
"text": "Usage\n\nInstallation\nInstall latest from the GitHub repository:\n$ pip install git+https://github.com/AnswerDotAI/dialoghelper.git\nor from conda\n$ conda install -c AnswerDotAI dialoghelper\nor from pypi\n$ pip install dialoghelper\n\n\nDocumentation\nDocumentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.",
68+
"crumbs": [
69+
"dialoghelper"
70+
]
71+
},
72+
{
73+
"objectID": "index.html#how-to-use",
74+
"href": "index.html#how-to-use",
75+
"title": "dialoghelper",
76+
"section": "How to use",
77+
"text": "How to use\nFill me in please! Don’t forget code examples:\n\n1+1\n\n2",
78+
"crumbs": [
79+
"dialoghelper"
80+
]
81+
}
82+
]

site_libs/bootstrap/bootstrap-b1527d6dab3c1d2528611d399e709420.min.css

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)