지난번 블로그 글에서는 내PC에 Devika를 설치하는 방법을 알아 보았습니다.
이제 실제로 잘 동작하는지 사용을 해보도록 하겠습니다.
웹브라우저를 실행해서 'http://localhost:3000'으로 접속을 합니다.
왼쪽 상단에 'Select Project'를 클릭하고 '+ new project'를 선택합니다.
프로젝트 이름을 입력합니다.
devika 프롬프트 입력창에 아래와 같이 입력을 하고 'send' 버튼을 클릭합니다.
model을 선택하라고 알림창이 출력됩니다.
화면 오른쪽 상단에 'Select Search Engine' 과 'Select Model'을 선택하는 메뉴가 있습니다.
필자는 Search Engine으로는 'Google', Model은 'GPT-4 Turbo'를 선택했습니다.
다시 프롬프트에 입력하고 'Send' 키를 클릭하면, 다음과 같이 에러가 발생합니다.
Bing API 키가 없다고합니다.
분명히 config.toml 파일에서 BING 을 사용하지않고 Google만 입력했지만,
코드상에 문제가 있는것 같습니다.
할수 없이 BING API를 다운로드 받아야 겠습니다.
구글에서 'bing search api key' 를 검색합니다.
로그인을 한다음에 Azure 구독을 해야합니다.
Azure 평가판 시작을 하겠습니다.
무료 체험 시작하기 버튼을 클릭합니다.
Azure에 가입하기 위해서는 카드 정보도 입력해야합니다.
config.toml 파일안에
[API_KEYS]
BING = "<YOUR_BING_API_KEY>"
해당 api 키를 입력한후에 다시 devika 를 실행합니다.
프롬프트 입력이 되지만 또다른 에러가 발생하였습니다.
이번에는 claude api 키를 입력하라고 합니다.
Setting에 해당부분을 삭제했습니다.
24.04.03 21:28:06: root: INFO : SOCKET server-message MESSAGE: {'messages': {'from_devika': False, 'message': "Implement Conway's game of Life in Python using Pygame", 'timestamp': '2024-04-03 21:28:06'}} 24.04.03 21:28:07: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 746} Exception in thread Thread-7 (<lambda>): Traceback (most recent call last): File "C:\Users\kolas_업무용\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "C:\Users\kolas_업무용\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "D:\test\devika\devika.py", line 94, in <lambda> thread = Thread(target=lambda: agent.execute(message, project_name, search_engine)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\test\devika\src\agents\agent.py", line 263, in execute plan = self.planner.execute(prompt, project_name_from_user) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\test\devika\src\agents\planner\planner.py", line 70, in execute response = self.llm.inference(prompt, project_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\test\devika\src\llm\llm.py", line 95, in inference response = model.inference(self.model_id, prompt).strip() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\test\devika\src\llm\openai_client.py", line 13, in inference chat_completion = self.client.chat.completions.create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\openai\_utils\_utils.py", line 275, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\openai\resources\chat\completions.py", line 667, in create return self._post( ^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\openai\_base_client.py", line 1213, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\openai\_base_client.py", line 902, in request return self._request( ^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\openai\_base_client.py", line 978, in _request return self._retry_request( ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\openai\_base_client.py", line 1026, in _retry_request return self._request( ^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\openai\_base_client.py", line 978, in _request return self._retry_request( ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\openai\_base_client.py", line 1026, in _retry_request return self._request( ^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\openai\_base_client.py", line 993, in _request raise self._make_status_error_from_response(err.response) from None openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}} |
위의 에러 내용은 open ai API 가 문제가 발생한 것 같습니다.
검색을 해보니
Error code : 429
RateLimitError 에 대한 에러 코드라고 합니다.
API는 Paid User만 이용이 가능해서
credit card에 대한 정보를 입력하면 문제가 해결되는것 같습니다.
$5.5 가 결제가 되었습니다.
한국 원 단위로는 '7,512원' 입니다.
이제야 Devika가 실행되었습니다.
개발이 잘 진행되다가 또다른 에러가 발생하였습니다.
24.04.03 21:51:23: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 1551} 24.04.03 21:51:27: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 1237} internal_monologue :: I need to research the rules of Conway's Game of Life first before setting up the Pygame environment. Once I understand the rules, I can proceed with defining the initial state and implementing the game logic. Excited to see the grid come to life! 24.04.03 21:51:27: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 1784} 24.04.03 21:51:30: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 982} research :: {'queries': ["Conway's Game of Life rules documentation", 'Pygame tutorial for beginners', 'Efficient grid update techniques in Pygame'], 'ask_user': ''} 24.04.03 21:51:30: root: INFO : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': "I am browsing the web to research the following queries: Conway's Game of Life rules documentation, Pygame tutorial for beginners, Efficient grid update techniques in Pygame.\n If I need anything, I will make sure to ask you.", 'timestamp': '2024-04-03 21:51:30'}} 24.04.03 21:51:31: root: INFO : SOCKET agent-state MESSAGE: [{'internal_monologue': None, 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': None, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 1177, 'timestamp': '2024-04-03 21:51:12'}, {'internal_monologue': "I need to research the rules of Conway's Game of Life first before setting up the Pygame environment. Once I understand the rules, I can proceed with defining the initial state and implementing the game logic. Excited to see the grid come to life!", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': None, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 937, 'timestamp': '2024-04-03 21:51:27'}] 24.04.03 21:51:31: root: INFO : Search : google Searching in Google... Link :: Exception in thread Thread-8 (<lambda>): Traceback (most recent call last): File "C:\Users\kolas_업무용\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "C:\Users\kolas_업무용\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "D:\test\devika\devika.py", line 94, in <lambda> thread = Thread(target=lambda: agent.execute(message, project_name, search_engine)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\test\devika\src\agents\agent.py", line 336, in execute search_results = self.search_queries(queries, project_name, engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\test\devika\src\agents\agent.py", line 95, in search_queries browser.go_to(link) File "D:\test\devika\src\browser\browser.py", line 23, in go_to self.page.goto(url, timeout=20000) File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\playwright\sync_api\_generated.py", line 8641, in goto self._sync( File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\playwright\_impl\_sync_base.py", line 113, in _sync return task.result() ^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\playwright\_impl\_page.py", line 500, in goto return await self._main_frame.goto(**locals_to_params(locals())) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\playwright\_impl\_frame.py", line 145, in goto await self._channel.send("goto", locals_to_params(locals())) File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\playwright\_impl\_connection.py", line 59, in send return await self._connection.wrap_api_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\playwright\_impl\_connection.py", line 509, in wrap_api_call return await cb() ^^^^^^^^^^ File "C:\Users\kolas_업무용\AppData\Roaming\Python\Python312\site-packages\playwright\_impl\_connection.py", line 97, in inner_send result = next(iter(done)).result() ^^^^^^^^^^^^^^^^^^^^^^^^^ playwright._impl._errors.Error: Protocol error (Page.navigate): Cannot navigate to invalid URL |
위의 에러는 'Playwright'에서 발생한 에러입니다.
playwright._impl._errors.Error: Protocol error (Page.navigate): Cannot navigate to invalid URL
'인공지능' 카테고리의 다른 글
[인공지능] Devika - 첫번째 오픈소스 인공지능 개발자 내 PC에 설치하기 (Windows) (0) | 2024.04.02 |
---|---|
[인공지능] 내 PC에서 이미지 생성형 AI ‘Stable Diffusion WebUI’ 구축하기 (0) | 2023.07.25 |
[인공지능] 내 노트북에서 ChatGPT 같은 오픈소스 인공지능 챗봇(ChatBot) 구축하기(GPT4All) (0) | 2023.07.11 |