Trinity Posted April 11 공유하기 Posted April 11 (edited) python API 호출 테스트 앱을 실행하니, IDLE에서 HCX응답이 한글이 깨져서 벡터로 나와요.. 무엇이 잘 못된 건가요? <run display> ========= RESTART: D:/2024년 도민평생일자리앱 구축/300.LLM CLOVA X studio/HCX1.py ========= {'text': '안양에 자바 개발자 경력 10년 미만 채용정보 추천해줘'} [-0.53557444, -0.76450264, -0.4154677, 1.6675595, -1.2688131, -0.54253244, -0.4640129, 1.1871266, 0.40865526, 1.3430359, -1.1109644, 0.76951, 1.2739059, 1.2159135, -0.26272708, 0.27264908, -0.78354096, -0.579579, 0.49763882, 1.0837064, 0.14117855, -0.3412071, 1.1212595, 0.7299563, 1.3295211, -1.302297, -1.1951586, -0.36852652, 0.7666879, 0.9198962, 0.37460843, 1.0429626, -0.9661552, -0.9128566, 1.5023053, 0.6296575, -1.0316303, -0.99597543, -0.59629935, -0.18510227, -0.7013912, -1.7147275, 0.0698107, -0.48017663, -0.115227304, 0.72180176, -1.5184273, -1.3109384, -0.04284792, -1.2054205, 0.6357266, 0.282388, -0.26687574, -0.63344705, 0.55327225, -1.4505029, 0.72566414, 0.43685964, -1.6787992, -0.9588162, 1.6410594, 0.8116826, -0.29161203, 0.5884494, 0.6655446, -0.6706299, 0.8245463, -0.83480555, 0.52494675, -0.6924907, 0.65046775, -1.0517169, -1.0276042, -0.50462085, -0.48223922, -1.3230313, -1.6139607, 0.94752425, 0.34271598, 1.4127363, 1.3798226, 0.74773246, 0.23577093, 1.7076931, 0.72975534, 0.9739824, 1.1097176, -1.1114644, 0.7108877, -0.12766601, 0.44626826, 0.7475345, -0.48467252, -0.449903, 1.0917208, -0.69620925, -0.06954458, 2.9978683, 0.75019634, 0.125394, 0.9145066, -0.4969485, -1.2131337, 0.91001576, -0.44880536, -0.8631775, 0.12489094, 0.9754693, -1.0512749, -1.0227627, -1.4563739, 0.57613415, -1.17674, 0.5863751, -1.135971, -1.0189716, 0.97162354, -0.12590012, -0.48907596, 0.95948434, 0.75333726, 1.1873552, 0.9862677, -0.24838619, 0.06623556, -1.3576442, -0.7126613, 1.0156839, -0.79187626, 1.0530996, 1.0628124, -0.8159258, 0.45452544, -0.69652796, -0.86891973, -0.9530688, 1.3680706, 0.40426767, -1.0055014, -1.1745039, 1.0408502, 0.91969836, 1.6155205, 1.0630862, -0.37694123, -1.2810433, 0.22246614, 0.8085475, 0.4435899, -1.1384326, -0.46422282, 0.27278215, -0.5482855, 1.0230165, -0.94515395, -0.50095826, -1.1314065, -0.9420252, -0.4880956, -0.7867681, 0.73658746, 0.79379964, 0.2323443, 0.09272547, -0.98298055, -0.8046533, 0.8286521, -0.03643306, 0.4276531, -0.4515318, 0.5571877, -0.9342172, -0.61979866, 0.7156777, -0.8130253, -1.0442865, 0.9156736, 0.717267, 0.59480786, 1.2033998, 0.6221499, 1.0478021, 0.025264855, 0.91080815, 1.1226137, 0.93722624, 0.6641795, -1.1973683, -1.1976366, 1.0134208, -0.34974545, 1.449464, 0.20638673, -1.2627841, 0.55824345, 1.2334596, -0.031782303, 1.4990013, -1.335929, 0.5644297, 1.4231839, 0.85846967, -0.46810144, -0.6278065, -0.98791033, 0.53745365, -0.9302846, -0.42149907, -1.2925684, 1.1204339, 1.1665803, -0.5393347, 0.7202316, 0.55063915, -1.6690077, 1.4200091, 0.87018764, 0.5202942, 1.3281891, 0.9693977, -0.82303476, 0.8247108, -1.0134943, -0.88957965, 1.2498592, 0.9127062, 0.4067937, 0.95493203, -0.68269694, 1.1074672, -1.0425894, -1.385579, 0.91394645, 0.026835332, -0.24733505, 0.14076377, -0.74559385, -0.9111513, 1.0868609, -0.1910863, 1.3735769, -1.0084283, 0.7115898, 0.048248805, -0.11674988, -1.1379899, 1.0188626, -0.5881415, -0.64003843, -0.6936606, -1.1194359, 1.0604124, 0.86692727, 0.94153285, 0.8304258, -0.8331244, 1.2980484, 0.5929704, 1.4770272, -0.6441699, -0.2695083, 0.2731384, 0.42594934, 0.7635955, -0.98444086, -0.4855164, -0.779772, -0.12730972, 0.51717246, -1.0376246, 0.5537622, 0.7899003, -0.8323328, 1.0303565, 0.5923937, 0.933843, 0.25442418, 0.77706325, -1.3281484, 0.7099526, 0.8262062, 0.033635452, 1.13173, -0.75053144, 0.94066554, 0.3211091, -0.77721906, -1.392867, 0.010067031, 1.5509887, 0.9220982, -0.5217237, 1.6772379, 1.164623, 0.31053764, -0.4886079, 0.41129935, -1.238869, 1.1531267, 0.48821735, 0.88529015, -1.0288792, -0.9684257, -1.7498183, -1.2961265, -0.593067, 0.8694372, -0.7399722, -0.5788159, -1.0669379, -1.4543222, 1.6602911, -0.9102792, -0.06659389, 0.30923966, -0.70115083, 0.7348248, -0.5247474, 0.8708107, 0.9368516, 0.74154866, 0.3447771, -0.30082798, 0.15862289, -1.8459849, -1.2463573, -0.40037802, -1.0074717, -0.7771617, 1.1538754, 1.0046571, 0.46987972, 0.55504256, -1.5791537, 0.7989442, 1.2199427, -1.0363538, 0.93281686, -0.688878, -0.060338728, -1.0114919, -1.1458683, -0.5473814, 0.80204785, 1.5371481, -0.7261681, -0.4851172, -1.2926977, 0.9709568, -0.7847037, -1.5369227, -0.20374928, -1.5836804, -0.9264395, -0.6108342, -0.32299593, 1.2240713, 0.97850645, -0.90826195, 0.07612049, -1.0206846, -0.318228, 1.487924, 0.3692756, -1.4002568, 0.99511284, 1.318411, -1.1914465, 0.5032353, 1.064621, -1.0030956, 0.9829583, 0.8856648, -1.33302, -0.72209, -0.04157682, 1.2440009, 1.2393625, 0.2886416, 0.6206437, -0.5815396, 0.9031422, 0.8255868, -0.6300444, 0.16981733, -0.35801452, 1.3663653, 0.8144522, 0.54241294, 0.49257767, -0.9121283, -0.24351737, 1.0587496, 0.91919076, 0.7241568, -1.1183374, -0.89552414, -1.3165512, 1.5234827, -0.95251274, 1.3848532, -0.5794025, -0.63843536, 0.5129102, -1.4932874, 1.2456204, -0.1452239, -0.15381654, 1.1221111, 0.82548696, -0.767515, 1.069161, -0.7970752, -0.8901244, -1.0312542, -0.56012404, 0.7666817, 1.0852522, -1.1904147, -0.349823, 1.5645549, 0.22918075, -0.97287196, -0.4273048, -0.37356308, 0.6680615, 0.61427003, 1.1796081, -1.3601689, -0.86887336, -1.2859998, 0.7396868, 1.3002213, 1.0458465, 0.3937132, 0.7872715, 0.2295203, 1.1925838, 0.6530343, 1.4181656, 0.95312256, -0.94565886, -1.1308355, 1.8290462, 0.22782576, 1.4105439, 0.8439394, 0.7532764, 0.23664361, -0.39907947, -1.2071787, -0.8466321, 1.490744, 0.64778525, -0.4873431, -0.62675756, 0.60301054, 0.61200166, 0.4446555, 0.3847718, -0.1740746, 1.1073234, -1.1838067, 1.1809046, 0.7275314, 0.21479675, -0.8858671, -0.5721728, 1.3259284, -0.4913506, -1.30686, -1.1022966, -0.07546669, 1.2364717, 0.7940519, -0.4298444, 0.49345127, 1.2839539, -0.84852195, 0.73305076, -1.6050748, 1.3949074, 1.2549095, 0.37480864, 0.5111143, 0.3679489, -1.1065509, 0.75824594, -0.5154471, -1.0927866, 0.60625875, -1.1716927, -0.10095149, -0.9611207, -0.4972728, 1.0454632, -0.6097337, 1.224261, -1.8338006, -0.759279, 0.76375514, -0.8899788, 0.2204391, -0.22518685, 1.1348156, -1.0030091, -0.51831853, -0.473489, -1.094192, -0.2244385, -0.9522055, 0.7250009, 1.3202968, -1.347448, -0.00682122, -1.0637556, 0.8732655, 0.3214113, 0.31537902, -0.5213647, 1.0924945, -0.5949549, 1.0889488, 1.3964772, -1.0706928, 1.2227982, 0.47648025, 0.249454, -0.6381074, -0.5071034, -1.1059958, 0.11651123, 1.1316079, -0.99526596, 1.5460562, -0.8885702, -0.23123887, -0.3422146, -0.361622, 0.38904753, -1.1980567, 0.2246741, 0.114914626, -1.0026543, -0.47258735, -1.5819322, -0.70607847, 1.6110497, 0.00077844365, -0.2587264, 1.0490243, 1.2989204, -0.12847427, 0.58859986, -1.1419909, -0.8836006, -1.186293, 0.65048933, 0.24735998, 0.9162932, -0.26267067, 0.99354374, -0.14246747, -1.337546, 1.465483, 1.7388676, -0.25175485, -0.6487869, 1.2996966, -0.9823173, 0.21432222, 0.5002786, -0.33344144, 1.4739081, -0.97481656, -0.8176734, -0.029510807, -0.3349418, 0.9631386, -1.3238381, 0.43120983, 1.4216945, 1.3060118, -0.49247098, -0.83920306, 0.05867204, -0.4130776, 1.4134736, -1.2606735, -1.379768, -0.89578974, 1.6235654, -0.4616105, -0.0038944362, 1.5397222, -0.70844895, -1.1354432, 1.2232187, 0.13001268, -1.2549437, -1.0528281, 0.75804764, -0.9813103, 0.9382494, -1.1996161, 0.45661706, 1.2729166, 1.0756954, -0.83112234, 0.85983866, -1.1648258, 0.3636405, 0.44991896, 0.41953886, -1.0077246, 0.73936856, 1.407211, -0.5478573, 0.7390797, -1.4556971, -0.67495036, 1.0599371, 1.3041323, -0.6659844, 0.28484756, 0.6232832, 1.1961219, -1.0349804, 0.74732244, 1.1717721, 0.83979875, 0.73770314, 0.08186959, 0.88221216, 0.29308024, 0.9282737, 1.1204447, 0.32133394, 0.8867231, -0.549089, 1.26942, 1.2721323, -0.20674826, 0.9404688, 0.3588875, 0.8036405, 1.1794498, -1.2326838, -0.0016799815, -0.9275361, -1.0847015, 1.2900707, 0.5084949, 0.3087612, -1.3928734, -0.64008915, 0.38540354, 0.5003623, 0.8500043, -0.040981553, 0.303425, -1.4669325, 1.1885654, -1.0440923, 1.1467004, 0.20069677, 1.3885065, -0.7070901, 1.6157149, 0.058300965, 0.19255419, -1.0380046, -0.30392313, -0.6898773, 0.8613456, -1.2410963, 0.6885903, 1.727385, -0.70820785, -1.8392322, -0.049313467, -0.47853327, -0.8965066, -0.25014272, -0.42827353, -1.1673878, -0.96633726, -1.0536015, -0.93622154, 0.44484338, -0.91560435, 0.6860719, -0.718573, -0.45124966, -1.3989682, -1.0470843, 0.12585801, 0.43918514, 0.9691126, -0.9515827, 0.17237844, -0.033144075, -0.931006, -1.1624345, 0.8878611, -0.6228427, 0.6344255, 0.6512033, 0.013417202, -0.32047543, 0.44226727, -0.6914507, 0.43110248, -1.1827755, 0.6404475, -1.2251108, 0.635943, -0.864836, 1.0085298, 1.5365117, 1.4169931, 0.70141566, -1.2154723, 1.1058112, -1.3170611, 0.5581385, 1.1882207, -0.06736812, 0.80386907, 0.71790844, -0.15626015, 1.607935, -0.87190443, -0.9190188, 1.3507566, 0.74675775, -0.024656838, -0.549136, -0.5905573, 1.0464917, 0.6101517, 0.5389773, 0.047895007, -0.8835471, 0.017117959, -0.7992455, -0.93491757, -1.2460477, -0.20917778, -0.9874963, -0.42742068, 1.504626, -0.69440705, 0.924317, 0.13747713, 1.1201704, -0.043200467, -0.24452381, 0.60838556, 1.7648538, -1.0373474, 0.5702327, -0.2676288, 0.17249706, -0.16426125, -0.47986677, 0.8497351, 1.180062, 0.86797863, 0.08763158, -1.2276117, -0.87860346, -0.5335737, 0.3895516, 0.5088431, 1.1571109, 1.7138729, 1.3660889, -0.9014943, 1.132069, 0.42892826, 1.4077663, -0.96607864, 1.1366296, -0.2769691, 0.96830356, 1.458905, -1.1027625, -0.9592205, -0.7927941, -1.3055602, 0.60324997, -0.23637909, -1.073085, -0.65801567, -0.24686138, 0.9123749, 1.1892259, 1.1553364, -0.6336213, -0.89475864, 0.84944785, 0.07946607, 0.66466117, 0.9634099, -0.49143565, -1.4582283, 0.7852337, 0.653188, -1.6015751, 1.6223822, 0.21641822, 1.1160529, 0.3350185, -0.871117, -0.19447485, 1.2419462, -0.7067386, -0.7008208, 1.1129746, 0.5484579, -1.1759691, -0.97495323, -0.7514766, 0.26949126, 0.8319864, -1.0001616, -0.80106765, -0.03396702, -0.06683501, 0.35243213, -0.67888933, 0.9210326, 0.79878956, -1.4471369, -0.3757163, 0.5999615, -0.26808587, 0.21173881, -0.9493808, -0.92164385, 0.18666112, 0.6982991, 1.3941333, 0.45097625, 0.41749838, 1.3971432, -0.9210779, 0.2760519, 1.2548108, -1.1551992, 1.189978, -0.15793107, -1.0925454, -0.50655675, 0.16109832, -0.483928, 0.6257531, -1.2754222, 0.34070277, 0.949945, 1.2273954, -0.48718858, -1.6623446, -1.4859176, -1.0051237, -0.43972638, 1.3008858, 0.09617482, -1.0950683, 1.3495783, -1.421531, -0.6260807, 0.47823215, 1.314642, 0.4517159, 0.33891934, 0.68290097, -0.24143067, -1.259256, -1.0258611, -0.9733063, -0.005350418, -0.5702324, 1.3608985, 0.7136956, 0.33872092, -0.6118658, -0.6919142, 1.0129464, -0.054072447, -0.32522976, 0.38882115, 0.038923558, -0.2270128, -0.48288947, -0.76423544, -0.8744727, -1.0494821, -1.5547129, 0.95957667, 0.09876617, -0.96747005, 1.3771813, -1.1080487, -1.1636432, -0.06964478, -1.2853911, -0.6074572, -0.9616713, -0.5230714, -1.4910866, 1.0754834, 1.086036, -0.69136345, -0.5027798, 1.391091, -0.38499552, -0.27820748, -0.6560959, 0.16870533, 0.54788315, -0.08157776, 1.183537, 1.2169349, 1.4522591, 1.2047628, 0.94642854, 1.3576034, 0.7772096, 0.9614262, 1.0634707, -0.7145741, 0.5610829, -1.4340839, 0.68274903, -1.1187745, 1.4752103, -0.32625246, -0.9193434, -0.66610634, 0.9768952, 0.92902493, 0.005445936, -0.8710849, -0.95166343, 1.049648, 0.20317784, -0.34394538, -1.375114, 0.9542449, -1.2929862, 0.5113058, 1.3339517, 0.38516942, 1.2238649, -0.46527293, -0.7735048, -1.2179259, 1.2159121, 0.7302934, -0.92575264, -0.21708098, -0.7276071, -0.5112138, -1.092147, 0.5876363, -0.5115473, 0.5396528, -1.4699118, -0.9575002, 1.0864569, -0.9793392, -0.60927576, 0.9173635, -0.7541307, -0.5484589, 1.0768132, -0.907679, 0.52865386, 0.20116684, 0.97758317, -1.0472876, 1.3938072, -0.573382, 1.1815387, -1.2486845, 0.5088983, -1.529363, -0.91750824, -1.3734273, -1.1898445, -1.0383991, -1.1493123, 0.6612782, 1.1251152, -0.30432937, -0.26948416, -0.2374481, -0.6489944, 1.4283582, -1.2245215, 1.480894, 1.3898773, 0.24905565, 0.05186177, -0.5181066, -1.1203187, -0.70705, 0.97133857, -0.28043237, -1.6446239, -0.7908936, 1.3427302, 0.15277018, 0.95124793, -1.3736421, 0.3832576, -0.056416027, -0.951169, 0.31738105, -0.037948854, -0.31478465, 0.12009812] <python code> import base64 import json import http.client class CompletionExecutor: def __init__(self, host, api_key, api_key_primary_val, request_id): self._host = host self._api_key = api_key self._api_key_primary_val = api_key_primary_val self._request_id = request_id def _send_request(self, completion_request): headers = { 'Content-Type': 'application/json; charset=utf-8', 'X-NCP-CLOVASTUDIO-API-KEY': self._api_key, 'X-NCP-APIGW-API-KEY': self._api_key_primary_val, 'X-NCP-CLOVASTUDIO-REQUEST-ID': self._request_id } conn = http.client.HTTPSConnection(self._host) conn.request('POST', '/testapp/v1/api-tools/embedding/clir-emb-dolphin/0d8d9840a285467fa0e146b680576ae1', json.dumps(completion_request), headers) response = conn.getresponse() result = json.loads(response.read().decode(encoding='utf-8')) conn.close() return result def execute(self, completion_request): res = self._send_request(completion_request) if res['status']['code'] == '20000': return res['result']['embedding'] else: return 'Error' if __name__ == '__main__': completion_executor = CompletionExecutor( host='clovastudio.apigw.ntruss.com', api_key='(보안상 생략)', api_key_primary_val = '(보안상 생략)'', request_id='(보안상 생략)'' ) request_data = json.loads("""{ "text" : "안양에 자바 개발자 경력 10년 미만 채용정보 추천해줘" }""", strict=False) response_text = completion_executor.execute(request_data) print(request_data) print(response_text) print("End") Edited April 11 by Trinity 링크 복사 다른 사이트에 공유하기 More sharing options...
Trinity Posted April 11 Author 공유하기 Posted April 11 앱 임베딩으로 생성해서, 그런가 보네요.. ^^ 그런데 중요한 문의사항이 있습니다. 외부 정보(text)를 HCX에 집어넣어서, 답변할 때 참조하게 하고 싶습니다. 임베팅으로 vector를 만들수는 있는거 같은데, 이것으로 RAG 구성을 어떻게 해야 하나요? RAG기능을 클로바나 클로바API에서 제공하나요? 링크 복사 다른 사이트에 공유하기 More sharing options...
William Posted April 16 공유하기 Posted April 16 답변이 늦어서 죄송합니다. 임베딩이라는 것이 TEXT를 Vector화한 수치 값으로 만드는 것이기에 위의 내용이 정상인 상화입니다. 외부 정보(URL, File)같은 경우에는 실제로 해당 사이트의 정보를 가져와서, vector하거나 참조하고자 하는 파일을 별도로 가져와서 답변을 해주셔야 합니다. 이부분은 또한 Langchain 역할과도 같은데요. 이 부분에 대한 지원도 빠르게 진행 예정에 있습니다. 참고 부탁 드립니다. 링크 복사 다른 사이트에 공유하기 More sharing options...
CLOVA Studio 운영자9 Posted November 8 공유하기 Posted November 8 안녕하세요 @Trinity님, 질의응답 중 언급된 CLOVA Studio-LangChain(랭체인) 연동 지원 건과 관련하여, 최신 버전의 langchain-community (>= 0.3.4) 파이썬 패키지를 설치하시면 CLOVA Studio를 랭체인에 연동하여 이용하실 수 있는 점 안내드립니다. 아래 관련 가이드 문서 및 쿡북, 랭체인 문서 참고 부탁드립니다. CLOVA Studio에 계속해서 많은 관심 부탁드리며, 이용중에 궁금하신 점이나 개선 의견이 있으시면 언제든지 편히 말씀주십시오. 감사합니다! [참고] NCP 사용 가이드: https://guide.ncloud-docs.com/docs/clovastudio-dev-langchain 랭체인 활용 RAG 구현 쿡북: https://www.ncloud-forums.com/topic/422 LangChain 관련 문서: https://python.langchain.com/docs/integrations/providers/naver/ 링크 복사 다른 사이트에 공유하기 More sharing options...
Recommended Posts
게시글 및 댓글을 작성하려면 로그인 해주세요.
로그인