Jump to content

랭체인(Langchain)으로 Naive RAG 구현하기 cookbook 따라하면서 오류가 납니다.


디티코리아

Recommended Posts

 윈도우 10에서 Anaconda로 python 3.12 환경 만들어서 코드 따라하고 있는데, 

2. Load

1) txt → html 변환 및 원본 사이트 주소 mapping 부분에서 아래와 같은 오류가 발생합니다.

Traceback (most recent call last):
  File "D:\clova_python\clova_langchain_test.py", line 40, in <module>
    subprocess.run(["wget", "--user-agent=RAGCookbook-Crawler/1.0", "-O", file_path, url], check=True)
  File "D:\conda_envs\clova_langchain\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\conda_envs\clova_langchain\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "D:\conda_envs\clova_langchain\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] 지정된 파일을 찾을 수 없습니다

 

subprocess.run(["wget", "--user-agent=RAGCookbook-Crawler/1.0", "-O", file_path, url], check=True) 을

 subprocess.run(["wget", "--user-agent=RAGCookbook-Crawler/1.0", "-O", file_path, url], check=True, shell=True) 로 변경해서 실행하면 아래와 같은 오류가 발생합니다. 

'wget'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.
Traceback (most recent call last):
  File "D:\clova_python\clova_langchain_test.py", line 40, in <module>
    subprocess.run(["wget", "--user-agent=RAGCookbook-Crawler/1.0", "-O", file_path, url], check=True, shell=True)
  File "D:\conda_envs\clova_langchain\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['wget', '--user-agent=RAGCookbook-Crawler/1.0', '-O', 'clovastudioguide\\clovastudio-info.html', 'https://guide.ncloud-docs.com/docs/clovastudio-info']' returned non-zero exit status 1.

 

 

오류 해결 방법을 알려주세요.

 

clova_langchain_test.py

링크 복사
다른 사이트에 공유하기

자문자답.

2. Load 부분에서 나는 오류는 winget으로 wget 설치하면 오류가 해결됩니다.

2-2)  UnstructuredHTMLLoader 사용 부분에서
```
# clovastudiodatas 리스트의 각 Document 객체의 'source' 수정
for doc_list in clovastudiodatas:
    for doc in doc_list:
        extracted_filename = doc.metadata["source"].split("/")[-1]
```
```
# clovastudiodatas 리스트의 각 Document 객체의 'source' 수정
for doc_list in clovastudiodatas:
    for doc in doc_list:
        extracted_filename = doc.metadata["source"].split("\\")[-1]
```
 
으로 수정하면 실행이 됩니다.
 
 
링크 복사
다른 사이트에 공유하기

게시글 및 댓글을 작성하려면 로그인 해주세요.



로그인
×
×
  • Create New...