\u0647\u0646\u0627<\/a>.<\/p>\nimport random\r\nimport time\r\nimport math\r\nimport sys\r\nfrom utils import *\r\nfrom constants import *\r\n\r\nclass Table:\r\ndef __init__(self, id, capacity=1):\r\nself.id = id\r\nself.capacity = capacity\r\nself.is_free = True\r\nself.cust_id = None\r\nself.plate = None\r\nself.cooking_complete_at = None\r\nself.leave_at = None\r\n\r\ndef seat(self, cust_id, clock, plate, cook_time, eat_time):\r\nself.is_free = False\r\nself.cust_id = cust_id\r\nself.plate = plate\r\nself.cooking_complete_at = clock + cook_time\r\nself._scheduled_eat_time = eat_time\r\nmsg = (\r\nf\"[{clock:04}m] \ud83e\ude91 Seated customer {cust_id} at T{self.id} \"\r\nf\"ordering {plate!r} (cook {cook_time}m, eat {eat_time}m)\"\r\n)\r\nprint(msg); sys.stdout.flush()\r\n\r\ndef start_eating(self, clock):\r\nself.leave_at = clock + self._scheduled_eat_time\r\nmsg = (\r\nf\"[{clock:04}m] \ud83c\udf7d\ufe0f Customer {self.cust_id} at T{self.id} \"\r\nf\"starts eating their {self.plate!r} (leaves at {self.leave_at}m)\"\r\n)\r\nprint(msg); sys.stdout.flush()\r\n\r\ndef depart(self, clock):\r\nmsg = (\r\nf\"[{clock:04}m] \ud83d\udcb8 Customer {self.cust_id} finished their \"\r\nf\"{self.plate!r} and left T{self.id}\"\r\n)\r\nprint(msg); sys.stdout.flush()\r\nself.is_free = True\r\nself.cust_id = None\r\nself.plate = None\r\nself.cooking_complete_at = None\r\nself.leave_at = None\r\n\r\nclass Restaurant:\r\ndef __init__(self, num_tables, arrival_prob=0.33,\r\ntick_length=1, real_pause=0.5, menu=None,\r\nquery_prob=0.0):\r\nself.tables = [Table(i) for i in range(num_tables)]\r\n# queue holds only customer IDs\r\nself.queue = []\r\nself.clock = 0\r\nself.next_cust_id = 1\r\nself.arrival_prob = arrival_prob\r\nself.tick = tick_length\r\nself.pause = real_pause\r\nself.menu = menu or [\r\n(\"Burger\", 2, 4),\r\n(\"Pasta\", 3, 5),\r\n(\"Salad\", 1, 2),\r\n(\"Steak\", 4, 6),\r\n(\"Soup\", 1, 3),\r\n]\r\nself.query_prob = query_prob\r\n\r\ntotal = sum(c + e for _, c, e in self.menu)\r\nself.avg_service_time = total \/ len(self.menu)\r\n\r\ndef open_tables(self):\r\nreturn [t for t in self.tables if t.is_free]\r\n\r\ndef _pick_dish(self):\r\nreturn random.choice(self.menu)\r\n\r\ndef arrive(self):\r\nif random.random() < self.arrival_prob:\r\ncid = self.next_cust_id\r\nself.next_cust_id += 1\r\nfree = self.open_tables()\r\nif free:\r\n# pick dish only when seating immediately\r\nplate, cook_time, eat_time = self._pick_dish()\r\ntable = min(free, key=lambda t: t.capacity)\r\ntable.seat(cid, self.clock, plate, cook_time, eat_time)\r\nelse:\r\nself.queue.append(cid)\r\nprint(f\"[{self.clock:04}m] \u23f3 Queued customer {cid} (waiting)\")\r\n\r\ndef process_cooking(self):\r\nfor t in self.tables:\r\nif (not t.is_free\r\nand t.cooking_complete_at is not None\r\nand t.cooking_complete_at <= self.clock\r\nand t.leave_at is None):\r\nt.start_eating(self.clock)\r\n\r\ndef process_departures(self):\r\nfor t in self.tables:\r\nif (not t.is_free\r\nand t.leave_at is not None\r\nand t.leave_at <= self.clock):\r\nt.depart(self.clock)\r\n\r\ndef seat_from_queue(self):\r\nwhile self.queue and self.open_tables():\r\ncid = self.queue.pop(0)\r\n# pick dish at seating time\r\nplate, cook_time, eat_time = self._pick_dish()\r\ntable = min(self.open_tables(), key=lambda t: t.capacity)\r\ntable.seat(cid, self.clock, plate, cook_time, eat_time)\r\n\r\ndef estimate_queue_time(self, cid):\r\npositions = list(self.queue)\r\nidx = positions.index(cid)\r\nraw_wait = (idx + 1) * self.avg_service_time \/ len(self.tables)\r\nreturn math.ceil(raw_wait)\r\n\r\ndef estimate_food_time(self, cid):\r\nfor t in self.tables:\r\nif t.cust_id == cid:\r\nif t.cooking_complete_at > self.clock:\r\nreturn t.cooking_complete_at - self.clock\r\nreturn max(0, t.leave_at - self.clock)\r\nreturn None\r\n\r\ndef handle_random_query(self):\r\nqueue_ids = list(self.queue)\r\nseated_ids = [t.cust_id for t in self.tables if not t.is_free]\r\nif queue_ids and (not seated_ids or random.random() < 0.7):\r\ncid = random.choice(queue_ids)\r\nwait = self.estimate_queue_time(cid)\r\nprint(f\"[{self.clock:04}m] \u2753 Customer {cid}: How long will I be in line?\")\r\nprint(f\"[{self.clock:04}m] \u27a1\ufe0f Estimated wait for customer {cid}: {wait}m\")\r\n\r\nelif seated_ids:\r\ncid = random.choice(seated_ids)\r\nwait = self.estimate_food_time(cid)\r\ntable = next(t for t in self.tables if t.cust_id == cid)\r\nfood = table.plate\r\nprint(f\"[{self.clock:04}m] \u2753 Customer {cid}: How long will the {food} take me?\")\r\nif wait is None:\r\nprint(f\"[{self.clock:04}m] \u27a1\ufe0f Ready now!\")\r\nelse:\r\nprint(f\"[{self.clock:04}m] \u27a1\ufe0f Estimated food wait for customer {cid}: {wait}m\")\r\n\r\ndef tick_once(self):\r\nself.arrive()\r\nself.process_cooking()\r\nself.process_departures()\r\nself.seat_from_queue()\r\nif self.query_prob and random.random() < self.query_prob:\r\nself.handle_random_query()\r\nself.clock += self.tick\r\ntime.sleep(self.pause)\r\n\r\ndef run(self, total_time):\r\nwhile self.clock < total_time:\r\nself.tick_once()\r\nprint(\"n--- END OF SHIFT ---\")\r\nfree = sum(t.is_free for t in self.tables)\r\nprint(f\"{free}\/{len(self.tables)} tables free at {self.clock}m.\")\r\n\r\nif __name__ == \"__main__\":\r\nrandom.seed(42)\r\nmenu = preprocess_menu(MENU_FILE, eat_time_factor=0.5)\r\nR = Restaurant(\r\nnum_tables=2,\r\narrival_prob=0.7,\r\ntick_length=1,\r\nreal_pause=5.0,\r\nquery_prob=0.4,\r\nmenu=menu\r\n)\r\nR.run(total_time=60)<\/pre>\n\u0625\u0630\u0646 \u0647\u0630\u0627 \u0637\u0648\u064a\u0644\u060c \u062f\u0639\u0646\u064a \u0622\u062e\u0630\u0643 \u0639\u0628\u0631 \u0628\u0639\u0636 \u0627\u0644\u062e\u0637\u0648\u0627\u062a.<\/p>\n
\u064a\u0639\u0645\u0644 \u0627\u0644\u0628\u0631\u0646\u0627\u0645\u062c \u0627\u0644\u0646\u0635\u064a \u0628\u0623\u0643\u0645\u0644\u0647 \u0639\u0644\u0649 naive_sim \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0623\u0645\u0631 .run()<\/strong> \u0645\u0639 \u0627\u0644\u0648\u0638\u0627\u0626\u0641 \u0627\u0644\u062a\u0627\u0644\u064a\u0629:<\/p>\n\n- arrive<\/strong>\u060c \u0627\u0644\u0630\u064a \u064a\u0645\u062b\u0644 \u0648\u0635\u0648\u0644 \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0648\u0637\u0644\u0628\u0647\u0645\u060c \u0623\u0648 \u0648\u0635\u0648\u0644\u0647\u0645 \u0648\u0648\u0636\u0639\u0647\u0645 \u0641\u064a \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631.<\/li>\n
- process_cooking<\/strong>\u060c \u0627\u0644\u0630\u064a \u064a\u062d\u0627\u0643\u064a \u0637\u0647\u064a \u0643\u0644 \u0637\u0627\u0648\u0644\u0629.<\/li>\n
- process_departures<\/strong>\u060c \u0627\u0644\u0630\u064a \u064a\u062d\u0627\u0643\u064a \u0645\u063a\u0627\u062f\u0631\u0629 \u0627\u0644\u0639\u0645\u0644\u0627\u0621.<\/li>\n
- seat_from_queue<\/strong>\u060c \u0627\u0644\u0630\u064a \u064a\u062d\u0627\u0643\u064a \u062c\u0644\u0648\u0633 \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631.<\/li>\n
- handle_random_query<\/strong>\u060c \u0627\u0644\u0630\u064a \u064a\u062a\u0645 \u0627\u0633\u062a\u062f\u0639\u0627\u0624\u0647 \u0639\u0634\u0648\u0627\u0626\u064a\u064b\u0627\u060c \u062d\u064a\u062b \u064a\u0645\u0643\u0646 \u0644\u0644\u0639\u0645\u064a\u0644 \u0641\u064a \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631 \u0623\u0648 \u0627\u0644\u0645\u0646\u062a\u0638\u0631 \u0644\u0637\u0639\u0627\u0645\u0647 \u0623\u0646 \u064a\u0633\u0623\u0644 \u0639\u0646 \u0648\u0642\u062a \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631.<\/li>\n<\/ul>\n
\u0625\u0630\u0627 \u0642\u0645\u0646\u0627 \u0628\u062a\u0634\u063a\u064a\u0644 naive_sim.py\u060c \u0641\u0633\u0646\u062d\u0635\u0644 \u0639\u0644\u0649 \u0647\u0630\u0627 \u0645\u0646 \u0627\u0644\u062c\u0647\u0627\u0632.<\/p>\n
<\/p>\n
\u0627\u0644\u0622\u0646\u060c \u0647\u0630\u0627 \u0645\u0646\u062a\u062c \u0639\u0644\u0645 \u0628\u064a\u0627\u0646\u0627\u062a \u0628\u062d\u062f \u0630\u0627\u062a\u0647. \u064a\u0645\u0643\u0646\u0643 \u062a\u0634\u063a\u064a\u0644 \u0633\u0644\u0633\u0644\u0629 \u0645\u0648\u0646\u062a \u0643\u0627\u0631\u0644\u0648 (monte carlo chain) \u0645\u0639 \u0647\u0630\u0627\u060c \u064a\u0645\u0643\u0646\u0643 \u0631\u0624\u064a\u0629 \u0627\u062d\u062a\u0645\u0627\u0644\u064a\u0629 \u0625\u0646\u0634\u0627\u0621 \u0642\u0627\u0626\u0645\u0629 \u0627\u0646\u062a\u0638\u0627\u0631 \u0637\u0648\u064a\u0644\u0629\u060c \u064a\u0645\u0643\u0646 \u0644\u0644\u0645\u0637\u0627\u0639\u0645 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0647\u0630\u0627 “\u0627\u0644\u062a\u0648\u0623\u0645 \u0627\u0644\u0631\u0642\u0645\u064a” \u0644\u0645\u0637\u0639\u0645\u0647\u0645 \u0648\u0631\u0624\u064a\u0629 \u0645\u062a\u0649 \u064a\u0645\u0643\u0646 \u0623\u0646 \u062a\u062d\u062f\u062b \u0623\u0634\u064a\u0627\u0621 \u062d\u0631\u062c\u0629. \u0627\u0644\u0622\u0646 \u0628\u0639\u062f \u0623\u0646 \u0623\u0635\u0628\u062d \u0644\u062f\u064a\u0646\u0627 \u0645\u0646\u062a\u062c \u064a\u0639\u0645\u0644\u060c \u0641\u0644\u0646\u062c\u0639\u0644\u0647 \u0623\u062c\u0645\u0644 \u0648\u0623\u0643\u062b\u0631 \u0642\u0648\u0629 \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064a (AI).<\/p>\n
3. \u062a\u0641\u0639\u064a\u0644 \u0646\u0638\u0627\u0645 \u0648\u0643\u064a\u0644 \u0627\u0644\u0645\u0637\u0639\u0645 (Agent Restaurant Implementation)<\/h2>\n
\u0643\u0645\u0627 \u0646\u0631\u0649 \u0623\u0639\u0644\u0627\u0647\u060c \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0642\u0627\u062f\u0631\u0648\u0646 \u0628\u0627\u0644\u0641\u0639\u0644 \u0639\u0644\u0649 \u0637\u0631\u062d \u0627\u0644\u0623\u0633\u0626\u0644\u0629\u060c \u0648\u0644\u062f\u064a\u0646\u0627 \u0627\u0644\u0625\u062c\u0627\u0628\u0629 \u0643\u0631\u0642\u0645. \u064a\u062e\u062a\u0627\u0631 \u0627\u0644\u0639\u0645\u064a\u0644 \u0623\u064a\u0636\u064b\u0627 \u0637\u0639\u0627\u0645\u064b\u0627 \u0639\u0634\u0648\u0627\u0626\u064a\u064b\u0627 \u0641\u064a \u0646\u0638\u0627\u0645\u0646\u0627. \u0644\u0646\u062c\u0631\u0628 \u0627\u0644\u0622\u0646 \u0625\u0636\u0627\u0641\u0629 \u0627\u0644\u0648\u0643\u0644\u0627\u0621 (Agents) \u0625\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u0646\u0638\u0627\u0645. \u064a\u0639\u062a\u0628\u0631 \u062a\u0641\u0639\u064a\u0644 \u0646\u0638\u0627\u0645 \u0648\u0643\u064a\u0644 \u0627\u0644\u0645\u0637\u0639\u0645 \u062e\u0637\u0648\u0629 \u0645\u062a\u0642\u062f\u0645\u0629 \u0641\u064a \u0623\u062a\u0645\u062a\u0629 \u062e\u062f\u0645\u0629 \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0648\u062a\u062d\u0633\u064a\u0646 \u062a\u062c\u0631\u0628\u0629 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\u060c \u062d\u064a\u062b \u064a\u0645\u0643\u0646 \u0644\u0644\u0648\u0643\u0644\u0627\u0621 \u0627\u0644\u0645\u062f\u0631\u0628\u064a\u0646 \u0627\u0644\u0625\u062c\u0627\u0628\u0629 \u0639\u0644\u0649 \u0627\u0633\u062a\u0641\u0633\u0627\u0631\u0627\u062a \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0628\u0643\u0641\u0627\u0621\u0629 \u0648\u062a\u0642\u062f\u064a\u0645 \u062a\u0648\u0635\u064a\u0627\u062a \u0645\u062e\u0635\u0635\u0629.<\/p>\n
3.1 \u062a\u0646\u0641\u064a\u0630 \u0648\u0643\u0644\u0627\u0621 \u0645\u062e\u0635\u0635\u064a\u0646<\/h3>\n
\u0633\u062a\u062d\u062a\u0627\u062c \u0625\u0644\u0649 \u062a\u062b\u0628\u064a\u062a \u0648\u062d\u062f\u0629 “\u0627\u0644\u0648\u0643\u0644\u0627\u0621”:<\/p>\n
\u0641\u064a\u0645\u0627 \u064a\u0644\u064a \u062a\u0646\u0641\u064a\u0630 \u0648\u0643\u064a\u0644 \u062e\u062f\u0645\u0629 \u0627\u0644\u0639\u0645\u0644\u0627\u0621\u060c \u0648\u0648\u0643\u064a\u0644 \u0627\u0644\u062a\u0631\u0641\u064a\u0647\u060c \u0648\u0645\u0639\u0627\u0644\u062c \u0627\u0644\u0634\u0643\u0627\u0648\u0649.<\/p>\n
# custom_agents.py\r\nimport os, json\r\nfrom openai import OpenAI\r\nfrom agents import Agent\r\nfrom newtools import *\r\n\r\nclient = OpenAI(api_key=os.getenv(\"OPENAI_API_KEY\"),\r\ndefault_headers={\"OpenAI-Beta\":\"assistants=v2\"})\r\n\r\n\r\nmenu_agent = Agent(name = \"Chef_suggester\",\r\ninstructions = \"You are a helpful server that knows everything about our restaurant and is helping customer picking their food. You will start by politely\"\r\n\"introducing yourself as a food virtual assistant, and politely saying hi to the customer. The name of the customer can be found in the msg json file\"\r\n\"You will read the menu, and, based on what the customer is asking you, in the request key of the json file, you will provide the best recommendation from the menu.\"\r\n\"If the customer is asking you inappopriate questions, just output 'unsuccessfull'. Answer in json format. '{food: <food_list [food_1, food_2,...,] or None if unsuccessfull>, status: <successfull or unsuccessfull>}'\",\r\ntools = [get_menu])\r\n\r\nentertainer_agent = Agent(name = \"Entertainer\",\r\ninstructions = (\"You are a helpful server that is keeping the customers busy while they wait.\"\r\n\"You can not provide any discount or offer, but they can ask questions about the menu, which you can get from the\"\r\n\"get_menu functions. They can also ask you how long the line is going to be to get in. Their information is in the waiting_time\"\r\n\"If the user_status is 'queue', just provide the waiting time with kindness, based on the length. Otherwise, \"\r\n\"if the user_status is 'food' it means they are waiting on food. Check 'order' and provide a funny reference on\"\r\n\"their waiting time. For example 'your wait time for pasta is 5 minutes, it looks like the chef is putting sauce on it!' \"),\r\ntools = [get_menu])\r\n\r\n\r\ncustomer_agent = Agent(name = \"Customer\",\r\ninstructions = (\"You are a customer and you are eating in an italian restaurant. Look at the menu using the get_menu function. If you already know what you want, just tell the waiter what you would like. \"\r\n\"Otherwise, give them a general indication, or ask for guidance based on your general liking, and they will pick their best for you.\"),\r\ntools = [get_menu])\r\n\r\n\r\n\r\n\r\n\r\ndef call_agent(runner, msg, class_agent = \"wait\"):\r\nif class_agent == \"entertainer\":\r\nreturn runner.run_sync(entertainer_agent, msg)\r\n\r\nelif class_agent == \"waiter\":\r\nreturn runner.run_sync(menu_agent, msg)\r\n\r\nelif class_agent == \"customer\":\r\nreturn runner.run_sync(customer_agent, '')<\/pre>\n\u0644\u062f\u064a\u0646\u0627 \u062a\u0639\u0631\u064a\u0641 \u0627\u0644\u0639\u0645\u064a\u0644<\/strong>\u060c \u0648\u0647\u0648 \u0627\u0633\u062a\u062f\u0639\u0627\u0621 \u0639\u0645\u064a\u0644 OpenAI\u060c \u0648 newtools.py<\/strong>\u060c \u0627\u0644\u0630\u064a \u064a\u0633\u062d\u0628 \u0627\u0644\u0642\u0627\u0626\u0645\u0629\u060c \u0648 call_agent<\/strong> \u0627\u0644\u0630\u064a \u064a\u0633\u062a\u062f\u0639\u064a \u0627\u0644\u0648\u0643\u064a\u0644 \u0627\u0644\u0641\u0631\u062f\u064a \u0648\u064a\u0634\u063a\u0644\u0647 \u0645\u0646 \u062e\u0644\u0627\u0644 runner<\/strong>. \u0647\u0630\u0647 \u0627\u0644\u0645\u0643\u0648\u0646\u0627\u062a \u0623\u0633\u0627\u0633\u064a\u0629 \u0644\u0625\u0646\u0634\u0627\u0621 \u0646\u0638\u0627\u0645 \u0648\u0643\u0644\u0627\u0621 \u0641\u0639\u0627\u0644.<\/p>\n\u0647\u0630\u0627 \u0628\u0627\u0644\u0636\u0628\u0637 \u0645\u0627 \u062a\u062d\u062f\u062b\u0646\u0627 \u0639\u0646\u0647 \u0641\u064a \u0627\u0644\u0645\u0642\u062f\u0645\u0629. \u0646\u062d\u0646 \u0646\u062d\u062f\u062f \u0639\u062f\u0629 \u0648\u0643\u0644\u0627\u0621<\/strong> \u0633\u064a\u062a\u0645 \u062a\u0648\u0635\u064a\u0644\u0647\u0645\u060c \u0648\u0647\u0645 \u064a\u0633\u062a\u062e\u062f\u0645\u0648\u0646 \u0623\u062f\u0648\u0627\u062a<\/strong> \u0645\u062d\u062f\u062f\u0629 \u0628\u0648\u0627\u0633\u0637\u0629 \u0627\u0644\u0643\u0648\u062f \u0627\u0644\u062e\u0627\u0635 \u0628\u064a. \u0647\u0630\u0647 \u0627\u0644\u0623\u062f\u0648\u0627\u062a \u0648\u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u064a\u0633\u0645\u062d\u0648\u0646 \u0628\u0623\u062a\u0645\u062a\u0629 \u0645\u0647\u0627\u0645 \u062e\u062f\u0645\u0629 \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0648\u062a\u062d\u0633\u064a\u0646 \u062a\u062c\u0631\u0628\u0629 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645.<\/p>\nfrom agents import function_tool\r\nfrom constants import *\r\nimport pandas as pd\r\n\r\n@function_tool\r\ndef get_menu():\r\ndf = pd.read_csv(MENU_FILE)\r\n# convert to list of dicts (or JSON-serializable structure)\r\nreturn df.to_dict(orient=\"records\")<\/pre>\n3.2 \u062a\u0646\u0641\u064a\u0630 \u0648\u0643\u0644\u0627\u0621 \u0645\u062e\u0635\u0635\u064a\u0646<\/h3>\n
\u062a\u0645 \u062f\u0645\u062c \u062a\u0646\u0641\u064a\u0630 Table<\/strong> \u0648 Restaurant<\/strong> \u0645\u0639 \u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u0641\u064a \u0627\u0644\u0643\u0648\u062f \u0627\u0644\u062a\u0627\u0644\u064a:<\/p>\n <\/p>\n
import random\r\nimport time\r\nimport math\r\nimport sys\r\nfrom utils import *\r\nfrom constants import *\r\nimport time, random, json\r\nfrom custom_agents import *\r\nfrom utils import *\r\nfrom constants import * \r\nfrom agents import Runner\r\n# list of first names from your NAMES constant\r\n# assume NAMES = [ ... ] is defined in constants.py\r\nimport logging\r\n\r\n# Set up logging\r\n\r\n\r\n\r\n\r\ndef log(msg):\r\nlogging.info(msg)\r\n\r\nclass Table:\r\ndef __init__(self, id, capacity=1):\r\nself.id = id\r\nself.capacity = capacity\r\nself.is_free = True\r\nself.cust_id = None\r\nself.orders = [] # list of (plate, cook_time, eat_time)\r\nself.current_phase = None # \"cooking\" or \"eating\"\r\nself.cooking_complete_at = None\r\nself.leave_at = None\r\n\r\ndef seat(self, cust_id, cust_name, clock, orders):\r\nself.is_free = False\r\nself.cust_id = cust_id\r\nself.orders = list(orders) # copy the list of tuples\r\n# start first dish cooking immediately\r\nplate, cook_time, eat_time = self.orders.pop(0)\r\nself.current_phase = \"cooking\"\r\nself._scheduled_eat_time = eat_time\r\nself._remaining_orders = self.orders # save the tail\r\nself.cooking_complete_at = clock + cook_time\r\nself.leave_at = None\r\nmsg = (f\"[{clock:04}m] \ud83e\ude91 Seated {cust_name} (#{cust_id}) at T{self.id} \"\r\nf\"ordering {len(orders)} dishes; first: {plate!r} \"\r\nf\"(cook {cook_time}m, eat {eat_time}m)\")\r\nprint(msg); sys.stdout.flush()\r\n\r\n\r\ndef start_eating(self, clock):\r\nself.current_phase = \"eating\"\r\nself.leave_at = clock + self._scheduled_eat_time\r\nplate = self.plate if hasattr(self, 'plate') else \"dish\"\r\nmsg = (f\"[{clock:04}m] \ud83c\udf7d\ufe0f {plate!r} ready for {self.cust_name} \"\r\nf\"(#{self.cust_id}) at T{self.id}, eating until {self.leave_at}m\")\r\nprint(msg); sys.stdout.flush()\r\n\r\ndef finish_phase(self, clock):\r\n\"\"\"Called when eating of current dish finishes.\"\"\"\r\nif self._remaining_orders:\r\n# move to next dish\r\nplate, cook_time, eat_time = self._remaining_orders.pop(0)\r\nself.current_phase = \"cooking\"\r\nself._scheduled_eat_time = eat_time\r\nself.cooking_complete_at = clock + cook_time\r\nself.leave_at = None\r\nself.plate = plate\r\nmsg = (f\"[{clock:04}m] \ud83d\udd04 Next dish for {self.cust_name} (#{self.cust_id}) \"\r\nf\"at T{self.id}: {plate!r} (cook {cook_time}m, eat {eat_time}m)\")\r\nprint(msg); sys.stdout.flush()\r\nelse:\r\n# no more dishes: depart\r\nmsg = (f\"[{clock:04}m] \ud83d\udcb8 {self.cust_name} (#{self.cust_id}) \"\r\nf\"finished all dishes and left T{self.id}\")\r\nprint(msg); sys.stdout.flush()\r\nself.is_free = True\r\nself.cust_id = None\r\nself.orders = []\r\nself.current_phase = None\r\nself.cooking_complete_at = None\r\nself.leave_at = None\r\n\r\nclass Restaurant:\r\ndef __init__(self, num_tables, arrival_prob=0.33,\r\ntick_length=1, real_pause=0.5, menu=None,\r\nquery_prob=0.0):\r\nself.tables = [Table(i) for i in range(num_tables)]\r\nself.queue = [] # just customer IDs\r\nself.clock = 0\r\nself.next_cust_id = 1\r\nself.arrival_prob = arrival_prob\r\nself.tick = tick_length\r\nself.pause = real_pause\r\nself.menu = menu or [\r\n(\"Burger\", 2, 4),\r\n(\"Pasta\", 3, 5),\r\n(\"Salad\", 1, 2),\r\n(\"Steak\", 4, 6),\r\n(\"Soup\", 1, 3),\r\n]\r\nself.runner = Runner()\r\nself.query_prob = query_prob\r\nself.names = {}\r\nself.load_logging()\r\n\r\ndef load_logging(self):\r\nlogging.getLogger(\"httpx\").setLevel(logging.WARNING)\r\nlogging.getLogger(\"openai\").setLevel(logging.WARNING)\r\nlogging.getLogger(\"urllib3\").setLevel(logging.WARNING)\r\nlogging.basicConfig(level=logging.INFO, format='[%(asctime)s] %(message)s',\r\ndatefmt='%H:%M:%S', handlers=[\r\nlogging.FileHandler(\"restaurant_log.txt\", mode='w'),\r\nlogging.StreamHandler(sys.stdout)])\r\n\r\n\r\ndef log_to_msg(self,msg):\r\nlogging.info(msg)\r\n\r\n\r\n\r\n\r\n\r\ndef open_tables(self):\r\nreturn [t for t in self.tables if t.is_free]\r\n\r\ndef _pick_orders(self, cname):\r\n\"\"\"Choose between 1\u20133 random menu items as a list.\"\"\"\r\n#n = random.randint(1, 3)\r\n#return random.sample(self.menu, n)\r\ncustomer_text = call_agent(runner = self.runner, msg= '', class_agent=\"customer\").final_output\r\nmsg = f'The customer {cname} is talking to the waiter, saying this {customer_text}'\r\nprint(msg)\r\nself.log_to_msg(msg)\r\nmenu_asker_output = call_agent(runner = self.runner, msg = json.dumps(customer_text), class_agent=\"waiter\").final_output\r\noutput = extract_json_dict(menu_asker_output)\r\nmsg = f'The processed response from our LLM is {output}'\r\nprint(msg)\r\nself.log_to_msg(msg)\r\nif output['status'] == 'successfull':\r\nreturn filter_menu_items(output['food'])\r\nelse:\r\nn = random.randint(1, 3)\r\nreturn random.sample(self.menu, n)\r\n\r\n\r\n\r\n\r\ndef _assign_name(self, cid):\r\nname = random.choice(NAMES)\r\nself.names[cid] = name\r\nreturn name\r\n\r\ndef arrive(self):\r\nif random.random() < self.arrival_prob:\r\ncid = self.next_cust_id\r\nself.next_cust_id += 1\r\ncname = self._assign_name(cid)\r\nfree = self.open_tables()\r\nif free:\r\norders = self._pick_orders(cname)\r\ntable = min(free, key=lambda t: t.capacity)\r\ntable.cust_name = cname\r\nplate, cook_time, eat_time = orders[0]\r\ntable.plate = plate\r\ntable.seat(cid, cname, self.clock, orders)\r\nelse:\r\nself.queue.append(cid)\r\nmsg = f\"[{self.clock:04}m] \u23f3 Queued {cname} (#{cid}) \u2013 waiting\"\r\nprint(msg)\r\nself.log_to_msg(msg)\r\n\r\ndef process_cooking(self):\r\nfor t in self.tables:\r\nif (not t.is_free and\r\nt.current_phase==\"cooking\" and\r\nt.cooking_complete_at <= self.clock):\r\n# cooking done \u2192 start eating\r\nt.cust_name = self.names[t.cust_id]\r\nt.start_eating(self.clock)\r\n\r\ndef process_departures(self):\r\nfor t in self.tables:\r\nif (not t.is_free and\r\nt.current_phase==\"eating\" and\r\nt.leave_at <= self.clock):\r\nt.cust_name = self.names[t.cust_id]\r\nt.finish_phase(self.clock)\r\n\r\ndef seat_from_queue(self):\r\nwhile self.queue and self.open_tables():\r\ncid = self.queue.pop(0)\r\ncname = self.names[cid]\r\norders = self._pick_orders(cname=cname)\r\ntable = min(self.open_tables(), key=lambda t: t.capacity)\r\ntable.cust_name = cname\r\nplate, cook_time, eat_time = orders[0]\r\ntable.plate = plate\r\ntable.seat(cid, cname, self.clock, orders)\r\n\r\ndef estimate_queue_time(self, cid):\r\n# same logic as before: position in queue \u00d7 avg service\r\navg = sum(c+e for _,c,e in self.menu) \/ len(self.menu)\r\nidx = self.queue.index(cid)\r\nreturn math.ceil((idx+1)*avg\/len(self.tables))\r\n\r\ndef estimate_food_time(self, cid):\r\nfor t in self.tables:\r\nif t.cust_id == cid:\r\n# if they\u2019re still cooking, time until cook\u2010done\r\nif t.current_phase == \"cooking\":\r\nreturn max(0, t.cooking_complete_at - self.clock)\r\n# if they\u2019re eating, time until they finish eating\r\nif t.current_phase == \"eating\":\r\nreturn max(0, t.leave_at - self.clock)\r\nreturn None\r\n\r\ndef handle_random_query(self):\r\nqueue_ids = list(self.queue)\r\nseated_ids = [t.cust_id for t in self.tables if not t.is_free]\r\nif queue_ids and (not seated_ids or random.random() < 0.7):\r\ncid = random.choice(queue_ids)\r\nwait = self.estimate_queue_time(cid)\r\ncname = self.names[cid]\r\nmsg = f\"[{self.clock:04}m] \u2753 Customer {cid}: How long will I be in line?\"\r\nprint(msg)\r\nself.log_to_msg(msg)\r\n\r\nmsg = f\"[{self.clock:04}m] \u27a1\ufe0f Estimated wait for customer {cid}: {wait}m\"\r\nprint(msg)\r\nself.log_to_msg(msg)\r\nwaiting_message = {\r\n\"customer_id\": cid,\r\n\"customer_name\": cname,\r\n\"type\": \"line\",\r\n\"wait_min\": wait,\r\n\"next_food\": None\r\n}\r\noutput_llm = call_agent(class_agent=\"entertainer\", runner = self.runner, msg = json.dumps(waiting_message))\r\nmsg = f\"Our LLM took care of {cname} with this: {output_llm}\"\r\nprint(msg)\r\nself.log_to_msg(msg)\r\n\r\nelif seated_ids:\r\ncid = random.choice(seated_ids)\r\nwait = self.estimate_food_time(cid)\r\ntable = next(t for t in self.tables if t.cust_id == cid)\r\nfood = table.plate\r\ncname = self.names[cid]\r\nmsg = f\"[{self.clock:04}m] \u2753 Customer {cid}: How long will the food take me?\"\r\nprint(msg)\r\nself.log_to_msg(msg)\r\nif wait is None:\r\nmsg = f\"[{self.clock:04}m] \u27a1\ufe0f Ready now!\"\r\nprint(msg)\r\nself.log_to_msg(msg)\r\nelse:\r\nmsg = f\"[{self.clock:04}m] \u27a1\ufe0f Estimated food wait for customer {cid}: {wait}m\"\r\nprint(msg)\r\nself.log_to_msg(msg)\r\nwaiting_message = {\r\n\"customer_id\": cid,\r\n\"customer_name\": cname,\r\n\"type\": \"line\",\r\n\"wait_min\": wait,\r\n\"next_food\": food\r\n}\r\noutput_llm = call_agent(class_agent=\"entertainer\", runner = self.runner, msg = json.dumps(waiting_message))\r\nmsg = f\"Our LLM took care of {cname} with this: {output_llm}\"\r\nprint(msg)\r\nself.log_to_msg(msg)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\ndef tick_once(self):\r\nself.arrive()\r\nself.process_cooking()\r\nself.process_departures()\r\nself.seat_from_queue()\r\nif self.query_prob and random.random() < self.query_prob:\r\nself.handle_random_query()\r\nself.clock += self.tick\r\ntime.sleep(self.pause)\r\n\r\ndef run(self, total_time):\r\nwhile self.clock < total_time:\r\nself.tick_once()\r\nfree = sum(t.is_free for t in self.tables)\r\nmsg = f\"n--- END OF SHIFT ---n{free}\/{len(self.tables)} tables free at {self.clock}m.\"\r\nprint(msg)\r\nself.log_to_msg(msg)\r\n\r\nif __name__ == \"__main__\":\r\n\r\n\r\nrandom.seed(42)\r\nmenu = preprocess_menu(MENU_FILE, eat_time_factor=0.5)\r\nR = Restaurant(\r\nnum_tables=5,\r\narrival_prob=0.7,\r\ntick_length=1,\r\nreal_pause=5.0,\r\nquery_prob=0.8,\r\nmenu=menu\r\n)\r\nR.run(total_time=60)<\/pre>\n\n3.3 \u062a\u0646\u0641\u064a\u0630 \u0648\u0627\u062c\u0647\u0629 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0627\u0644\u0631\u0633\u0648\u0645\u064a\u0629 (GUI) \u0644\u0645\u0637\u0639\u0645 \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0646\u0645\u0648\u0630\u062c \u0627\u0644\u0644\u063a\u0629 \u0627\u0644\u0643\u0628\u064a\u0631 (LLM)<\/h3>\n
\u0644\u0639\u0631\u0636 \u0623\u062f\u0627\u0621 \u0627\u0644\u0645\u0637\u0639\u0645 \u0645\u0639 \u062a\u0637\u0628\u064a\u0642 \u0646\u0645\u0648\u0630\u062c \u0627\u0644\u0644\u063a\u0629 \u0627\u0644\u0643\u0628\u064a\u0631 (LLM)\u060c \u0633\u0646\u0633\u062a\u062e\u062f\u0645 \u0648\u0627\u062c\u0647\u0629 \u0645\u0633\u062a\u062e\u062f\u0645 \u0631\u0633\u0648\u0645\u064a\u0629 (GUI) \u0628\u0633\u064a\u0637\u0629.<\/p>\n
from llm_models_gui import RestaurantGUI\r\nfrom utils import * \r\nimport random\r\nfrom llm_models import Restaurant\r\n\r\nif __name__ == \"__main__\":\r\nrandom.seed(42)\r\nmenu = preprocess_menu(MENU_FILE, eat_time_factor=0.5)\r\nR = Restaurant(\r\nnum_tables=5,\r\narrival_prob=0.7,\r\ntick_length=1,\r\nreal_pause=1.0, # smoother for GUI\r\nquery_prob=0.8,\r\nmenu=menu\r\n)\r\napp = RestaurantGUI(R)<\/pre>\n
<\/p>\n
\u062a\u0648\u0641\u0631 \u0644\u0643 \u0648\u0627\u062c\u0647\u0629 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0627\u0644\u0631\u0633\u0648\u0645\u064a\u0629 (GUI) \u0645\u0639\u0644\u0648\u0645\u0627\u062a \u062d\u0648\u0644 \u0627\u0644\u0634\u062e\u0635 (Emma)\u060c \u0648\u0627\u0644\u0637\u0627\u0648\u0644\u0629\u060c \u0648\u0627\u0644\u0648\u0642\u062a\u060c \u0648\u0645\u062e\u0631\u062c\u0627\u062a \u0646\u0645\u0648\u0630\u062c \u0627\u0644\u0644\u063a\u0629 \u0627\u0644\u0643\u0628\u064a\u0631 (LLM). \u064a\u062a\u0645 \u0623\u064a\u0636\u064b\u0627 \u0625\u0646\u0634\u0627\u0621 \u0633\u062c\u0644 .txt \u062a\u0644\u0642\u0627\u0626\u064a\u064b\u0627.<\/p>\n
\u062f\u0639\u0646\u064a \u0623\u0631\u064a\u0643 \u0645\u062b\u0627\u0644\u064b\u0627 \u0639\u0644\u0649 \u0627\u0644\u0645\u062e\u0631\u062c\u0627\u062a:<\/p>\n
[\u0661\u0662:\u0663\u0661:\u0662\u0663] \u0627\u0644\u0632\u0628\u0648\u0646\u0629 \u0625\u064a\u0645\u0627 \u062a\u062a\u062d\u062f\u062b \u0645\u0639 \u0627\u0644\u0646\u0627\u062f\u0644 \u0642\u0627\u0626\u0644\u0629\u064b: “\u0623\u0648\u062f \u0623\u0646 \u0623\u0628\u062f\u0623 \u0628\u0627\u0644\u0628\u0631\u0648\u0634\u064a\u062a\u0627 \u0643\u0645\u0642\u0628\u0644\u0627\u062a. \u062b\u0645 \u0633\u0623\u0637\u0644\u0628 \u0633\u0628\u0627\u063a\u064a\u062a\u064a \u0643\u0627\u0631\u0628\u0648\u0646\u0627\u0631\u0627 \u0643\u0637\u0628\u0642 \u0623\u0648\u0644. \u0623\u0645\u0627 \u0627\u0644\u062d\u0644\u0648\u0649\u060c \u0641\u0633\u0623\u0633\u062a\u0645\u062a\u0639 \u0628\u0627\u0644\u062a\u064a\u0631\u0627\u0645\u064a\u0633\u0648. \u0647\u0644 \u064a\u0645\u0643\u0646\u0643\u0650 \u0623\u064a\u0636\u064b\u0627 \u0627\u0642\u062a\u0631\u0627\u062d \u0646\u0648\u0639 \u0645\u0646 \u0627\u0644\u0646\u0628\u064a\u0630 \u0645\u0639 \u0647\u0630\u0647 \u0627\u0644\u0648\u062c\u0628\u0629\u061f”<\/span><\/span> [\u0661\u0662:\u0663\u0661:\u0662\u0665] \u0627\u0644\u0625\u062c\u0627\u0628\u0629 \u0627\u0644\u0645\u064f\u0639\u0627\u0644\u062c\u0629 \u0645\u0646 \u0637\u0627\u0644\u0628\u0629 \u0627\u0644\u0645\u0627\u062c\u0633\u062a\u064a\u0631 \u0644\u062f\u064a\u0646\u0627 \u0647\u064a: {‘food’: [‘Bruschetta’, ‘Spaghetti Carbonara’, ‘Tiramisu’, ‘Chianti Classico’], ‘status’: ‘successful’} [\u0661\u0662:\u0663\u0661:\u0662\u0665] [\u0660\u0660\u0660\u0660\u0645] \u2753 \u0627\u0644\u0632\u0628\u0648\u0646 \u0661: \u0643\u0645 \u0645\u0646 \u0627\u0644\u0648\u0642\u062a \u0633\u064a\u0633\u062a\u063a\u0631\u0642\u0646\u064a \u062a\u062d\u0636\u064a\u0631 \u0627\u0644\u0637\u0639\u0627\u0645\u061f<\/span><\/span> [\u0661\u0662:\u0663\u0661:\u0662\u0665] [\u0660\u0660\u0660\u0660\u0645] \u27a1\ufe0f \u0645\u062f\u0629 \u0627\u0646\u062a\u0638\u0627\u0631 \u0627\u0644\u0637\u0639\u0627\u0645 \u0627\u0644\u0645\u062a\u0648\u0642\u0639\u0629 \u0644\u0644\u0632\u0628\u0648\u0646 \u0661: \u0661\u0665 \u062f\u0642\u064a\u0642\u0629 [\u0661\u0662:\u0663\u0661:\u0662\u0666] \u062a\u0648\u0644\u0649 \u0637\u0627\u0644\u0628 \u0627\u0644\u0645\u0627\u062c\u0633\u062a\u064a\u0631 \u0641\u064a \u0627\u0644\u0642\u0627\u0646\u0648\u0646 \u0623\u0645\u0631 \u0625\u064a\u0645\u0627 \u0628\u0647\u0630\u0627: \u0622\u062e\u0631 \u0639\u0645\u064a\u0644: Agent(name=”Entertainer”, …) \u0627\u0644\u0646\u062a\u064a\u062c\u0629 \u0627\u0644\u0646\u0647\u0627\u0626\u064a\u0629 (\u0633\u0644\u0633\u0644\u0629): \u0645\u0631\u062d\u0628\u064b\u0627 \u0625\u064a\u0645\u0627!<\/span><\/span> \u0634\u0643\u0631\u064b\u0627 \u0644\u0643\u0650 \u0639\u0644\u0649 \u0635\u0628\u0631\u0643\u0650.<\/span><\/span> \u0645\u062f\u0629 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631 \u0644\u0644\u062f\u062e\u0648\u0644 \u062d\u0648\u0627\u0644\u064a \u0661\u0665 \u062f\u0642\u064a\u0642\u0629.<\/span><\/span> \u0627\u0642\u062a\u0631\u0628\u0646\u0627 \u0645\u0646 \u0627\u0644\u0648\u0635\u0648\u0644 – \u0648\u0642\u062a \u0643\u0627\u0641\u064d \u0644\u0623\u0628\u062f\u0623 \u0628\u0627\u0644\u062d\u0644\u0645 \u0628\u062a\u0644\u0643 \u0627\u0644\u0628\u0631\u0648\u0634\u062a\u0627 \u0627\u0644\u0644\u0630\u064a\u0630\u0629!<\/span><\/span> \ud83c\udf7d\ufe0f<\/span><\/span><\/span><\/p><\/blockquote>\n\u064a\u0645\u0643\u0646\u0646\u0627 \u0623\u0646 \u0646\u0639\u0631\u0636:<\/p>\n
\n- \u064a\u0642\u0648\u0645 \u0627\u0644\u0639\u0645\u064a\u0644 \u0628\u0625\u0646\u0634\u0627\u0621 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0637\u0639\u0627\u0645 \u0627\u0644\u062e\u0627\u0635\u0629 \u0628\u0647 \u0645\u0646 \u062e\u0644\u0627\u0644 \u0627\u0644\u0648\u0643\u064a\u0644<\/strong>\u060c \u0648\u064a\u0637\u0644\u0628 \u062a\u0648\u0635\u064a\u0629 \u0645\u0646 \u0648\u0643\u064a\u0644 \u0627\u0644\u0646\u0627\u062f\u0644<\/li>\n
- \u064a\u0648\u0635\u064a \u0627\u0644\u0646\u0627\u062f\u0644 \u0628\u0646\u0628\u064a\u0630 Chianti \u0648\u064a\u0636\u064a\u0641\u0647 \u0625\u0644\u0649 \u0627\u0644\u0642\u0627\u0626\u0645\u0629<\/strong><\/li>\n
- \u064a\u0642\u0648\u0645 \u0648\u0643\u064a\u0644 \u0645\u0639\u0627\u0644\u062c\u0629 \u0627\u0644\u0634\u0643\u0627\u0648\u0649 \u0628\u0625\u0628\u0644\u0627\u063a \u0627\u0644\u0639\u0645\u064a\u0644 \u0628\u0645\u062f\u0629 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631<\/strong><\/li>\n<\/ol>\n
\u0627\u0644\u0622\u0646\u060c \u0644\u0627 \u064a\u0645\u0643\u0646\u0646\u0627 \u0641\u0642\u0637 \u0645\u062d\u0627\u0643\u0627\u0629 \u062e\u0637 \u0633\u064a\u0631 \u0627\u0644\u0639\u0645\u0644\u060c \u0643\u0645\u0627 \u0643\u0646\u0627 \u0646\u0641\u0639\u0644 \u0645\u0646 \u0642\u0628\u0644\u060c \u0628\u0644 \u0644\u062f\u064a\u0646\u0627 \u062e\u0637 \u0633\u064a\u0631 \u0639\u0645\u0644 \u0630\u0643\u064a<\/strong>\u060c \u0645\u0639\u0632\u0632 \u0628\u0646\u0641\u0633 \u062a\u0643\u0646\u0648\u0644\u0648\u062c\u064a\u0627 ChatGPT. \u0623\u0644\u064a\u0633 \u0647\u0630\u0627 \u0631\u0627\u0626\u0639\u064b\u0627\u061f<\/p>\n <\/p>\n
4. \u0627\u0644\u062e\u0644\u0627\u0635\u0629<\/h2>\n
\u0634\u0643\u0631\u0627\u064b \u062c\u0632\u064a\u0644\u0627\u064b \u0644\u062d\u0636\u0648\u0631\u0643\u0645\u060c \u0647\u0630\u0627 \u064a\u0639\u0646\u064a \u0644\u064a \u0627\u0644\u0643\u062b\u064a\u0631 \u2764\ufe0f.
\n\u062f\u0639\u0648\u0646\u0627 \u0646\u0639\u0648\u062f \u0644\u0631\u0624\u064a\u0629 \u0645\u0627 \u0642\u0645\u0646\u0627 \u0628\u0647 \u0641\u064a \u0647\u0630\u0647 \u0627\u0644\u0645\u0642\u0627\u0644\u0629.<\/p>\n
\n- \u062a\u0635\u0645\u064a\u0645 \u0646\u0638\u0627\u0645 \u0645\u0637\u0639\u0645<\/strong>:
\n\u0642\u0645\u0646\u0627 \u0628\u0625\u0646\u0634\u0627\u0621 \u062a\u0635\u0645\u064a\u0645 \u0633\u0631\u064a\u0639 \u0644\u0646\u0638\u0627\u0645 \u0627\u0644\u0645\u0637\u0639\u0645 \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0628\u0631\u0646\u0627\u0645\u062c PowerPoint \u0645\u0639 \u0625\u0636\u0627\u0641\u0629 \u0648\u0643\u0644\u0627\u0621 AI.<\/li>\n- \u0627\u0644\u0623\u0633\u0627\u0633 \u0627\u0644\u062e\u0627\u0644\u064a \u0645\u0646 \u0627\u0644\u0648\u0643\u0644\u0627\u0621:<\/strong>
\n\u0642\u0645\u0646\u0627 \u0623\u0648\u0644\u0627\u064b \u0628\u0628\u0646\u0627\u0621 \u0645\u062d\u0627\u0643\u0627\u0629 \u062d\u062a\u0645\u064a\u0629 \u062d\u062a\u0649 \u0646\u062a\u0645\u0643\u0646 \u0645\u0646 \u062a\u0631\u0645\u064a\u0632 \u0645\u0646\u0637\u0642 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631 \u0648\u0623\u0648\u0642\u0627\u062a \u0627\u0644\u0637\u0647\u064a \u0648\u062f\u0648\u0631\u0627\u0646 \u0627\u0644\u0637\u0627\u0648\u0644\u0629. \u0647\u0630\u0627 \u0647\u0648 \u0647\u064a\u0643\u0644\u0646\u0627 \u0627\u0644\u0639\u0638\u0645\u064a \u0642\u0628\u0644 \u0627\u0644\u0642\u064a\u0627\u0645 \u0628\u0623\u064a AI.<\/li>\n- \u0645\u0637\u0639\u0645 \u064a\u0639\u062a\u0645\u062f \u0639\u0644\u0649 \u0627\u0644\u0648\u0643\u0644\u0627\u0621:<\/strong>
\n\u0641\u064a \u0647\u0630\u0647 \u0627\u0644\u0645\u0631\u062d\u0644\u0629\u060c \u0627\u0633\u062a\u062e\u062f\u0645\u0646\u0627 \u0648\u0643\u0644\u0627\u0621 AI \u0644\u0645\u0644\u0621 \u062d\u0627\u0644\u0629 \u0627\u0644\u0634\u0643\u0648\u0649 + \u0627\u0644\u0625\u062c\u0631\u0627\u0621 \u0627\u0644\u062e\u0627\u0635\u0629 \u0628\u0646\u0627 \u0628\u0627\u0644\u0648\u0643\u0644\u0627\u0621. \u0642\u0645\u0646\u0627 \u0623\u064a\u0636\u0627\u064b \u0628\u0639\u0645\u0644 \u0648\u0627\u062c\u0647\u0629 \u0645\u0633\u062a\u062e\u062f\u0645 \u0631\u0633\u0648\u0645\u064a\u0629 \u0644\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0646\u062a\u0627\u0626\u062c \u0628\u0648\u0636\u0648\u062d.<\/li>\n<\/ol>\n\u0627\u0644\u0622\u0646\u060c \u0641\u064a \u0647\u0630\u0647 \u0627\u0644\u0645\u0631\u062d\u0644\u0629\u060c \u0623\u0631\u064a\u062f \u0623\u0646 \u0623\u0643\u0648\u0646 \u0648\u0627\u0636\u062d\u0627\u064b \u062c\u062f\u0627\u064b. \u0623\u0639\u0644\u0645 \u0623\u0646 \u0647\u0630\u0627 \u064a\u0628\u062f\u0648 \u0648\u0643\u0623\u0646\u0647 \u0645\u0631\u0622\u0629 \u0633\u0648\u062f\u0627\u0621 \u0628\u0639\u0636 \u0627\u0644\u0634\u064a\u0621. \u0645\u062d\u0627\u0643\u0627\u0629 \u0627\u0644\u0632\u0628\u0648\u0646\u061f \u0645\u062d\u0627\u0643\u0627\u0629 \u0627\u0644\u0645\u0637\u0639\u0645 \u0648\u0627\u0644\u0646\u0627\u062f\u0644\u061f \u0646\u0639\u0645\u060c \u0625\u0646\u0647 \u0623\u0645\u0631 \u063a\u0631\u064a\u0628\u060c \u0648\u0644\u0643\u0646<\/strong> \u0627\u0644\u0645\u0634\u0643\u0644\u0629 \u0644\u064a\u0633\u062a \u0623\u0628\u062f\u0627\u064b \u0623\u062f\u0627\u0629 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064a\u060c \u0628\u0644 \u062f\u0627\u0626\u0645\u0627\u064b \u0643\u064a\u0641 \u064a\u062a\u0645 \u0627\u0633\u062a\u062e\u062f\u0627\u0645\u0647\u0627. \u0623\u0639\u062a\u0642\u062f \u0623\u0646 \u0627\u0633\u062a\u0628\u062f\u0627\u0644 \u0627\u0644\u0646\u0627\u062f\u0644 \u0627\u0644\u0628\u0634\u0631\u064a \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064a \u0647\u0648 \u0644\u0639\u0628\u0629 \u062e\u0627\u0633\u0631\u0629.<\/p>\n\u0623\u0646 \u062a\u0643\u0648\u0646 \u0646\u0627\u062f\u0644\u0627\u064b \u0644\u0627 \u064a\u0639\u0646\u064a \u0628\u0628\u0633\u0627\u0637\u0629 \u062a\u0644\u0642\u064a \u0627\u0644\u0637\u0644\u0628\u0627\u062a \u0648\u0627\u0644\u062a\u0648\u0635\u064a\u0629 \u0628\u0627\u0644\u0646\u0628\u064a\u0630 \u0631\u0642\u0645 N \u0628\u0646\u0627\u0621\u064b \u0639\u0644\u0649 \u0623\u0646\u0648\u0627\u0639 \u0627\u0644\u0646\u0628\u064a\u0630 N-1 \u0627\u0644\u062a\u064a \u062a\u0645 \u0637\u0644\u0628\u0647\u0627 \u0645\u0646 \u0642\u0628\u0644. \u0625\u0646\u0647\u0627 \u0645\u0633\u0623\u0644\u0629 \u0623\u0646 \u062a\u0643\u0648\u0646 \u062f\u0627\u0641\u0626\u0627\u064b \u0628\u0645\u0627 \u064a\u0643\u0641\u064a \u0644\u062c\u0639\u0644 \u0627\u0644\u0636\u064a\u0641 \u064a\u0634\u0639\u0631 \u0628\u0627\u0644\u062a\u0631\u062d\u064a\u0628 \u0648\u0644\u0643\u0646\u0647 \u0628\u0639\u064a\u062f \u0628\u0645\u0627 \u064a\u0643\u0641\u064a \u0644\u0639\u062f\u0645 \u0627\u0644\u062a\u062f\u062e\u0644 \u0641\u064a \u0645\u062d\u0627\u062f\u062b\u062a\u0647\u060c \u0648\u0644\u0637\u064a\u0641\u0627\u064b \u0628\u0645\u0627 \u064a\u0643\u0641\u064a \u0644\u062c\u0639\u0644\u0647 \u064a\u0634\u0639\u0631 \u0648\u0643\u0623\u0646\u0647 \u0641\u064a \u0645\u0646\u0632\u0644\u0647 \u0648\u0644\u0643\u0646\u0647 \u0642\u0648\u064a \u0628\u0645\u0627 \u064a\u0643\u0641\u064a \u0644\u062c\u0639\u0644\u0647 \u064a\u062d\u062a\u0631\u0645 \u062d\u062f\u0648\u062f\u0643. \u0625\u0646\u0647 \u0645\u0632\u064a\u062c \u0645\u0646 \u0627\u0644\u0635\u0641\u0627\u062a \u0627\u0644\u062a\u064a \u0623\u0639\u062a\u0642\u062f \u0623\u0646\u0647\u0627 \u062a\u062a\u0637\u0644\u0628 \u0644\u0645\u0633\u0629 \u0625\u0646\u0633\u0627\u0646\u064a\u0629 \u0648\u0635\u0628\u0631 \u0648\u062a\u0639\u0627\u0637\u0641.<\/p>\n
\u0648\u0645\u0639 \u0630\u0644\u0643\u060c \u0623\u0639\u062a\u0642\u062f \u0623\u0646 \u0627\u0644\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0635\u062d\u064a\u062d \u0644\u0647\u0630\u0647 \u0627\u0644\u062a\u0643\u0646\u0648\u0644\u0648\u062c\u064a\u0627 \u064a\u0645\u0643\u0646 \u0623\u0646 \u064a\u0643\u0648\u0646 \u0630\u0627 \u0634\u0642\u064a\u0646:<\/p>\n
\n- \u0645\u0633\u0627\u0639\u062f\u0629 \u0627\u0644\u0623\u0634\u062e\u0627\u0635 \u0627\u0644\u062d\u0642\u064a\u0642\u064a\u064a\u0646 \u0627\u0644\u0630\u064a\u0646 \u064a\u062a\u0645 \u0648\u0636\u0639\u0647\u0645 \u0641\u064a \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631.<\/strong> \u0627\u0644\u0646\u0627\u062f\u0644\u0648\u0646 \u0641\u064a \u0627\u0644\u062f\u0627\u062e\u0644 \u0645\u0634\u063a\u0648\u0644\u0648\u0646 \u0644\u0644\u063a\u0627\u064a\u0629\u060c \u0648\u062a\u0642\u062f\u0645 \u0627\u0644\u0645\u0637\u0627\u0639\u0645 \u0628\u0627\u0644\u0641\u0639\u0644 \u0642\u0627\u0626\u0645\u0629 \u0637\u0639\u0627\u0645 \u0644\u0644\u0646\u0638\u0631 \u0625\u0644\u064a\u0647\u0627 \u0623\u062b\u0646\u0627\u0621 \u0627\u0646\u062a\u0638\u0627\u0631 \u0637\u0627\u0648\u0644\u062a\u0643\u060c \u0648\u0645\u0646 \u063a\u064a\u0631 \u0627\u0644\u0648\u0627\u0642\u0639\u064a \u0627\u0644\u0627\u0639\u062a\u0642\u0627\u062f \u0628\u0623\u0646 \u0627\u0644\u0646\u0627\u062f\u0644\u0648\u0646 \u0627\u0644\u0622\u062e\u0631\u064a\u0646 \u064a\u0633\u0644\u064a\u0648\u0646 \u0627\u0644\u0623\u0634\u062e\u0627\u0635 \u0627\u0644\u0630\u064a\u0646 \u064a\u0646\u062a\u0638\u0631\u0648\u0646 \u0628\u062f\u0648\u0646 \u0637\u0627\u0648\u0644\u0629. \u0641\u064a \u0647\u0630\u0647 \u0627\u0644\u0645\u0631\u062d\u0644\u0629\u060c \u064a\u0645\u0643\u0646 \u0623\u0646 \u064a\u0643\u0648\u0646 \u0631\u0641\u064a\u0642 AI \u0644\u0644\u062f\u0631\u062f\u0634\u0629 \u0645\u0639\u0647 \u0645\u0641\u064a\u062f\u0627\u064b.<\/li>\n
- \u0645\u062d\u0627\u0643\u0627\u0629 \u0627\u0644\u0645\u0637\u0639\u0645<\/strong>. \u0627\u0644\u0633\u064a\u0646\u0627\u0631\u064a\u0648 \u0627\u0644\u0630\u064a \u0643\u062a\u0628\u062a\u0647 \u064a\u062d\u0627\u0643\u064a \u0633\u0644\u0648\u0643<\/strong> \u0627\u0644\u0639\u0645\u0644\u0627\u0621<\/strong> \u0623\u064a\u0636\u0627\u064b. \u0647\u0630\u0627 \u064a\u0639\u0646\u064a \u0623\u0646\u0647\u060c \u0645\u0646 \u0627\u0644\u0645\u062d\u062a\u0645\u0644\u060c \u064a\u0645\u0643\u0646\u0643 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0645\u062d\u0627\u0643\u0627\u0629 \u0644\u0627\u062e\u062a\u0628\u0627\u0631 \u0633\u064a\u0646\u0627\u0631\u064a\u0648\u0647\u0627\u062a \u0645\u062e\u062a\u0644\u0641\u0629\u060c \u0648\u0645\u0639\u0631\u0641\u0629 \u0645\u062a\u0649 \u062a\u062a\u0634\u0643\u0644 \u0642\u0648\u0627\u0626\u0645 \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631\u060c \u0648\u0627\u0641\u062a\u0631\u0627\u0636 \u0631\u062f\u0648\u062f \u0623\u0641\u0639\u0627\u0644 \u0645\u062e\u062a\u0644\u0641\u0629 \u0644\u0644\u0623\u0634\u062e\u0627\u0635\u060c \u0648\u0631\u062f\u0648\u062f \u0645\u062e\u062a\u0644\u0641\u0629 \u0645\u0646 \u0627\u0644\u0646\u0648\u0627\u062f\u0644 \u0648\u0645\u0627 \u0625\u0644\u0649 \u0630\u0644\u0643. \u0648\u0628\u0639\u0628\u0627\u0631\u0629 \u0623\u062e\u0631\u0649\u060c \u064a\u0645\u0643\u0646 \u0623\u0646 \u064a\u0643\u0648\u0646 \u0647\u0630\u0627 \u0647\u0648 “\u0627\u0644\u062a\u0648\u0623\u0645 \u0627\u0644\u0631\u0642\u0645\u064a” \u0627\u0644\u062e\u0627\u0635 \u0628\u0643 \u062d\u064a\u062b \u062a\u062c\u0631\u064a \u0627\u062e\u062a\u0628\u0627\u0631\u0627\u062a.<\/li>\n<\/ol>\n
<\/p>\n
<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"
\u0627\u0644\u0623\u0633\u0628\u0648\u0639 \u0627\u0644\u0645\u0627\u0636\u064a\u060c \u0623\u0635\u062f\u0631\u062a OpenAI \u0645\u0644\u0641 PDF\u060c \u0648\u0627\u0644\u062c\u0645\u064a\u0639 \u064a\u062a\u062d\u062f\u062b \u0639\u0646\u0647. \u0647\u0630\u0627 \u0627\u0644\u0645\u0644\u0641 \u0639\u0628\u0627\u0631\u0629 \u0639\u0646 \u062f\u0644\u064a\u0644 \u0645\u0646 34 \u0635\u0641\u062d\u0629 \u064a\u0634\u0631\u062d \u0645\u0627\u0647\u064a\u0629 \u0648\u0643\u0644\u0627\u0621 \u0646\u0645\u0627\u0630\u062c \u0627\u0644\u0644\u063a\u0627\u062a \u0627\u0644\u0643\u0628\u064a\u0631\u0629 (LLM Agents) \u0648\u0643\u064a\u0641\u064a\u0629 \u0627\u0633\u062a\u062e\u062f\u0627\u0645\u0647\u0627. \u0645\u0644\u0641 PDF \u0642\u0635\u064a\u0631 \u0646\u0633\u0628\u064a\u064b\u0627 \u0648\u0633\u0647\u0644 \u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0623\u064a\u0636\u064b\u0627 (\u0644\u0627 \u062a\u062d\u062a\u0627\u062c \u0625\u0644\u0649 \u0623\u0646 \u062a\u0643\u0648\u0646 \u0645\u0647\u0646\u062f\u0633 \u0628\u0631\u0645\u062c\u064a\u0627\u062a\/\u0645\u0648\u062c\u0647 \u0644\u0641\u0647\u0645\u0647)\u060c \u0648\u0644\u0643\u0646\u0647 \u064a\u0634\u0631\u062d \u0641\u064a \u0628\u0636\u0639 \u0643\u0644\u0645\u0627\u062a \u062b\u0644\u0627\u062b\u0629 \u0623\u0634\u064a\u0627\u0621: .1. \u0648\u0643\u0644\u0627\u0621 \u0646\u0645\u0627\u0630\u062c \u0627\u0644\u0644\u063a\u0629 \u0627\u0644\u0643\u0628\u064a\u0631\u0629 (LLM […]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":3,"featured_media":3588,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-3587","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai"],"yoast_head":"\n
\u0645\u062d\u0627\u0643\u0627\u0629 \u0645\u0637\u0639\u0645 \u0645\u062a\u0639\u062f\u062f \u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0646\u0645\u0627\u0630\u062c \u0627\u0644\u0644\u063a\u0627\u062a \u0627\u0644\u0643\u0628\u064a\u0631\u0629 (LLM) \u0639\u0645\u0644\u064a\u064b\u0627\u060c \u0645\u0639 Python \u0648 OpenAI<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n\n\n\n\t\n\t\n\t\n