diff --git a/faststream_gen/__init__.py b/faststream_gen/__init__.py index 9bca567..374c836 100644 --- a/faststream_gen/__init__.py +++ b/faststream_gen/__init__.py @@ -1 +1 @@ -__version__ = "0.1.5rc4" \ No newline at end of file +__version__ = "0.1.6rc0" \ No newline at end of file diff --git a/faststream_gen/_code_generator/app_and_test_generator.py b/faststream_gen/_code_generator/app_and_test_generator.py index 62fa26f..17d5c33 100644 --- a/faststream_gen/_code_generator/app_and_test_generator.py +++ b/faststream_gen/_code_generator/app_and_test_generator.py @@ -39,9 +39,10 @@ # %% ../../nbs/App_And_Test_Generator.ipynb 5 _code_fix_prompt = """ -Your task is to correct the provided code. Your response should consist solely of valid Python code. You must follow the below rules while responding: +Fix the provided Python code following these rules: -- Do not include explanations or wrap your response in ```python tags. +- Provide only valid Python code, no explanations or code tags. +- Do not modify the line starting with 'from app.application'; it must remain unchanged. Adherence to this rule is crucial. """ def _fix_generated_code(s: str) -> str: diff --git a/faststream_gen/_code_generator/prompts.py b/faststream_gen/_code_generator/prompts.py index ded3dbe..49aee88 100644 --- a/faststream_gen/_code_generator/prompts.py +++ b/faststream_gen/_code_generator/prompts.py @@ -228,6 +228,29 @@ async def on_output_data(msg: DataBasic) -> DataBasic: # ERROR IN THIS LINE async def on_output_data(msg: DataBasic): # ERROR FIXED IN THIS LINE pass +==== Error ==== + +ImportError: cannot import name 'on_output_data' from 'app.application' + +==== ERROR CODE ==== + +from app.application import InputData, broker, on_input_data, on_output_data + +==== FIXED CODE ==== + +from app.application import InputData, broker, on_input_data + +==== Error ==== + +assert on_input_data.mock.assert_called_with(dict(DataMessage(data=1))) + +==== ERROR CODE ==== + +assert on_input_data.mock.assert_called_with(dict(DataMessage(data=1))) + +==== FIXED CODE ==== + +on_input_data.mock.assert_called_with(dict(DataMessage(data=1))) ==== APP DESCRIPTION ==== diff --git a/faststream_gen/package_data/docs/index.faiss b/faststream_gen/package_data/docs/index.faiss index 30c7bd9..93d5651 100644 Binary files a/faststream_gen/package_data/docs/index.faiss and b/faststream_gen/package_data/docs/index.faiss differ diff --git a/faststream_gen/package_data/docs/index.pkl b/faststream_gen/package_data/docs/index.pkl index f22793c..8200955 100644 Binary files a/faststream_gen/package_data/docs/index.pkl and b/faststream_gen/package_data/docs/index.pkl differ diff --git a/faststream_gen/package_data/examples/index.faiss b/faststream_gen/package_data/examples/index.faiss index 1d97ae5..8766244 100644 Binary files a/faststream_gen/package_data/examples/index.faiss and b/faststream_gen/package_data/examples/index.faiss differ diff --git a/faststream_gen/package_data/examples/index.pkl b/faststream_gen/package_data/examples/index.pkl index 0c01fce..cfe2381 100644 Binary files a/faststream_gen/package_data/examples/index.pkl and b/faststream_gen/package_data/examples/index.pkl differ diff --git a/nbs/App_And_Test_Generator.ipynb b/nbs/App_And_Test_Generator.ipynb index eca1277..11fdde4 100644 --- a/nbs/App_And_Test_Generator.ipynb +++ b/nbs/App_And_Test_Generator.ipynb @@ -101,9 +101,10 @@ "# | export\n", "\n", "_code_fix_prompt = \"\"\"\n", - "Your task is to correct the provided code. Your response should consist solely of valid Python code. You must follow the below rules while responding:\n", + "Fix the provided Python code following these rules:\n", "\n", - "- Do not include explanations or wrap your response in ```python tags.\n", + "- Provide only valid Python code, no explanations or code tags.\n", + "- Do not modify the line starting with 'from app.application'; it must remain unchanged. Adherence to this rule is crucial.\n", "\"\"\"\n", "\n", "def _fix_generated_code(s: str) -> str:\n", @@ -284,7 +285,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "['\\x1b[1m============================= test session starts ==============================\\x1b[0m\\nplatform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0\\nrootdir: /tmp/tmp_y4g4zm7\\nplugins: anyio-3.7.1, asyncio-0.21.1\\nasyncio: mode=Mode.STRICT\\ncollected 1 item\\n\\ntests/test_application.py \\x1b[31mF\\x1b[0m\\x1b[31m [100%]\\x1b[0m\\n\\n=================================== FAILURES ===================================\\n\\x1b[31m\\x1b[1m______________________________ test_always_fails _______________________________\\x1b[0m\\n\\x1b[1m\\x1b[31mtests/test_application.py\\x1b[0m:3: in test_always_fails\\n \\x1b[94massert\\x1b[39;49;00m \\x1b[94mFalse\\x1b[39;49;00m\\x1b[90m\\x1b[39;49;00m\\n\\x1b[1m\\x1b[31mE assert False\\x1b[0m\\n\\x1b[36m\\x1b[1m=========================== short test summary info ============================\\x1b[0m\\n\\x1b[31mFAILED\\x1b[0m tests/test_application.py::\\x1b[1mtest_always_fails\\x1b[0m - assert False\\n\\x1b[31m============================== \\x1b[31m\\x1b[1m1 failed\\x1b[0m\\x1b[31m in 0.04s\\x1b[0m\\x1b[31m ===============================\\x1b[0m\\n']\n", + "['\\x1b[1m============================= test session starts ==============================\\x1b[0m\\nplatform linux -- Python 3.11.5, pytest-7.4.2, pluggy-1.3.0\\nrootdir: /tmp/tmp858giugx\\nplugins: anyio-3.7.1, asyncio-0.21.1\\nasyncio: mode=Mode.STRICT\\ncollected 1 item\\n\\ntests/test_application.py \\x1b[31mF\\x1b[0m\\x1b[31m [100%]\\x1b[0m\\n\\n=================================== FAILURES ===================================\\n\\x1b[31m\\x1b[1m______________________________ test_always_fails _______________________________\\x1b[0m\\n\\x1b[1m\\x1b[31mtests/test_application.py\\x1b[0m:3: in test_always_fails\\n \\x1b[94massert\\x1b[39;49;00m \\x1b[94mFalse\\x1b[39;49;00m\\x1b[90m\\x1b[39;49;00m\\n\\x1b[1m\\x1b[31mE assert False\\x1b[0m\\n\\x1b[36m\\x1b[1m=========================== short test summary info ============================\\x1b[0m\\n\\x1b[31mFAILED\\x1b[0m tests/test_application.py::\\x1b[1mtest_always_fails\\x1b[0m - assert False\\n\\x1b[31m============================== \\x1b[31m\\x1b[1m1 failed\\x1b[0m\\x1b[31m in 0.04s\\x1b[0m\\x1b[31m ===============================\\x1b[0m\\n']\n", "OK\n" ] } diff --git a/nbs/Prompts.ipynb b/nbs/Prompts.ipynb index 2e30bb9..f20bd94 100644 --- a/nbs/Prompts.ipynb +++ b/nbs/Prompts.ipynb @@ -269,6 +269,29 @@ "async def on_output_data(msg: DataBasic): # ERROR FIXED IN THIS LINE\n", "pass\n", "\n", + "==== Error ====\n", + "\n", + "ImportError: cannot import name 'on_output_data' from 'app.application'\n", + "\n", + "==== ERROR CODE ====\n", + "\n", + "from app.application import InputData, broker, on_input_data, on_output_data\n", + "\n", + "==== FIXED CODE ====\n", + "\n", + "from app.application import InputData, broker, on_input_data\n", + "\n", + "==== Error ====\n", + "\n", + "assert on_input_data.mock.assert_called_with(dict(DataMessage(data=1)))\n", + "\n", + "==== ERROR CODE ====\n", + "\n", + "assert on_input_data.mock.assert_called_with(dict(DataMessage(data=1)))\n", + "\n", + "==== FIXED CODE ====\n", + "\n", + "on_input_data.mock.assert_called_with(dict(DataMessage(data=1)))\n", "\n", "==== APP DESCRIPTION ====\n", "\n", diff --git a/settings.ini b/settings.ini index 23e88ed..3782676 100644 --- a/settings.ini +++ b/settings.ini @@ -5,7 +5,7 @@ ### Python library ### repo = faststream-gen lib_name = %(repo)s -version = 0.1.5rc4 +version = 0.1.6rc0 min_python = 3.8 license = apache2 black_formatting = False