Petr Tsvetkov commited on
Commit
e684577
β€’
1 Parent(s): bb44b5c

Add the usage instructions for generated_message_length_comparison.ipynb

Browse files
generated_message_length_comparison.ipynb CHANGED
@@ -1,10 +1,37 @@
1
  {
2
  "cells": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  {
4
  "metadata": {
5
  "ExecuteTime": {
6
- "end_time": "2024-05-31T13:59:45.809229Z",
7
- "start_time": "2024-05-31T13:59:45.738228Z"
8
  }
9
  },
10
  "cell_type": "code",
@@ -17,13 +44,13 @@
17
  ],
18
  "id": "ce11a4c781c152e",
19
  "outputs": [],
20
- "execution_count": 9
21
  },
22
  {
23
  "metadata": {
24
  "ExecuteTime": {
25
- "end_time": "2024-05-31T13:59:46.750857Z",
26
- "start_time": "2024-05-31T13:59:46.726738Z"
27
  }
28
  },
29
  "cell_type": "code",
@@ -39,48 +66,21 @@
39
  ],
40
  "id": "84a769c8765a7b64",
41
  "outputs": [],
42
- "execution_count": 10
43
  },
44
  {
45
- "metadata": {
46
- "ExecuteTime": {
47
- "end_time": "2024-05-31T14:00:17.941407Z",
48
- "start_time": "2024-05-31T13:59:48.952862Z"
49
- }
50
- },
51
  "cell_type": "code",
52
  "source": "generate_commit_message_prod(\"TEST\")",
53
  "id": "af2f20def94b0490",
54
- "outputs": [
55
- {
56
- "ename": "KeyboardInterrupt",
57
- "evalue": "",
58
- "output_type": "error",
59
- "traceback": [
60
- "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
61
- "\u001B[1;31mRequestFailedException\u001B[0m Traceback (most recent call last)",
62
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\api_wrappers\\grazie_wrapper.py:35\u001B[0m, in \u001B[0;36mllm_request\u001B[1;34m(prompt)\u001B[0m\n\u001B[0;32m 34\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m---> 35\u001B[0m output \u001B[38;5;241m=\u001B[39m \u001B[43mclient\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mchat\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m 36\u001B[0m \u001B[43m \u001B[49m\u001B[43mchat\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mChatPrompt\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 37\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43madd_system\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mYou are a helpful assistant.\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\n\u001B[0;32m 38\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43madd_user\u001B[49m\u001B[43m(\u001B[49m\u001B[43mprompt\u001B[49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 39\u001B[0m \u001B[43m \u001B[49m\u001B[43mprofile\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mLLMProfile\u001B[49m\u001B[43m(\u001B[49m\u001B[43mconfig\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mLLM_MODEL\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 40\u001B[0m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\u001B[38;5;241m.\u001B[39mcontent\n\u001B[0;32m 41\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m:\n",
63
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\grazie\\api\\client\\gateway.py:193\u001B[0m, in \u001B[0;36mGrazieApiGatewayClient.chat\u001B[1;34m(self, chat, profile, prompt_id, parameters, headers)\u001B[0m\n\u001B[0;32m 192\u001B[0m chunks: List[ChatResponseStream] \u001B[38;5;241m=\u001B[39m []\n\u001B[1;32m--> 193\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m stream_response \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mchat_stream(chat, profile\u001B[38;5;241m=\u001B[39mprofile, prompt_id\u001B[38;5;241m=\u001B[39mprompt_id, parameters\u001B[38;5;241m=\u001B[39mparameters, headers\u001B[38;5;241m=\u001B[39mheaders):\n\u001B[0;32m 194\u001B[0m chunks\u001B[38;5;241m.\u001B[39mappend(stream_response)\n",
64
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\grazie\\api\\client\\gateway.py:254\u001B[0m, in \u001B[0;36mGrazieApiGatewayClient.chat_stream\u001B[1;34m(self, chat, profile, prompt_id, parameters, headers)\u001B[0m\n\u001B[0;32m 246\u001B[0m response \u001B[38;5;241m=\u001B[39m requests\u001B[38;5;241m.\u001B[39mpost(\n\u001B[0;32m 247\u001B[0m url\u001B[38;5;241m=\u001B[39m\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;132;01m{\u001B[39;00m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_api_gateway_url\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m/\u001B[39m\u001B[38;5;132;01m{\u001B[39;00m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_auth_type\u001B[38;5;241m.\u001B[39mvalue\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m/v5/llm/chat/stream/v6\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[0;32m 248\u001B[0m headers\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_generate_headers(headers),\n\u001B[1;32m (...)\u001B[0m\n\u001B[0;32m 251\u001B[0m stream\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m\n\u001B[0;32m 252\u001B[0m )\n\u001B[1;32m--> 254\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_raise_if_error\u001B[49m\u001B[43m(\u001B[49m\u001B[43mresponse\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 256\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m event \u001B[38;5;129;01min\u001B[39;00m _decode_llm_sse(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_parse_sse_response(response\u001B[38;5;241m.\u001B[39miter_lines()), LLMChatEventV6):\n",
65
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\grazie\\api\\client\\gateway.py:298\u001B[0m, in \u001B[0;36mGrazieApiGatewayClient._raise_if_error\u001B[1;34m(self, response)\u001B[0m\n\u001B[0;32m 297\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m response\u001B[38;5;241m.\u001B[39mstatus_code \u001B[38;5;241m!=\u001B[39m \u001B[38;5;241m200\u001B[39m:\n\u001B[1;32m--> 298\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m RequestFailedException(\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;132;01m{\u001B[39;00mresponse\u001B[38;5;241m.\u001B[39mstatus_code\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m Error: \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mresponse\u001B[38;5;241m.\u001B[39mreason\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m. \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mresponse\u001B[38;5;241m.\u001B[39mtext\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)\n",
66
- "\u001B[1;31mRequestFailedException\u001B[0m: 401 Error: Unauthorized. ",
67
- "\nDuring handling of the above exception, another exception occurred:\n",
68
- "\u001B[1;31mKeyboardInterrupt\u001B[0m Traceback (most recent call last)",
69
- "Cell \u001B[1;32mIn[11], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m \u001B[43mgenerate_commit_message_prod\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mTEST\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\n",
70
- "Cell \u001B[1;32mIn[10], line 8\u001B[0m, in \u001B[0;36mgenerate_commit_message_prod\u001B[1;34m(diff)\u001B[0m\n\u001B[0;32m 7\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mgenerate_commit_message_prod\u001B[39m(diff):\n\u001B[1;32m----> 8\u001B[0m \t\u001B[43mgenerate_for_prompt\u001B[49m\u001B[43m(\u001B[49m\u001B[43mprod_prompt\u001B[49m\u001B[43m(\u001B[49m\u001B[43mdiff\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n",
71
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\api_wrappers\\grazie_wrapper.py:57\u001B[0m, in \u001B[0;36mgenerate_for_prompt\u001B[1;34m(prompt)\u001B[0m\n\u001B[0;32m 54\u001B[0m LLM_CACHE_USED[prompt] \u001B[38;5;241m=\u001B[39m \u001B[38;5;241m0\u001B[39m\n\u001B[0;32m 56\u001B[0m \u001B[38;5;28;01mwhile\u001B[39;00m LLM_CACHE_USED[prompt] \u001B[38;5;241m>\u001B[39m\u001B[38;5;241m=\u001B[39m \u001B[38;5;28mlen\u001B[39m(LLM_CACHE[prompt]):\n\u001B[1;32m---> 57\u001B[0m new_response \u001B[38;5;241m=\u001B[39m \u001B[43mllm_request\u001B[49m\u001B[43m(\u001B[49m\u001B[43mprompt\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 58\u001B[0m LLM_CACHE[prompt]\u001B[38;5;241m.\u001B[39mappend(new_response)\n\u001B[0;32m 60\u001B[0m \u001B[38;5;28;01mwith\u001B[39;00m \u001B[38;5;28mopen\u001B[39m(LLM_CACHE_FILE, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mwb\u001B[39m\u001B[38;5;124m\"\u001B[39m) \u001B[38;5;28;01mas\u001B[39;00m file:\n",
72
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\api_wrappers\\grazie_wrapper.py:42\u001B[0m, in \u001B[0;36mllm_request\u001B[1;34m(prompt)\u001B[0m\n\u001B[0;32m 35\u001B[0m output \u001B[38;5;241m=\u001B[39m client\u001B[38;5;241m.\u001B[39mchat(\n\u001B[0;32m 36\u001B[0m chat\u001B[38;5;241m=\u001B[39mChatPrompt()\n\u001B[0;32m 37\u001B[0m \u001B[38;5;241m.\u001B[39madd_system(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mYou are a helpful assistant.\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m 38\u001B[0m \u001B[38;5;241m.\u001B[39madd_user(prompt),\n\u001B[0;32m 39\u001B[0m profile\u001B[38;5;241m=\u001B[39mLLMProfile(config\u001B[38;5;241m.\u001B[39mLLM_MODEL)\n\u001B[0;32m 40\u001B[0m )\u001B[38;5;241m.\u001B[39mcontent\n\u001B[0;32m 41\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m:\n\u001B[1;32m---> 42\u001B[0m \u001B[43mtime\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43msleep\u001B[49m\u001B[43m(\u001B[49m\u001B[43mconfig\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mGRAZIE_TIMEOUT_SEC\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 44\u001B[0m \u001B[38;5;28;01massert\u001B[39;00m output \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[0;32m 46\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m output\n",
73
- "\u001B[1;31mKeyboardInterrupt\u001B[0m: "
74
- ]
75
- }
76
- ],
77
- "execution_count": 11
78
  },
79
  {
80
  "metadata": {
81
  "ExecuteTime": {
82
- "end_time": "2024-05-31T14:00:33.963374Z",
83
- "start_time": "2024-05-31T14:00:21.253920Z"
84
  }
85
  },
86
  "cell_type": "code",
@@ -90,43 +90,6 @@
90
  ],
91
  "id": "a49cabf576c9d692",
92
  "outputs": [
93
- {
94
- "data": {
95
- "text/plain": [
96
- "Downloading readme: 0%| | 0.00/2.41k [00:00<?, ?B/s]"
97
- ],
98
- "application/vnd.jupyter.widget-view+json": {
99
- "version_major": 2,
100
- "version_minor": 0,
101
- "model_id": "5dc984c015fc4493aedbfb5a70f7b026"
102
- }
103
- },
104
- "metadata": {},
105
- "output_type": "display_data"
106
- },
107
- {
108
- "name": "stderr",
109
- "output_type": "stream",
110
- "text": [
111
- "Downloading data: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 163k/163k [00:00<00:00, 474kB/s]\n",
112
- "Downloading data: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 167k/167k [00:00<00:00, 493kB/s]\n",
113
- "Downloading data: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 163k/163k [00:00<00:00, 684kB/s]\n"
114
- ]
115
- },
116
- {
117
- "data": {
118
- "text/plain": [
119
- "Generating test split: 0 examples [00:00, ? examples/s]"
120
- ],
121
- "application/vnd.jupyter.widget-view+json": {
122
- "version_major": 2,
123
- "version_minor": 0,
124
- "model_id": "5f55866359b345d09a67f87888b8ad73"
125
- }
126
- },
127
- "metadata": {},
128
- "output_type": "display_data"
129
- },
130
  {
131
  "data": {
132
  "text/plain": [
@@ -198,67 +161,26 @@
198
  "</div>"
199
  ]
200
  },
201
- "execution_count": 12,
202
  "metadata": {},
203
  "output_type": "execute_result"
204
  }
205
  ],
206
- "execution_count": 12
207
  },
208
  {
209
- "metadata": {
210
- "ExecuteTime": {
211
- "end_time": "2024-05-30T13:20:38.052443Z",
212
- "start_time": "2024-05-30T13:20:26.913353Z"
213
- }
214
- },
215
  "cell_type": "code",
216
  "source": "DATA[\"prediction_prod\"] = DATA.progress_apply(lambda row: generate_commit_message_prod(str(row[\"diff\"])), axis=1)",
217
  "id": "9ded493e087f991d",
218
- "outputs": [
219
- {
220
- "name": "stderr",
221
- "output_type": "stream",
222
- "text": [
223
- " 1%| | 1/163 [00:10<29:35, 10.96s/it]\n"
224
- ]
225
- },
226
- {
227
- "ename": "KeyboardInterrupt",
228
- "evalue": "",
229
- "output_type": "error",
230
- "traceback": [
231
- "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
232
- "\u001B[1;31mRequestFailedException\u001B[0m Traceback (most recent call last)",
233
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\api_wrappers\\grazie_wrapper.py:35\u001B[0m, in \u001B[0;36mllm_request\u001B[1;34m(prompt)\u001B[0m\n\u001B[0;32m 34\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m---> 35\u001B[0m output \u001B[38;5;241m=\u001B[39m output \u001B[38;5;241m=\u001B[39m \u001B[43mclient\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mchat\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m 36\u001B[0m \u001B[43m \u001B[49m\u001B[43mchat\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mChatPrompt\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 37\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43madd_system\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mYou are a helpful assistant.\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\n\u001B[0;32m 38\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43madd_user\u001B[49m\u001B[43m(\u001B[49m\u001B[43mprompt\u001B[49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m 39\u001B[0m \u001B[43m \u001B[49m\u001B[43mprofile\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mLLMProfile\u001B[49m\u001B[43m(\u001B[49m\u001B[43mconfig\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mLLM_MODEL\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 40\u001B[0m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\u001B[38;5;241m.\u001B[39mcontent\n\u001B[0;32m 41\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m:\n",
234
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\grazie\\api\\client\\gateway.py:193\u001B[0m, in \u001B[0;36mGrazieApiGatewayClient.chat\u001B[1;34m(self, chat, profile, prompt_id, parameters, headers)\u001B[0m\n\u001B[0;32m 192\u001B[0m chunks: List[ChatResponseStream] \u001B[38;5;241m=\u001B[39m []\n\u001B[1;32m--> 193\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m stream_response \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mchat_stream(chat, profile\u001B[38;5;241m=\u001B[39mprofile, prompt_id\u001B[38;5;241m=\u001B[39mprompt_id, parameters\u001B[38;5;241m=\u001B[39mparameters, headers\u001B[38;5;241m=\u001B[39mheaders):\n\u001B[0;32m 194\u001B[0m chunks\u001B[38;5;241m.\u001B[39mappend(stream_response)\n",
235
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\grazie\\api\\client\\gateway.py:254\u001B[0m, in \u001B[0;36mGrazieApiGatewayClient.chat_stream\u001B[1;34m(self, chat, profile, prompt_id, parameters, headers)\u001B[0m\n\u001B[0;32m 246\u001B[0m response \u001B[38;5;241m=\u001B[39m requests\u001B[38;5;241m.\u001B[39mpost(\n\u001B[0;32m 247\u001B[0m url\u001B[38;5;241m=\u001B[39m\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;132;01m{\u001B[39;00m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_api_gateway_url\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m/\u001B[39m\u001B[38;5;132;01m{\u001B[39;00m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_auth_type\u001B[38;5;241m.\u001B[39mvalue\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m/v5/llm/chat/stream/v6\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[0;32m 248\u001B[0m headers\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_generate_headers(headers),\n\u001B[1;32m (...)\u001B[0m\n\u001B[0;32m 251\u001B[0m stream\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m\n\u001B[0;32m 252\u001B[0m )\n\u001B[1;32m--> 254\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_raise_if_error\u001B[49m\u001B[43m(\u001B[49m\u001B[43mresponse\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 256\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m event \u001B[38;5;129;01min\u001B[39;00m _decode_llm_sse(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_parse_sse_response(response\u001B[38;5;241m.\u001B[39miter_lines()), LLMChatEventV6):\n",
236
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\grazie\\api\\client\\gateway.py:298\u001B[0m, in \u001B[0;36mGrazieApiGatewayClient._raise_if_error\u001B[1;34m(self, response)\u001B[0m\n\u001B[0;32m 297\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m response\u001B[38;5;241m.\u001B[39mstatus_code \u001B[38;5;241m!=\u001B[39m \u001B[38;5;241m200\u001B[39m:\n\u001B[1;32m--> 298\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m RequestFailedException(\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;132;01m{\u001B[39;00mresponse\u001B[38;5;241m.\u001B[39mstatus_code\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m Error: \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mresponse\u001B[38;5;241m.\u001B[39mreason\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m. \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mresponse\u001B[38;5;241m.\u001B[39mtext\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)\n",
237
- "\u001B[1;31mRequestFailedException\u001B[0m: 401 Error: Unauthorized. ",
238
- "\nDuring handling of the above exception, another exception occurred:\n",
239
- "\u001B[1;31mKeyboardInterrupt\u001B[0m Traceback (most recent call last)",
240
- "Cell \u001B[1;32mIn[17], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m DATA[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mprediction_prod\u001B[39m\u001B[38;5;124m\"\u001B[39m] \u001B[38;5;241m=\u001B[39m \u001B[43mDATA\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mprogress_apply\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43;01mlambda\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mrow\u001B[49m\u001B[43m:\u001B[49m\u001B[43m \u001B[49m\u001B[43mgenerate_commit_message_prod\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mstr\u001B[39;49m\u001B[43m(\u001B[49m\u001B[43mrow\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mdiff\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m]\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43maxis\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;241;43m1\u001B[39;49m\u001B[43m)\u001B[49m\n",
241
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\tqdm\\std.py:917\u001B[0m, in \u001B[0;36mtqdm.pandas.<locals>.inner_generator.<locals>.inner\u001B[1;34m(df, func, *args, **kwargs)\u001B[0m\n\u001B[0;32m 914\u001B[0m \u001B[38;5;66;03m# Apply the provided function (in **kwargs)\u001B[39;00m\n\u001B[0;32m 915\u001B[0m \u001B[38;5;66;03m# on the df using our wrapper (which provides bar updating)\u001B[39;00m\n\u001B[0;32m 916\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m--> 917\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mgetattr\u001B[39m(df, df_function)(wrapper, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39mkwargs)\n\u001B[0;32m 918\u001B[0m \u001B[38;5;28;01mfinally\u001B[39;00m:\n\u001B[0;32m 919\u001B[0m t\u001B[38;5;241m.\u001B[39mclose()\n",
242
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\pandas\\core\\frame.py:10361\u001B[0m, in \u001B[0;36mDataFrame.apply\u001B[1;34m(self, func, axis, raw, result_type, args, by_row, engine, engine_kwargs, **kwargs)\u001B[0m\n\u001B[0;32m 10347\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mpandas\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mcore\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mapply\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m frame_apply\n\u001B[0;32m 10349\u001B[0m op \u001B[38;5;241m=\u001B[39m frame_apply(\n\u001B[0;32m 10350\u001B[0m \u001B[38;5;28mself\u001B[39m,\n\u001B[0;32m 10351\u001B[0m func\u001B[38;5;241m=\u001B[39mfunc,\n\u001B[1;32m (...)\u001B[0m\n\u001B[0;32m 10359\u001B[0m kwargs\u001B[38;5;241m=\u001B[39mkwargs,\n\u001B[0;32m 10360\u001B[0m )\n\u001B[1;32m> 10361\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mop\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mapply\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[38;5;241m.\u001B[39m__finalize__(\u001B[38;5;28mself\u001B[39m, method\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mapply\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n",
243
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\pandas\\core\\apply.py:916\u001B[0m, in \u001B[0;36mFrameApply.apply\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 913\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mraw:\n\u001B[0;32m 914\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mapply_raw(engine\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mengine, engine_kwargs\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mengine_kwargs)\n\u001B[1;32m--> 916\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mapply_standard\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n",
244
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\pandas\\core\\apply.py:1063\u001B[0m, in \u001B[0;36mFrameApply.apply_standard\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 1061\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mapply_standard\u001B[39m(\u001B[38;5;28mself\u001B[39m):\n\u001B[0;32m 1062\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mengine \u001B[38;5;241m==\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mpython\u001B[39m\u001B[38;5;124m\"\u001B[39m:\n\u001B[1;32m-> 1063\u001B[0m results, res_index \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mapply_series_generator\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 1064\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[0;32m 1065\u001B[0m results, res_index \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mapply_series_numba()\n",
245
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\pandas\\core\\apply.py:1081\u001B[0m, in \u001B[0;36mFrameApply.apply_series_generator\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 1078\u001B[0m \u001B[38;5;28;01mwith\u001B[39;00m option_context(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mmode.chained_assignment\u001B[39m\u001B[38;5;124m\"\u001B[39m, \u001B[38;5;28;01mNone\u001B[39;00m):\n\u001B[0;32m 1079\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m i, v \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28menumerate\u001B[39m(series_gen):\n\u001B[0;32m 1080\u001B[0m \u001B[38;5;66;03m# ignore SettingWithCopy here in case the user mutates\u001B[39;00m\n\u001B[1;32m-> 1081\u001B[0m results[i] \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mfunc(v, \u001B[38;5;241m*\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39margs, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mkwargs)\n\u001B[0;32m 1082\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28misinstance\u001B[39m(results[i], ABCSeries):\n\u001B[0;32m 1083\u001B[0m \u001B[38;5;66;03m# If we have a view on v, we need to make a copy because\u001B[39;00m\n\u001B[0;32m 1084\u001B[0m \u001B[38;5;66;03m# series_generator will swap out the underlying data\u001B[39;00m\n\u001B[0;32m 1085\u001B[0m results[i] \u001B[38;5;241m=\u001B[39m results[i]\u001B[38;5;241m.\u001B[39mcopy(deep\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mFalse\u001B[39;00m)\n",
246
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\.venv\\lib\\site-packages\\tqdm\\std.py:912\u001B[0m, in \u001B[0;36mtqdm.pandas.<locals>.inner_generator.<locals>.inner.<locals>.wrapper\u001B[1;34m(*args, **kwargs)\u001B[0m\n\u001B[0;32m 906\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mwrapper\u001B[39m(\u001B[38;5;241m*\u001B[39margs, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39mkwargs):\n\u001B[0;32m 907\u001B[0m \u001B[38;5;66;03m# update tbar correctly\u001B[39;00m\n\u001B[0;32m 908\u001B[0m \u001B[38;5;66;03m# it seems `pandas apply` calls `func` twice\u001B[39;00m\n\u001B[0;32m 909\u001B[0m \u001B[38;5;66;03m# on the first column/row to decide whether it can\u001B[39;00m\n\u001B[0;32m 910\u001B[0m \u001B[38;5;66;03m# take a fast or slow code path; so stop when t.total==t.n\u001B[39;00m\n\u001B[0;32m 911\u001B[0m t\u001B[38;5;241m.\u001B[39mupdate(n\u001B[38;5;241m=\u001B[39m\u001B[38;5;241m1\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m t\u001B[38;5;241m.\u001B[39mtotal \u001B[38;5;129;01mor\u001B[39;00m t\u001B[38;5;241m.\u001B[39mn \u001B[38;5;241m<\u001B[39m t\u001B[38;5;241m.\u001B[39mtotal \u001B[38;5;28;01melse\u001B[39;00m \u001B[38;5;241m0\u001B[39m)\n\u001B[1;32m--> 912\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m func(\u001B[38;5;241m*\u001B[39margs, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39mkwargs)\n",
247
- "Cell \u001B[1;32mIn[17], line 1\u001B[0m, in \u001B[0;36m<lambda>\u001B[1;34m(row)\u001B[0m\n\u001B[1;32m----> 1\u001B[0m DATA[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mprediction_prod\u001B[39m\u001B[38;5;124m\"\u001B[39m] \u001B[38;5;241m=\u001B[39m DATA\u001B[38;5;241m.\u001B[39mprogress_apply(\u001B[38;5;28;01mlambda\u001B[39;00m row: \u001B[43mgenerate_commit_message_prod\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mstr\u001B[39;49m\u001B[43m(\u001B[49m\u001B[43mrow\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mdiff\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m]\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m, axis\u001B[38;5;241m=\u001B[39m\u001B[38;5;241m1\u001B[39m)\n",
248
- "Cell \u001B[1;32mIn[3], line 8\u001B[0m, in \u001B[0;36mgenerate_commit_message_prod\u001B[1;34m(diff)\u001B[0m\n\u001B[0;32m 7\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mgenerate_commit_message_prod\u001B[39m(diff):\n\u001B[1;32m----> 8\u001B[0m \t\u001B[43mgenerate_for_prompt\u001B[49m\u001B[43m(\u001B[49m\u001B[43mprod_prompt\u001B[49m\u001B[43m(\u001B[49m\u001B[43mdiff\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n",
249
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\api_wrappers\\grazie_wrapper.py:57\u001B[0m, in \u001B[0;36mgenerate_for_prompt\u001B[1;34m(prompt)\u001B[0m\n\u001B[0;32m 54\u001B[0m LLM_CACHE_USED[prompt] \u001B[38;5;241m=\u001B[39m \u001B[38;5;241m0\u001B[39m\n\u001B[0;32m 56\u001B[0m \u001B[38;5;28;01mwhile\u001B[39;00m LLM_CACHE_USED[prompt] \u001B[38;5;241m>\u001B[39m\u001B[38;5;241m=\u001B[39m \u001B[38;5;28mlen\u001B[39m(LLM_CACHE[prompt]):\n\u001B[1;32m---> 57\u001B[0m new_response \u001B[38;5;241m=\u001B[39m \u001B[43mllm_request\u001B[49m\u001B[43m(\u001B[49m\u001B[43mprompt\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 58\u001B[0m LLM_CACHE[prompt]\u001B[38;5;241m.\u001B[39mappend(new_response)\n\u001B[0;32m 60\u001B[0m \u001B[38;5;28;01mwith\u001B[39;00m \u001B[38;5;28mopen\u001B[39m(LLM_CACHE_FILE, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mwb\u001B[39m\u001B[38;5;124m\"\u001B[39m) \u001B[38;5;28;01mas\u001B[39;00m file:\n",
250
- "File \u001B[1;32mD:\\petrtsv\\work\\jetbrains\\commit-rewriting-processing\\api_wrappers\\grazie_wrapper.py:42\u001B[0m, in \u001B[0;36mllm_request\u001B[1;34m(prompt)\u001B[0m\n\u001B[0;32m 35\u001B[0m output \u001B[38;5;241m=\u001B[39m output \u001B[38;5;241m=\u001B[39m client\u001B[38;5;241m.\u001B[39mchat(\n\u001B[0;32m 36\u001B[0m chat\u001B[38;5;241m=\u001B[39mChatPrompt()\n\u001B[0;32m 37\u001B[0m \u001B[38;5;241m.\u001B[39madd_system(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mYou are a helpful assistant.\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m 38\u001B[0m \u001B[38;5;241m.\u001B[39madd_user(prompt),\n\u001B[0;32m 39\u001B[0m profile\u001B[38;5;241m=\u001B[39mLLMProfile(config\u001B[38;5;241m.\u001B[39mLLM_MODEL)\n\u001B[0;32m 40\u001B[0m )\u001B[38;5;241m.\u001B[39mcontent\n\u001B[0;32m 41\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m:\n\u001B[1;32m---> 42\u001B[0m \u001B[43mtime\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43msleep\u001B[49m\u001B[43m(\u001B[49m\u001B[43mconfig\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mGRAZIE_TIMEOUT_SEC\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 44\u001B[0m \u001B[38;5;28;01massert\u001B[39;00m output \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[0;32m 46\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m output\n",
251
- "\u001B[1;31mKeyboardInterrupt\u001B[0m: "
252
- ]
253
- }
254
- ],
255
- "execution_count": 17
256
  },
257
  {
258
  "metadata": {
259
  "ExecuteTime": {
260
- "end_time": "2024-05-31T14:00:33.979797Z",
261
- "start_time": "2024-05-31T14:00:33.965373Z"
262
  }
263
  },
264
  "cell_type": "code",
@@ -276,26 +198,26 @@
276
  ]
277
  }
278
  ],
279
- "execution_count": 13
280
  },
281
  {
282
  "metadata": {},
283
  "cell_type": "code",
284
- "outputs": [],
285
- "execution_count": null,
286
  "source": [
287
  "prod_avg_length = DATA[\"prediction_prod\"].str.len().mean()\n",
288
  "print(f\"Prod average length: {prod_avg_length}\")"
289
  ],
290
- "id": "ec8b4412410794a4"
 
 
291
  },
292
  {
293
  "metadata": {},
294
  "cell_type": "code",
295
- "outputs": [],
296
- "execution_count": null,
297
  "source": "print(f\"Length ratio (current / prod): {current_avg_length / prod_avg_length})\")",
298
- "id": "10f087784896eca3"
 
 
299
  }
300
  ],
301
  "metadata": {
 
1
  {
2
  "cells": [
3
+ {
4
+ "metadata": {},
5
+ "cell_type": "markdown",
6
+ "source": [
7
+ "### How to run\n",
8
+ "\n",
9
+ "* Install libraries using the cell below (for grazie-api-gateway-client you will have to add a custom JB repository)\n",
10
+ "* Put the production prompt to file `data/prod_prompt.txt`\n",
11
+ "* Environment variables:\n",
12
+ " - `GRAZIE_API_JWT_TOKEN` -- JWT token for grazie (check `api_wrappers/grazie_wrapper.py` to adjust the client initialization if necessary)\n",
13
+ " - `HF_TOKEN` -- should _not_ be required; however, if it is, set it to a valid Hugging Face token"
14
+ ],
15
+ "id": "77d51d55b41735cf"
16
+ },
17
+ {
18
+ "metadata": {},
19
+ "cell_type": "code",
20
+ "source": [
21
+ "!pip install grazie-api-gateway-client\n",
22
+ "!pip install tqdm\n",
23
+ "!pip install pandas\n",
24
+ "!pip install datasets"
25
+ ],
26
+ "id": "91fa273e8987f6f6",
27
+ "outputs": [],
28
+ "execution_count": null
29
+ },
30
  {
31
  "metadata": {
32
  "ExecuteTime": {
33
+ "end_time": "2024-05-31T16:15:11.790663Z",
34
+ "start_time": "2024-05-31T16:15:11.777607Z"
35
  }
36
  },
37
  "cell_type": "code",
 
44
  ],
45
  "id": "ce11a4c781c152e",
46
  "outputs": [],
47
+ "execution_count": 20
48
  },
49
  {
50
  "metadata": {
51
  "ExecuteTime": {
52
+ "end_time": "2024-05-31T16:15:13.223782Z",
53
+ "start_time": "2024-05-31T16:15:13.207891Z"
54
  }
55
  },
56
  "cell_type": "code",
 
66
  ],
67
  "id": "84a769c8765a7b64",
68
  "outputs": [],
69
+ "execution_count": 21
70
  },
71
  {
72
+ "metadata": {},
 
 
 
 
 
73
  "cell_type": "code",
74
  "source": "generate_commit_message_prod(\"TEST\")",
75
  "id": "af2f20def94b0490",
76
+ "outputs": [],
77
+ "execution_count": null
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  },
79
  {
80
  "metadata": {
81
  "ExecuteTime": {
82
+ "end_time": "2024-05-31T16:15:24.167706Z",
83
+ "start_time": "2024-05-31T16:15:16.619781Z"
84
  }
85
  },
86
  "cell_type": "code",
 
90
  ],
91
  "id": "a49cabf576c9d692",
92
  "outputs": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  {
94
  "data": {
95
  "text/plain": [
 
161
  "</div>"
162
  ]
163
  },
164
+ "execution_count": 22,
165
  "metadata": {},
166
  "output_type": "execute_result"
167
  }
168
  ],
169
+ "execution_count": 22
170
  },
171
  {
172
+ "metadata": {},
 
 
 
 
 
173
  "cell_type": "code",
174
  "source": "DATA[\"prediction_prod\"] = DATA.progress_apply(lambda row: generate_commit_message_prod(str(row[\"diff\"])), axis=1)",
175
  "id": "9ded493e087f991d",
176
+ "outputs": [],
177
+ "execution_count": null
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  },
179
  {
180
  "metadata": {
181
  "ExecuteTime": {
182
+ "end_time": "2024-05-31T16:15:24.183660Z",
183
+ "start_time": "2024-05-31T16:15:24.170584Z"
184
  }
185
  },
186
  "cell_type": "code",
 
198
  ]
199
  }
200
  ],
201
+ "execution_count": 23
202
  },
203
  {
204
  "metadata": {},
205
  "cell_type": "code",
 
 
206
  "source": [
207
  "prod_avg_length = DATA[\"prediction_prod\"].str.len().mean()\n",
208
  "print(f\"Prod average length: {prod_avg_length}\")"
209
  ],
210
+ "id": "ec8b4412410794a4",
211
+ "outputs": [],
212
+ "execution_count": null
213
  },
214
  {
215
  "metadata": {},
216
  "cell_type": "code",
 
 
217
  "source": "print(f\"Length ratio (current / prod): {current_avg_length / prod_avg_length})\")",
218
+ "id": "10f087784896eca3",
219
+ "outputs": [],
220
+ "execution_count": null
221
  }
222
  ],
223
  "metadata": {