diff --git a/.idea/ruff.xml b/.idea/ruff.xml
index 60000eef1..c115e5497 100644
--- a/.idea/ruff.xml
+++ b/.idea/ruff.xml
@@ -4,6 +4,8 @@
+
+
diff --git a/.idea/runConfigurations/pytest_in_tests.xml b/.idea/runConfigurations/pytest_in_tests.xml
index bafef3934..d9b1ec25a 100644
--- a/.idea/runConfigurations/pytest_in_tests.xml
+++ b/.idea/runConfigurations/pytest_in_tests.xml
@@ -5,12 +5,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cli/codeflash/api/aiservice.py b/cli/codeflash/api/aiservice.py
index da8707b9d..0548eba92 100644
--- a/cli/codeflash/api/aiservice.py
+++ b/cli/codeflash/api/aiservice.py
@@ -5,7 +5,6 @@ import platform
from typing import Any, Dict, List, Optional, Tuple
import requests
-from overrides import overrides
from pydantic.dataclasses import dataclass
from pydantic.json import pydantic_encoder
@@ -222,6 +221,5 @@ class AiServiceClient:
class LocalAiServiceClient(AiServiceClient):
- @overrides
def get_aiservice_base_url(self) -> str:
return "http://localhost:8000/"
diff --git a/experiments/mistral-api-experiments.ipynb b/experiments/mistral-api-experiments.ipynb
index 5fd38bb8c..6e358a194 100644
--- a/experiments/mistral-api-experiments.ipynb
+++ b/experiments/mistral-api-experiments.ipynb
@@ -2,16 +2,6 @@
"cells": [
{
"cell_type": "code",
- "outputs": [
- {
- "data": {
- "text/plain": "True"
- },
- "execution_count": 9,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
"source": [
"import optimizer.optimizer_mistral as opt\n",
"from dotenv import load_dotenv\n",
@@ -26,7 +16,8 @@
}
},
"id": "1aca8c639f7c0f59",
- "execution_count": 9
+ "execution_count": 9,
+ "outputs": []
},
{
"cell_type": "markdown",
@@ -38,39 +29,6 @@
},
{
"cell_type": "code",
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "OpenAI code\n",
- "The given Python function `mutinator` appends a zero to the input list and returns the new length of the list. This function is already quite efficient because both `list.append` and `len` operations are O(1) in Python. However, the function could be slightly 'optimized' by directly using the increment operation on the length, but it's important to note that such 'optimization' wouldn't typically result in a noticeable performance improvement. \n",
- "\n",
- "Here's the function with a minor change to eliminate the use of `append`:\n",
- "\n",
- "```python\n",
- "def mutinator(mylist):\n",
- " return len(mylist) + 1\n",
- "```\n",
- "\n",
- "This version assumes that mutating the input list is not essential since the only observable effect from outside the function is the returned length. The original list remains unchanged - if the mutation is required, the original version should be retained.\n",
- "\n",
- "It is important to note that such optimizations are often marginal and can potentially introduce bugs if the function's behavior is expected to mutate the list. Always profile before and after such changes to ensure there is a real performance benefit.\n",
- "\n",
- "Mistral code\n",
- "Sure, I can help with that. The function you've provided appends a 0 to the end of a list and then returns the length of the list. This operation is already quite fast in Python, but if we're dealing with a very large list, appending an element to the end of it might take some time due to the way Python lists are implemented.\n",
- "\n",
- "However, since we know that appending an element to a list increases its length by 1, we can avoid the append operation altogether and just return the length of the list plus 1. Here's the optimized function:\n",
- "\n",
- "```python\n",
- "def mutinator_optimized(mylist):\n",
- " return len(mylist) + 1\n",
- "```\n",
- "\n",
- "This function will return the same value as the original function, but it won't modify the input list. If it's important for the list to be modified, then the original function is already as efficient as it can be.\n"
- ]
- }
- ],
"source": [
"code0 = \"\"\"def sorter(arr):\n",
" for i in range(len(arr)):\n",
@@ -137,11 +95,11 @@
}
},
"id": "e6f0f53319d68837",
- "execution_count": 10
+ "execution_count": 10,
+ "outputs": []
},
{
"cell_type": "code",
- "outputs": [],
"source": [],
"metadata": {
"collapsed": false,
@@ -151,7 +109,8 @@
}
},
"id": "d65fcf3dbed8c36f",
- "execution_count": 10
+ "execution_count": 10,
+ "outputs": []
}
],
"metadata": {
diff --git a/experiments/remove_subprocess_mock.ipynb b/experiments/remove_subprocess_mock.ipynb
index cb336d903..30b1f8415 100644
--- a/experiments/remove_subprocess_mock.ipynb
+++ b/experiments/remove_subprocess_mock.ipynb
@@ -2,31 +2,6 @@
"cells": [
{
"cell_type": "code",
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "import pickle\n",
- "import os\n",
- "def _log__test__values(values, duration, test_name):\n",
- " iteration = os.environ[\"CODEFLASH_TEST_ITERATION\"]\n",
- " with open(os.path.join('{codeflash_run_tmp_dir_client_side}', f'test_return_values_{iteration}.bin'), 'ab') as f:\n",
- " return_bytes = pickle.dumps(values)\n",
- " _test_name = f\"{test_name}\".encode(\"ascii\")\n",
- " f.write(len(_test_name).to_bytes(4, byteorder='big'))\n",
- " f.write(_test_name)\n",
- " f.write(duration.to_bytes(8, byteorder='big'))\n",
- " f.write(len(return_bytes).to_bytes(4, byteorder='big'))\n",
- " f.write(return_bytes)\n",
- "import inspect\n",
- "import time\n",
- "import gc\n",
- "from code_to_optimize.impure import mutinator\n",
- "[42]\n"
- ]
- }
- ],
"source": [
"from testgen.instrumentation.instrument_test_source import instrument_test_source\n",
"from aiservice.models.functions_to_optimize import FunctionToOptimize\n",
@@ -56,11 +31,11 @@
}
},
"id": "8d108492763a25a5",
- "execution_count": 5
+ "execution_count": 5,
+ "outputs": []
},
{
"cell_type": "code",
- "outputs": [],
"source": [],
"metadata": {
"collapsed": false,
@@ -70,7 +45,8 @@
}
},
"id": "694116ed54c4af6a",
- "execution_count": 4
+ "execution_count": 4,
+ "outputs": []
},
{
"cell_type": "code",
@@ -83,12 +59,11 @@
"start_time": "2024-02-29T07:11:56.812619Z"
}
},
- "outputs": [],
- "source": []
+ "source": [],
+ "outputs": []
},
{
"cell_type": "code",
- "outputs": [],
"source": [],
"metadata": {
"collapsed": false,
@@ -98,11 +73,11 @@
}
},
"id": "80fefa4a71d32347",
- "execution_count": 4
+ "execution_count": 4,
+ "outputs": []
},
{
"cell_type": "code",
- "outputs": [],
"source": [],
"metadata": {
"collapsed": false,
@@ -112,11 +87,11 @@
}
},
"id": "3cb5881311ca16e2",
- "execution_count": 4
+ "execution_count": 4,
+ "outputs": []
},
{
"cell_type": "code",
- "outputs": [],
"source": [],
"metadata": {
"collapsed": false,
@@ -126,11 +101,11 @@
}
},
"id": "639c96f42318a856",
- "execution_count": 4
+ "execution_count": 4,
+ "outputs": []
},
{
"cell_type": "code",
- "outputs": [],
"source": [],
"metadata": {
"collapsed": false,
@@ -140,7 +115,8 @@
}
},
"id": "12baa8a023eafc26",
- "execution_count": 4
+ "execution_count": 4,
+ "outputs": []
}
],
"metadata": {