{"id":3242,"date":"2023-05-08T07:59:17","date_gmt":"2023-05-07T22:59:17","guid":{"rendered":"http:\/\/www.bravesoft.co.jp\/seblog\/?p=3242"},"modified":"2023-05-08T07:59:17","modified_gmt":"2023-05-07T22:59:17","slug":"openai-api-embeddingsgcp%e3%81%a7%e6%a4%9c%e7%b4%a2ai%e7%b3%bbline%e3%82%a2%e3%83%97%e3%83%aa%e3%81%ae%e4%bd%9c%e3%82%8a%e6%96%b9-34","status":"publish","type":"post","link":"https:\/\/bravesoft.co.jp\/seblog\/archives\/3242","title":{"rendered":"OpenAI API Embeddings+GCP\u3067\u691c\u7d22AI\u7cfbLINE\u30a2\u30d7\u30ea\u306e\u4f5c\u308a\u65b9 #34"},"content":{"rendered":"<p>GW\u4e2d\u306b\u958b\u767a\u3057\u305f\u3001\u30dc\u30b1\u3092\u304a\u3059\u3059\u3081\u3057\u3066\u304f\u308c\u308bLINE\u30a2\u30d7\u30ea\u3092\u30a8\u30f3\u30b8\u30cb\u30a2\u5411\u3051\u306b\u89e3\u8aac\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/www.bravesoft.co.jp\/seblog\/archives\/3186\" rel=\"noopener noreferrer\" target=\"_blank\">\u4eca\u56de\u3064\u304f\u3063\u305f\u306e\u306f\u30dc\u30b1\u3066\u3092AI\u691c\u7d22\u3059\u308bLINE\u30a2\u30d7\u30ea \u3000\u301cAI\u30dc\u30b1\u30c6\u30f3\u30c0\u30fc\u300c\u30a8\u30a4\u30b8\u300d\u301c<\/a><\/p>\n<p>LINE\u3067\u5165\u529b\u3055\u308c\u305f\u6587\u7ae0\uff08\u304a\u984c\uff09\u306b\u3064\u3044\u3066\u3001\u610f\u5473\u7684\u306b\u8fd1\u3044\u56de\u7b54\uff08\u30dc\u30b1\uff09\u3092\u30d4\u30c3\u30af\u30a2\u30c3\u30d7\u3057\u3066\u30ec\u30b3\u30e1\u30f3\u30c9\u3059\u308b\u4ed5\u69d8\u3060\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306fOpenAI\u306eAPI\u3067\u3053\u306e\u3088\u3046\u306a\u30a2\u30d7\u30ea\u3092\u4f5c\u308a\u305f\u3044\u4eba\u5411\u3051\u306e\u89e3\u8aac\u3092\u30bd\u30fc\u30b9\u4ed8\u304d\u3067\u66f8\u304d\u305f\u3044\u3068\u601d\u3046\u3002<\/p>\n<p><strong>AI\u30dc\u30b1\u30c6\u30f3\u30c0\u30fc\u304c\u52d5\u4f5c\u3057\u3066\u3044\u308b\u3068\u3053\u308d<\/strong><br \/>\n<a href=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3188\" data-permalink=\"https:\/\/bravesoft.co.jp\/seblog\/archives\/3186\/sample3\" data-orig-file=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?fit=1620%2C656&amp;ssl=1\" data-orig-size=\"1620,656\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"sample3\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?fit=300%2C121&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?fit=700%2C283&amp;ssl=1\" tabindex=\"0\" role=\"button\" src=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?resize=700%2C283&#038;ssl=1\" alt=\"\" width=\"700\" height=\"283\" class=\"aligncenter size-full wp-image-3188\" srcset=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?w=1620&amp;ssl=1 1620w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?resize=300%2C121&amp;ssl=1 300w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?resize=700%2C283&amp;ssl=1 700w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?resize=768%2C311&amp;ssl=1 768w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?resize=1536%2C622&amp;ssl=1 1536w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?resize=800%2C324&amp;ssl=1 800w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/sample3.png?w=1400&amp;ssl=1 1400w\" sizes=\"(max-width: 700px) 100vw, 700px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p><strong>OpenAI\u306eAPI\u30da\u30fc\u30b8<\/strong><br \/>\n<a href=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3243\" data-permalink=\"https:\/\/bravesoft.co.jp\/seblog\/archives\/3242\/openapidoc\" data-orig-file=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?fit=2746%2C1502&amp;ssl=1\" data-orig-size=\"2746,1502\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"openapidoc\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?fit=300%2C164&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?fit=700%2C383&amp;ssl=1\" tabindex=\"0\" role=\"button\" src=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?resize=700%2C383&#038;ssl=1\" alt=\"\" width=\"700\" height=\"383\" class=\"aligncenter size-full wp-image-3243\" srcset=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?w=2746&amp;ssl=1 2746w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?resize=300%2C164&amp;ssl=1 300w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?resize=700%2C383&amp;ssl=1 700w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?resize=768%2C420&amp;ssl=1 768w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?resize=1536%2C840&amp;ssl=1 1536w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?resize=2048%2C1120&amp;ssl=1 2048w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?resize=800%2C438&amp;ssl=1 800w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?w=1400&amp;ssl=1 1400w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapidoc.png?w=2100&amp;ssl=1 2100w\" sizes=\"(max-width: 700px) 100vw, 700px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h1>\u958b\u767a\u306e\u624b\u9806\u306f\u4e0b\u8a18\u306e\u901a\u308a<\/h1>\n<p>\u2460OpenAI\u306eAPI\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u53d6\u5f97<br \/>\n\u2461OpenAI API\u3000Embeddings\u3067\u30dc\u30b1\u30c7\u30fc\u30bf\u3092\u30d9\u30af\u30bf\u30fc\u5316<br \/>\n\u2462GCP\u306eCloud Functions\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u767a\u884c<br \/>\n\u2463LINE Developers\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u767a\u884c<br \/>\n\u2464CGP\u4e0a\u3067LINE BOT API\u306e\u958b\u767a<\/p>\n<p>\u2460\u3001\u2462\u3001\u2463\u306b\u3064\u3044\u3066\u306f\u3059\u3067\u306b\u30cd\u30c3\u30c8\u306b\u305f\u304f\u3055\u3093\u306e\u8a18\u4e8b\u304c\u3042\u308b\u306e\u3067\u7701\u7565\u3059\u308b<\/p>\n<h1>\u2461OpenAI API\u3000Embeddings\u3067\u30dc\u30b1\u30c7\u30fc\u30bf\u3092\u30d9\u30af\u30bf\u30fc\u5316<\/h1>\n<p>OpenAI\u306f\u305f\u304f\u3055\u3093\u306e\u6a5f\u80fd\u3092API\u3068\u3057\u3066\u63d0\u4f9b\u3057\u3066\u3044\u308b\u3002<br \/>\n\u4eca\u56de\u306f\u305f\u304f\u3055\u3093\u306e\u30dc\u30b1\u306e\u4e2d\u304b\u3089\u3001\u300c\u5165\u529b\u3055\u308c\u305f\u6587\u7ae0\u300d\u3068\u300c\u30dc\u30b1\u3066\u306e\u30dc\u30b1\u306e\u6587\u7ae0\u300d\u3068\u30de\u30c3\u30c1\u5ea6\u304c\u9ad8\u3044\u6587\u7ae0\u691c\u7d22\u304c\u6c42\u3081\u3089\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u66f4\u306b\u306f\u5927\u91cf\u306e\u51e6\u7406\u6e08\u307f\u30dc\u30b1\u30c7\u30fc\u30bf\u3092OpenAI\u306e\u30b5\u30fc\u30d0\u5074\u306b\u306f\u304a\u304b\u305a\u3001\u81ea\u793e\u30b5\u30fc\u30d0(GCP\uff09\u306b\u300c\u7d44\u307f\u8fbc\u3080\u300d\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u9ad8\u901f\u6027\u3084\u4f4e\u30b3\u30b9\u30c8\u3067\u306e\u5b9f\u73fe\u3092\u56f3\u3063\u3066\u3044\u308b\u3002<br \/>\n\u305d\u308c\u3092\u5b9f\u73fe\u3059\u308bOpenAI\u306eAPI\u304cEmbeddings\u3060\u3002<\/p>\n<p>Embeddings\u306eAPI\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<br \/>\n<a href=\"https:\/\/platform.openai.com\/docs\/guides\/embeddings\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/platform.openai.com\/docs\/guides\/embeddings<\/a><\/p>\n<p>\u7c21\u5358\u306b\u8aac\u660e\u3059\u308b\u3068<\/p>\n<p>\u30fb\u4e8b\u524d\u306b\u6587\u7ae0DB\u3092API\u3067\u30d9\u30af\u30bf\u30fc\u51e6\u7406\u5316\u3057\u3066\u30ed\u30fc\u30ab\u30eb\u306b\u4fdd\u5b58\u3067\u304d\u308b<br \/>\n\uff08\u3053\u306e\u969b\u306e\u8a00\u8a9e\u51e6\u7406\u529b\u304cOpenAI\u306e\u771f\u4fa1\uff09<br \/>\n\u30fb\u305d\u306e\u30c7\u30fc\u30bf(CSV)\u3092GCP\u4e0a\u306b\u30a2\u30c3\u30d7\u3057\u3066\u304a\u304f<br \/>\n\u30fb\u691c\u7d22\u6642\u306b\u5165\u529b\u3055\u308c\u305f\u6587\u7ae0\u3092API\u3067\u30d9\u30af\u30bf\u30fc\u5316\u3057\u3001\u4fdd\u5b58\u6e08\u307f\u30d9\u30af\u30bf\u30fc\u5316\u30c7\u30fc\u30bf\u306b\u5bfe\u3057\u3066\u691c\u7d22\u30de\u30c3\u30c1\u5ea6\u304c\u9ad8\u3044\u9806\u306b\u30d4\u30c3\u30af\u30a2\u30c3\u30d7\u3057\u3066\u8868\u793a\u3055\u305b\u308b<\/p>\n<p>\u30d9\u30af\u30bf\u30fc\u5316\uff08\u6570\u5024\u5316\uff09\u3057\u3066\u4fdd\u5b58\u30fb\u6bd4\u8f03\u3059\u308b\u304b\u3089\u6570\u5341\u4e07\u306e\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u691c\u7d22\u3082\u4e00\u77ac\u3067OK<\/p>\n<p><strong>\u51e6\u7406\u524d\u306e\u30dc\u30b1\u3066\u30c7\u30fc\u30bf\u3010bokeData.csv\u3011<\/strong><\/p>\n<pre class=\"prettyprint lang-py linenums\">\r\nid,text\r\n103973108,\u3092\u4e57\u305b\u305a\u306b\u6d77\u5916\r\n103971848,\u6bbf\u3001\u6bd2\u898b\u304c\u7d42\u308f\u308a\u307e\u3057\u305f\u3002\r\n103971447,\u30d0\u30bf\u30fc\u3068\u30c1\u30fc\u30ba\r\n<\/pre>\n<p>\u30dc\u30b1id\u3068\u30dc\u30b1\u306e\u5185\u5bb9\u306e\u307f\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u6210<\/p>\n<p><strong>\u30d9\u30af\u30bf\u30fc\u51e6\u7406\u6e08\u307f\u30dc\u30b1\u3066\u30c7\u30fc\u30bf\u3010outputVec.csv\u3011<\/strong><\/p>\n<pre class=\"prettyprint lang-py linenums\">\r\nid,text\r\n103973108,\u3092\u4e57\u305b\u305a\u306b\u6d77\u5916,[-0.025080611929297447, -0.012434509582817554,..(\u7701\u7565)]\r\n103971848,\u6bbf\u3001\u6bd2\u898b\u304c\u7d42\u308f\u308a\u307e\u3057\u305f\u3002,[-0.005088195204734802, -0.018677828833460808, ..(\u7701\u7565)]\r\n103971447,\u30d0\u30bf\u30fc\u3068\u30c1\u30fc\u30ba,[-0.010187446139752865, -0.009211978875100613, ..(\u7701\u7565)]\r\n<\/pre>\n<p>\u5f8c\u534a\u306e\u6570\u5024\u306e\u7f85\u5217\u304c\u3044\u308f\u3086\u308b\u30d9\u30af\u30bf\u30fc\u5316\u3055\u308c\u305f\u6570\u5024\u30c7\u30fc\u30bf\u3002\u2191\u3067\u306f\uff12\u9805\u76ee\u305a\u3064\u3060\u3051\u306b\u7701\u7565\u3057\u3066\u308b\u304c\u3001\u305d\u306e\u5f8c\u3053\u306e\u3088\u3046\u306a\u6570\u5024\u304c\u4e00\u884c\u3042\u305f\u308a1500\u9805\u76ee\u3082\u4e26\u3076\u3002\u3053\u308c\u3089\u306e\u6570\u5024\u304c\u30dc\u30b1\u306e\u6570\u6587\u5b57\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u3044\u308d\u3044\u308d\u306a\u65b9\u5411\uff08\u30d9\u30af\u30c8\u30eb\uff09\u306b\u5f37\u5f31\u3092\u8868\u73fe\u3057\u305f\u30c7\u30fc\u30bf\u3068\u3044\u3046\u3053\u3068\u3060\u3002<\/p>\n<p><strong>\u30c7\u30fc\u30bf\u51e6\u7406\u7528\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3010dataset.py\u3011<\/strong><br \/>\npython\u3067\u30b3\u30f3\u30bd\u30fc\u30eb\u304b\u3089\u3053\u308c\u3092\u5b9f\u884c\u3059\u308c\u3070\u3001\u540c\u30d5\u30a9\u30eb\u30c0\u306b\u3042\u308bbokeData.csv\u3092\u8aad\u307f\u8fbc\u307f\u3001OpenAI\u306eAPI\u306b\u63a5\u7d9a\u3057\u30d9\u30af\u30bf\u30fc\u5909\u63db\u51e6\u7406\u3092\u3057\u3066\u3001OutputVec.csv\u306b\u4fdd\u5b58\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint lang-py linenums\">\r\nimport csv\r\nimport openai\r\nimport pandas as pd\r\nimport tiktoken\r\nimport math\r\n\r\nfrom openai.embeddings_utils import get_embedding\r\n\r\n# OpenAI API\u30ad\u30fc\u3092\u8a2d\u5b9a\uff08\u672c\u756a\u904b\u7528\u6642\u306f\u74b0\u5883\u5909\u6570\u306b\u30bb\u30c3\u30c8\u3059\u308b\u3053\u3068\uff09\r\nopenai.api_key = \"\u3053\u3053\u306bOpenAI\u306eAPI\u30ad\u30fc\u3092\u3044\u308c\u307e\u3059\"\r\n\r\n# \u5165\u529b\u30c7\u30fc\u30bfCSV\u30d5\u30a1\u30a4\u30eb\u540d\r\ninput_csv_path = \".\/bokeData.csv\"\r\n#input_csv_path = \".\/data\/sample100.csv\"\r\n\r\n# Embedded\u30d9\u30af\u30c8\u30eb\u30c7\u30fc\u30bf\u3068\u3057\u3066\u51fa\u529b\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u540d\r\noutput_csv_path = \".\/outputVec.csv\"\r\n\r\n# API\u306b\u308f\u305f\u3059\u30e2\u30c7\u30eb\u540d\u306a\u3069\r\nembedding_model = \"text-embedding-ada-002\"\r\nembedding_encoding = \"cl100k_base\"\r\nmax_tokens = 8000\r\n\r\n\r\n# \u5165\u529bCSV\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\r\ndf = pd.read_csv(input_csv_path)\r\ndf = df[[\"id\", \"text\"]]\r\ndf = df.dropna()\r\ndf[\"combined\"] = (\r\n    \"id: \" + df.id.astype(str).str.strip() + \"; text: \" + df.text.str.strip()\r\n)\r\ndf.head(2)\r\nencoding = tiktoken.get_encoding(embedding_encoding)\r\n\r\n# \u5206\u5272\u6570\u306e\u8a2d\u5b9a\uff081000\u4ef6\u305a\u3064\uff09\r\nchunk_size = 1000\r\ntotal_rows = len(df)\r\nnum_chunks = math.ceil(total_rows \/ chunk_size)\r\n\r\n#API\u3092\u53e9\u3044\u3066\u30d9\u30af\u30c8\u30eb\u30c7\u30fc\u30bf\u306b\u3057\u3066CSV\u3078\u4fdd\u7ba1\r\nfor i in range(num_chunks):\r\n    start_index = i * chunk_size\r\n    end_index = start_index + chunk_size\r\n    chunk_df = df.iloc[start_index:end_index]\r\n    chunk_df[\"embedding\"] = chunk_df.combined.apply(lambda x: get_embedding(x, engine=embedding_model))\r\n\r\n    # \u7d50\u679c\u3092CSV\u306b\u4ed8\u3051\u8db3\u3057\u3066\u4fdd\u5b58\r\n    if i == 0:\r\n        chunk_df.to_csv(output_csv_path, index=False)\r\n    else:\r\n        chunk_df.to_csv(output_csv_path, mode='a', header=False, index=False)\r\n\r\n    # \u9032\u6357\u72b6\u6cc1\u3092\u8868\u793a\r\n    print(f\"\u66f8\u304d\u8fbc\u307f\u307e\u3057\u305f: {end_index if end_index <= total_rows else total_rows} \/ {total_rows} \u884c\")\r\n\r\nprint(\"\u57cb\u3081\u8fbc\u307f\u304c\u4fdd\u5b58\u3055\u308c\u307e\u3057\u305f:\", output_csv_path)\r\n<\/pre>\n<p>\u4f8b\u3048\u3070\u6570\u4e07\u4ef6\u306e\u30c7\u30fc\u30bf\u306a\u3089\u6570\u6642\u9593\u3067\u5b9f\u884c\u304c\u5b8c\u4e86\u3059\u308b\u3002<br \/>\n\u51fa\u529b\u3055\u308c\u308bCSV\u4e2d\u8eab\u306f\u5c0f\u6570\u70b9\u3060\u3089\u3051\u306e\u30d9\u30af\u30c8\u30eb\u30c7\u30fc\u30bf\u3002\u30c7\u30fc\u30bf\u5bb9\u91cf\u306f\u3060\u3044\u3076\u5897\u3048\u308b\u3002\u4f8b\u3048\u3070\u5143\u30c7\u30fc\u30bf\u304c10\u4e07\u4ef6\u300110MB\u3060\u3068\u3057\u305f\u3089\u3001\u51fa\u529b\u30c7\u30fc\u30bf\u306f10\u4e07\u4ef6\u306e\u307e\u307e\u3067\u3001\u5bb9\u91cf\u306f50\u500d\u306e500MB\u7a0b\u5ea6\u306e\u5927\u304d\u3055\u306b\u3082\u306b\u306a\u308b\u3002<\/p>\n<h1>\u2464CGP\u4e0a\u3067LINE BOT API\u306e\u958b\u767a<\/h1>\n<p>\u30d9\u30af\u30c8\u30eb\u30c7\u30fc\u30bf\u304c\u4f5c\u6210\u3067\u304d\u305f\u3089\u3001\u305d\u308c\u3092GCP\u306eCloud Storage\u306b\u30a2\u30c3\u30d7\u3057\u3066\u3001Cloud Functions\u304b\u3089\u53c2\u7167\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3088\u3046\u3002<br \/>\n\u305d\u3057\u3066\u3001Cloud Functions\u306b\u30c7\u30d7\u30ed\u30a4\u3059\u308bpython\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3002<\/p>\n<p>LINE\u3078\u306e\u30c1\u30e3\u30c3\u30c8\u6295\u7a3f\u3092\u30c8\u30ea\u30ac\u30fc\u3068\u3057\u3066LINE\u306bwebhook\u767b\u9332\u3057\u3066\u3042\u308b\u3053\u306epython\u306eAPI\u3067\u3001\u5165\u529b\u3055\u308c\u305f\u5185\u5bb9\u3068\u30de\u30c3\u30c1\u5ea6\u306e\u9ad8\u3044\u30dc\u30b1\u3092csv\u304b\u3089\u30d4\u30c3\u30af\u30a2\u30c3\u30d7\u3057\u3066LINE\u306b\u30c1\u30e3\u30c3\u30c8\u3067\u56de\u7b54\u3059\u308b\u3002<\/p>\n<p><strong>LINE BOT\u30a2\u30d7\u30ea\u3068\u3057\u3066GCP\u4e0a\u3067\u5f85\u6a5f\u3059\u308bAPI\u3010main.py\u3011<\/strong><\/p>\n<pre class=\"prettyprint lang-py linenums\">\r\n\r\nimport os\r\nimport sys\r\nimport openai\r\nimport json\r\nimport pandas as pd\r\nimport numpy as np\r\nfrom io import BytesIO\r\nfrom google.cloud import storage #G\u30af\u30e9\u30b9\u30c8\u30ec\u30fc\u30b8\u304b\u3089csv\u3092\u8aad\u307f\u53d6\u308b\r\nfrom flask import make_response, abort, jsonify\r\nfrom linebot import (\r\n    LineBotApi, WebhookHandler\r\n)\r\nfrom linebot.exceptions import (\r\n    InvalidSignatureError\r\n)\r\nfrom linebot.models import (\r\n    MessageEvent, TextMessage, TextSendMessage\r\n)\r\n\r\n#LINE\u95a2\u9023\r\nLINE_CHANNEL_SECRET = \"\u3053\u3053\u306bLINE\u306e\u30ad\u30fc\u3092\u3044\u308c\u307e\u3059\"\r\nLINE_CHANNEL_ACCESS_TOKEN = \"\u3053\u3053\u306bLINE\u306e\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u3044\u308c\u307e\u3059\"\r\n\r\n# OpenAI API\u30ad\u30fc\u3092\u8a2d\u5b9a\r\nopenai.api_key = \"\u3053\u3053\u306bOpenAI\u306eAPI\u30ad\u30fc\u3092\u3044\u308c\u307e\u3059\"\r\n# OpenAI API\u306e\u30e2\u30c7\u30eb\u540d\r\nembedding_model = \"text-embedding-ada-002\"\r\n\r\n#G\u30af\u30e9\u30d0\u30b1\u30c3\u30c8\u540d\u3068csv\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\r\nGC_BUCKET = \"bokedata\"\r\nGC_CSV    = \"outputVec.csv\"\r\n\r\n#LINE\u3078\u306e\u63a5\u7d9a\u8a2d\u5b9a\r\nline_bot_api = LineBotApi(LINE_CHANNEL_ACCESS_TOKEN)\r\nhandler = WebhookHandler(LINE_CHANNEL_SECRET)\r\n\r\n# Cloud\u30b9\u30c8\u30ec\u30fc\u30b8\u306e\u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\r\nstorage_client = storage.Client()\r\n# Cloud Storage\u306e\u30d0\u30b1\u30c3\u30c8\u540d\u3068csv\u30d5\u30a1\u30a4\u30eb\u540d\r\nbucket = storage_client.get_bucket(GC_BUCKET)\r\n# \u30d9\u30af\u30c8\u30eb\u5909\u63db\u6e08\u307fcsv\u30c7\u30fc\u30bf\u3092\u30d0\u30a4\u30ca\u30ea\u304b\u3089\u53d6\u5f97\r\nblob = bucket.blob(GC_CSV)\r\ncontent = blob.download_as_bytes()\r\ndf = pd.read_csv(BytesIO(content))\r\n\r\n##\u30ed\u30fc\u30ab\u30ebcsv\u3067\u306e\u30c7\u30d0\u30c3\u30b0\u7528\r\n# CSV\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\r\n#df = pd.read_csv(datafile_path)\r\n# \u30c7\u30fc\u30bf\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\r\n#datafile_path = \"..\/data\/outputVec.csv\"\r\n\r\n\r\n\r\n# embedding\u30ab\u30e9\u30e0\u306e\u6587\u5b57\u5217\u3092\u8a55\u4fa1\u3057\u3001NumPy\u914d\u5217\u306b\u5909\u63db\u3059\u308b\r\ndf[\"embedding\"] = df.embedding.apply(eval).apply(np.array)\r\n\r\nfrom openai.embeddings_utils import get_embedding, cosine_similarity\r\n\r\n# \u30dc\u30b1\u3092\u691c\u7d22\u3059\u308b\u95a2\u6570\r\ndef search_boke(df, search_query, n=3, pprint=True):\r\n    # \u30dc\u30b1\u30c7\u30fc\u30bf\u304b\u3089embedded\u30d9\u30af\u30c8\u30eb\u3092\u53d6\u5f97\u3059\u308b\r\n    boke_embedding = get_embedding(\r\n        search_query,\r\n        engine=embedding_model\r\n    )\r\n    # \u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u306e\u5404\u57cb\u3081\u8fbc\u307f\u30d9\u30af\u30c8\u30eb\u3068\u306e\u30b3\u30b5\u30a4\u30f3\u985e\u4f3c\u5ea6\u3092\u8a08\u7b97\u3059\u308b\r\n    df[\"similarity\"] = df.embedding.apply(lambda x: cosine_similarity(x, boke_embedding))\r\n\r\n    # \u30b3\u30b5\u30a4\u30f3\u985e\u4f3c\u5ea6\u306e\u9ad8\u3044\u9806\u306b\u4e26\u3079\u66ff\u3048\u3001\u4e0a\u4f4dn\u4ef6\u306e\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b\r\n    results = (\r\n        df.sort_values(\"similarity\", ascending=False)\r\n        .head(n)\r\n        .combined.str.replace(\"Title: \", \"\")\r\n        .str.replace(\"; Content:\", \": \")\r\n    )\r\n    # \u30de\u30c3\u30c1\u5ea6\u306e\u9ad8\u3044\u30dc\u30b1\u306eid\u304b\u3089URL\u3092\u751f\u6210\u3057\u3066\u8868\u793a\u3059\u308b\r\n    if pprint:\r\n        for r in results:\r\n            print(f\"https:\/\/bokete.jp\/boke\/{r.split(';')[0].split(':')[1].strip()}\")\r\n    return results\r\n\r\n# \u30b5\u30fc\u30d0API\u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u4ed8\u3051\u3066\u691c\u7d22\u306e\u5834\u5408\r\ndef main(request):\r\n\r\n    signature = request.headers['X-Line-Signature']\r\n    body = request.get_data(as_text=True)\r\n\r\n    try:\r\n        handler.handle(body, signature)\r\n    except InvalidSignatureError:\r\n        abort(400)\r\n\r\n    return 'OK'\r\n\r\n#LINE\u304b\u3089\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u3046\u3051\u3066\u5b9f\u884c\r\n@handler.add(MessageEvent, message=TextMessage)\r\ndef handle_message(event):\r\n\r\n    results = search_boke(df, event.message.text, n=5) #top5\u3092\u51fa\u529b\r\n\r\n    # \u30dc\u30b1\u306e\u30ea\u30f3\u30af\u4e00\u89a7\u3092\u751f\u6210\r\n    links = []\r\n\r\n    for r in results:\r\n        boke_id = r.split(\";\")[0].split(\":\")[1].strip()\r\n        link = f\"https:\/\/bokete.jp\/boke\/{boke_id}\"\r\n        links.append(link)\r\n\r\n    # \u914d\u5217\u3092\u6539\u884c\u3067\u533a\u5207\u3089\u308c\u305f\u6587\u5b57\u5217\u306b\u5909\u63db\r\n    return_text  = \"\u304a\u5f85\u305f\u305b\u3057\u307e\u3057\u305f\uff01\\n\"\r\n    return_text += \"\\n\".join(links)\r\n    return_text += \"\\n\u6b21\u306e\u6ce8\u6587\u3082\u3069\u3046\u305e\uff01\"\r\n\r\n    #LINE\u306b\u8fd4\u4fe1\u3055\u308c\u308b\u30e1\u30c3\u30bb\u30fc\u30b8\r\n    line_bot_api.reply_message(\r\n        event.reply_token,\r\n        TextSendMessage(text=return_text))\r\n\r\n\r\n#\u30c7\u30d0\u30c3\u30b0\u7528\r\n# \u30b5\u30fc\u30d0API\u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u4ed8\u3051\u3066\u691c\u7d22\u306e\u5834\u5408\r\n\"\"\"\r\ndef main(request):\r\n\r\n    # \u30d1\u30e9\u30e1\u30fc\u30bfq\u306b\u691c\u7d22\u30ef\u30fc\u30c9\u304c\u5165\u529b\u3055\u308c\u3066\u3001search_query\u306b\u4ee3\u5165\r\n    search_query = request.args.get(\"q\", \"\u30c7\u30d5\u30a9\u30eb\u30c8\u691c\u7d22\u30ef\u30fc\u30c9\")\r\n\r\n    results = search_boke(df, search_query, n=5) #top5\u3092\u51fa\u529b\r\n    # \u30ea\u30f3\u30af\u3092HTML\u5f62\u5f0f\u3067\u4f5c\u6210\r\n    links = []\r\n    for r in results:\r\n        boke_id = r.split(\";\")[0].split(\":\")[1].strip()\r\n        link = f\"https:\/\/bokete.jp\/boke\/{boke_id}\"\r\n        links.append(f'<a href=\"{link}\">{link}<\/a>')\r\n    # \u30ea\u30f3\u30af\u3092\u4e00\u89a7\u306b\u3057\u3066\u6587\u5b57\u5217\u306b\u5909\u63db\r\n    links_html = \"<br>\".join(links)\r\n\r\n    # HTML\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u4f5c\u6210\r\n    response = make_response(links_html)\r\n    response.headers[\"Content-Type\"] = \"text\/html\"\r\n    return response\r\n\"\"\"\r\n\r\n#\u30c7\u30d0\u30c3\u30b0\u7528\r\n#\u30bf\u30fc\u30df\u30ca\u30eb\u304b\u3089\u5f15\u6570\u3092\u53d7\u3051\u53d6\u3063\u3066\u691c\u7d22\u306e\u5834\u5408\r\nif __name__ == \"__main__\":\r\n    search_query = sys.argv[1] if len(sys.argv) > 1 else \"\u30c7\u30d5\u30a9\u30eb\u30c8\u691c\u7d22\u30ef\u30fc\u30c9\"\r\n    results = search_boke(df, search_query, n=5) #top5\u3092\u51fa\u529b\r\n\r\n\r\n<\/pre>\n<p>\u30b3\u30b9\u30c8\u3092\u6291\u3048\u305fCloud Functions\u306a\u305f\u3081\u3001\u6700\u521d\u306e\u5b9f\u884c\u3067\u306e\u30e1\u30e2\u30ea\u3078\u306e\u30ed\u30fc\u30c9\u306b1\u5206\u7a0b\u5ea6\u6642\u9593\u304c\u304b\u304b\u308b\u304c\u3001\u4e00\u5ea6\u30ed\u30fc\u30c9\u3057\u305f\u3089\uff12\u56de\u76ee\u4ee5\u964d\u306e\u56de\u7b54\u306f\u6570\u79d2\u3067\u5b8c\u4e86\u3059\u308b\u3002<br \/>\n\uff08\u3042\u308b\u7a0b\u5ea6\u30b3\u30b9\u30c8\u3092\u639b\u3051\u3066\u3061\u3083\u3093\u3068\u3057\u305f\u30b5\u30fc\u30d0\u3092\u501f\u308a\u308c\u3070\u5e38\u6642\u6570\u79d2\u3067\u30ec\u30b9\u30dd\u30f3\u30b9\u3067\u304d\u308b\uff09<\/p>\n<h1>OpenAI\u306eAPI\u30b3\u30b9\u30c8\u306f\u6bd4\u8f03\u7684\u5b89\u3044\u3068\u611f\u3058\u305f<\/h1>\n<p>GW\u4e2d\u3001\u4f55\u5341\u4e07\u56de\u3001\u4f55\u5341MB\u5206\u306eAPI\u3092\u53e9\u3044\u305f\u304c\u3001API\u306b\u9001\u308b\u30c7\u30fc\u30bf\u3092\u6700\u5c0f\u9650\u306e\u6587\u5b57\u5217\u306b\u3057\u305f\u306e\u3082\u3042\u3063\u3066\u304b\u3001\uff11\u65e5\u6570\u767e\u5186\u7a0b\u5ea6\u3057\u304b\u304b\u304b\u3089\u306a\u304b\u3063\u305f\u3002<br \/>\n\u9001\u308b\u6587\u5b57\u30c7\u30fc\u30bf\u304c\u5927\u304d\u304f\u306a\u308c\u3070\u306a\u308b\u307b\u3069\u8ab2\u91d1\u304c\u5927\u304d\u304f\u306a\u308b\u3089\u3057\u3044\u304c\u3001\u305d\u3082\u305d\u3082\u5b89\u304f\u611f\u3058\u308b<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3244\" data-permalink=\"https:\/\/bravesoft.co.jp\/seblog\/archives\/3242\/openapiusage\" data-orig-file=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?fit=2752%2C1416&amp;ssl=1\" data-orig-size=\"2752,1416\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"openapiusage\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?fit=300%2C154&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?fit=700%2C360&amp;ssl=1\" tabindex=\"0\" role=\"button\" src=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?resize=700%2C360&#038;ssl=1\" alt=\"\" width=\"700\" height=\"360\" class=\"aligncenter size-full wp-image-3244\" srcset=\"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?w=2752&amp;ssl=1 2752w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?resize=300%2C154&amp;ssl=1 300w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?resize=700%2C360&amp;ssl=1 700w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?resize=768%2C395&amp;ssl=1 768w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?resize=1536%2C790&amp;ssl=1 1536w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?resize=2048%2C1054&amp;ssl=1 2048w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?resize=800%2C412&amp;ssl=1 800w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?w=1400&amp;ssl=1 1400w, https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/openapiusage.png?w=2100&amp;ssl=1 2100w\" sizes=\"(max-width: 700px) 100vw, 700px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<h1>\u958b\u767a\u306f\u307e\u3059\u307e\u3059\u7c21\u5358\u306b\uff01<\/h1>\n<p>\u4e00\u3064\u524d\u306e\u8a18\u4e8b\u306b\u3082\u66f8\u3044\u305f\u304c\u3001\u305d\u3082\u305d\u3082\u4eca\u56deChatGPT\u3092\u958b\u767a\u30c4\u30fc\u30eb\u3068\u3057\u3066\u3082\u4f7f\u3046\u3053\u3068\u3067\uff13\u500d\u901f\u3092\u5b9f\u73fe\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u307e\u305f\u6700\u5148\u7aef\u306eAI\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3092API\u7d4c\u7531\u3067\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3001API\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306e\u52b4\u529b\u3082\u8ab2\u91d1\u30b3\u30b9\u30c8\u3082\u601d\u3063\u305f\u3088\u308a\u3082\u5c11\u306a\u3044\u3002<\/p>\n<p>AI\u958b\u767a\u304c\u3053\u3093\u306a\u306b\u7c21\u5358\u306b\u306a\u3063\u305f\u306e\u3060\u3002\u3053\u308c\u3092\u6a5f\u306b\u30a2\u30a4\u30c7\u30a3\u30a2\u3092\u5b9f\u73fe\u3059\u3079\u304f\u6311\u6226\u3057\u3088\u3046\uff01<\/p>\n<h1>\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/h1>\n<p>\u2460\u4eca\u56de\u958b\u767a\u3057\u305fLINE\u30a2\u30d7\u30ea\u3067\u7b11\u3044\u305f\u3044\u306a\u3089\u3053\u3061\u3089\uff01<br \/>\n<a href=\"https:\/\/www.bravesoft.co.jp\/seblog\/archives\/3186\" rel=\"noopener noreferrer\" target=\"_blank\">\u4eca\u56de\u3064\u304f\u3063\u305f\u30dc\u30b1\u3066\u3092AI\u691c\u7d22\u3059\u308bLINE\u30a2\u30d7\u30ea \u3000\u301cAI\u30dc\u30b1\u30c6\u30f3\u30c0\u30fc\u300c\u30a8\u30a4\u30b8\u300d\u301c<\/a><\/p>\n<p>\u2461\u4eca\u56de\u958b\u767a\u306b<strong>ChatGPT<\/strong>\u3092\u30d5\u30eb\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u300c\u958b\u767a\u304c\u4f53\u611f\uff13\u500d\u901f\u300d\u306b\u306a\u3063\u305f\u3002\u305d\u3053\u3067\u306f\u3069\u3093\u306a\u6307\u793a\u3092GPT\u306b\u3057\u3066\u3044\u305f\u306e\u304b\uff1f\u3000\u305d\u306e\u904e\u7a0b\u3092\u8a73\u7d30\u89e3\u8aac\uff01<br \/>\n<a href=\"https:\/\/www.bravesoft.co.jp\/seblog\/archives\/3209\" target=\"_blank\" rel=\"noopener noreferrer\">ChatGPT\u3092\u4f7f\u3063\u305f\u3089\u958b\u767a\u304c\uff13\u500d\u901f\u306b\u306a\u3063\u305f\u4ef6\uff06GPT\u3078\u306e\u751f\u3005\u3057\u3044\u6307\u793a\u4e00\u89a7 #33<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GW\u4e2d\u306b\u958b\u767a\u3057\u305f\u3001\u30dc\u30b1\u3092\u304a\u3059\u3059\u3081\u3057\u3066\u304f\u308c\u308bLINE\u30a2\u30d7\u30ea\u3092\u30a8\u30f3\u30b8\u30cb\u30a2\u5411\u3051\u306b\u89e3\u8aac\u3059\u308b\u3002 \u4eca\u56de\u3064\u304f\u3063\u305f\u306e\u306f\u30dc\u30b1\u3066\u3092AI\u691c\u7d22\u3059\u308bLINE\u30a2\u30d7\u30ea \u3000\u301cAI\u30dc\u30b1\u30c6\u30f3\u30c0\u30fc\u300c\u30a8\u30a4\u30b8\u300d\u301c LINE\u3067\u5165\u529b\u3055\u308c\u305f\u6587\u7ae0\uff08\u304a\u984c\uff09\u306b\u3064\u3044\u3066\u3001\u610f\u5473\u7684&#8230;<\/p>\n","protected":false},"author":1,"featured_media":3263,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[8],"tags":[],"class_list":["post-3242","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gijyutu"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/bravesoft.co.jp\/seblog\/wp-content\/uploads\/2023\/05\/inthepark-scaled.jpg?fit=2560%2C1920&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7fAdy-Qi","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/posts\/3242"}],"collection":[{"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/comments?post=3242"}],"version-history":[{"count":32,"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/posts\/3242\/revisions"}],"predecessor-version":[{"id":3328,"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/posts\/3242\/revisions\/3328"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/media\/3263"}],"wp:attachment":[{"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/media?parent=3242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/categories?post=3242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bravesoft.co.jp\/seblog\/wp-json\/wp\/v2\/tags?post=3242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}