4 inches , how tall am I in centimeters ? "}, 4 {'question ': "Who was the 12th person on the moon?"} 5 ] 6 res = llm_chain.invoke(qs) 7 print(res) ˛ ࣮ߦ݁Ռ The New Orleans Saints did not win the Super Bowl in the 2010 season. It was actually the Pittsburgh Steelers who won the Super Bowl XLV in that year , defeating the Green Bay Packers. To convert your height from feet and inches to centimeters : First , multiply your height in inches by 2.54 (since one inch is equal to 2.54 centimeters ). Then add any extra inches converted fully into centimeters . So for someone who is 6 ft 4 inches tall , it would be calculated as follows: (6 feet * 12 inches/foot) + 4 inches = 76 inches 76 inches * 2.54 cm/inch = 193.04 centimeters Therefore , a person who is 6 ft 4 inches tall is approximately 193 centimeters tall. Neil Armstrong was the first person to step onto the moon 's surface during the Apollo 11 mission in July 1969 and he wasn 't specifically the 12th man on a lunar expedition , but as part of the Apollo 11 crew with Buzz Aldrin. 2.3 CharacterTextSplitter LangChain ʹ RAG ͳͲΛ࣮͢Δࡍʹߦ͏ςΩετׂͷػೳ (Text Splitters) ͕༻ҙ͞Ε͍ͯ·͢ɻϓϩάϥϜ 2.8 จࣈʹԊͬͯςΩετ ͷׂΛߦ͏ CharacterTextSplitter ͷαϯϓϧίʔυͰ͢*3 ɻ ˛ϓϩάϥϜ 2.8 CharacterTextSplitter ᶃ 1 from langchain_text_splitters import CharacterTextSplitter 2 3 text = " ޗ ഐ ೣ Ͱ ͋ Δ ɻ ໊ લ · ͩ ͳ ͍ ɻ " 4 5 text_splitter = CharacterTextSplitter ( *3 Ҏޙ 2.3 અͷϓϩάϥϜͰ from langchain_text_splitters import Characte rTextSplitter Λলུ͠·͢ɻ 19
ͷϝιουͱඞͣ͠Ұக͠ͳ͍͜ͱ͓͑ͯ͘ͱྑ͍ͱࢥ͍· ͢*5 ɻ 2.5 TextLoader TextLoader ֎෦ͷςΩετϑΝΠϧΛಡΈࠐΉࡍʹ༻͍ΔػೳͰ͢ɻ ಡΈࠐΈݩͷςΩετϑΝΠϧ͕ඞཁͳͷͰ texts σΟϨΫτϦΛ࡞͠ɺ ԼهΛ./texts/sample.txt ʹอଘ͠·͢*6 ɻ ˛ ./texts/sample.txt The nearest neighbor algorithm was one of the first algorithms used to solve the travelling salesman problem approximately . In that problem , the salesman starts at a random city and repeatedly visits the nearest city until all have been visited. The algorithm quickly yields a short tour , but usually not the optimal one. In computer science , Monte Carlo tree search (MCTS) is a heuristic search algorithm for some kinds of decision processes , most notably those employed in software that plays board games. In that context MCTS is used to solve the game tree. In statistical modeling , regression analysis is a set of statistical processes for estimating the relationships between a dependent variable (often called the 'outcome ' or 'response ' variable , or a ' label ' in machine learning parlance) and one or more independent variables (often called 'predictors ', 'covariates ', 'explanatory variables ' or 'features '). The most common form of regression analysis is linear regression , in which one finds the line (or a more complex linear combination ) that most closely fits the data according to a specific mathematical criterion. For example , the method of ordinary least squares computes the unique line (or hyperplane) that minimizes the sum of squared differences between the true data and that line (or hyperplane). *5 Python ίʔυͷׂΛ A ͰऔΓѻ͍·͕͢ɺׂʹ༻͍Δ from_language Re cursiveCharacterTextSplitter ʹଘࡏ͢ΔҰํͰ CharacterTextSplitter ʹ ଘࡏ͠·ͤΜɻ͜ͷΑ͏ʹ RecursiveCharacterTextSplitter ͱ CharacterText Splitter ͷػೳࣅ௨͍ͬͯΔҰํͰඞͣ͠Ұக͠ͳ͍ͱ͍͏ͷҙ͓ͯ͘͠ͱ ྑ͍ͱࢥ͍·͢ɻ *6 ͜ͷςΩετ Wikipedia ͷ Nearest Neighbor ๏ɺMCTSɺճؼੳͷهࣄͷຊจ ͷҰ෦Ͱ͢ɻ 26
ςΩετͷಡΈࠐΈ 1 from langchain_community . document_loaders import TextLoader 2 3 loader = TextLoader("./ texts/sample.txt") 4 documents = loader.load () 5 6 print(type(documents)) 7 print(len(documents)) 8 print(documents) ˛ ࣮ߦ݁Ռ <class 'list '> 1 [Document(metadata ={'source ': './ texts/sample.txt '}, page_content ="The nearest neighbor algorithm was one of the first algorithms used to solve the travelling salesman problem approximately . In that problem , the salesman starts at a random city and repeatedly visits the nearest city until all have been visited. The algorithm quickly yields a short tour , but usually not the optimal one .\n\nIn computer science , ... ϓϩάϥϜ 2.14 ͷ documents ͷதΛ֬ೝ͢Δʹ͋ͨͬͯɺϓϩάϥ Ϝ 2.15 Λ࣮ߦ͢Δͱྑ͍Ͱ͢ɻ ˛ϓϩάϥϜ 2.15 ϓϩάϥϜ 2.14 ͷ documents ͷதͷ֬ೝ 1 print(documents [0]. metadata) 2 print(len(documents [0]. page_content )) ˛ ࣮ߦ݁Ռ {'source ': './ texts/sample.txt '} 1322 ϓϩάϥϜ 2.15 ͷΑ͏ʹ metadata page_content Λࢦఆ͢Δ͜ͱͰ ಡΈࠐΜͩςΩετಡΈࠐΈݩʹ͍ͭͯ֬ೝ͢Δ͜ͱ͕Ͱ͖·͢ɻ 27