Programming/python-nlp

Auto-GPT로 실시간 날씨 정보를 얻어보자!

방황하는 데이터불도저 2023. 6. 14. 23:00

참고 링크

GitHub - Significant-Gravitas/Auto-GPT: An experimental open-source attempt to make GPT-4 fully autonomous. 

 

GitHub - Significant-Gravitas/Auto-GPT: An experimental open-source attempt to make GPT-4 fully autonomous.

An experimental open-source attempt to make GPT-4 fully autonomous. - GitHub - Significant-Gravitas/Auto-GPT: An experimental open-source attempt to make GPT-4 fully autonomous.

github.com

Auto-GPT란?

  • open-source Python application called Auto-GPT
  • Chrome 웹사이트에 검색결과를 기반으로 최신, 인기 웹사이트 url의 정보를 활용하고, 그 정보를 summarization(요약)한 결과를 제공한다. 해당 결과에 따라 새로운 prompt(command)도 자동으로 제안해준다.
  • GPT의 결과를 txt로 자동저장할 수 있는 기능도 제공되고 있다.
  • OpenAI와 Pinecone의 API를 활용함
  • GPT-4 사용
  • 개인 토큰을 사용해야함 (유료)

위의 Auto-GPT Github 링크로 들어가, document부분에서 설치부터 실행까지 도움말을 확인할 수 있습니다.

 

  • docker를 활용하여 셋팅하는 것을 추천한다고 되어있지만, 저는 docker를 사용하는 것에 낯설어 아래와 같은 환경으로 도커없이 셋팅하였습니다. docker를 활용하실 분들은 공식 document를 확인해주세요.
  • 따라서, 필자는 linux (Ubuntu 20.04 LTS), 아나콘다로 새로운 가상환경 생성하여 셋팅하였습니다.

 

아래는 Auto-GPT를 사용하는 방법입니다.

 

1) Get the API Key of OpenAI  (공통으로 수행해야하는 부분)

  1. API Keys 발급받기 (OpenAI API key)

2) Set up with Git 

  1. git clone -b stable https://github.com/Significant-Gravitas/Auto-GPT.git
  2. cd Auto-GPT

3) Configuration

  1. ls -a 커맨드로 .env.template 파일이 있는지 확인
  2. cp .env.template .env 해당 커맨드로 파일명을 .env로 변경
  3. nano .env 커맨드로 파일 에디터 실행
  4. OPENAI_API_KEY= 이라고 적힌 행(라인)을 찾아서 위에서 발급받았던 API Key를 복사 붙여넣기 후, 파일 저장

4) Execution

  1. ./run.sh 커맨드로 실행
  2. 테스트 문장 1 : I would like to know the weather forecast for Busan city of Korea tomorrow. --> 해당 프롬프트로는 제대로된 결과를 얻을 수 없었다.
  3. 테스트 문장 2 : I would like to know the weather forecast only for Busan city of Korea tomorrow and today is May 17.   (구체적인 조건을 문장에 넣어주었다.)
  • 모든 결과 : 한 출력당 약 30초~1분 이내로 출력

문장 입력해주기
실행결과 1
실행결과 2
실행결과 3
실행결과 4
마지막 실행 : 처음 입력된 프롬프트에 대한 요약한 결과를 txt 파일로 저장하기
자동 저장된 파일을 볼 수 있다.

 

텍스트 파일에 저장된 결과

👉 The current temperature in Busan, Korea is 26°C with a RealFeel Shade™ of 24°C. The humidity is not provided on the website. The wind speed is not provided on the website. The precipitation information is not provided on the website. The weather forecast for today is increasing cloudiness with a high of 27°C and for tomorrow, it is cloudy with showers and not as warm with a high of 21°C.

(대한민국 부산의 현재 기온은 26°C이며 RealFeel Shade™는 24°C입니다. 습도는 웹 사이트에 제공되지 않습니다. 풍속은 웹 사이트에 제공되지 않습니다. 강수량 정보는 웹사이트에 제공되지 않습니다. 오늘 일기예보는 흐리고 최고 27°C, 내일은 흐리고 소나기가 내리며 따뜻하지는 않지만 최고 21°C입니다.)

 

→ 실시간 정보 획득 성공