{"id":350770,"date":"2023-07-25T21:01:29","date_gmt":"2023-07-25T21:01:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=350770"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=350770","title":{"rendered":"<span>\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0439 AnythingGPT, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0442\u0430\u043a, \u043a\u0430\u043a \u0432\u0430\u043c \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e (Python, OpenAI Embeddings, ChatGPT API)<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/df7\/f40\/870\/df7f40870b054c2c667ead02329e21c0.png\" alt=\"AnythingGPT (\u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043a\u0440\u0438\u0432\u043e\u0439 \u0448\u0440\u0438\u0444\u0442)\" title=\"AnythingGPT (\u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043a\u0440\u0438\u0432\u043e\u0439 \u0448\u0440\u0438\u0444\u0442)\" width=\"1570\" height=\"1010\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/df7\/f40\/870\/df7f40870b054c2c667ead02329e21c0.png\"\/><\/p>\n<div><figcaption>AnythingGPT (\u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043a\u0440\u0438\u0432\u043e\u0439 \u0448\u0440\u0438\u0444\u0442)<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u043e\u0434\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u0430\u0432\u043d\u043e \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0433\u043e\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0420\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u0432\u043e\u0435\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 ChatGPT, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0431\u0430\u0437\u0443 \u0437\u043d\u0430\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043f\u0440\u043e\u043c\u0442\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b \u0431\u044b \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u043a ChatGPT). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0435 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u0438 \u043e\u0442 OpenAI (\u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0440\u0435\u043b\u0435\u0432\u0430\u0442\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439) \u0438 \u0441\u0430\u043c \u0421hatGPT API (\u0434\u043b\u044f \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0432 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u044b). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0440\u044f\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432 Q&amp;A \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043d\u043e \u0438 \u043d\u0430 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043c\u043e\u0433 \u0431\u044b \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 Q&amp;A. \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0431\u043e\u0442\u043e\u0432, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0445 \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.<\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u0432\u0438\u0434\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/python.langchain.com\/docs\/get_started\/introduction.html\" rel=\"noopener noreferrer nofollow\">LangChain<\/a>, \u0438 \u044f \u0442\u043e\u0436\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u043a\u0430\u043a \u0438 \u043b\u044e\u0431\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0439\u0441\u044f \u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u043d\u043d\u0435\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u043d \u0441\u043a\u043e\u0440\u0435\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442, \u0447\u0435\u043c \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0436\u0438\u0437\u043d\u044c. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043b, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0445\u043e\u0447\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043b, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a, \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u043f\u0440\u043e\u043c\u0442\u0435, \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438), \u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u0441 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e\u043c, \u0430 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0443\u0436\u0435 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043e\u0432\u0435\u0440\u043a\u0438\u043b\u043b \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u043e\u0431\u0449\u0435\u043c \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u0432\u043e\u0439 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442 \u043a\u043e\u0434 \u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u0435\u043d \u0442\u0430\u043a\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c. <\/p>\n<h3>\u0417\u0430\u0434\u0430\u0447\u0430<\/h3>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0448\u0443 \u0437\u0430\u0434\u0430\u0447\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0440\u0435\u0448\u0430\u043b \u044f, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u043a\u043e\u0434 \u0432 \u0441\u0432\u043e\u0438\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u043e\u043c\u0442\u044b \u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432\u0430\u043c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443 \u0432\u0430\u0441 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043e\u0442\u0430. <\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u044f \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e ChatGPT (<s>\u0438 \u043d\u0435 \u0441\u0442\u044b\u0436\u0443\u0441\u044c \u044d\u0442\u043e\u0433\u043e<\/s>), \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430 2022+ \u0433\u043e\u0434 \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u044b\u043c\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c\u0438. <\/p>\n<p>\u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0430\u0431\u0433\u0440\u0430\u0444\u043e\u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 <a href=\"https:\/\/thegraph.com\/\" rel=\"noopener noreferrer nofollow\">The Graph<\/a> (\u044d\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f ETL \u0434\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432 \u0438\u0437 EVM-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0445 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u0432, \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0432 \u043c\u043e\u0435\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/articles\/741536\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>), \u0441\u0430\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438 \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u043c\u0430\u044e\u0449\u0438\u0445 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0447\u0442\u043e &#171;\u0441\u0442\u0430\u0440\u044b\u0435&#187; \u043e\u0442\u0432\u0435\u0442\u044b \u043e\u0442 ChatGPT \u0443\u0436\u0435 \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0438 \u043d\u0430\u0434\u043e \u0438\u0434\u0442\u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u0441\u043a\u0443\u0434\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0432 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0447\u0442\u043e \u043c\u044f\u0433\u043a\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e (<s>\u044d\u0442\u043e \u0432\u0430\u043c \u043d\u0435 stackoverflow<\/s>). <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e ChatGPT \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f \u0443\u0432\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0442 \u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e \u0441\u0430\u0431\u0433\u0440\u0430\u0444\u0430\u043c, \u0442\u043e \u0432 GraphQL, \u0442\u043e \u0432 SQL, \u0442\u043e \u0432 \u0432\u044b\u0441\u0448\u0443\u044e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443 (The graph, subgraphs \u0438 \u0442\u0434 \u0441\u0443\u043f\u0435\u0440 \u043d\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u044b \u0441 \u043a\u0443\u0447\u0435\u0439 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u043e\u043b\u043a\u043e\u0432\u0430\u043d\u0438\u0439 \u0438 \u0442\u0435\u043c\u0430\u0442\u0438\u043a). <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0434\u043e\u043b\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0432 \u043e\u0442 \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 ChatGPT \u043d\u0430 \u0442\u0435\u043c\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u043a\u043e\u0434\u0435 \u0441\u0430\u0431\u0433\u0440\u0430\u0444\u043e\u0432, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e <a href=\"https:\/\/t.me\/SubgraphGPT_bot\" rel=\"noopener noreferrer nofollow\">SubgraphGPT<\/a> \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0438 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0431\u0430\u0437\u0443 \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.<\/p>\n<p>PS. \u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043f\u0440\u043e\u0434\u0430\u043a\u0442-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u043c \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438-\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0435 Web3-\u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b chainstack.com<sup><sub>[\u0441\u0441\u044b\u043b\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0430 \u043c\u043e\u0434\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c]<\/sub><\/sup> \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u044e \u0437\u0430 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u044d\u0442\u0438\u0445 \u0441\u0430\u043c\u044b\u0445 \u0441\u0430\u0431\u0433\u0440\u0430\u0444\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043d\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043f\u043e\u043c\u043e\u0433\u0430\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0435\u0439.<\/p>\n<h3>\u0412\u0435\u0440\u0445\u043d\u0435\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430:<\/p>\n<p>1) \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0431\u0430\u0437\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u043e\u0442\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u043e\u043b\u0443\u0441\u043b\u0435\u043f\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 (\u0447\u0430\u0441\u0442\u043e \u044f \u0431\u0440\u0430\u043b \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043c\u044b \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0430 \u0432\u0435\u0441\u044c \u0430\u0431\u0437\u0430\u0446 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u0432\u0435\u0442\u0430)<\/p>\n<p>2) \u0412\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0430 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 2 \u0433\u043e\u0434\u0430 (\u043a\u0430\u043a \u0440\u0430\u0437 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0441 \u043a\u043e\u043d\u0446\u0430 2021 \u0433\u043e\u0434\u0430)<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a ChatGPT API, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e Q&amp;A,  <\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433 (\u0432\u0435\u043a\u0442\u043e\u0440, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438), \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c <a href=\"https:\/\/platform.openai.com\/docs\/models\/embeddings\" rel=\"noopener noreferrer nofollow\"><strong>text-embedding-ada-002<\/strong><\/a><strong> <\/strong>, <\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u043e\u0441\u0438\u043d\u0443\u0441\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0442\u043e\u043f-3 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0438\u0437 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439 (\u0432\u043c\u0435\u0441\u0442\u043e 3 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0447\u0438\u0441\u043b\u043e),<\/p>\n<\/li>\n<li>\n<p>\u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u044d\u0442\u0438 3 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u043c\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u044b\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c &#171;\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u044d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 FAQ, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443&#187;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0438\u0437 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0442\u0430\u043a\u0436\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433 (\u0447\u0435\u0440\u0435\u0437 \u0442\u0443 \u0436\u0435 \u043c\u043e\u0434\u0435\u043b\u044c)<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043f-5 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430 \u044d\u0442\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c 20 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043b\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441<\/p>\n<\/li>\n<li>\n<p>\u0430 \u043a \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u043c\u0443 \u043f\u0440\u043e\u043c\u0442\u0443 \u044d\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: &#171;\u0415\u0441\u043b\u0438 \u0442\u044b \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 Q&amp;A, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u0447\u0430\u0442\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0442\u0435\u0431\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 &#8230;&#187;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u0435\u043c\u0443 \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0442\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 Q&amp;A \u0438 \u0447\u0430\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0434\u0432\u0443\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u043e\u0442\u0432\u0435\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/283\/d79\/b33\/283d79b331bf5568f7394b11f6c91c11.png\" width=\"1460\" height=\"516\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/283\/d79\/b33\/283d79b331bf5568f7394b11f6c91c11.png\"\/><\/figure>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u043e\u043d \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441 \u0431\u044b\u043b \u043e\u0442\u0432\u044f\u0437\u0430\u043d \u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0438 \u043f\u0440\u0438\u043d\u044f\u0442 \u0431\u044b\u043b \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0414\u0430\u043b\u0435\u0435 \u0435\u043c\u0443 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u043e\u043d \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u043e:<\/p>\n<p>1) \u0412\u043e\u043e\u0431\u0449\u0435-\u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439 &#8230;<\/p>\n<p>2) \u0410 \u0435\u0441\u043b\u0438 \u0443\u0447\u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 &#8230;<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e, \u043c\u044b \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 topic, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0440\u043e\u043c\u0442\u0430 \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<blockquote>\n<p><em>&#171;\u041c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 \u0442\u0435\u043c\u043e\u0439 &#171;<\/em><strong><em>The Graph subgraph development<\/em><\/strong><em>&#171;: {{{what is a subgraph?}}}&#187;<\/em><\/p>\n<\/blockquote>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u044f \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u044d\u0442\u043e:<\/p>\n<blockquote>\n<p><em>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432\u044b\u0448\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0432 \u0442\u0435\u043c\u0435 &#171;<\/em><strong><em>The Graph subgraph development<\/em><\/strong><em>&#187; \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441.<\/em><\/p>\n<\/blockquote>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0442 (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0447\u0430\u0441\u0442\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u0437 \u0447\u0430\u0442\u043e\u0432) \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<blockquote>\n<p>I need to get an answer to the question related to the topic of &#171;The Graph subgraph development&#187;: {{{what is a subgraph?}}}.<\/p>\n<p>Possibly, you might find an answer in these Q&amp;As [use the information only if it is actually relevant and useful for the question answering]:<\/p>\n<p>Q: &lt;What is a subgraph?> <br \/>A: &lt;A subgraph is a custom API built on blockchain data. Subgraphs are queried using the GraphQL query language and are deployed to a Graph Node using the Graph CLI. Once deployed and published to The Graph&#8217;s decentralized network, Indexers process subgraphs and make them available to be queried by subgraph consumers.><\/p>\n<p>Q: &lt;Am I still able to create a subgraph if my smart contracts don&#8217;t have events?> <br \/>A: &lt;It is highly recommended that you structure your smart contracts to have events associated with data you are interested in querying. Event handlers in the subgraph are triggered by contract events and are by far the fastest way to retrieve useful data. If the contracts you are working with do not contain events, your subgraph can use call and block handlers to trigger indexing. Although this is not recommended, as performance will be significantly slower.><\/p>\n<p>Q: &lt;How do I call a contract function or access a public state variable from my subgraph mappings?> <br \/>A: &lt;Take a look at Access to smart contract state inside the section AssemblyScript API. https:\/\/thegraph.com\/docs\/en\/developing\/assemblyscript-api\/><\/p>\n<p>Finally, only if the information above was not enough you can use your knowledge in the topic of &#171;The Graph subgraph development&#187; to answer the question.<\/p>\n<\/blockquote>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0448\u0435 \u0441 \u0442\u0430\u043a\u0438\u043c \u043f\u043e\u043b\u0443-\u0430\u0432\u0442\u043e-\u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u043c\u0442\u043e\u043c \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0443\u0436\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2c3\/611\/e1f\/2c3611e1fcc42be828732376b8944690.png\" width=\"1356\" height=\"782\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2c3\/611\/e1f\/2c3611e1fcc42be828732376b8944690.png\"\/><\/figure>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u0442 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0449\u0435 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u0442\u0430\u043a \u0441\u043a\u0443\u0434\u043d\u043e, \u043a\u0430\u043a \u0432 Q&amp;A (\u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432-\u043e\u0442\u0432\u0435\u0442\u043e\u0432), \u0430 \u0441 \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u043c\u0438 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f\u043c\u0438, \u043e\u0442\u0447\u0430\u0441\u0442\u0438 \u0441\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u043c\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<h3>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b<\/h3>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0442\u0430\u043a \u0447\u0442\u043e \u0431\u043e\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u0430\u043a \u0435\u0441\u0442\u044c, \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0432 &#171;topic&#187; \u043d\u0430 \u0441\u0432\u043e\u0439, \u0444\u0430\u0439\u043b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0437\u043d\u0430\u043d\u0438\u0439 Q&amp;A &#8212; \u043d\u0430 \u0441\u0432\u043e\u0438, \u0438 \u043f\u043e\u0434\u043b\u043e\u0436\u0438\u0432 \u0441\u0432\u043e\u0438 API \u043a\u043b\u044e\u0447\u0438 \u0434\u043b\u044f OpenAI \u0438 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442\u0430. \u0422\u0430\u043a \u0447\u0442\u043e \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0437\u0434\u0435\u0441\u044c, \u044f \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e \u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u0433\u0438\u0442\u0445\u0430\u0431\u0443, \u0441\u043a\u043e\u0440\u0435\u0435 \u043d\u0430 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u043a\u043e\u0434\u0430.<\/p>\n<h4>1 &#8212; \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u043e\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437 requirements.txt:<\/p>\n<pre><code>virtualenv -p python3.8 .venv source .venv\/bin\/activate pip install -r requirements.txt<\/code><\/pre>\n<h4>2 &#8212; \u0411\u0430\u0437\u0430 \u0437\u043d\u0430\u043d\u0438\u0439, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0430\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e<\/h4>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432-\u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u044d\u043a\u0441\u0435\u043b\u044c-\u0444\u0430\u0439\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ce7\/252\/448\/ce72524482b68de27d0b6edfd6e722f0.png\" width=\"1628\" height=\"936\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ce7\/252\/448\/ce72524482b68de27d0b6edfd6e722f0.png\"\/><\/figure>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043a \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 (\u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0444\u0430\u0439\u043b\u043e\u043c <strong>add_embeddings.py<\/strong>. \u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. <\/p>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"python\">import pandas as pd import openai import argparse   # Create an Argument Parser object parser = argparse.ArgumentParser(description='Adding embeddings for each line of csv file')  # Add the arguments parser.add_argument('--openai_api_key', type=str, help='API KEY of OpenAI API to create contextual embeddings for each line') parser.add_argument('--file', type=str, help='A source CSV file with the text data') parser.add_argument('--colname', type=str, help='Column name with the texts')  # Parse the command-line arguments args = parser.parse_args()  # Access the argument values openai.api_key = args.openai_api_key file = args.file colname = args.colname<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 pandas dataframe \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u044e \u0432\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u0430. \u042d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u043e\u0431\u0449\u0438\u0439 \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439, \u0442\u0430\u043a \u0438 \u0441\u044b\u0440\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438\u0437 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044f, \u0447\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0447\u0430\u0441\u0442\u043e \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0433\u0440\u0443\u0431\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u0435-\u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432. <\/p>\n<pre><code class=\"python\">if file[-4:] == '.csv':     df = pd.read_csv(file) else:     df = pd.read_excel(file)  # filter NAs df = df[~df[colname].isna()] # Keep only questions df = df[df[colname].str.contains('\\?')]<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u0430, \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0430 API \u043c\u043e\u0434\u0435\u043b\u0438 <em>text-embedding-ada-002<\/em>, \u043f\u0430\u0440\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u043a API \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d \u0438 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043a\u043d\u0446\u0438\u0438 \u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0430:<\/p>\n<pre><code class=\"python\">def get_embedding(text, model=\"text-embedding-ada-002\"):     i = 0     max_try = 3     # to avoid random OpenAI API fails:     while i &lt; max_try:         try:             text = text.replace(\"\\n\", \" \")             result = openai.Embedding.create(input=[text], model=model)['data'][0]['embedding']             return result         except:             i += 1   def process_row(x):     return get_embedding(x, model='text-embedding-ada-002')   df['ada_embedding'] = df[colname].apply(process_row) df.to_csv(file[:-4]+'_question_embed.csv', index=False)<\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">python add_embeddings.py \\   --openai_api_key=\"xxx\" \\   --file=\".\/subgraphs_faq.xlsx\" \\   --colname=\"Question\"<\/code><\/pre>\n<p>\u0437\u0430\u0434\u0430\u0432 OpenAI API \u043a\u043b\u044e\u0447, \u0444\u0430\u0439\u043b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u0438\u043c\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u0430. \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b <strong>subgraphs_faq._question_embed.csv<\/strong> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u043c\u0438\u043c\u043e \u043a\u043e\u043b\u043e\u043d\u043e\u043a &#171;<em>Question<\/em>&#187; \u0438 &#171;<em>Answer<\/em>&#187; \u0435\u0449\u0435 \u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0443 &#171;<em>ada_embedding<\/em>&#171;.<\/p>\n<h4>3 &#8212; \u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0430 (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e)<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u043e\u0442, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e, \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u044b. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043a\u0440\u0430\u0442\u043a\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0438\u0437 \u0434\u0438\u0441\u043a\u043e\u0440\u0434-\u043a\u0430\u043d\u0430\u043b\u0430, \u0442\u0430\u043a \u0438 \u0438\u0437 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0433\u0440\u0443\u043f\u043f\u044b. \u0424\u0430\u0439\u043b <strong>discord-channel-data-collection.py <\/strong>\u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. <\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f &#8212; \u0438\u043c\u043f\u043e\u0440\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"python\">import requests import json import pandas as pd import argparse  # Create an Argument Parser object parser = argparse.ArgumentParser(description='Discord Channel Data Collection Script')  # Add the arguments parser.add_argument('--channel_id', type=str, help='Channel ID from the URL of a channel in browser https:\/\/discord.com\/channels\/xxx\/{CHANNEL_ID}') parser.add_argument('--authorization_key', type=str, help='Authorization Key. Being on the discord channel page, start typing anything, then open developer tools -> Network -> Find \"typing\" -> Headers -> Authorization.')  # Parse the command-line arguments args = parser.parse_args()  # Access the argument values channel_id = args.channel_id authorization_key = args.authorization_key<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0445 \u0432 pandas \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0435 \u0432\u044b\u0437\u043e\u0432 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n<pre><code class=\"python\">def retrieve_messages(channel_id, authorization_key):     num = 0     limit = 100      headers = {         'authorization': authorization_key     }      last_message_id = None      # Create a pandas DataFrame     df = pd.DataFrame(columns=['id', 'dt', 'text', 'author_id', 'author_username', 'is_bot', 'is_reply', 'id_reply'])      while True:         query_parameters = f'limit={limit}'         if last_message_id is not None:             query_parameters += f'&amp;before={last_message_id}'          r = requests.get(             f'https:\/\/discord.com\/api\/v9\/channels\/{channel_id}\/messages?{query_parameters}', headers=headers         )         jsonn = json.loads(r.text)         if len(jsonn) == 0:             break          for value in jsonn:             is_reply = False             id_reply = '0'             if 'message_reference' in value and value['message_reference'] is not None:                 if 'message_id' in value['message_reference'].keys():                     is_reply = True                     id_reply = value['message_reference']['message_id']              text = value['content']             if 'embeds' in value.keys():                 if len(value['embeds'])>0:                     for x in value['embeds']:                         if 'description' in x.keys():                             if text != '':                                 text += ' ' + x['description']                             else:                                 text = x['description']             df_t = pd.DataFrame({                 'id': value['id'],                 'dt': value['timestamp'],                 'text': text,                 'author_id': value['author']['id'],                 'author_username': value['author']['username'],                 'is_bot': value['author']['bot'] if 'bot' in value['author'].keys() else False,                 'is_reply': is_reply,                 'id_reply': id_reply,             }, index=[0])             if len(df) == 0:                 df = df_t.copy()             else:                 df = pd.concat([df, df_t], ignore_index=True)              last_message_id = value['id']             num = num + 1          print('number of messages we collected is', num)           # Save DataFrame to a CSV file         df.to_csv(f'..\/discord_messages_{channel_id}.csv', index=False)   if __name__ == '__main__':     retrieve_messages(channel_id, authorization_key)<\/code><\/pre>\n<p>\u0418\u0437 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u044f \u0434\u043d\u0435\u043c \u0441 \u043e\u0433\u043d\u0435\u043c \u043d\u0435 \u043c\u043e\u0433\u0443 \u0441\u044b\u0441\u043a\u0430\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 &#8212; \u044d\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 <strong>channel_id<\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 URL \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a\u043e\u0440\u0434 \u043a\u0430\u043d\u0430\u043b, \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432 \u0441\u0441\u044b\u043b\u043a\u0435), \u0442\u043e <strong>authorization_key<\/strong> \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u0432 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u043c \u043a\u0430\u043d\u0430\u043b\u0435, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u0430\u0439\u0442\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#171;typing&#187; \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 Network \u0438 \u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u0437 header&#8217;a.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ab7\/838\/f45\/ab7838f45755f62102d0058ec1e8932a.png\" width=\"1430\" height=\"918\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ab7\/838\/f45\/ab7838f45755f62102d0058ec1e8932a.png\"\/><\/figure>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u044d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0441\u0431\u043e\u0440 \u0432\u0441\u0435\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 (\u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0432 \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f):<\/p>\n<pre><code class=\"bash\">python discord-channel-data-collection.py \\   --channel_id=123456 \\   --authorization_key=\"123456qwerty\"<\/code><\/pre>\n<h4>4 &#8212; \u0421\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0430<\/h4>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u044f \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u043a\u0430\u0447\u0438\u0432\u0430\u044e \u0440\u0430\u0437\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0447\u0430\u0442\u0438\u043a\u043e\u0432\/\u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u0438\u0437 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0430, \u0442\u043e \u0440\u0435\u0448\u0438\u043b \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a\u043e\u0434 \u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043f\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0443 (\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u0432 \u0441\u043c\u044b\u0441\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 <strong>add_embeddings.py<\/strong> csv \u0444\u0430\u0439\u043b). \u0418\u0442\u0430\u043a \u0441\u043a\u0440\u0438\u043f\u0442 <strong>telegram-group-data-collection.py<\/strong> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0418\u043c\u043f\u043e\u0440\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"python\">import pandas as pd import argparse from telethon import TelegramClient  # Create an Argument Parser object parser = argparse.ArgumentParser(description='Telegram Group Data Collection Script')  # Add the arguments parser.add_argument('--app_id', type=int, help='Telegram APP id from https:\/\/my.telegram.org\/apps') parser.add_argument('--app_hash', type=str, help='Telegram APP hash from https:\/\/my.telegram.org\/apps') parser.add_argument('--phone_number', type=str, help='Telegram user phone number with the leading \"+\"') parser.add_argument('--password', type=str, help='Telegram user password') parser.add_argument('--group_name', type=str, help='Telegram group public name without \"@\"') parser.add_argument('--limit_messages', type=int, help='Number of last messages to download')  # Parse the command-line arguments args = parser.parse_args()  # Access the argument values app_id = args.app_id app_hash = args.app_hash phone_number = args.phone_number password = args.password group_name = args.group_name limit_messages = args.limit_messages<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438\u0437 \u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437 \u0447\u0430\u0442\u0430, \u043d\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u043e\u0442 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043b\u0438\u0446\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u043c\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f app \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/my.telegram.org\/apps\" rel=\"noopener noreferrer nofollow\">https:\/\/my.telegram.org\/apps<\/a> (\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f APP_ID \u0438 APP_HASH), \u0435\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 TelegramClient \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Telethon. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 group_name \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0447\u0430\u0442\u0430 \u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0412 \u0446\u0435\u043b\u043e\u043c, \u044f \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u0434\u0435\u043b\u0430\u043b \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0441 \u043b\u044e\u0431\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438 \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 \u0431\u0430\u043d\u043e\u0432 \u043e\u0442 Telegram API, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0447\u0430\u0441\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430. <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0430\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438 \u0435\u0435 \u0437\u0430\u043f\u0443\u0441\u043a (\u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a, \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0441\u0431\u043e\u0440 \u043d\u0430 \u043f\u043e\u043b\u043f\u0443\u0442\u0438):<\/p>\n<pre><code class=\"python\">async def main():     messages = await client.get_messages(group_name, limit=limit_messages)     df = pd.DataFrame(columns=['date', 'user_id', 'raw_text', 'views', 'forwards', 'text', 'chan', 'id'])      for m in messages:         if m is not None:             if 'from_id' in m.__dict__.keys():                 if m.from_id is not None:                     if 'user_id' in m.from_id.__dict__.keys():                         df = pd.concat([df, pd.DataFrame([{'date': m.date, 'user_id': m.from_id.user_id, 'raw_text': m.raw_text, 'views': m.views,                              'forwards': m.forwards, 'text': m.text, 'chan': group_name, 'id': m.id}])], ignore_index=True)      df = df[~df['user_id'].isna()]     df = df[~df['text'].isna()]     df['date'] = pd.to_datetime(df['date'])     df = df.sort_values('date').reset_index(drop=True)      df.to_csv(f'..\/telegram_messages_{group_name}.csv', index=False)  client = TelegramClient('session', app_id, app_hash) client.start(phone=phone_number, password=password)  with client:     client.loop.run_until_complete(main())<\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 (\u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0432\u043e\u0438):<\/p>\n<pre><code class=\"python\">python telegram-group-data-collection.py \\   --app_id=123456 --app_hash=\"123456qwerty\" \\   --phone_number=\"+xxxxxx\" --password=\"qwerty123\" \\   --group_name=\"xxx\" --limit_messages=10000<\/code><\/pre>\n<h4>5 &#8212; \u0421\u043a\u0440\u0438\u043f\u0442 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/h4>\n<p>\u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u044f \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e \u0441\u0432\u043e\u0438 \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u043e\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0443\u0441\u0438\u043b\u0438\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b \u0442\u0430\u043a\u0436\u0435. \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043a\u043e\u0434 \u0431\u043e\u0442\u0430 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435\u0445 \u043a\u043e\u0440\u043d\u0435\u0440-\u043a\u0435\u0439\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u043e\u0442\u0430 <a href=\"https:\/\/t.me\/SubgraphGPT_bot\" rel=\"noopener noreferrer nofollow\">SubgraphGPT<\/a>, \u0442.\u043a. \u0432 \u043d\u0435\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u043e\u0435\u0433\u043e \u043f\u0435\u0442-\u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u0430\u043f\u0440\u043e\u0442\u0438\u0432 \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u043d\u0443\u0436\u0434\u044b.<\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 telegram-bot.py \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u043a \u0438 \u043f\u0440\u0435\u0436\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u043c\u043f\u043e\u0440\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"python\">import threading import telegram from telegram.ext import Updater, CommandHandler, MessageHandler, Filters  import openai from openai.embeddings_utils import cosine_similarity  import numpy as np import pandas as pd  import argparse import functools  # Create an Argument Parser object parser = argparse.ArgumentParser(description='Run the bot which uses prepared knowledge base enriched with contextual embeddings')  # Add the arguments parser.add_argument('--openai_api_key', type=str, help='API KEY of OpenAI API to create contextual embeddings for each line') parser.add_argument('--telegram_bot_token', type=str, help='A telegram bot token obtained via @BotFather') parser.add_argument('--file', type=str, help='A source CSV file with the questions, answers and embeddings') parser.add_argument('--topic', type=str, help='Write the topic to add a default context for the bot') parser.add_argument('--start_message', type=str, help=\"The text that will be shown to the users after they click \/start button\/command\", default=\"Hello, World!\") parser.add_argument('--model', type=str, help='A model of ChatGPT which will be used', default='gpt-3.5-turbo-16k') parser.add_argument('--num_top_qa', type=str, help=\"The number of top similar questions' answers as a context\", default=3)  # Parse the command-line arguments args = parser.parse_args()  # Access the argument values openai.api_key = args.openai_api_key token = args.telegram_bot_token file = args.file topic = args.topic model = args.model num_top_qa = args.num_top_qa start_message = args.start_message<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f OpenAI API \u043a\u043b\u044e\u0447, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u0438\u0437 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433 \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0432\u044b\u0437\u0432\u0430\u0432 API \u043a\u0430\u043a \u043c\u044b \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u043b\u0438 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0442\u043e\u043a\u0435\u043d \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442\u0430 \u043e\u0442 BotFather<\/p>\n<\/li>\n<li>\n<p>\u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0437\u043d\u0430\u043d\u0438\u0439 (\u044f \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044e \u0437\u0434\u0435\u0441\u044c \u0441\u043b\u0443\u0447\u0430\u0439 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u0438\u0437 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0430, \u0442\u043a \u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0438\u0448\u0435\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u043a\u0430, \u043d\u043e \u0438\u0445 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 \u043a\u043e\u0434\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e)<\/p>\n<\/li>\n<li>\n<p>topic &#8212; \u044d\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430 \u0442\u0435\u043c\u044b (\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u0430\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u043e\u0442.<\/p>\n<\/li>\n<li>\n<p>start_message &#8212; \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u043d\u0430\u0436\u0430\u0432\u0448\u0438\u0439 \/start (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 &#171;Hello, World!&#187;<\/p>\n<\/li>\n<li>\n<p>model &#8212;  \u0432\u044b\u0431\u043e\u0440 \u043c\u043e\u0434\u0435\u043b\u0438 (\u0437\u0430\u0434\u0430\u043d\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e)<\/p>\n<\/li>\n<li>\n<p>num_top_qa &#8212;  \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u0438\u0445 \u043a \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432-\u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438\u0437 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a ChatGPT<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u043e\u0432 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<pre><code class=\"python\"># reading QA file with embeddings df_qa = pd.read_csv(file) df_qa['ada_embedding'] = df_qa.ada_embedding.apply(eval).apply(np.array)<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a ChatGPT API, \u0442\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u044f, \u0447\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0431\u0443\u0434\u0443\u0447\u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0430\u0432\u0442\u043e-\u043f\u043e\u0432\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435:<\/p>\n<pre><code class=\"python\">def retry_on_error(func):     @functools.wraps(func)     def wrapper(*args, **kwargs):         max_retries = 3         for i in range(max_retries):             try:                 return func(*args, **kwargs)             except Exception as e:                 print(f\"Error occurred, retrying ({i+1}\/{max_retries} attempts)...\")         # If all retries failed, raise the last exception         raise e      return wrapper  @retry_on_error def call_chatgpt(*args, **kwargs):     return openai.ChatCompletion.create(*args, **kwargs)<\/code><\/pre>\n<p>\u041f\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 OpenAI \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0441\u0447\u0435\u0442\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0431\u0435\u043b\u044b:<\/p>\n<pre><code class=\"python\">def get_embedding(text, model=\"text-embedding-ada-002\"):     text = text.replace(\"\\n\", \" \")     return openai.Embedding.create(input=[text], model=model)['data'][0]['embedding']<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043a\u043e\u0441\u0438\u043d\u0443\u0441\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u0430\u043c\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0432\u0437\u044f\u0442\u043e\u0435 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 openai:<\/p>\n<pre><code class=\"python\">def search_similar(df, question, n=3, pprint=True):     embedding = get_embedding(question, model='text-embedding-ada-002')     df['similarities'] = df.ada_embedding.apply(lambda x: cosine_similarity(x, embedding))     res = df.sort_values('similarities', ascending=False).head(n)     return res<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u0438\u0445 \u043a \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0430\u0440 \u0432\u043e\u043f\u0440\u043e\u0441-\u043e\u0442\u0432\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0445 \u0432 \u043e\u0434\u0438\u043d \u0442\u0435\u043a\u0441\u0442, \u0440\u0430\u0437\u043c\u0435\u0442\u0438\u0432 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b ChatGPT \u043d\u0435\u0434\u0432\u0443\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0442\u043e:<\/p>\n<pre><code class=\"python\">def collect_text_qa(df):     text = ''     for i, row in df.iterrows():         text += f'Q: &lt;'+row['Question'] + '>\\nA: &lt;'+ row['Answer'] +'>\\n\\n'     print('len qa', len(text.split(' ')))     return text<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e, \u0443\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 &#171;\u043a\u0443\u0441\u043a\u0438&#187; \u043f\u0440\u043e\u043c\u0442\u0430 \u0432\u043e\u0435\u0434\u0438\u043d\u043e:<\/p>\n<pre><code class=\"python\">def collect_full_prompt(question, qa_prompt, chat_prompt=None):     prompt = f'I need to get an answer to the question related to the topic of \"{topic}\": ' + \"{{{\"+ question +\"}}}. \"     prompt += '\\n\\nPossibly, you might find an answer in these Q&amp;As [use the information only if it is actually relevant and useful for the question answering]: \\n\\n' + qa_prompt     # edit if you need to use this also     if chat_prompt is not None:         prompt += \"---------\\nIf you didn't find a clear answer in the Q&amp;As, possibly, these talks from chats might be helpful to answer properly [use the information only if it is actually relevant and useful for the question answering]: \\n\\n\" + chat_prompt     prompt += f'\\nFinally, only if the information above was not enough you can use your knowledge in the topic of \"{topic}\" to answer the question.'      return prompt<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u043b \u0447\u0430\u0441\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0443\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0430, \u043d\u043e \u043b\u043e\u0433\u0438\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 chat_prompt != None. <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u043e\u0447\u0435\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 ChatGPT API \u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0430 (\u043d\u0435 \u0431\u043e\u043b\u0435\u0435 4096 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432):<\/p>\n<pre><code class=\"python\">def telegram_message_format(text):     max_message_length = 4096      if len(text) > max_message_length:         parts = []         while len(text) > max_message_length:             parts.append(text[:max_message_length])             text = text[max_message_length:]         parts.append(text)         return parts     else:         return [text]<\/code><\/pre>\n<p>\u0411\u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0448\u0430\u0433\u043e\u0432, \u0441 \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c \u0434\u0432\u0443\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <strong>\/start<\/strong> \u0438 \u043f\u043e \u043f\u0440\u0438\u0435\u043c\u0443 \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"python\">bot = telegram.Bot(token=token) updater = Updater(token=token, use_context=True) dispatcher = updater.dispatcher  dispatcher.add_handler(CommandHandler(\"start\", start, filters=Filters.chat_type.private)) dispatcher.add_handler(MessageHandler(~Filters.command &amp; Filters.text, message_handler))  updater.start_polling()<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \/start \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d:<\/p>\n<pre><code class=\"python\">def start(update, context):     user = update.effective_user     context.bot.send_message(chat_id=user.id, text=start_message)<\/code><\/pre>\n<p>\u0410 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435, \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043e\u0442 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0441\u0440\u0430\u0437\u0443 &#171;\u0440\u0430\u0437\u0432\u0435\u0434\u0435\u043c&#187; \u0438\u0445 \u043f\u043e \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c \u0447\u0435\u0440\u0435\u0437 <em>threading<\/em>.<\/p>\n<pre><code class=\"python\">def message_handler(update, context):      thread = threading.Thread(target=long_running_task, args=(update, context))     thread.start()<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>long_running_task.<\/em> \u042f \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u043b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0432 try\/except, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u0431\u043e\u0442\u0430 \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u0440\u0430\u0437\u0443 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443. <\/p>\n<ul>\n<li>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043a\u0438, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b \u0438\u043b\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443. <\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u0438\u0441\u043a \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432-\u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 <em>search_similar<\/em><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438-\u043e\u0442\u0432\u0435\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 <em>collect_text_qa<\/em><\/p>\n<\/li>\n<li>\n<p>\u0418 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u043c\u0442\u0430 \u0434\u043b\u044f ChatGPT API \u0447\u0435\u0440\u0435\u0437 <em>collect_full_prompt<\/em><\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">def long_running_task(update, context):     user = update.effective_user     context.bot.send_message(chat_id=user.id, text='?\ufe0f\u23f0?\u23f1\ufe0f\u23f3...')      try:         question = update.message.text.strip()     except Exception as e:         context.bot.send_message(chat_id=user.id,                                  text=f\"?It seems like you're sending not text to the bot. Currently, the bot can only work with text requests.\")         return      try:         qa_found = search_similar(df_qa, question, n=num_top_qa)         qa_prompt = collect_text_qa(qa_found)         full_prompt = collect_full_prompt(question, qa_prompt)     except Exception as e:         context.bot.send_message(chat_id=user.id,                                  text=f\"Search failed. Debug needed.\")         return<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0437\u0430\u043c\u0435\u043d\u0435 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u0442\u043e\u043f\u0438\u043a\u0430 \u043d\u0430 \u0441\u0432\u043e\u0438, \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437-\u0437\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u0432\u044b\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e-\u0447\u0438\u0442\u0430\u0435\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 ChatGPT API \u0441 \u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u0436\u0435 \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b\u043e \u0441\u0435\u0431\u044f &#171;You are a helpful assistant.&#187;, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/p>\n<pre><code class=\"python\">    try:         print(full_prompt)         completion = call_chatgpt(             model=model,             n=1,             messages=[{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}, {\"role\": \"user\", \"content\": full_prompt}]         )         result = completion['choices'][0]['message']['content']     except Exception as e:         context.bot.send_message(chat_id=user.id,                                  text=f'It seems like the OpenAI service is responding with errors. Try sending the request again.')         return      parts = telegram_message_format(result)     for part in parts:         update.message.reply_text(part, reply_to_message_id=update.message.message_id)<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0447\u0430\u0441\u0442\u044c \u0441 \u043a\u043e\u0434\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430.<\/p>\n<h3>\u041f\u0440\u043e\u0442\u043e\u0442\u0438\u043f<\/h3>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u043e\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043f\u043e <a href=\"https:\/\/t.me\/SubgraphGPT_bot\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>. \u0422\u0430\u043a \u043a\u0430\u043a API \u043f\u043b\u0430\u0442\u043d\u043e\u0435, \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e 3 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0443\u0442\u043a\u0438, \u043d\u043e \u043d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u043a\u043e\u0433\u043e-\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u044d\u0442\u043e \u043d\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e \u0443\u0437\u043a\u043e\u0439 \u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0435 \u0431\u043e\u0442, \u0430 \u0441\u0430\u043c \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 AnythingGPT, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/balakhonoff\/AnythingGPT\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a> (\u043d\u0435 \u043e\u0442\u043a\u0430\u0436\u0443\u0441\u044c \u043e\u0442 \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u0435\u043a) \u0441 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e \u0431\u043e\u0442\u0430, \u0440\u0435\u0448\u0430\u044e\u0449\u0435\u0433\u043e \u0432\u0430\u0448\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0441 \u0432\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u043e\u0439 \u0437\u043d\u0430\u043d\u0438\u0439 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430.  <\/p>\n<p>\u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/feb\/2dd\/853\/feb2dd853ea357a46e92866992cdebf8.png\" alt=\"\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0431\u043e\u0442\u043e\u043c\" title=\"\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0431\u043e\u0442\u043e\u043c\" width=\"1492\" height=\"1234\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/feb\/2dd\/853\/feb2dd853ea357a46e92866992cdebf8.png\"\/><\/p>\n<div><figcaption>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0431\u043e\u0442\u043e\u043c<\/figcaption><\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/749740\/\"> https:\/\/habr.com\/ru\/articles\/749740\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\">\n<div><figcaption>AnythingGPT (\u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u043a\u0440\u0438\u0432\u043e\u0439 \u0448\u0440\u0438\u0444\u0442)<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u043e\u0434\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u0430\u0432\u043d\u043e \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0433\u043e\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0420\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u0432\u043e\u0435\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 ChatGPT, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0431\u0430\u0437\u0443 \u0437\u043d\u0430\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043f\u0440\u043e\u043c\u0442\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b \u0431\u044b \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u043a ChatGPT). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0435 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433\u0438 \u043e\u0442 OpenAI (\u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0440\u0435\u043b\u0435\u0432\u0430\u0442\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439) \u0438 \u0441\u0430\u043c \u0421hatGPT API (\u0434\u043b\u044f \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0432 \u043d\u0430\u0442\u0443\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u044b). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0440\u044f\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432 Q&amp;A \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043d\u043e \u0438 \u043d\u0430 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043c\u043e\u0433 \u0431\u044b \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 Q&amp;A. \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0431\u043e\u0442\u043e\u0432, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0445 \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.<\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u0432\u0438\u0434\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/python.langchain.com\/docs\/get_started\/introduction.html\" rel=\"noopener noreferrer nofollow\">LangChain<\/a>, \u0438 \u044f \u0442\u043e\u0436\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u043a\u0430\u043a \u0438 \u043b\u044e\u0431\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0439\u0441\u044f \u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u043d\u043d\u0435\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u043d \u0441\u043a\u043e\u0440\u0435\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442, \u0447\u0435\u043c \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0436\u0438\u0437\u043d\u044c. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043b, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0445\u043e\u0447\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043b, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438 (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a, \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u043f\u0440\u043e\u043c\u0442\u0435, \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438), \u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u0441 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u043c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e\u043c, \u0430 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0443\u0436\u0435 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043e\u0432\u0435\u0440\u043a\u0438\u043b\u043b \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u043e\u0431\u0449\u0435\u043c \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u0432\u043e\u0439 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442 \u043a\u043e\u0434 \u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u0435\u043d \u0442\u0430\u043a\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c. <\/p>\n<h3>\u0417\u0430\u0434\u0430\u0447\u0430<\/h3>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0448\u0443 \u0437\u0430\u0434\u0430\u0447\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0440\u0435\u0448\u0430\u043b \u044f, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u043a\u043e\u0434 \u0432 \u0441\u0432\u043e\u0438\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u043e\u043c\u0442\u044b \u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432\u0430\u043c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443 \u0432\u0430\u0441 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043e\u0442\u0430. <\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u044f \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e ChatGPT (<s>\u0438 \u043d\u0435 \u0441\u0442\u044b\u0436\u0443\u0441\u044c \u044d\u0442\u043e\u0433\u043e<\/s>), \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430 2022+ \u0433\u043e\u0434 \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u044b\u043c\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c\u0438. <\/p>\n<p>\u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0430\u0431\u0433\u0440\u0430\u0444\u043e\u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 <a href=\"https:\/\/thegraph.com\/\" rel=\"noopener noreferrer nofollow\">The Graph<\/a> (\u044d\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f ETL \u0434\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432 \u0438\u0437 EVM-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0445 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u0432, \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0432 \u043c\u043e\u0435\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/articles\/741536\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>), \u0441\u0430\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u0440\u0435\u0442\u0435\u0440\u043f\u0435\u043b\u0438 \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u043c\u0430\u044e\u0449\u0438\u0445 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0447\u0442\u043e &#171;\u0441\u0442\u0430\u0440\u044b\u0435&#187; \u043e\u0442\u0432\u0435\u0442\u044b \u043e\u0442 ChatGPT \u0443\u0436\u0435 \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0438 \u043d\u0430\u0434\u043e \u0438\u0434\u0442\u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u0441\u043a\u0443\u0434\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0430 \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0432 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u0447\u0442\u043e \u043c\u044f\u0433\u043a\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e (<s>\u044d\u0442\u043e \u0432\u0430\u043c \u043d\u0435 stackoverflow<\/s>). <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e ChatGPT \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f \u0443\u0432\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0442 \u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e \u0441\u0430\u0431\u0433\u0440\u0430\u0444\u0430\u043c, \u0442\u043e \u0432 GraphQL, \u0442\u043e \u0432 SQL, \u0442\u043e \u0432 \u0432\u044b\u0441\u0448\u0443\u044e \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443 (The graph, subgraphs \u0438 \u0442\u0434 \u0441\u0443\u043f\u0435\u0440 \u043d\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u044b \u0441 \u043a\u0443\u0447\u0435\u0439 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u043e\u043b\u043a\u043e\u0432\u0430\u043d\u0438\u0439 \u0438 \u0442\u0435\u043c\u0430\u0442\u0438\u043a). <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0434\u043e\u043b\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0432 \u043e\u0442 \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 ChatGPT \u043d\u0430 \u0442\u0435\u043c\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u043a\u043e\u0434\u0435 \u0441\u0430\u0431\u0433\u0440\u0430\u0444\u043e\u0432, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e <a href=\"https:\/\/t.me\/SubgraphGPT_bot\" rel=\"noopener noreferrer nofollow\">SubgraphGPT<\/a> \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0438 \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0431\u0430\u0437\u0443 \u0437\u043d\u0430\u043d\u0438\u0439 \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.<\/p>\n<p>PS. \u042f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u043f\u0440\u043e\u0434\u0430\u043a\u0442-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u043c \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438-\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0435 Web3-\u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b chainstack.com<sup><sub>[\u0441\u0441\u044b\u043b\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0430 \u043c\u043e\u0434\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c]<\/sub><\/sup> \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u044e \u0437\u0430 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u044d\u0442\u0438\u0445 \u0441\u0430\u043c\u044b\u0445 \u0441\u0430\u0431\u0433\u0440\u0430\u0444\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043d\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043f\u043e\u043c\u043e\u0433\u0430\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0435\u0439.<\/p>\n<h3>\u0412\u0435\u0440\u0445\u043d\u0435\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430:<\/p>\n<p>1) \u0412\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0431\u0430\u0437\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u043e\u0442\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u043e\u043b\u0443\u0441\u043b\u0435\u043f\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 (\u0447\u0430\u0441\u0442\u043e \u044f \u0431\u0440\u0430\u043b \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043c\u044b \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0430 \u0432\u0435\u0441\u044c \u0430\u0431\u0437\u0430\u0446 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u0432\u0435\u0442\u0430)<\/p>\n<p>2) \u0412\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0430 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 2 \u0433\u043e\u0434\u0430 (\u043a\u0430\u043a \u0440\u0430\u0437 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0441 \u043a\u043e\u043d\u0446\u0430 2021 \u0433\u043e\u0434\u0430)<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a ChatGPT API, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e Q&amp;A,  <\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433 (\u0432\u0435\u043a\u0442\u043e\u0440, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438), \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c <a href=\"https:\/\/platform.openai.com\/docs\/models\/embeddings\" rel=\"noopener noreferrer nofollow\"><strong>text-embedding-ada-002<\/strong><\/a><strong> <\/strong>, <\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435 \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u043a\u043e\u0441\u0438\u043d\u0443\u0441\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0442\u043e\u043f-3 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0438\u0437 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439 (\u0432\u043c\u0435\u0441\u0442\u043e 3 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430 \u0447\u0438\u0441\u043b\u043e),<\/p>\n<\/li>\n<li>\n<p>\u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u044d\u0442\u0438 3 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u043c\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u044b\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c &#171;\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 \u044d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 FAQ, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443&#187;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0438\u0437 \u0434\u0438\u0441\u043a\u043e\u0440\u0434\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:<\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u0442\u0430\u043a\u0436\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433 (\u0447\u0435\u0440\u0435\u0437 \u0442\u0443 \u0436\u0435 \u043c\u043e\u0434\u0435\u043b\u044c)<\/p>\n<\/li>\n<li>\n<p>\u0434\u0430\u043b\u0435\u0435, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043f-5 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430 \u044d\u0442\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c 20 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043b\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441<\/p>\n<\/li>\n<li>\n<p>\u0430 \u043a \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u043c\u0443 \u043f\u0440\u043e\u043c\u0442\u0443 \u044d\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: &#171;\u0415\u0441\u043b\u0438 \u0442\u044b \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 Q&amp;A, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u0447\u0430\u0442\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0442\u0435\u0431\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 &#8230;&#187;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u0435\u043c\u0443 \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0442\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 Q&amp;A \u0438 \u0447\u0430\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0434\u0432\u0443\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u043e\u0442\u0432\u0435\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u043e\u043d \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441 \u0431\u044b\u043b \u043e\u0442\u0432\u044f\u0437\u0430\u043d \u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0438 \u043f\u0440\u0438\u043d\u044f\u0442 \u0431\u044b\u043b \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0414\u0430\u043b\u0435\u0435 \u0435\u043c\u0443 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u043e\u043d \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u043e:<\/p>\n<p>1) \u0412\u043e\u043e\u0431\u0449\u0435-\u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439 &#8230;<\/p>\n<p>2) \u0410 \u0435\u0441\u043b\u0438 \u0443\u0447\u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 &#8230;<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e, \u043c\u044b \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u0435 topic, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0440\u043e\u043c\u0442\u0430 \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<blockquote>\n<p><em>&#171;\u041c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 \u0442\u0435\u043c\u043e\u0439 &#171;<\/em><strong><em>The Graph subgraph development<\/em><\/strong><em>&#171;: {{{what is a subgraph?}}}&#187;<\/em><\/p>\n<\/blockquote>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u044f \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u044d\u0442\u043e:<\/p>\n<blockquote>\n<p><em>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432\u044b\u0448\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0432 \u0442\u0435\u043c\u0435 &#171;<\/em><strong><em>The Graph subgraph development<\/em><\/strong><em>&#187; \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441.<\/em><\/p>\n<\/blockquote>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0442 (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0447\u0430\u0441\u0442\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u0437 \u0447\u0430\u0442\u043e\u0432) \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<blockquote>\n<p>I need to get an answer to the question related to the topic of &#171;The Graph subgraph development&#187;: {{{what is a subgraph?}}}.<\/p>\n<p>Possibly, you might find an answer in these Q&amp;As [use the information only if it is actually relevant and useful for the question answering]:<\/p>\n<p>Q: &lt;What is a subgraph?> <br \/>A: &lt;A subgraph is a custom API built on blockchain data. Subgraphs are queried using the GraphQL query language and are deployed to a Graph Node using the Graph CLI. Once deployed and published to The Graph&#8217;s decentralized network, Indexers process subgraphs and make them available to be queried by subgraph consumers.><\/p>\n<p>Q: &lt;Am I still able to create a subgraph if my smart contracts don&#8217;t have events?> <br \/>A: &lt;It is highly recommended that you structure your smart contracts to have events associated with data you are interested in querying. Event handlers in the subgraph are triggered by contract events and are by far the fastest way to retrieve useful data. If the contracts you are working with do not contain events, your subgraph can use call and block handlers to trigger indexing. Although this is not recommended, as performance will be significantly slower.><\/p>\n<p>Q: &lt;How do I call a contract function or access a public state variable from my subgraph mappings?> <br \/>A: &lt;Take a look at Access to smart contract state inside the section AssemblyScript API. https:\/\/thegraph.com\/docs\/en\/developing\/assemblyscript-api\/><\/p>\n<p>Finally, only if the information above was not enough you can use your knowledge in the topic of &#171;The Graph subgraph development&#187; to answer the question.<\/p>\n<\/blockquote>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0448\u0435 \u0441 \u0442\u0430\u043a\u0438\u043c \u043f\u043e\u043b\u0443-\u0430\u0432\u0442\u043e-\u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u043c\u0442\u043e\u043c \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0443\u0436\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u0442 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0449\u0435 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u0442\u0430\u043a \u0441\u043a\u0443\u0434\u043d\u043e, \u043a\u0430\u043a \u0432 Q&amp;A (\u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432-\u043e\u0442\u0432\u0435\u0442\u043e\u0432), \u0430 \u0441 \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u043c\u0438 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f\u043c\u0438, \u043e\u0442\u0447\u0430\u0441\u0442\u0438 \u0441\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u043c\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<h3>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b<\/h3>\n<p>\u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0442\u0430\u043a \u0447\u0442\u043e \u0431\u043e\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u0430\u043a \u0435\u0441\u0442\u044c, \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0432 &#171;topic&#187; \u043d\u0430 \u0441\u0432\u043e\u0439, \u0444\u0430\u0439\u043b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0437\u043d\u0430\u043d\u0438\u0439 Q&amp;A &#8212; \u043d\u0430 \u0441\u0432\u043e\u0438, \u0438 \u043f\u043e\u0434\u043b\u043e\u0436\u0438\u0432 \u0441\u0432\u043e\u0438 API \u043a\u043b\u044e\u0447\u0438 \u0434\u043b\u044f OpenAI \u0438 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442\u0430. \u0422\u0430\u043a \u0447\u0442\u043e \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0437\u0434\u0435\u0441\u044c, \u044f \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e \u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u0433\u0438\u0442\u0445\u0430\u0431\u0443, \u0441\u043a\u043e\u0440\u0435\u0435 \u043d\u0430 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u043a\u043e\u0434\u0430.<\/p>\n<h4>1 &#8212; \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u043e\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437 requirements.txt:<\/p>\n<pre><code>virtualenv -p python3.8 .venv source .venv\/bin\/activate pip install -r requirements.txt<\/code><\/pre>\n<h4>2 &#8212; \u0411\u0430\u0437\u0430 \u0437\u043d\u0430\u043d\u0438\u0439, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0430\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e<\/h4>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432-\u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u044d\u043a\u0441\u0435\u043b\u044c-\u0444\u0430\u0439\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u0438\u0437\u043a\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043a \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u044d\u043c\u0431\u0435\u0434\u0434\u0438\u043d\u0433 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 (\u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0444\u0430\u0439\u043b\u043e\u043c <strong>add_embeddings.py<\/strong>. \u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. <\/p>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"python\">import pandas as pd import openai import argparse   # Create an Argument Parser object parser = argparse.ArgumentParser(description='Adding embeddings for each line of csv file')  # Add the arguments parser.add_argument('--openai_api_key', type=str, help='API KEY of OpenAI API to create contextual embeddings for each line') parser.add_argument('--file', type=str, help='A source CSV file with the text data') parser.add_argument('--colname', type=str, help='Column name with the texts')  # Parse the command-line arguments args = parser.parse_args()  # Access the argument values openai.api_key = args.openai_api_key file = args.file colname = args.colname<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 pandas<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-350770","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=350770"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350770\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}