Reference
__main__.py
Entry point that passes info read from files to chain, then passes LLM result to be written
main()
Create chain, read info from files, append generated questions, then write to new file
Source code in src/chatbot_util/__main__.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
chain.py
Setup language model and output parser, then generate and append new questions
generate(store, phrases)
Generate and append new questions to store
Source code in src/chatbot_util/chain.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
invoke(prompt, phrases)
Define chat model, then create the chain
Source code in src/chatbot_util/chain.py
46 47 48 49 50 51 52 53 54 55 56 |
|
parse(response, phrases)
Parse lines from LLM and clean them before returning
Source code in src/chatbot_util/chain.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
file_io.py
Reads csv, employees, and answers, and writes generated result to csv
read(filenames)
Read questions from csv file, read employees, phrases and answers from text files
Source code in src/chatbot_util/file_io.py
128 129 130 131 132 133 |
|
read_answers(lines)
Read and return answers for cen, robotics, instr
Source code in src/chatbot_util/file_io.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
read_basic(lines)
Read and return basic answers for topics other than CEN
Source code in src/chatbot_util/file_io.py
83 84 85 86 87 88 89 90 |
|
read_cen(lines)
Read and return cen_answers
Source code in src/chatbot_util/file_io.py
70 71 72 73 74 75 76 77 78 79 80 |
|
read_employees(lines)
Read and return employee list
Source code in src/chatbot_util/file_io.py
46 47 48 49 50 51 52 53 54 55 56 |
|
read_entries(filename)
Read and return topics and basic answers
Source code in src/chatbot_util/file_io.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
read_other(filename)
Read and return employees, phrases, and answers
Source code in src/chatbot_util/file_io.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
read_phrases(lines)
Read and return phrases to find and replace
Source code in src/chatbot_util/file_io.py
59 60 61 62 63 64 65 66 67 |
|
write(filenames, store, employees, answers, nums)
Format questions and topics, write to csv file
Source code in src/chatbot_util/file_io.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
utils.py
Utilities for creating and cleaning answers based on file content
clean_entry(question, answer)
Clean up unnecessary quotes
Source code in src/chatbot_util/utils.py
90 91 92 93 94 95 96 97 98 99 100 |
|
create_answer(topic, question, employees, answers, nums, indices)
Convert topics to answers depending on whether the topic is a person, CEN, or other
Source code in src/chatbot_util/utils.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
create_cen_answer(question, cen_answers, num_cen, cen_index)
Update CEN topics to be the relevant answer
Source code in src/chatbot_util/utils.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
create_cen_answer_helper(question, cen_answer)
Format answer based on question content
Source code in src/chatbot_util/utils.py
17 18 19 20 21 22 23 24 25 26 27 |
|
create_other_answer(answers, num, index)
Update other topics to be the relevant answer
Source code in src/chatbot_util/utils.py
46 47 48 49 50 51 52 53 54 55 |
|
create_person_answer(topic, employees)
Update person topics to be their contact info
Source code in src/chatbot_util/utils.py
7 8 9 10 11 12 13 14 |
|