|
1 | 1 | # generative-agents
|
2 | 2 | Experimenting with an agent that searches documents and asks questions repeatedly in response to the main question, automatically determining the optimal answer from the current documents or recognizing when there is no answer.
|
3 | 3 |
|
| 4 | +# Assumed environment, etc |
| 5 | + |
| 6 | +* Operating environment |
| 7 | + * Windows10/11 WSL2, Ubuntu, Mac |
| 8 | +* Install |
| 9 | + * Python 3 can be used |
| 10 | +* OpenAI |
| 11 | + * OpenAPI key can be used |
| 12 | + |
| 13 | +# What you can do |
| 14 | + |
| 15 | +* You can input multiple existing documents |
| 16 | +* You can ask questions about the documents you input |
| 17 | +* It speculates questions from various angles, reads the necessary documents, and provides answers |
| 18 | + |
| 19 | +## Types of supported documents |
| 20 | + |
| 21 | +LangChain has loaders that support various documents, but as of now, it can load the following documents. |
| 22 | + |
| 23 | +* PDF |
| 24 | +* CSV |
| 25 | +* PPTX |
| 26 | +* URL |
| 27 | +* JSON |
| 28 | + |
| 29 | +# Install |
| 30 | + |
| 31 | +Please install the following |
| 32 | + |
| 33 | +``` |
| 34 | +pip3 install openai |
| 35 | +pip3 install chromadb |
| 36 | +pip3 install tiktoken |
| 37 | +pip3 install pypdf |
| 38 | +pip3 install langchain |
| 39 | +pip3 install unstructured |
| 40 | +pip3 install tabulate |
| 41 | +``` |
| 42 | + |
| 43 | +Please set the OpenAPI API key as an environment variable. |
| 44 | + |
| 45 | +``` |
| 46 | +export OPENAI_API_KEY=<APIキー> |
| 47 | +``` |
| 48 | + |
| 49 | +Clone the repository |
| 50 | + |
| 51 | +``` |
| 52 | +git clone https://github.com/tmori/generative-agents.git |
| 53 | +``` |
| 54 | + |
| 55 | +# Place the existing documents |
| 56 | + |
| 57 | +Please create a `documents` directory on the same directory level as `generative-agents`. |
| 58 | + |
| 59 | +``` |
| 60 | +mkdir documents |
| 61 | +``` |
| 62 | + |
| 63 | +``` |
| 64 | +$ ls |
| 65 | +documents generative-agents |
| 66 | +``` |
| 67 | + |
| 68 | +Then, create the following two directories under `documents`. |
| 69 | + |
| 70 | +``` |
| 71 | +mkdir documents/docs |
| 72 | +mkdir documents/dbs |
| 73 | +``` |
| 74 | + |
| 75 | +Please place the PDF files you want to load under `documents/docs`. |
| 76 | +Placement example: PDFs of my own Qiita article |
| 77 | + |
| 78 | +``` |
| 79 | +ls documents/docs/ |
| 80 | +'ChatGPTのAPI使って、Unity上の箱庭ロボットを動かしてみた! - Qiita.pdf' |
| 81 | +'Mac+Unity+Pythonで箱庭ロボットを強化学習できるようにするための手順書 - Qiita.pdf' |
| 82 | +'Python使ってUnity上の箱庭ロボットのカメラデータを取得してみよう - Qiita.pdf' |
| 83 | +'Ubuntuでも箱庭で機械学習するやつを動かそう - Qiita.pdf' |
| 84 | +'Unity + Python + 箱庭でロボットを強化学習させてみよう! - Qiita.pdf' |
| 85 | +'Unity 内の箱庭ロボットを動かすPython API仕様書 - Qiita.pdf' |
| 86 | +'Unity+Python+箱庭で自作ドローンを動かしてみる! - Qiita.pdf' |
| 87 | +'Windows+Unity+Pythonで箱庭ロボットを強化学習できるようにするための手順書 - Qiita.pdf' |
| 88 | +``` |
| 89 | + |
| 90 | +After completing the placement, please execute the following command. |
| 91 | + |
| 92 | + |
| 93 | +``` |
| 94 | +bash generative-agents/tools/create_doclist.bash |
| 95 | +``` |
| 96 | + |
| 97 | +If successful, logs like this will be output. |
| 98 | + |
| 99 | +``` |
| 100 | +DB_DIR =tmp/DB |
| 101 | +DOC_DIR=tmp |
| 102 | +INFO: Loading document=ChatGPTのAPI使って、Unity上の箱庭ロボットを動かしてみた! - Qiita.pdf |
| 103 | +INFO: Storing Vector DB:tmp/DB |
| 104 | +: |
| 105 | +DB_DIR =tmp/DB |
| 106 | +DOC_DIR=tmp |
| 107 | +INFO: Loading document=Windows+Unity+Pythonで箱庭ロボットを強化学習できるようにするための手順書 - Qiita.pdf |
| 108 | +INFO: Storing Vector DB:tmp/DB |
| 109 | +``` |
| 110 | + |
4 | 111 | ## Tool chain for creating document TITLE and DB
|
5 | 112 |
|
6 | 113 | 
|
|
0 commit comments