当前位置:   article > 正文

借助知识图谱和Llama-Index实现基于大模型的RAG-下

图索引 大模型

来自:爱吃牛油果的璐璐

58bcc6dec49d0f2f38b0de63dc0378fc.png

7、构建知识图谱索引

  1. #setup the service context
  2. service_context = ServiceContext.from_defaults(
  3.     chunk_size=256,
  4.     llm=llm,
  5.     embed_model=embed_model
  6. )
  7. #setup the storage context
  8. graph_store = SimpleGraphStore()
  9. storage_context = StorageContext.from_defaults(graph_store=graph_store)
  10. #Construct the Knowlege Graph Undex
  11. index = KnowledgeGraphIndex.from_documents( documents=documents,
  12.                                            max_triplets_per_chunk=3,
  13.                                            service_context=service_context,
  14.                                            storage_context=storage_context,
  15.                                           include_embeddings=True)

8、从文档中创建知识图谱

  1. Text: page_label: 2
  2. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  3. What is an ESOP?
  4. Triplets:
  5. (page_label, is, 2)
  6. (ESOP, is, What is an ESOP?)
  7. ---------------------
  8. Text: page_label: 3
  9. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  10. Why Offer an ESOP?
  11. Triplets:
  12. (page_label, is, 3)
  13. (ESOP, is, Why Offer an ESOP?)
  14. ---------------------
  15. Text: page_label: 4
  16. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-P
  17. (page_label, is, part of)
  18. (page_label, is, Table of Contents)
  19. (file_path, is, path of)
  20. (file_path, is, /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf)
  21. (ESOP, is, part of)
  22. (ESOP, is, Intro to Options Plans)
  23. (Option, is, part of)
  24. (Option, is, Intro to Options Plans)
  25. (Lifecycle of a Startup ESOP, is, part of)
  26. (Lifecycle of a Startup ESOP, is, Intro to Options Plans)
  27. (Common Terms in an Options Package, is, part of)
  28. (Common Terms in an Options Package, is, Intro to Options Plans)
  29. (Why Issue Options to Employees, is, part of)
  30. (Why Issue Options to Employees, is, Intro to Options Plans)
  31. (A Defining Characteristic of Startup Culture, is, part of)
  32. (A Defining Characteristic of Startup Culture, is, Why Issue Options to Em
  33. (ESOP, is, equity compensation plan)
  34. (ESOP, is, employee stock option plan)
  35. (ESOP, is, part of startup culture)
  36. (ESOP, is, necessary part of capital structure)
  37. (ESOP, is, defined characteristic of startup culture)
  38. (ESOP, is, defined characteristic of startup culture)
  39. (ESOP, is, defined characteristic of startup culture)
  40. (ESOP, is, defined characteristic of startup culture)
  41. (ESOP, is, defined characteristic of startup culture)
  42. (ESOP, is, defined characteristic of startup culture)
  43. (ESOP, is, defined characteristic of startup culture)
  44. (ESOP, is, defined characteristic of startup culture)
  45. (ESOP, is, defined characteristic of startup culture)
  46. (ESOP, is, defined characteristic of startup culture)
  47. (ESOP, is, defined characteristic of startup culture)
  48. (ESOP, is, defined characteristic of startup culture)
  49. (ESOP, is, defined characteristic of startup culture)
  50. (ESOP, is, defined characteristic of startup culture)
  51. (ESOP, is, defined characteristic of startup culture)
  52. (ESOP, is, defined characteristic of startup culture)
  53. (page_label, is, 3)
  54. (INTRO TO OPTIONS PLANS, is, Part I)
  55. ---------------------
  56. Text: The 2018 Annual Report of the Board of Trustees of the University of Arkansas System is presented here as a PDF file.
  57. Triplets:
  58. (The, is, PDF file)
  59. (The, is presented, here)
  60. (The, is, The 2018 Annual Report of the Board of Trustees of the University of Arkansas System)
  61. ---------------------
  62. Text: The 2018 Annual Report of the Board of Trustees of the University of Arkansas System is presented here as a PDF file.
  63. Triplets:
  64. (The, is, PDF file)
  65. (The, is presented, here)
  66. (The, is, The 2018 Annual Report of the Board of Trustees of the University of Arkansas System)
  67. ---------------------
  68. Text: The 2018 Annual Report of the Board of Trustees of the University of Arkansas System is presented here as a PDF file.
  69. Triplets:
  70. (The, is, PDF file)
  71. (The, is presented, here)
  72. (The,
  73. (ESOP, is, Employee Stock Options Plan)
  74. (ESOP, is, allocation)
  75. (ESOP, is, plan)
  76. ---------------------
  77. Text: page_label: 5
  78. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  79. What is an ESOP?  
  80. •An Employee Stock Options Plan (ESOP)  
  81. •An allocation  of shares that will be granted to employees in the future
  82. in the form of stock options  
  83. –How much equity should we set aside for employees?  
  84. •A plan for how these options will be distributed:  
  85. –How many shares will individual employees receive?  
  86. –What terms will govern these grants?  
  87. •The plan is as important as the allocation!
  88. Triplets:
  89. (ESOP, is, allocation)
  90. (ESOP, is, plan)
  91. (ESOP, is, important)
  92. ---------------------
  93. Text: page_label: 6
  94. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-
  95. (Option, is, effective form of equity ownership)
  96. (Option, has, intrinsic value)
  97. (Option, is, locked-in price for shares)
  98. ---------------------
  99. Text: page_label: 1
  100. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  101. What is an ESOP?  
  102. •What is an ESOP?  
  103. –A qualified retirement plan  
  104. –A tax-qualified defined contribution plan  
  105. –A plan that is primarily designed to
  106. provide retirement benefits to employees  
  107. –A plan that is primarily designed to
  108. provide benefits in the form of stock  
  109. –A plan that is primarily designed to
  110. provide benefits in the form of stock  
  111. –A plan that is primarily designed to
  112. provide benefits in the form of stock  
  113. –A plan that is primarily designed to
  114. provide benefits in the form of stock  
  115. –A plan that is primarily designed to
  116. provide benefits in the form of stock  
  117. –A plan that is primarily designed to
  118. provide benefits in the form of stock  
  119. (Option, is, right to purchase)
  120. (Option, is, set price)
  121. (Option, is, certain period of time)
  122. ---------------------
  123. Text: page_label: 1
  124. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  125. What is an ESOP?  
  126. •What is an ESOP?  
  127. –A qualified retirement plan  
  128. –A tax-qualified plan that meets
  129. ERISA requirements  
  130. –A plan that is primarily designed
  131. to provide retirement benefits to
  132. employees  
  133. –A plan that is primarily designed
  134. to provide benefits in the form
  135. of employer securities  
  136. –A plan that is primarily designed
  137. to provide benefits in the form
  138. of employer securities that are
  139. acquired through purchase,
  140. receipt from a corporate parent,
  141. or through the accumulation of
  142. distributions on employer securities  
  143. –A plan that is primarily designed
  144. to provide benefits in the form
  145. of employer securities that are
  146. acquired through the accumulation
  147. of
  148. (Lifecycle of a Startup ESOP, involves, founders and early investors)
  149. (Lifecycle of a Startup ESOP, involves, management and the Board of Directors)
  150. (Lifecycle of a Startup ESOP, involves, employees)
  151. (Employees, receive, options packages)
  152. (Options, are, exercised)
  153. (Options, are, granted)
  154. (Options, are, issued)
  155. (Options, are, marketable)
  156. (Options, are, forfeitable)
  157. (Options, are, vested)
  158. (Shares, are, acquired)
  159. (Shares, are, granted)
  160. (Shares, are, marketable)
  161. (Shares, are, owned)
  162. (Shares, are, vested)
  163. (Strike price, is, paid)
  164. (Strike price, is, set)
  165. (Strike price, is, specified)
  166. ---------------------
  167. Text: page_label: 11
  168. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  169. Lifecycle of a Startup ESOP  
  170. •Found
  171. (Common Terms in an Options Package, is, Number of Shares)
  172. (Common Terms in an Options Package, is, Strike Price)
  173. (Common Terms in an Options Package, is, Vesting Schedule)
  174. (Common Terms in an Options Package, is, Cliff Period)
  175. (Common Terms in an Options Package, is, Expiration Date)
  176. ---------------------
  177. Text: page_label: 1
  178. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  179. Executive Summary  
  180. This document outlines the best practices for designing and implementing an employee stock option plan (ESOP) for a private company. The document is intended to provide a framework for designing an ESOP that is tailored to the specific needs of the company and its employees. The document is not intended to be a comprehensive guide to ESOP design, but rather a high-level overview of the key considerations that should be taken into account when designing an ESOP.
  181. Triplets:
  182. (Executive Summary, is, High-level overview)
  183. (Executive Summary, is, Key considerations)
  184. (Executive Summary
  185. (Why Issue Options to Employees?, attracts, top recruits)
  186. (Why Issue Options to Employees?, retains, employees)
  187. (Why Issue Options to Employees?, aligns, incentives)
  188. (Why Issue Options to Employees?, rewards, value creation)
  189. (Why Issue Options to Employees?, encourages, long -term thinking)
  190. ---------------------
  191. Text: page_label: 10
  192. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  193. How Should Options Be Granted?  
  194. •At the Right Time:  options should be granted at the right time in the
  195. company’s life cycle, when the company has achieved a certain level
  196. of success and the value of the company is clear  
  197. •At the Right Price:  options should be granted at a fair price, based on
  198. the company’s valuation at the time of grant  
  199. •At the Right Size:  options should be granted in the right size, based
  200. on the employee’s role and contribution to the company  
  201. Triplets:
  202. (
  203. (Startups, are, unique case)
  204. (Startups, use, options)
  205. (Startups, seeking to achieve, big exit)
  206. ---------------------
  207. Text: page_label: 10
  208. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  209. The defining difference between Silicon Valley companies and almost
  210. every other industry in the U.S. Is the virtually universal practice among
  211. tech companies of distributing meaningful equity (usually in the form of
  212. stock options) to ordinary employees .  A Defining Characteristic of Startup Culture  
  213. Steven Johnson, Technology Writer  
  214. •Startups are a unique case . Unlike at larger corporations, employee
  215. ownership is an essential element of startup communities and culture  
  216. –As high -risk/high -reward enterprises, startups use options to align
  217. employee compensation with the risk -prone mentality of the
  218. business  
  219. –Startups seeking to achieve a “big exit” use options to align all
  220. employees to drive toward this desired outcome
  221. Triplets:
  222. (Startups
  223. (ESOP, is, necessary part of, capital structure)
  224. (VCs, require, ESOPs)
  225. (Startups, are compelled, to offer, options packages)
  226. ---------------------
  227. Text: page_label: 11
  228. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  229. The ESOP as a Recruitment and Retention Tool  
  230. •ESOPs are a critical tool for recruiting and retaining employees
  231. –In a competitive job market, ESOPs can be used to attract top talent
  232. –In a tight labor market, ESOPs can be used to retain key employees
  233. –In a volatile market, ESOPs can be used to retain employees during
  234. a downturn  
  235. –In a high-growth company, ESOPs can be used to retain employees during
  236. a period of rapid expansion  
  237. –In a company with a high employee turnover rate, ESOPs can be used to
  238. reduce turnover and associated costs  
  239. –In a company with a high executive turnover rate, ESOPs can be used to
  240. (page_label: 11, is, stage)
  241. (stage, is, pre-seed)
  242. (stage, is, seed)
  243. (stage, is, early -vc)
  244. ---------------------
  245. Text: page_label: 11
  246. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  247. page_label: 12
  248. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  249. page_label: 13
  250. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  251. page_label: 14
  252. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  253. page_label: 15
  254. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices
  255. (ESOP, is necessary for, Pre-seed)
  256. (ESOP, is not necessary for, Pre-seed)
  257. (ESOP, can be helpful for, Pre-seed)
  258. (ESOP, is not necessary for, Seed)
  259. (ESOP, is required for, Early -VC)
  260. (ESOP, must be created for, Early -VC)
  261. (ESOP, serves as a guideline for, Early -VC)
  262. (ESOP, is important to have standardized for, Late-VC)
  263. (ESOP, is gone for, Growth)
  264. (ESOP, shares remaining are more valuable for, Growth)
  265. (ESOP, is used to allow new hires to share in the upside for, Growth)
  266. (ESOP, should be set up between, Pre-seed and, Early -VC)
  267. ---------------------
  268. Text: page_label: 12
  269. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  270. How Much Equity Should You Grant?  
  271. Stage  Considerations  Takeaway  
  272. Pre-seed  Found
  273. (Communicating options to employees, can be communicated, % versus $)
  274. (Communicating options to employees, can be communicated, %)
  275. (Communicating options to employees, can be communicated, $)
  276. (Communicating options to employees, can be communicated, 0.5%)
  277. (Communicating options to employees, can be communicated, $200,000)
  278. ---------------------
  279. Text: page_label: 13
  280. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  281. Exercise Price: Market Price vs. Discount  
  282. When setting the exercise price for options, there are two
  283. approaches: (1) set the price equal to the market price of
  284. the stock at the time of grant, or (2) set the price at a
  285. discount to the market price.  
  286. Market Price:  
  287. •Fair to employees and the company  
  288. •No tax deduction for company
  289. •Employees can sell immediately
  290. •Employees can exercise immediately
  291. Discount:
  292. (Communication of options packages, recommended, dollar value)
  293. (Communication of options packages, recommended against, percent of the company)
  294. (Communication of options packages, effective when, dollar value)
  295. ---------------------
  296. Text: page_label: 13
  297. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  298. or (2) a dollar value based on the
  299. current valuation; we encourage the latter when possible  
  300. % $
  301. “We are granting you options equivalent to
  302. 0.5% of the company’s equity”  
  303. Considerations:  
  304. •At an early stage, the only way
  305. to communicate options grants given no true
  306. valuation of the company  
  307. •Hard for employees to grasp  what they
  308. are really getting (“0.5% seems too little”)  
  309. •Invites a negotiation  about what percent
  310. of the company an employee really
  311. deserves  “We are granting you options equivalent to
  312. $200,000 of company stock”  
  313. Considerations
  314. (page_label, is, 12)
  315. (file_path, is, /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf)
  316. (5%, is, equivalent to)
  317. (5%, is, $200,000 of company stock)
  318. (Considerations, is, highly effective way to communicate the true value of an options grant)
  319. ---------------------
  320. Text: The 2018 FIFA World Cup was the 21st FIFA World Cup, an international men's football tournament contested by the national teams of FIFA member associations. It took place in Russia from 14 June to 15 July 2018. It was the first World Cup to be held in Eastern Europe, and the 11th time that it had been held in Europe. At an estimated cost of over $14.2 billion, it is the most expensive World Cup.
  321. Triplets:
  322. (2018 FIFA World Cup, is, 21st FIFA World Cup)
  323. (2018 FIFA World Cup, took place in, Russia)
  324. (201
  325. (HOW MUCH TO GRANT, Part II, )
  326. ---------------------
  327. Text: page_label: 13
  328. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  329. HOW MUCH TO GRANT  Part II
  330. Triplets:
  331. (HOW MUCH TO GRANT, Part II, )
  332. ---------------------
  333. Text: page_label: 13
  334. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  335. HOW MUCH TO GRANT  Part II
  336. Triplets:
  337. (HOW MUCH TO GRANT, Part II, )
  338. ---------------------
  339. Text: page_label: 13
  340. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  341. HOW MUCH TO GRANT  Part II
  342. Triplets:
  343. (HOW MUCH TO GRANT, Part II, )
  344. ----------------
  345. (Two Approaches, is, reality)
  346. (Creating an ESOP, requires, a combination of top-down and bottom -up planning)
  347. (Decide the total amount of equity to be granted, is, part of creating an ESOP)
  348. (Allocate these shares to employees over time, is, part of creating an ESOP)
  349. (Decide the appropriate size of individual equity grants by position, is, part of creating an ESOP)
  350. (Issue these shares as employees are hired, is, part of creating an ESOP)
  351. ---------------------
  352. Text: page_label: 15
  353. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  354. Two Approaches  
  355. In reality, creating an ESOP will require a combination of
  356. top-down and bottom -up planning  Top Down  Bottom Up  
  357. Decide the total amount of
  358. equity to be granted; allocate
  359. these shares to employees
  360. over time  Decide the appropriate size of
  361. individual equity grants by
  362. position; issue these shares as
  363. employees are
  364. (Top -Down Process, consists of, determining)
  365. (Top -Down Process, consists of, creating)
  366. (Top -Down Process, consists of, scheduling)
  367. Text: page_label: 16
  368. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  369. The Bottom -Up Process  
  370. 1.Determine the number of shares to be granted to each employee  
  371. 2.Determine the grant date  
  372. 3.Determine the vesting schedule  
  373. Triplets:
  374. (Bottom -Up Process, consists of, determining)
  375. (Bottom -Up Process, consists of, determining)
  376. (Bottom -Up Process, consists of, determining)
  377. Text: page_label: 17
  378. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  379. The Bottom -Up Process (continued)  
  380. 1.Determine the exercise price  
  381. 2.Determine the expiration date  
  382. Triplets:
  383. (Bottom -Up Process, consists
  384. (page_label, is, 16)
  385. (page_label, represents, how much equity to set aside in the esop)
  386. (page_label, has, values of 15-20% for generally non-founder employees)
  387. ---------------------
  388. Text: The 2018-19 budget for the Department of Energy (DOE) includes $3.7 billion for the Office of Science (SC), an increase of $645 million (21.1%) over the 2018 enacted level.
  389. Triplets:
  390. (The, 2018-19 budget for the Department of Energy, includes, $3.7 billion for the Office of Science)
  391. (The, 2018-19 budget for the Department of Energy, is, an increase of $645 million over the 2018 enacted level)
  392. (The, 2018-19 budget for the Department of Energy, represents, a 21.1% increase over the 2018 enacted level for the Office of Science)
  393. ---------------------
  394. Text: The 2018
  395. (page_label, is, 16)
  396. (file_path, is, /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf)
  397. (no, is, 0)
  398. (technology emphasis, is, 0)
  399. (geographic focus, is, region that is not considered a startup hub)
  400. (hiring needs, are primarily, administrative or back -office team members)
  401. (percentage of company issued to non founder employees, is between, 15% and 20%)
  402. (founders, are, top managers, but hire others to fill key technical or functional roles)
  403. (dna of the company, is, applying technology to a non -technical industry)
  404. (geographic focus, is, either wholly or partially in a startup hub)
  405. (hiring needs, are primarily, sales and marketing team members)
  406. (founders, are not top managers in the business, or plan to step aside)
  407. (dna of the company, is, technology, engineering, or data science)
  408. (geographic focus, is, in a leading startup hub such as sf,
  409. (page_label, is, 16)
  410. (file_path, is, /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf)
  411. (companies, issue, up to 25%)
  412. (founders, are, top managers)
  413. (founders, are not, top managers in the business, or)
  414. (DNA, is, in applying technology to a non -technical industry)
  415. (DNA, is, in technology, engineering, or data science)
  416. (geographic focus, is, wholly or partially in a startup hub)
  417. (geographic focus, is, in a leading startup hub such as SF, NYC or Boston)
  418. (hiring needs, are, primarily sales and marketing team members)
  419. (hiring needs, are, primarily engineering, development, or technical team members)
  420. ---------------------
  421. Text: The 2018-19 season of the National Basketball Association (NBA) is the 72nd season of the National Basketball Association.
  422. Triplets:
  423. (2018-19 season, is, the 7
  424. (Typical Distribution Schedule, consists of, Seniority)
  425. (Typical Distribution Schedule, consists of, Equity Allocation)
  426. (First, consists of, 10%)
  427. (Next, consists of, 5%)
  428. (Next, consists of, 5%)
  429. (CTO, consists of, 1-5%)
  430. (Key Developer or Engineer, consists of, 1-2%)
  431. (Other Functional Team Member, consists of, 0.5-1.5%)
  432. (No non -founding member of the senior team, should not exceed, 10%)
  433. ---------------------
  434. Text: page_label: 18
  435. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  436. 3. Vesting Schedule  
  437. •Four year vesting schedule is most common.  
  438. •Cliff vesting is less common, but can be used to retain key employees.  
  439. •Monthly vesting is less common, but can be used to align employee interests with company performance.  
  440. Triplets:
  441. (Vesting Schedule, is most common
  442. (Bottom -Up Process, consists of, Segment your human resources)
  443. (Bottom -Up Process, consists of, Create pay multipliers for each job function)
  444. (Bottom -Up Process, consists of, Determine the dollar value of an options grant)
  445. (Bottom -Up Process, consists of, Determine the current share price)
  446. (Bottom -Up Process, consists of, Calculate options grants)
  447. ---------------------
  448. Text: page_label: 19
  449. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  450. The Top-Down Process  
  451. 1.Determine the total dollar amount to be spent on options  
  452. 2.Determine the number of shares to be reserved for options  
  453. 3.Determine the number of options to be granted  
  454. 4.Determine the exercise price  
  455. 5.Determine the vesting schedule  
  456. Triplets:
  457. (Top-Down Process, consists of, Determine the total dollar amount to be spent on options)
  458. (Top-Down Process, consists of, Determine the number of shares to be reserved for options)
  459. (Top-
  460. (Segment Your Human Resources, is, segmentation)
  461. (Segment Your Human Resources, has, Segment  Roles)
  462. (Segment Your Human Resources, has, Award)
  463. ---------------------
  464. Text: page_label: 20
  465. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  466. 2. Communicate Early and Often  
  467. •Communicate the plan to all employees as soon as possible  
  468. •Communicate the plan to all new hires as part of their orientation  
  469. •Communicate the plan to all employees at least annually  
  470. •Communicate the plan to all employees when there is a material change  
  471. Triplets:
  472. (Communicate Early and Often, is, communication)
  473. (Communicate Early and Often, has, Communicate the plan to all employees as soon as possible)
  474. (Communicate Early and Often, has, Communicate the plan to all new hires as part of their orientation)
  475. (Communicate Early and Often, has, Communicate the plan to all employees at least annually)
  476. (Communicate Early and Often,
  477. (2, establish, Pay Multipliers for Each Role)
  478. (Segment, Roles, 2)
  479. (Segment, Award, ?)
  480. ---------------------
  481. Text: page_label: 21
  482. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  483. 3. Establish Vesting Schedules  
  484. Segment  Vesting Schedule  
  485. in Years or %?
  486. Triplets:
  487. (3, establish, Vesting Schedules)
  488. (Segment, Vesting Schedule, ?)
  489. ---------------------
  490. Text: page_label: 22
  491. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  492. 4. Establish Performance Criteria  
  493. Segment  Performance Criteria  
  494. in % or $?
  495. Triplets:
  496. (4, establish, Performance Criteria)
  497. (Segment, Performance Criteria, ?)
  498. ---------------------
  499. Text: page_label: 23
  500. file_path: /content/Documents/Employee-Stock-Option-
  501. (page_label, is, 20)
  502. (2, establish, Pay Multipliers for Each Role)
  503. (Segment, is, Roles)
  504. (Segment, is, Award)
  505. (Segment, is, Options Multiplier)
  506. (Segment, is, Founders)
  507. (Segment, is, Co-Founders)
  508. (Segment, is, %)
  509. (Segment, is, Founding Team)
  510. (Segment, is, Technical & Product)
  511. (Segment, is, Early -Stage Hires)
  512. (Segment, is, Senior Team)
  513. (Segment, is, C-Level)
  514. (Segment, is, Directors / VPs)
  515. (Segment, is, Functional / Technical Team)
  516. (Segment, is, Support Team)
  517. (Segment, is, $)
  518. (Segment, is, 0.5x)
  519. (Segment, is, 1.0x)
  520. (Segment, is, 0.25x)
  521. (Segment, is, 0.5x)
  522. (Segment, is, 0.1x)
  523. (Segment, is, 0.0x)
  524. (page_label, is, 2)
  525. (Employee, Base Salary, x)
  526. (Employee, Options, x)
  527. (Employee, Options Multiplier, based on the employee’s role in HR segmentation schedule)
  528. ---------------------
  529. Text: page_label: 21
  530. file_path: /content/Documents/Employee-Stock-Option-Plans-ESOP-Best-Practices-2.pdf
  531. 3. Determine the Dollar Value of the Options Grant  
  532. Employee  
  533. Base Salary  = x Options  
  534. Multiplier  Dollar Value  
  535. of Options Grant  Base Salary as negotiated with
  536. the employee at the time of hire
  537. or promotion  
  538. Options Multiplier is decided
  539. based on the employee’s role in
  540. the HR segmentation schedule
  541. Triplets:
  542. (Employee, Base Salary, x)
  543. (Employee, Options, x)
  544. (Employee, Options Multiplier, based on the employee’s role in HR segmentation schedule)
  545. ---------------------
  546. Text: page_label: 21
  547. file_path: /content/Documents/Employ

9、构建查询引擎来查询知识图谱

  1. query = 'What is ESOP?'
  2. query_engine = index.as_query_engine(include_text=True,
  3.                                      response_mode ='tree_summarize',
  4.                                      embedding_mode='hybrid',
  5.                                      similarity_top_k=5,)
  6. #
  7. message_template =f'''<|system|>Please check if the following pieces of context has any mention of the  keywords provided in the Question.If not then don't know the answer, just say that you don't know.Stop there.Please donot try to make up an answer.</s>
  8. <|user|>
  9. Question: {query}
  10. Helpful Answer:
  11. </s>'''
  12. #
  13. response = query_engine.query(message_template)
  14. #
  15. print(response.response.split('<|assistant|>')[-1].strip())
  16. #####OUTPUT #####################
  17. ESOP stands for Employee Stock Ownership Plan. It is a retirement plan that allows employees to receive company stock or stock options as part of their compensation. In simpler terms, it is a plan that allows employees to own a portion of the company they work for. This can be a motivating factor for employees as they have a direct stake in the company's success. ESOPs can also be a tax-efficient way for companies to provide retirement benefits to their employees.
  18. query ='Who is Atul?'
  19. message_template =f'''<|system|>Please check if the following pieces of context has any mention of the  keywords provided in the Question.If not then don't know the answer, just say that you don't know.Stop there.Please donot try to make up an answer.</s>
  20. <|user|>
  21. Question: {query}
  22. Helpful Answer:
  23. </s>'''
  24. #
  25. response = query_engine.query(message_template)
  26. #
  27. print(response.response.split('<|assistant|>')[-1].strip())
  28. ################OUTPUT#####################
  29. I do not have prior knowledge or context about who atul is. Please provide more information or context so I can assist you better. Without any further context, I do not know the answer to your question.

10、可视化表示

  1. from pyvis.network import Network
  2. from IPython.display import display
  3. g = index.get_networkx_graph()
  4. net = Network(notebook=True,cdn_resources='in_line',directed=True)
  5. net.from_nx(g)
  6. net.show('graph.html')
  7. net.save_graph('Knowledge_graph.html')
  8. #
  9. import IPython
  10. IPython.display.HTML(filename='/content/Knowledge_graph.html')

11、持久化保存

storage_context.persist()

总结

对于语言模型(LLM)幻觉,知识图谱被证明优于向量数据库。知识图谱提供更准确、多样化、有趣、逻辑和一致的信息,减少了LLM中出现幻觉的可能性。这种优越性源于它们能够提供关于实体之间关系的精确细节,而不仅仅是表示相似性,支持更复杂的查询和逻辑推理。

向量数据库以其数字数组在相似性搜索和最佳匹配场景中表现出色。最终,两者之间的选择取决于项目的需求,包括数据的性质、关系探索的需要以及预期的查询类型。


备注:昵称-学校/公司-方向/会议(eg.ACL),进入技术/投稿群

a286f6eed3ef8812bb113bc44d103dea.png

id:DLNLPer,记得备注呦

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/269120
推荐阅读
相关标签
  

闽ICP备14008679号