{"id":365718,"date":"2024-05-21T02:43:57","date_gmt":"2024-05-21T02:43:57","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=365718"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=365718","title":{"rendered":"<span>\u0421\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u0438\u0441\u043a \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430 R. \u0427\u0430\u0441\u0442\u044c 2<\/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<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/articles\/786090\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0430\u0433\u0435\u043d\u0442\u043e\u0432.<\/p>\n<h2>\u0414\u0430\u043d\u043d\u044b\u0435 \u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0442 OpenAI. \u0414\u043b\u044f opensource \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h3>\n<pre><code class=\"r\">library(reticulate) library(data.table) library(magrittr) library(stringr)  py_install(c('torch',               'torchvision',               \"torchaudio\",               'langchain',               'docx2txt',               'faiss-cpu',               'openai==0.28.1',               'tiktoken',              \"google-api-python-client>=2.100.0\"), pip = TRUE)   langchain &lt;- import('langchain')<\/code><\/pre>\n<h3>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/h3>\n<p>\u0422\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0433\u0443\u0433\u043b\u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c.<\/p>\n<pre><code class=\"r\">OPENAI_API_KEY &lt;- '&lt;YOUR OPENAI TOKEN>' GOOGLE_API_KEY &lt;- \"&lt;YOUR GOOGLE TOKEN>\" CUSTOM_SEARCH_ENGINE_ID &lt;- \"&lt;YOUR GOOGLE SEARCH ID>\" MODEL_NAME_GPT &lt;- \"gpt-4\" TEMPERATURE &lt;- 0.5 MAX_TOKENS &lt;- 100L<\/code><\/pre>\n<h2>\u041f\u0430\u043c\u044f\u0442\u044c<\/h2>\n<p>\u0422\u0438\u043f\u044b \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>ConversationBufferMemory &#8212; \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0438\u043f \u043f\u0430\u043c\u044f\u0442\u0438. \u0412 history \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c.<\/p>\n<\/li>\n<li>\n<p>ConversationSummaryMemory &#8212; \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043f\u0435\u0440\u0435\u0434 \u043f\u043e\u0434\u0430\u0447\u0435\u0439 \u0432 history. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0430\u0436\u0434\u044b (\u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0434\u043b\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438).<\/p>\n<\/li>\n<li>\n<p>ConversationSummaryBufferMemory &#8212; \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043e\u043a\u043d\u0430 \u0432 \u0442\u043e\u043a\u0435\u043d\u0430\u0445, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u0430 \u0442\u043e \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>ConversationBufferWindowMemory &#8212; \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 k \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>ConversationKGMemory &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0433\u0440\u0430\u0444 \u0437\u043d\u0430\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>ConversationEntityMemory &#8212; \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0432 history \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435.<\/p>\n<\/li>\n<\/ul>\n<h4>ConversationBufferMemory<\/h4>\n<pre><code class=\"r\">llm &lt;- langchain$llms$OpenAI(temperature = TEMPERATURE,                               openai_api_key = OPENAI_API_KEY,                               max_tokens = MAX_TOKENS)    memory_buffer &lt;- langchain$chains$conversation$memory$ConversationBufferMemory() chain_buffer &lt;- langchain$chains$ConversationChain(llm = llm, memory = memory_buffer)  chain_buffer(\"\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\")  ### $input ### [1] \"\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\" ###  ### $history ### [1] \"\" ###  ### $response ### [1] \" \u0414\u0430, \u044f \u0437\u043d\u0430\u044e \u043e \u043a\u043e\u043d\u0435. \u042d\u0442\u043e \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0433\u043e \u0438 \u0434\u043b\u044f \u0441\"  chain_buffer(\"\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e\") ### $input ### [1] \"\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e\" ###  ### $history ### [1] \"Human: \u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\\nAI:  \u0414\u0430, \u044f \u0437\u043d\u0430\u044e \u043e \u043a\u043e\u043d\u0435. \u042d\u0442\u043e \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0433\u043e \u0438 \u0434\u043b\u044f \u0441\" ###  ### $response ### [1] \" \u041a\u043e\u043d\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u0438\u043c\u0438 \u0438 \u043c\u043e\u0449\u043d\u044b\u043c\u0438 \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u043c\u0438 \u0441 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0448\u0435\u0435\u0439, \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043d\u043e\u0433\u0430\u043c\u0438 \u0438 \u043f\u043b\u043e\u0442\u043d\u044b\u043c \u0442\"   # \u0414\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 # chain_buffer &lt;- langchain$chains$ConversationalRetrievalChain$from_llm(llm = llm, #                                                                        memory = memory_buffer,  #                                                                        retriever = db_gpt$as_retriever()) # chat_history &lt;- list() # query &lt;- \"&lt;\u0417\u0430\u043f\u0440\u043e\u0441 1>\" # res1 &lt;- chain_buffer$run(list(question = query, chat_history = chat_history)) # res1 # chat_history &lt;- c(chat_history, tuple(query, res1)) #  # query &lt;- \"&lt;\u0417\u0430\u043f\u0440\u043e\u0441 2>\" # res2 &lt;- chain_buffer$run(list(question = query, chat_history = chat_history)) # res2 # chat_history &lt;- c(chat_history, tuple(query, res2))<\/code><\/pre>\n<h4>ConversationSummaryMemory<\/h4>\n<p>\u0421\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<pre><code class=\"r\">memory_summary &lt;- langchain$chains$conversation$memory$ConversationSummaryMemory(llm = llm) chain_summary &lt;- langchain$chains$ConversationChain(llm = llm, memory = memory_summary)  chain_summary(\"\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\")  ### $input ### [1] \"\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\" ###  ### $history ### [1] \"\" ###  ### $response ### [1] \" \u0414\u0430, \u044f \u0437\u043d\u0430\u044e \u043e \u043a\u043e\u043d\u0435. \u041a\u043e\u043d\u044c - \u044d\u0442\u043e \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435 \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043b\u043e\u0448\u0430\u0434\u0435\u0439. \u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f\"  chain_summary(\"\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e\") ### $input ### [1] \"\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e\" ###  ### $history ### [1] \"\\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential. The human then asks who a horse is and the AI responds that it is a domesticated animal from the horse family and is used for transportation and recreation.\" ###  ### $response ### [1] \" A horse is a four-legged mammal with a long snout, long mane, and a short tail. It has hooves and is typically a brown or black color. It is usually around 1.5 to 1.8 meters tall and can weigh up to 900 kilograms. Horses are intelligent creatures and have been domesticated for thousands of years. They are used for transportation, recreation, and even as a source of food.\"<\/code><\/pre>\n<p>\u041f\u0430\u043c\u044f\u0442\u044c<\/p>\n<pre><code class=\"r\">chain_summary$memory$chat_memory ### ChatMessageHistory(messages=[HumanMessage(content='\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?'), AIMessage(content=' \u0414\u0430, \u044f \u0437\u043d\u0430\u044e \u043e \u043a\u043e\u043d\u0435. \u041a\u043e\u043d\u044c - \u044d\u0442\u043e \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435 \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043b\u043e\u0448\u0430\u0434\u0435\u0439. \u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f'), HumanMessage(content='\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e'), AIMessage(content=' A horse is a four-legged mammal with a long snout, long mane, and a short tail. It has hooves and is typically a brown or black color. It is usually around 1.5 to 1.8 meters tall and can weigh up to 900 kilograms. Horses are intelligent creatures and have been domesticated for thousands of years. They are used for transportation, recreation, and even as a source of food.')])<\/code><\/pre>\n<h2>\u0410\u0433\u0435\u043d\u0442<\/h2>\n<p>\u0410\u0433\u0435\u043d\u0442 &#8212; \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0443\u044e\u0449\u0435\u0435 \u0437\u0430\u0432\u0435\u043d\u043e \u043c\u0435\u0436\u0434\u0443 \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e (LLM) \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c (Tool). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u044f\u0437\u044b\u043a\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u043b\u0430 \u0438\u0437 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0433\u0443\u0433\u043b\u0430 (\u043e\u0431\u043b\u0430\u0434\u0430\u043b\u0430 \u043d\u043e\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438).<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c API \u043a\u043b\u044e\u0447 \u0433\u0443\u0433\u043b\u0430 (<a href=\"https:\/\/console.cloud.google.com\/getting-started?project=proud-storm-410009&amp;supportedpurview=project\" rel=\"noopener noreferrer nofollow\">\u0433\u0443\u0433\u043b \u043e\u0431\u043b\u0430\u043a\u043e<\/a> -> APIs &amp; services -> Credentials -> Create credentials -> API key). \u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/console.cloud.google.com\/apis\/library\/customsearch.googleapis.com?project=trim-approach-384913\" rel=\"noopener noreferrer nofollow\">Custom search API<\/a> -> Enable. <a href=\"https:\/\/programmablesearchengine.google.com\/controlpanel\/create\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c<\/a>, \u0434\u0430\u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0432 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0443, \u0437\u0430\u0442\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<pre><code class=\"r\"># \u041e\u0431\u0451\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 search_engine &lt;- langchain$utilities$GoogleSearchAPIWrapper(google_api_key = GOOGLE_API_KEY, google_cse_id = CUSTOM_SEARCH_ENGINE_ID)  # \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u0418\u043c\u044f \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a Intermediate Answer, \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f. tool &lt;- langchain$tools$Tool(name = \"Intermediate Answer\", func = search_engine$run, description = \"Google answers\")  # \u0413\u0443\u0433\u043b \u0430\u0433\u0435\u043d\u0442 agent_google &lt;- langchain$agents$initialize_agent(tools = c(tool),                                                    llm = llm,                                                    agent = \"self-ask-with-search\", # \u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b: zero-shot-react-description, react-docstore, conversational-react-description                                                   verbose = TRUE,                                                    max_iterations = 5)   # \u0417\u0430\u043f\u0443\u0441\u043a \u0430\u0433\u0435\u043d\u0442\u0430 agent_google$run(\"\u041a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0413\u0435\u043c\u0443\u0434\u0430?\")   ### [1m> Entering new AgentExecutor chain...[0m ### [32;1m[1;3m Yes. ### Follow up: \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0413\u0435\u043c\u0443\u0434\u0430?[0m ### Intermediate answer: [36;1m[1;3m\u0413\u0435\u043c\u0443\u0434\u0430, \u043a\u0430\u043a \u0432\u0435\u043b\u0435\u043b \u041a\u0430\u0440\u0430\u0448\u0430\u0443\u0430\u0439, \u043d\u0430\u0447\u0430\u043b \u0441\u043a\u0430\u043a\u0430\u0442\u044c \u0438 \u043f\u0440\u044b\u0433\u0430\u0442\u044c \u043f\u043e \u043c\u043e\u0440\u044e \u0438 \u043f\u043e \u0435\u0433\u043e \u0434\u043d\u0443 \u0442\u0443\u0434\u0430-\u0441\u044e\u0434\u0430. \u041a\u043e\u0433\u0434\u0430 \u043c\u043e\u0440\u0435 \u043f\u043e\u0447\u0435\u0440\u043d\u0435\u043b\u043e, \u043f\u043e\u043c\u0443\u0442\u043d\u0435\u043b\u043e \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u043f\u043e\u0434 \u0432\u043e\u0434\u043e\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u0442\u0430\u043b\u043e ... ... \u0413\u0435\u043c\u0443\u0434\u0430-\u0421\u0435\u043a\u0438\u0440\u0433\u0435\u043d-\u0442\u0430\u0448 \u00ab\u041a\u0430\u043c\u0435\u043d\u044c-\u0427\u0435\u0440\u0435\u0437-\u041a\u043e\u0442\u043e\u0440\u044b\u0439-\u041f\u0435\u0440\u0435\u043f\u0440\u044b\u0433\u043d\u0443\u043b-\u0413\u0435\u043c\u0443\u0434\u0430\u00bb \u0438 \u0442.\u0434.), \u0447\u0442\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0442\u0435\u0441\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0431\u043e\u0433\u0430\u0442\u044b\u0440\u0441\u043a\u043e\u0433\u043e \u044d\u043f\u043e\u0441\u0430 \u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u0443\u043b\u044c\u0442\u0443\u0440\u044b ... \u0414\u043e\u0441\u043a\u0430\u043a\u0430\u043b\u0438 \u0434\u043e \u0433\u0440\u043e\u043c\u0430\u0434\u043d\u043e\u0439 \u0433\u043e\u0440\u044b,. [\u0413\u0435\u043c\u0443\u0434\u0430] \u0433\u0440\u0443\u0434\u044c\u044e [\u0435\u0435] \u0443\u0434\u0430\u0440\u0438\u043b,. \u0413\u0440\u043e\u043c\u0430\u0434\u043d\u0443\u044e \u0433\u043e\u0440\u0443 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u043a\u043e\u043b\u043e\u043b. \u0413\u043e\u043b\u0443\u0431\u044b\u0435 \u043e\u0437\u0435\u0440\u0430 \u2014 \u0441\u043b\u0435\u0434\u044b \u0435\u0433\u043e \u043a\u043e\u043f\u044b\u0442,. \u0420\u0430\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043b\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043b\u043e\u0448\u0430\u0434\u0435\u0439 \u041a\u0430\u0440\u0430\u0447\u0430\u0435\u0432\u0441\u043a\u043e\u0439 \u043f\u043e\u0440\u043e\u0434\u044b\/\u041a\u044a \u041a\u0430\u0440\u0430\u0447\u0430\u0435\u0432\u043e-\u0427\u0435\u0440\u043a\u0435\u0441\u0441\u043a\u0430\u044f \u0420\u0435\u0441\u043f\u0443\u0431\u043b\u0438\u043a\u0430 \u00b7 \u274c\u041f\u0420\u041e\u0414\u0410\u041d\u274c \u0416\u0435\u0440\u0435\u0431\u0435\u0446-\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0432 \u041f\u0420\u041e\u0414\u0410\u0416\u0415 \u0413\u0435\u043c\u0443\u0434\u0430 2017\u0433 ... May 18, 2010 ... \u0412 \u043c\u0438\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0413\u0435\u043c\u0443\u0434\u0430 \u0436\u0438\u0432\u0435\u0442 \u0432 \u043f\u043e\u0434\u0437\u0435\u043c\u043d\u043e\u0439 \u043a\u043e\u043d\u044e\u0448\u043d\u0435, \u043f\u0438\u0442\u0430\u044f\u0441\u044c \u0440\u0443\u0434\u043e\u0439 \u0438\u043b\u0438 \u0436\u0435\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u043e\u043f\u0438\u043b\u043a\u0430\u043c\u0438. \u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 - \u0413\u0435\u043c\u0443\u0434\u0430 \u0432\u043b\u0430\u0434\u0435\u0435\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0447\u044c\u044e \u0438 ... \u0413\u0435\u043c\u0443\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e \u043e\u0431\u043b\u0438\u043a \u0437\u0430\u0445\u0443\u0434\u0430\u043b\u043e\u0439 \u043a\u043b\u044f\u0447\u0438, \u0442\u043e \u0432\u0438\u0434 \u0431\u043e\u0433\u0430\u0442\u044b\u0440\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u044f. \u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0435\u0442 \u0432 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 - \u0441 \u043a\u0440\u044b\u043b\u044c\u044f\u043c\u0438 \u043e\u0440\u043b\u0430 \u0438 \u0441 \u0440\u044b\u0431\u044c\u0438\u043c \u0445\u0432\u043e\u0441\u0442\u043e\u043c, \u0442. \u0435. Mar 13, 2023 ... \u041d\u0430\u0440\u0442 \u0430\u0442 \u2013 \u043a\u043e\u043d\u044c \u043d\u0430\u0440\u0442\u0430,(\u0413\u0435\u043c\u0443\u0434\u0430); \u042e\u0447 \u0430\u044f\u043a\u044a \u0430\u0442 \u2013 \u043a\u0440\u044b\u043b\u0430\u0442\u044b\u0439 \u043a\u043e\u043d\u044c (\u0442\u0440\u0451\u0445\u043d\u043e\u0433\u0438\u0439 \u0432 \u043d\u0430\u0440\u0442\u0441\u043a\u043e\u043c \u044d\u043f\u043e\u0441\u0435, \u0430\u043d\u0430\u043b\u043e\u0433 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0430\u043c\u043e\u043b\u0435\u0442\u0430 \u2013 \u0442\u0440\u0438 \u0448\u0430\u0441\u0441\u0438). \u0416\u044b\u043b\u043a\u044a\u044b ... Sep 25, 2016 ... \u0422\u0430\u043a \u0436\u0435 \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u041d\u0430\u0440\u0442\u044b \u0431\u044b\u043b\u0438 \u0432\u0435\u0440\u043d\u044b \u0441\u0432\u043e\u0438\u043c \u0441\u043a\u0430\u043a\u0443\u043d\u0430\u043c, \u0438 \u0441\u043a\u0430\u043a\u0443\u043d\u044b \u041d\u0430\u0440\u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0438\u0437 \u043a\u043b\u044f\u0442\u0432\u044b \u041a\u0430\u0440\u0430\u0448\u0443\u0430\u0439\u0430 \u0438 \u0413\u0435\u043c\u0443\u0434\u044b \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0435: (\u0413\u0435\u043c\u0443\u0434\u0430): Dec 10, 2015 ... \u0410 \u0432 \u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u00ab\u041a\u0430\u0440\u0430\u0448\u0430\u0443\u0430\u0439 \u0438 \u0413\u0435\u043c\u0443\u0434\u0430\u00bb \u0434\u0430\u0436\u0435 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0443 \u0413\u0435\u043c\u0443\u0434\u044b \u043e\u043a\u043e\u043b\u043e \u0443\u0448\u0435\u0439 \u0431\u044b\u043b\u0438 \u0436\u0430\u0431\u0440\u044b \u0438 \u043e\u043d, \u043e\u0447\u0443\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u043f\u043e\u0434 \u0432\u043e\u0434\u043e\u0439, \u00ab\u043a\u044a\u0443\u043b\u0430\u043a\u044a \u043e\u0440\u0442\u0430\u043b\u0430\u0440\u044b \u0431\u043b\u0430, ... Jul 6, 2021 ... \u043b\u0435\u0433\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0439 \u043a\u043e\u043d\u044c \u0413\u0435\u043c\u0443\u0434\u0430, \u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0435. \u042d\u043b\u044c\u0431\u0440\u0443\u0441\u0430. \u041e\u043d \u043c\u043e\u0433 \u0441\u043a\u0430\u043a\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e \u0433\u0440\u0443\u0434\u044c\u044e \u0440\u0430\u0441\u0441\u0435\u043a\u0430\u043b \u0433\u043e\u0440\u044b. \u0422\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0427\u0435\u0440\u0435\u043a\u0441\u043a\u043e\u0435 \u0438. \u0427\u0435\u0433\u0435\u043c\u0441\u043a\u043e\u0435 ...[0m ### [32;1m[1;3mSo the final answer is: \u0413\u0435\u043c\u0443\u0434\u0430 - \u043b\u0435\u0433\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0439 \u043a\u043e\u043d\u044c, \u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0435 \u042d\u043b\u044c\u0431\u0440\u0443\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433 \u0441\u043a\u0430\u043a\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e[0m ###  ### [1m> Finished chain.[0m ### [1] \"\u0413\u0435\u043c\u0443\u0434\u0430 - \u043b\u0435\u0433\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0439 \u043a\u043e\u043d\u044c, \u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0435 \u042d\u043b\u044c\u0431\u0440\u0443\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433 \u0441\u043a\u0430\u043a\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\"<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 RAG. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u0438 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438 \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 langchain. \u041c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0430\u043c\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b RAG, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0414\u0440\u0443\u0433\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\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\/787410\/\"> https:\/\/habr.com\/ru\/articles\/787410\/<\/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<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/articles\/786090\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043f\u0440\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0430\u0433\u0435\u043d\u0442\u043e\u0432.<\/p>\n<h2>\u0414\u0430\u043d\u043d\u044b\u0435 \u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0442 OpenAI. \u0414\u043b\u044f opensource \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c.<\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h3>\n<pre><code class=\"r\">library(reticulate) library(data.table) library(magrittr) library(stringr)  py_install(c('torch',               'torchvision',               \"torchaudio\",               'langchain',               'docx2txt',               'faiss-cpu',               'openai==0.28.1',               'tiktoken',              \"google-api-python-client>=2.100.0\"), pip = TRUE)   langchain &lt;- import('langchain')<\/code><\/pre>\n<h3>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/h3>\n<p>\u0422\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0433\u0443\u0433\u043b\u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c.<\/p>\n<pre><code class=\"r\">OPENAI_API_KEY &lt;- '&lt;YOUR OPENAI TOKEN>' GOOGLE_API_KEY &lt;- \"&lt;YOUR GOOGLE TOKEN>\" CUSTOM_SEARCH_ENGINE_ID &lt;- \"&lt;YOUR GOOGLE SEARCH ID>\" MODEL_NAME_GPT &lt;- \"gpt-4\" TEMPERATURE &lt;- 0.5 MAX_TOKENS &lt;- 100L<\/code><\/pre>\n<h2>\u041f\u0430\u043c\u044f\u0442\u044c<\/h2>\n<p>\u0422\u0438\u043f\u044b \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>ConversationBufferMemory &#8212; \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0438\u043f \u043f\u0430\u043c\u044f\u0442\u0438. \u0412 history \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c.<\/p>\n<\/li>\n<li>\n<p>ConversationSummaryMemory &#8212; \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043f\u0435\u0440\u0435\u0434 \u043f\u043e\u0434\u0430\u0447\u0435\u0439 \u0432 history. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0430\u0436\u0434\u044b (\u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0434\u043b\u044f \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438).<\/p>\n<\/li>\n<li>\n<p>ConversationSummaryBufferMemory &#8212; \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043e\u043a\u043d\u0430 \u0432 \u0442\u043e\u043a\u0435\u043d\u0430\u0445, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u0430 \u0442\u043e \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0441\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>ConversationBufferWindowMemory &#8212; \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 k \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>ConversationKGMemory &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0433\u0440\u0430\u0444 \u0437\u043d\u0430\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>ConversationEntityMemory &#8212; \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0432 history \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435.<\/p>\n<\/li>\n<\/ul>\n<h4>ConversationBufferMemory<\/h4>\n<pre><code class=\"r\">llm &lt;- langchain$llms$OpenAI(temperature = TEMPERATURE,                               openai_api_key = OPENAI_API_KEY,                               max_tokens = MAX_TOKENS)    memory_buffer &lt;- langchain$chains$conversation$memory$ConversationBufferMemory() chain_buffer &lt;- langchain$chains$ConversationChain(llm = llm, memory = memory_buffer)  chain_buffer(\"\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\")  ### $input ### [1] \"\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\" ###  ### $history ### [1] \"\" ###  ### $response ### [1] \" \u0414\u0430, \u044f \u0437\u043d\u0430\u044e \u043e \u043a\u043e\u043d\u0435. \u042d\u0442\u043e \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0433\u043e \u0438 \u0434\u043b\u044f \u0441\"  chain_buffer(\"\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e\") ### $input ### [1] \"\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e\" ###  ### $history ### [1] \"Human: \u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\\nAI:  \u0414\u0430, \u044f \u0437\u043d\u0430\u044e \u043e \u043a\u043e\u043d\u0435. \u042d\u0442\u043e \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0433\u043e \u0438 \u0434\u043b\u044f \u0441\" ###  ### $response ### [1] \" \u041a\u043e\u043d\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u0438\u043c\u0438 \u0438 \u043c\u043e\u0449\u043d\u044b\u043c\u0438 \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u043c\u0438 \u0441 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0448\u0435\u0435\u0439, \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u043d\u043e\u0433\u0430\u043c\u0438 \u0438 \u043f\u043b\u043e\u0442\u043d\u044b\u043c \u0442\"   # \u0414\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 # chain_buffer &lt;- langchain$chains$ConversationalRetrievalChain$from_llm(llm = llm, #                                                                        memory = memory_buffer,  #                                                                        retriever = db_gpt$as_retriever()) # chat_history &lt;- list() # query &lt;- \"&lt;\u0417\u0430\u043f\u0440\u043e\u0441 1>\" # res1 &lt;- chain_buffer$run(list(question = query, chat_history = chat_history)) # res1 # chat_history &lt;- c(chat_history, tuple(query, res1)) #  # query &lt;- \"&lt;\u0417\u0430\u043f\u0440\u043e\u0441 2>\" # res2 &lt;- chain_buffer$run(list(question = query, chat_history = chat_history)) # res2 # chat_history &lt;- c(chat_history, tuple(query, res2))<\/code><\/pre>\n<h4>ConversationSummaryMemory<\/h4>\n<p>\u0421\u0443\u043c\u043c\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<pre><code class=\"r\">memory_summary &lt;- langchain$chains$conversation$memory$ConversationSummaryMemory(llm = llm) chain_summary &lt;- langchain$chains$ConversationChain(llm = llm, memory = memory_summary)  chain_summary(\"\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\")  ### $input ### [1] \"\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?\" ###  ### $history ### [1] \"\" ###  ### $response ### [1] \" \u0414\u0430, \u044f \u0437\u043d\u0430\u044e \u043e \u043a\u043e\u043d\u0435. \u041a\u043e\u043d\u044c - \u044d\u0442\u043e \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435 \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043b\u043e\u0448\u0430\u0434\u0435\u0439. \u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f\"  chain_summary(\"\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e\") ### $input ### [1] \"\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e\" ###  ### $history ### [1] \"\\nThe human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential. The human then asks who a horse is and the AI responds that it is a domesticated animal from the horse family and is used for transportation and recreation.\" ###  ### $response ### [1] \" A horse is a four-legged mammal with a long snout, long mane, and a short tail. It has hooves and is typically a brown or black color. It is usually around 1.5 to 1.8 meters tall and can weigh up to 900 kilograms. Horses are intelligent creatures and have been domesticated for thousands of years. They are used for transportation, recreation, and even as a source of food.\"<\/code><\/pre>\n<p>\u041f\u0430\u043c\u044f\u0442\u044c<\/p>\n<pre><code class=\"r\">chain_summary$memory$chat_memory ### ChatMessageHistory(messages=[HumanMessage(content='\u0417\u043d\u0430\u0435\u0448\u044c \u043a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u044c?'), AIMessage(content=' \u0414\u0430, \u044f \u0437\u043d\u0430\u044e \u043e \u043a\u043e\u043d\u0435. \u041a\u043e\u043d\u044c - \u044d\u0442\u043e \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0435 \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0435 \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043b\u043e\u0448\u0430\u0434\u0435\u0439. \u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f'), HumanMessage(content='\u041e\u043f\u0438\u0448\u0438 \u0435\u0433\u043e'), AIMessage(content=' A horse is a four-legged mammal with a long snout, long mane, and a short tail. It has hooves and is typically a brown or black color. It is usually around 1.5 to 1.8 meters tall and can weigh up to 900 kilograms. Horses are intelligent creatures and have been domesticated for thousands of years. They are used for transportation, recreation, and even as a source of food.')])<\/code><\/pre>\n<h2>\u0410\u0433\u0435\u043d\u0442<\/h2>\n<p>\u0410\u0433\u0435\u043d\u0442 &#8212; \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0443\u044e\u0449\u0435\u0435 \u0437\u0430\u0432\u0435\u043d\u043e \u043c\u0435\u0436\u0434\u0443 \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e (LLM) \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c (Tool). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u044f\u0437\u044b\u043a\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u043b\u0430 \u0438\u0437 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0433\u0443\u0433\u043b\u0430 (\u043e\u0431\u043b\u0430\u0434\u0430\u043b\u0430 \u043d\u043e\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438).<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c API \u043a\u043b\u044e\u0447 \u0433\u0443\u0433\u043b\u0430 (<a href=\"https:\/\/console.cloud.google.com\/getting-started?project=proud-storm-410009&amp;supportedpurview=project\" rel=\"noopener noreferrer nofollow\">\u0433\u0443\u0433\u043b \u043e\u0431\u043b\u0430\u043a\u043e<\/a> -> APIs &amp; services -> Credentials -> Create credentials -> API key). \u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/console.cloud.google.com\/apis\/library\/customsearch.googleapis.com?project=trim-approach-384913\" rel=\"noopener noreferrer nofollow\">Custom search API<\/a> -> Enable. <a href=\"https:\/\/programmablesearchengine.google.com\/controlpanel\/create\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c<\/a>, \u0434\u0430\u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0432 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0443, \u0437\u0430\u0442\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<pre><code class=\"r\"># \u041e\u0431\u0451\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 search_engine &lt;- langchain$utilities$GoogleSearchAPIWrapper(google_api_key = GOOGLE_API_KEY, google_cse_id = CUSTOM_SEARCH_ENGINE_ID)  # \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u0418\u043c\u044f \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a Intermediate Answer, \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f. tool &lt;- langchain$tools$Tool(name = \"Intermediate Answer\", func = search_engine$run, description = \"Google answers\")  # \u0413\u0443\u0433\u043b \u0430\u0433\u0435\u043d\u0442 agent_google &lt;- langchain$agents$initialize_agent(tools = c(tool),                                                    llm = llm,                                                    agent = \"self-ask-with-search\", # \u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b: zero-shot-react-description, react-docstore, conversational-react-description                                                   verbose = TRUE,                                                    max_iterations = 5)   # \u0417\u0430\u043f\u0443\u0441\u043a \u0430\u0433\u0435\u043d\u0442\u0430 agent_google$run(\"\u041a\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0413\u0435\u043c\u0443\u0434\u0430?\")   ### [1m> Entering new AgentExecutor chain...[0m ### [32;1m[1;3m Yes. ### Follow up: \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0413\u0435\u043c\u0443\u0434\u0430?[0m ### Intermediate answer: [36;1m[1;3m\u0413\u0435\u043c\u0443\u0434\u0430, \u043a\u0430\u043a \u0432\u0435\u043b\u0435\u043b \u041a\u0430\u0440\u0430\u0448\u0430\u0443\u0430\u0439, \u043d\u0430\u0447\u0430\u043b \u0441\u043a\u0430\u043a\u0430\u0442\u044c \u0438 \u043f\u0440\u044b\u0433\u0430\u0442\u044c \u043f\u043e \u043c\u043e\u0440\u044e \u0438 \u043f\u043e \u0435\u0433\u043e \u0434\u043d\u0443 \u0442\u0443\u0434\u0430-\u0441\u044e\u0434\u0430. \u041a\u043e\u0433\u0434\u0430 \u043c\u043e\u0440\u0435 \u043f\u043e\u0447\u0435\u0440\u043d\u0435\u043b\u043e, \u043f\u043e\u043c\u0443\u0442\u043d\u0435\u043b\u043e \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u043f\u043e\u0434 \u0432\u043e\u0434\u043e\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u0442\u0430\u043b\u043e ... ... \u0413\u0435\u043c\u0443\u0434\u0430-\u0421\u0435\u043a\u0438\u0440\u0433\u0435\u043d-\u0442\u0430\u0448 \u00ab\u041a\u0430\u043c\u0435\u043d\u044c-\u0427\u0435\u0440\u0435\u0437-\u041a\u043e\u0442\u043e\u0440\u044b\u0439-\u041f\u0435\u0440\u0435\u043f\u0440\u044b\u0433\u043d\u0443\u043b-\u0413\u0435\u043c\u0443\u0434\u0430\u00bb \u0438 \u0442.\u0434.), \u0447\u0442\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0442\u0435\u0441\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0431\u043e\u0433\u0430\u0442\u044b\u0440\u0441\u043a\u043e\u0433\u043e \u044d\u043f\u043e\u0441\u0430 \u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u0443\u043b\u044c\u0442\u0443\u0440\u044b ... \u0414\u043e\u0441\u043a\u0430\u043a\u0430\u043b\u0438 \u0434\u043e \u0433\u0440\u043e\u043c\u0430\u0434\u043d\u043e\u0439 \u0433\u043e\u0440\u044b,. [\u0413\u0435\u043c\u0443\u0434\u0430] \u0433\u0440\u0443\u0434\u044c\u044e [\u0435\u0435] \u0443\u0434\u0430\u0440\u0438\u043b,. \u0413\u0440\u043e\u043c\u0430\u0434\u043d\u0443\u044e \u0433\u043e\u0440\u0443 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u043a\u043e\u043b\u043e\u043b. \u0413\u043e\u043b\u0443\u0431\u044b\u0435 \u043e\u0437\u0435\u0440\u0430 \u2014 \u0441\u043b\u0435\u0434\u044b \u0435\u0433\u043e \u043a\u043e\u043f\u044b\u0442,. \u0420\u0430\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043b\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043b\u043e\u0448\u0430\u0434\u0435\u0439 \u041a\u0430\u0440\u0430\u0447\u0430\u0435\u0432\u0441\u043a\u043e\u0439 \u043f\u043e\u0440\u043e\u0434\u044b\/\u041a\u044a \u041a\u0430\u0440\u0430\u0447\u0430\u0435\u0432\u043e-\u0427\u0435\u0440\u043a\u0435\u0441\u0441\u043a\u0430\u044f \u0420\u0435\u0441\u043f\u0443\u0431\u043b\u0438\u043a\u0430 \u00b7 \u274c\u041f\u0420\u041e\u0414\u0410\u041d\u274c \u0416\u0435\u0440\u0435\u0431\u0435\u0446-\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0432 \u041f\u0420\u041e\u0414\u0410\u0416\u0415 \u0413\u0435\u043c\u0443\u0434\u0430 2017\u0433 ... May 18, 2010 ... \u0412 \u043c\u0438\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0413\u0435\u043c\u0443\u0434\u0430 \u0436\u0438\u0432\u0435\u0442 \u0432 \u043f\u043e\u0434\u0437\u0435\u043c\u043d\u043e\u0439 \u043a\u043e\u043d\u044e\u0448\u043d\u0435, \u043f\u0438\u0442\u0430\u044f\u0441\u044c \u0440\u0443\u0434\u043e\u0439 \u0438\u043b\u0438 \u0436\u0435\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u043e\u043f\u0438\u043b\u043a\u0430\u043c\u0438. \u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 - \u0413\u0435\u043c\u0443\u0434\u0430 \u0432\u043b\u0430\u0434\u0435\u0435\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0447\u044c\u044e \u0438 ... \u0413\u0435\u043c\u0443\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e \u043e\u0431\u043b\u0438\u043a \u0437\u0430\u0445\u0443\u0434\u0430\u043b\u043e\u0439 \u043a\u043b\u044f\u0447\u0438, \u0442\u043e \u0432\u0438\u0434 \u0431\u043e\u0433\u0430\u0442\u044b\u0440\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u044f. \u041e\u0434\u043d\u0430\u0436\u0434\u044b \u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0435\u0442 \u0432 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 - \u0441 \u043a\u0440\u044b\u043b\u044c\u044f\u043c\u0438 \u043e\u0440\u043b\u0430 \u0438 \u0441 \u0440\u044b\u0431\u044c\u0438\u043c \u0445\u0432\u043e\u0441\u0442\u043e\u043c, \u0442. \u0435. Mar 13, 2023 ... \u041d\u0430\u0440\u0442 \u0430\u0442 \u2013 \u043a\u043e\u043d\u044c \u043d\u0430\u0440\u0442\u0430,(\u0413\u0435\u043c\u0443\u0434\u0430); \u042e\u0447 \u0430\u044f\u043a\u044a \u0430\u0442 \u2013 \u043a\u0440\u044b\u043b\u0430\u0442\u044b\u0439 \u043a\u043e\u043d\u044c (\u0442\u0440\u0451\u0445\u043d\u043e\u0433\u0438\u0439 \u0432 \u043d\u0430\u0440\u0442\u0441\u043a\u043e\u043c \u044d\u043f\u043e\u0441\u0435, \u0430\u043d\u0430\u043b\u043e\u0433 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0430\u043c\u043e\u043b\u0435\u0442\u0430 \u2013 \u0442\u0440\u0438 \u0448\u0430\u0441\u0441\u0438). \u0416\u044b\u043b\u043a\u044a\u044b ... Sep 25, 2016 ... \u0422\u0430\u043a \u0436\u0435 \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u041d\u0430\u0440\u0442\u044b \u0431\u044b\u043b\u0438 \u0432\u0435\u0440\u043d\u044b \u0441\u0432\u043e\u0438\u043c \u0441\u043a\u0430\u043a\u0443\u043d\u0430\u043c, \u0438 \u0441\u043a\u0430\u043a\u0443\u043d\u044b \u041d\u0430\u0440\u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0438\u0437 \u043a\u043b\u044f\u0442\u0432\u044b \u041a\u0430\u0440\u0430\u0448\u0443\u0430\u0439\u0430 \u0438 \u0413\u0435\u043c\u0443\u0434\u044b \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0435: (\u0413\u0435\u043c\u0443\u0434\u0430): Dec 10, 2015 ... \u0410 \u0432 \u0441\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u00ab\u041a\u0430\u0440\u0430\u0448\u0430\u0443\u0430\u0439 \u0438 \u0413\u0435\u043c\u0443\u0434\u0430\u00bb \u0434\u0430\u0436\u0435 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0443 \u0413\u0435\u043c\u0443\u0434\u044b \u043e\u043a\u043e\u043b\u043e \u0443\u0448\u0435\u0439 \u0431\u044b\u043b\u0438 \u0436\u0430\u0431\u0440\u044b \u0438 \u043e\u043d, \u043e\u0447\u0443\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u043f\u043e\u0434 \u0432\u043e\u0434\u043e\u0439, \u00ab\u043a\u044a\u0443\u043b\u0430\u043a\u044a \u043e\u0440\u0442\u0430\u043b\u0430\u0440\u044b \u0431\u043b\u0430, ... Jul 6, 2021 ... \u043b\u0435\u0433\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0439 \u043a\u043e\u043d\u044c \u0413\u0435\u043c\u0443\u0434\u0430, \u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0435. \u042d\u043b\u044c\u0431\u0440\u0443\u0441\u0430. \u041e\u043d \u043c\u043e\u0433 \u0441\u043a\u0430\u043a\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e \u0433\u0440\u0443\u0434\u044c\u044e \u0440\u0430\u0441\u0441\u0435\u043a\u0430\u043b \u0433\u043e\u0440\u044b. \u0422\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0427\u0435\u0440\u0435\u043a\u0441\u043a\u043e\u0435 \u0438. \u0427\u0435\u0433\u0435\u043c\u0441\u043a\u043e\u0435 ...[0m ### [32;1m[1;3mSo the final answer is: \u0413\u0435\u043c\u0443\u0434\u0430 - \u043b\u0435\u0433\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0439 \u043a\u043e\u043d\u044c, \u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0435 \u042d\u043b\u044c\u0431\u0440\u0443\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433 \u0441\u043a\u0430\u043a\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e[0m ###  ### [1m> Finished chain.[0m ### [1] \"\u0413\u0435\u043c\u0443\u0434\u0430 - \u043b\u0435\u0433\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0439 \u043a\u043e\u043d\u044c, \u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0435 \u042d\u043b\u044c\u0431\u0440\u0443\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433 \u0441\u043a\u0430\u043a\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\"<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 RAG. \u041e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u0438 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438 \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 langchain. \u041c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0430\u043c\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b RAG, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0414\u0440\u0443\u0433\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\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\/787410\/\"> https:\/\/habr.com\/ru\/articles\/787410\/<\/a><br \/><\/br><\/br><\/p>\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-365718","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/365718","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=365718"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/365718\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=365718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=365718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=365718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}