From 3f085ab875e7709ead461b03f7af6ecd6c22b0d1 Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Sat, 28 Sep 2024 01:29:14 +0300 Subject: [PATCH 1/6] fix version of gh-pages-deploy-action https://www.github.com/JamesIves/github-pages-deploy-action/issues/1697 --- .github/workflows/build_and_publish_docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_publish_docs.yml b/.github/workflows/build_and_publish_docs.yml index a74150e5e..f50a2ea99 100644 --- a/.github/workflows/build_and_publish_docs.yml +++ b/.github/workflows/build_and_publish_docs.yml @@ -65,7 +65,7 @@ jobs: - name: deploy website if: ${{ github.ref == 'refs/heads/master' }} - uses: JamesIves/github-pages-deploy-action@v4 + uses: JamesIves/github-pages-deploy-action@v4.6.4 with: branch: gh-pages folder: docs/build/ From 214f0937cc0b3d83022e80c06c51ea000b367336 Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Fri, 4 Oct 2024 14:39:02 +0300 Subject: [PATCH 2/6] clear up slot user guide --- docs/source/user_guides/slot_extraction.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/source/user_guides/slot_extraction.rst b/docs/source/user_guides/slot_extraction.rst index 61dcff117..11798074e 100644 --- a/docs/source/user_guides/slot_extraction.rst +++ b/docs/source/user_guides/slot_extraction.rst @@ -100,7 +100,7 @@ A dot-separated string that acts as a path from the root slot to the needed slot In the example above ``name_slot`` would have the name "name" because that is the key used to store it in the ``profile_slot``. -If you have a nested structure (of ``GroupSlots``) separate the names with dots: +Let's consider nested group slots: .. code-block:: python @@ -141,7 +141,10 @@ The `conditions` submodule provides a function for checking if specific slots ha Both `processing` and `response` submodules provide functions for filling templates with extracted slot values. -Choose whichever one you like, there's not much difference between them at the moment. + +- ``FillTemplate`` changes the response function of the current node to ``FilledTemplate`` at the ``PRE_RESPONSE`` level. +- ``FilledTemplate`` is a response function that fills slots after producing inner response + (which can be ``BaseResponse``, ``Message`` or simply a string). .. code-block:: python @@ -153,7 +156,7 @@ Choose whichever one you like, there's not much difference between them at the m RESPONSE: rsp.FilledTemplate("Your first name: {name}") -Some real examples of scripts utilizing slot extraction can be found in the +An example of script utilizing slot extraction can be found in the `tutorials section <../tutorials/tutorials.slots.1_basic_example.html>`_. Further reading From f4e4cf43f8b8a7ec04c3fb02e887ceb42cf2f653 Mon Sep 17 00:00:00 2001 From: Alexander Sergeev <22302418+pseusys@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:20:35 +0800 Subject: [PATCH 3/6] Benchmark time reduce (#396) # Description Benchmark data reduced in order to reduce total benchmarking time (was more than 20 hours before; and now 5 hours). # Checklist - [x] I have performed a self-review of the changes # To Consider - Add tests (if functionality is changed) - Update API reference / tutorials / guides - Update CONTRIBUTING.md (if devel workflow is changed) - Update `.ignore` files, scripts (such as `lint`), distribution manifest (if files are added/deleted) - Search for references to changed entities in the codebase --------- Co-authored-by: Roman Zlobin --- chatsky/utils/db_benchmark/basic_config.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/chatsky/utils/db_benchmark/basic_config.py b/chatsky/utils/db_benchmark/basic_config.py index 68d9c1006..edd0cc620 100644 --- a/chatsky/utils/db_benchmark/basic_config.py +++ b/chatsky/utils/db_benchmark/basic_config.py @@ -96,9 +96,9 @@ class BasicBenchmarkConfig(BenchmarkConfig, frozen=True): Number of times the contexts will be benchmarked. Increasing this number decreases standard error of the mean for benchmarked data. """ - from_dialog_len: int = 300 + from_dialog_len: int = 25 """Starting dialog len of a context.""" - to_dialog_len: int = 311 + to_dialog_len: int = 50 """ Final dialog len of a context. :py:meth:`~.BasicBenchmarkConfig.context_updater` will return contexts @@ -177,27 +177,25 @@ def context_updater(self, context: Context) -> Optional[Context]: basic_configurations = { "large-misc": BasicBenchmarkConfig( from_dialog_len=1, - to_dialog_len=50, + to_dialog_len=26, message_dimensions=(3, 5, 6, 5, 3), misc_dimensions=(2, 4, 3, 8, 100), ), "short-messages": BasicBenchmarkConfig( - from_dialog_len=500, - to_dialog_len=550, message_dimensions=(2, 30), misc_dimensions=(0, 0), ), "default": BasicBenchmarkConfig(), - "large-misc--long-dialog": BasicBenchmarkConfig( - from_dialog_len=500, - to_dialog_len=550, + "large-misc-long-dialog": BasicBenchmarkConfig( + from_dialog_len=50, + to_dialog_len=75, message_dimensions=(3, 5, 6, 5, 3), misc_dimensions=(2, 4, 3, 8, 100), ), "very-long-dialog-len": BasicBenchmarkConfig( context_num=10, - from_dialog_len=10000, - to_dialog_len=10050, + from_dialog_len=1000, + to_dialog_len=1050, ), "very-long-message-len": BasicBenchmarkConfig( context_num=10, From 96d05dc7119f2db99890f057ea5e19f7b59b6e1e Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Fri, 18 Oct 2024 16:46:23 +0300 Subject: [PATCH 4/6] update lock file --- poetry.lock | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 6f12d5e09..4a689a3c2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -33,6 +33,17 @@ aiohttp-speedups = ["aiodns", "aiohttp (>=3.8.4)", "ciso8601 (>=2.3.0)", "faust- httpx = ["httpx"] httpx-speedups = ["ciso8601 (>=2.3.0)", "httpx"] +[[package]] +name = "aiofiles" +version = "24.1.0" +description = "File support for asyncio." +optional = true +python-versions = ">=3.8" +files = [ + {file = "aiofiles-24.1.0-py3-none-any.whl", hash = "sha256:b4ec55f4195e3eb5d7abd1bf7e061763e864dd4954231fb8539a0ef8bb8260e5"}, + {file = "aiofiles-24.1.0.tar.gz", hash = "sha256:22a075c9e5a3810f0c2e48f3008c94d68c65d763b9b03857924c99e57355166c"}, +] + [[package]] name = "aiohappyeyeballs" version = "2.4.2" @@ -7033,8 +7044,10 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [extras] benchmark = ["altair", "humanize", "pandas", "pympler", "tqdm"] +json = ["aiofiles"] mongodb = ["motor"] mysql = ["asyncmy", "cryptography", "sqlalchemy"] +pickle = ["aiofiles"] postgresql = ["asyncpg", "sqlalchemy"] redis = ["redis"] sqlite = ["aiosqlite", "sqlalchemy"] @@ -7046,4 +7059,4 @@ ydb = ["six", "ydb"] [metadata] lock-version = "2.0" python-versions = "^3.8.1,!=3.9.7" -content-hash = "9e9a6d04584f091b192d261f9f396b1157129ea1acacff34bc572d3daf863e7f" +content-hash = "511348f67731d8a26e0a269d3f8f032368a85289cdd4772df378335c57812201" From 1430544f0f26c350586ca6440ea059c477ca5d3f Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Fri, 18 Oct 2024 17:24:15 +0300 Subject: [PATCH 5/6] fix context size calculation --- chatsky/utils/db_benchmark/basic_config.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/chatsky/utils/db_benchmark/basic_config.py b/chatsky/utils/db_benchmark/basic_config.py index 3941f7f12..cc22a11ee 100644 --- a/chatsky/utils/db_benchmark/basic_config.py +++ b/chatsky/utils/db_benchmark/basic_config.py @@ -150,14 +150,21 @@ async def info(self): - "misc_size" -- size of a misc field of a context. - "message_size" -- size of a misc field of a message. """ + def remove_db_from_context(ctx: Context): + ctx._storage = None + ctx.requests._storage = None + ctx.responses._storage = None + ctx.labels._storage = None + + starting_context = await get_context(MemoryContextStorage(), self.from_dialog_len, self.message_dimensions, self.misc_dimensions) + final_contex = await get_context(MemoryContextStorage(), self.to_dialog_len, self.message_dimensions, self.misc_dimensions) + remove_db_from_context(starting_context) + remove_db_from_context(final_contex) return { "params": self.model_dump(), "sizes": { - "starting_context_size": naturalsize(asizeof.asizeof(await self.get_context(MemoryContextStorage())), gnu=True), - "final_context_size": naturalsize( - asizeof.asizeof(await get_context(MemoryContextStorage(), self.to_dialog_len, self.message_dimensions, self.misc_dimensions)), - gnu=True, - ), + "starting_context_size": naturalsize(asizeof.asizeof(starting_context.model_dump(mode="json")), gnu=True), + "final_context_size": naturalsize(asizeof.asizeof(final_contex.model_dump(mode="json")), gnu=True), "misc_size": naturalsize(asizeof.asizeof(get_dict(self.misc_dimensions)), gnu=True), "message_size": naturalsize(asizeof.asizeof(get_message(self.message_dimensions)), gnu=True), }, From 403e2e17dffbe52a9a00ad21c6d4689dc02b5446 Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Fri, 18 Oct 2024 17:30:36 +0300 Subject: [PATCH 6/6] change model_dump mode --- chatsky/utils/db_benchmark/basic_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chatsky/utils/db_benchmark/basic_config.py b/chatsky/utils/db_benchmark/basic_config.py index cc22a11ee..6b98636ae 100644 --- a/chatsky/utils/db_benchmark/basic_config.py +++ b/chatsky/utils/db_benchmark/basic_config.py @@ -163,8 +163,8 @@ def remove_db_from_context(ctx: Context): return { "params": self.model_dump(), "sizes": { - "starting_context_size": naturalsize(asizeof.asizeof(starting_context.model_dump(mode="json")), gnu=True), - "final_context_size": naturalsize(asizeof.asizeof(final_contex.model_dump(mode="json")), gnu=True), + "starting_context_size": naturalsize(asizeof.asizeof(starting_context.model_dump(mode="python")), gnu=True), + "final_context_size": naturalsize(asizeof.asizeof(final_contex.model_dump(mode="python")), gnu=True), "misc_size": naturalsize(asizeof.asizeof(get_dict(self.misc_dimensions)), gnu=True), "message_size": naturalsize(asizeof.asizeof(get_message(self.message_dimensions)), gnu=True), },