<< | [[2025-01-07|Next]] >> ## Goal - Project를 이루는 각 요소들을 만들기 위해 어떠한 Package가 필요할 지 고민 후 결정하기 - Project 가상환경 만들기 - `CrewAI`를 이용해 파일을 읽고 질문에 맞는 대답 출력하기 ## TODO > [!TODO|] TODO > - [v] Project 가상환경 만들기 > - [v] LangChain, CrewAI, openAI 등 필요 Packages 설치 > - [v] 특정 디렉토리 안에 았는 md 파일 찾기 > - [-] 해당 파일과 관련된 모든 파일 불러오기 > - [-] 특정 디렉토리 안에 있는 이미지 파일 찾기 ## Issue/Solution #### Issue 1 > [!blank] > >> [!warning]+ Problem >> `Crew AI`에게 `FileReadTool`을 사용하여 질문에 답을 할만한 `file`을 찾고 이를 요약 시키는 것을 목표로 `Agent`와 `Task`를 구현하였다. 문제는 `Crew AI` 가 해당 답을 구할 수 있는 `file`을 찾지 못한다는 것이다. > >> [!summary]+ Solution >> `Crew AI`의 `Agent`에게 **경로에 있는 모든 파일들을 찾는 일**과 **질문에 맞는 파일을 읽고 질문에 대해 대답 하는 일** 총 2가지를 맡겼기 때문에 이러한 문제가 발생하는 것이라 판단하였고 이 두 가지 일을 각각 다른 **Agent(pathSearcher, researcher)** 에게 맡기기로 하였다. >> 하지만 이렇게 구현한다 하여도 `researcher Agent`가 모든 `files`을 읽어야 되기 때문에 너무 많은 **token**을 사용하게 되었고 이 과정에서 많은 비용이 들었다. 따라서 이를 해결하기 위해선 `Agent`를 **저렴한 model** 또는 **오프라인 model**을 사용해야 할 것 같다. > #### Issue 2 > [!blank] > >> [!warning]+ Problem >>경로에 있는 모든 `markdown files`을 불러오도록 설정하였다. 하지만 어떤 이유에서 인지 `markdown file`을 아예 찾지 못하였다. > >> [!summary]+ Solution >> 관련 문서를 읽어보니 `DirectorySearchTool`이 아닌 **DirectoryReadTool**을 사용했어야 했다. 해당 `Tool`을 사용하면 지정 경로 안의 모든 `markdown file` 경로를 가져온다. > #### Issue 3([[2025-01-06#Issue 1|Before Issue]]) > [!blank] > >> [!warning]+ Problem >> `researcher Agent`를 사용하여 모든 `file`을 읽은 뒤, 질문에 맞는 대답을 구하려 하는 것은 과도한 **token**이 발생한다. >> 이를 해결하기 위해 `researcher Agent`의 일을 **해당 질문에 대답할 수 있을 것 같은 파일 선별하기**와 `주어진 파일들을 읽고 질문에 대답하기` 2개로 나누어 각각 다른 **Agent(fileSelct, research)** 에게 맡겼다. >> 문제는 관련된 파일들을 불러올 때 몇 개의 파일은 포함되지 않는 경우가 있었다는 것과 결과가 일정하게 출력 되지 않는다는 것이다. > >> [!summary]+ Solution >> 해당 문제의 해결 방안에 대해서는 조금 더 고민해봐야 할 것 같다. > ## Reference - [[Crew]] - [Directory RAG Search](https://docs.crewai.com/tools/directorysearchtool) ## Git commit contents - [build : Document Secretary Setting](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/b7743edae9c1551139f4aee7b87e0eebc775a368 "build : Document Secretary Setting") - [docs : package list 수정](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/9c2b89e797b1bfb4bc19559db1d7132c148d9af9 "docs : package list 수정") - [test : CrewAI 기능 테스트](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/343c7f18e7fce0ad6dd4c8943c3ef7aba888c4df "test : CrewAI 기능 테스트") - [build : research Agent와 Tool 구현 / pathSearch에 file_path input value 추가](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/fd5d7e0bc46d0edaec172d625b388e2701ed4ca3 "build : research Agent와 Tool 구현 / pathSearch에 file_path input value 추가") - [build : fileSelector Agent and fileSelct Task](https://github.com/Donghyeon-Shin/DocumentSecretary/commit/b1e59ce441b9ee20bf3b29a6fe1ce7803142656f "build : fileSelector Agent and fileSelct Task") ## What should I do more - `fileSelct Agent`의 결과 값이 정확하고 일정하게 나오도록 조정하기 - 특정 디렉토리 안에 있는 모든 이미지 파일 찾기 - 질문에 맞는 파일과 관련된 모든 이미지 찾기 - 관련된 모든 파일과 이미지들을 활용하여 질문에 대한 답 만들기