Skip to content

Commit 74f6375

Browse files
Merge pull request #34 from xsqian/main
change the prompt to generate data with a longer key to avoid the dupicates
2 parents a57013a + 577cb9b commit 74f6375

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

notebook.ipynb

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
},
143143
{
144144
"cell_type": "code",
145-
"execution_count": 1,
145+
"execution_count": null,
146146
"id": "76f05c23312057a3",
147147
"metadata": {},
148148
"outputs": [],
@@ -155,23 +155,12 @@
155155
},
156156
{
157157
"cell_type": "code",
158-
"execution_count": 2,
158+
"execution_count": null,
159159
"id": "7e7503f4-8830-4972-a986-10f4c29624b9",
160160
"metadata": {
161161
"tags": []
162162
},
163-
"outputs": [
164-
{
165-
"data": {
166-
"text/plain": [
167-
"True"
168-
]
169-
},
170-
"execution_count": 2,
171-
"metadata": {},
172-
"output_type": "execute_result"
173-
}
174-
],
163+
"outputs": [],
175164
"source": [
176165
"import dotenv\n",
177166
"import os\n",
@@ -185,7 +174,7 @@
185174
},
186175
{
187176
"cell_type": "code",
188-
"execution_count": 3,
177+
"execution_count": null,
189178
"id": "d33fc614-2898-4b12-b34f-62181651a9b5",
190179
"metadata": {},
191180
"outputs": [],
@@ -197,7 +186,7 @@
197186
},
198187
{
199188
"cell_type": "code",
200-
"execution_count": 4,
189+
"execution_count": null,
201190
"id": "9e2a5fd0-f4ff-486a-9d22-e5b80b7eb2a4",
202191
"metadata": {},
203192
"outputs": [],
@@ -310,7 +299,7 @@
310299
},
311300
{
312301
"cell_type": "code",
313-
"execution_count": 14,
302+
"execution_count": null,
314303
"id": "adc25213-d4d6-411d-a9b0-edf91007ba33",
315304
"metadata": {},
316305
"outputs": [],

project_setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def _set_function(
248248
def _set_calls_generation_functions(
249249
project: mlrun.projects.MlrunProject,
250250
node_name: str = None,
251-
image: str = ".mlrun-project-image-zzz"
251+
image: str = ".mlrun-project-image"
252252
):
253253
# Client and agent data generator
254254
_set_function(
@@ -288,7 +288,7 @@ def _set_calls_analysis_functions(
288288
gpus: int,
289289
node_name: str = None,
290290
node_selector: dict = None,
291-
image: str = ".mlrun-project-image-zzz"
291+
image: str = ".mlrun-project-image"
292292
):
293293
# DB management:
294294
_set_function(

src/calls_analysis/db_management.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
insert,
3333
select,
3434
update,
35+
delete,
3536
)
3637
from sqlalchemy.orm import (
3738
Mapped,
@@ -225,6 +226,8 @@ def create_tables():
225226
"""
226227
# Create an engine:
227228
engine = DBEngine()
229+
# Create the schema's tables if it already exits, drop it
230+
# Base.metadata.drop_all(engine.engine)
228231
# Create the schema's tables
229232
Base.metadata.create_all(engine.engine)
230233

@@ -240,6 +243,8 @@ def insert_clients(clients: list):
240243

241244
# Insert the new calls into the table and commit:
242245
with session.begin() as sess:
246+
sess.execute(delete(Call))
247+
sess.execute(delete(Client))
243248
sess.execute(insert(Client), clients)
244249

245250
engine.update_db()
@@ -254,6 +259,8 @@ def insert_agents(agents: list):
254259

255260
# Insert the new calls into the table and commit:
256261
with session.begin() as sess:
262+
sess.execute(delete(Call))
263+
sess.execute(delete(Agent))
257264
sess.execute(insert(Agent), agents)
258265

259266
engine.update_db()
@@ -273,6 +280,7 @@ def insert_calls(
273280

274281
# Insert the new calls into the table and commit:
275282
with session.begin() as sess:
283+
sess.execute(delete(Call))
276284
sess.execute(insert(Call), records)
277285

278286
engine.update_db()

src/workflows/calls_generation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def pipeline(
6868
f"last_name: in {language}, no special characters",
6969
"phone_number",
7070
"email",
71-
"client_id: no leading zeros",
71+
"client_id: no leading zeros, at least 8 digits long, only numbers, this is a primay key field for the database, avoid duplicates as much as possible",
7272
"client_city: Enter city, state in the US (e.g., Austin, TX), Not only Texas",
7373
"latitude: That correspond to the city",
7474
"longitude: That correspond to the city",
@@ -103,7 +103,7 @@ def pipeline(
103103
"fields": [
104104
f"first_name: in {language}, no special characters",
105105
f"last_name: in {language}, no special characters",
106-
"agent_id: no leading zeros",
106+
"agent_id: no leading zeros, at least 8 digits long, only numbers, this is a primay key field for the database, avoid duplicates as much as possible",
107107
],
108108
},
109109
returns=["agents: file"],

0 commit comments

Comments
 (0)