mudler / LocalAI

:robot: The free, Open Source OpenAI alternative. Self-hosted, community-driven and local-first. Drop-in replacement for OpenAI running on consumer-grade hardware. No GPU required. Runs gguf, transformers, diffusers and many more models architectures. It allows to generate Text, Audio, Video, Images. Also with voice cloning capabilities.
https://localai.io
MIT License
21.9k stars 1.68k forks source link

Auto-gpt exemple does not work [redis Not implemented and jsonFileMemory Errors] #1091

Open scenaristeur opened 9 months ago

scenaristeur commented 9 months ago

I Love LocalAI, it's a really good alternative to paid solution running on cpu, this allow low budget to be in the party : #GREATJob !!!

I 've tried @mudler Autogpt example but it seems that it does not work anymore.

  Asking user via keyboard...
Budget: $
NOTE:All files/directories created by this agent can be found inside its workspace at:  /app/auto_gpt_workspace
3DWorld Explorer  has been created with the following details:
Name:  3DWorld Explorer
Role:  an AI designed able to build 3D scene with enable3D, explore it and build things in it according to the user instruction : instruction like 'create three cube of différent size' will be converted by '3DWorld Explorer' to action that put 3 cubes in the environnements
Goals: 
-  create a 3dworld by copying the 'basic setup' of enable3D documentation, run it and access it in the webbrowser, create capture of the scene
-  add some chat interface in the webpage to allow user to chat with "3DWorld Explorer" (3dwe) and to give instructions, understand the instructions, ask the user if it is not clear or to get confirmation, 3dwe should keep an history to be able to revert to a previous state, user should be able to modify position and size of the objects
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/autogpt/__main__.py", line 5, in <module>
    autogpt.app.cli.main()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1666, in invoke
    rv = super().invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/app/autogpt/app/cli.py", line 121, in main
    run_auto_gpt(
  File "/app/autogpt/app/main.py", line 159, in run_auto_gpt
    memory = get_memory(config)
  File "/app/autogpt/memory/vector/__init__.py", line 82, in get_memory
    raise NotImplementedError(
NotImplementedError: The Redis memory backend has been rendered incompatible by work on the memory system, and has been removed temporarily.
ERROR: 1

i have remove reference to redis in the docker-compose.yaml like that :

version: "3.9"
services:
  api:
    image: quay.io/go-skynet/local-ai:latest
    ports:
      - 8080:8080
    env_file:
      - .env
    environment:
      - DEBUG=true
      - MODELS_PATH=/models
    volumes:
      - ./models:/models:cached
    command: ["/usr/bin/local-ai" ]
  auto-gpt:
    image: significantgravitas/auto-gpt
    depends_on:
      api:
        condition: service_healthy
      # redis:
      #   condition: service_started
    env_file:
      - .env
    #environment:
      # MEMORY_BACKEND: ${MEMORY_BACKEND:-redis}
      # REDIS_HOST: ${REDIS_HOST:-redis}
    profiles: ["exclude-from-up"]
    volumes:
      - ./auto_gpt_workspace:/app/autogpt/auto_gpt_workspace
      - ./data:/app/data
      ## allow auto-gpt to write logs to disk
      - ./logs:/app/logs
      ## uncomment following lines if you want to make use of these files
      ## you must have them existing in the same folder as this docker-compose.yml
      #- type: bind
      #  source: ./azure.yaml
      #  target: /app/azure.yaml
      #- type: bind
      #  source: ./ai_settings.yaml
      #  target: /app/ai_settings.yaml
  # redis:
  #   image: "redis/redis-stack-server:latest"

but now i got an error in parsing json

I want Auto-GPT to: create a python game NOTE:All files/directories created by this agent can be found inside its workspace at: /app/auto_gpt_workspace CMOGPT has been created with the following details: Name: CMOGPT Role: a professional digital marketer AI that assists Solo entrepreneurs in growing their businesses by providing world-class expertise in solving marketing problems for Saas, content products, agencies and more. Goals: Could not load MemoryItems from file: input length is 0: line 1 column 1 (char 0) Using memory of type: JSONFileMemory Using Browser: chrome Error parsing JSON response with literal_eval invalid syntax (, line 2) Response could not be parsed: Validation of response failed: 'thoughts' is a required property

Failed validating 'required' in schema:
    {'$schema': 'http://json-schema.org/draft-07/schema#',
     'additionalProperties': False,
     'properties': {'command': {'additionalProperties': False,
                                'properties': {'args': {'type': 'object'},
                                               'name': {'type': 'string'}},
                                'required': ['name', 'args'],
                                'type': 'object'},
                    'thoughts': {'additionalProperties': False,
                                 'properties': {'criticism': {'description': 'constructive '
                                                                             'self-criticism',
                                                              'type': 'string'},
                                                'plan': {'description': '- '
                                                                        'short '
                                                                        'bulleted\n'
                                                                        '- '
                                                                        'list '
                                                                        'that '
                                                                        'conveys\n'
                                                                        '- '
                                                                        'long-term '
                                                                        'plan',
                                                         'type': 'string'},
                                                'reasoning': {'type': 'string'},
                                                'speak': {'description': 'thoughts '
                                                                         'summary '
                                                                         'to '
                                                                         'say '
                                                                         'to '
                                                                         'user',
                                                          'type': 'string'},
                                                'text': {'description': 'thoughts',
                                                         'type': 'string'}},
                                 'required': ['text',
                                              'reasoning',
                                              'plan',
                                              'criticism',
                                              'speak'],
                                 'type': 'object'}},
     'required': ['thoughts', 'command'],
     'type': 'object'}

On instance:
    {};
  'command' is a required property

Failed validating 'required' in schema:
    {'$schema': 'http://json-schema.org/draft-07/schema#',
     'additionalProperties': False,
     'properties': {'command': {'additionalProperties': False,
                                'properties': {'args': {'type': 'object'},
                                               'name': {'type': 'string'}},
                                'required': ['name', 'args'],
                                'type': 'object'},
                    'thoughts': {'additionalProperties': False,
                                 'properties': {'criticism': {'description': 'constructive '
                                                                             'self-criticism',
                                                              'type': 'string'},
                                                'plan': {'description': '- '
                                                                        'short '
                                                                        'bulleted\n'
                                                                        '- '
                                                                        'list '
                                                                        'that '
                                                                        'conveys\n'
                                                                        '- '
                                                                        'long-term '
                                                                        'plan',
                                                         'type': 'string'},
                                                'reasoning': {'type': 'string'},
                                                'speak': {'description': 'thoughts '
                                                                         'summary '
                                                                         'to '
                                                                         'say '
                                                                         'to '
                                                                         'user',
                                                          'type': 'string'},
                                                'text': {'description': 'thoughts',
                                                         'type': 'string'}},
                                 'required': ['text',
                                              'reasoning',
                                              'plan',
                                              'criticism',
                                              'speak'],
                                 'type': 'object'}},
     'required': ['thoughts', 'command'],
     'type': 'object'}

On instance:

CMOGPT THOUGHTS: 
REASONING:  None
CRITICISM:  None
NO ACTION SELECTED:  The Agent failed to select an action.
  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for CMOGPT...
  Asking user via keyboard...
Input:

LocalAI (docker logs follow...) seems to receive the instruction (with something strange CMOGPT , professional marketer !!! but that is not the problem)

Task: 'create a python game'
Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.
### Response:
9:21AM DBG Prompt (after templating): The prompt below is a question to answer, a task to complete, or a conversation to respond to; decide which and write an appropriate response.
### Prompt:

Your task is to devise up to 5 highly effective goals and an appropriate role-based name (_GPT) for an autonomous agent, ensuring that the goals are optimally aligned with the successful completion of its assigned task.

The user will provide the task, you will provide only the output in the exact format specified below with no explanation or conversation.

Example input:
Help me with marketing my business

Example output:
Name: CMOGPT
Description: a professional digital marketer AI that assists Solopreneurs in growing their businesses by providing world-class expertise in solving marketing problems for SaaS, content products, agencies, and more.
Goals:
- Engage in effective problem-solving, prioritization, planning, and supporting execution to address your marketing needs as your virtual Chief Marketing Officer.

- Provide specific, actionable, and concise advice to help you make informed decisions without the use of platitudes or overly wordy explanations.

- Identify and prioritize quick wins and cost-effective campaigns that maximize results with minimal time and budget investment.

- Proactively take the lead in guiding you and offering suggestions when faced with unclear information or uncertainty to ensure your marketing strategy remains on track.

Task: 'create a python game'
Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.
### Response:
9:21AM DBG Loading model gpt4all-j from ggml-gpt4all-j.bin
9:21AM DBG Model already loaded in memory: ggml-gpt4all-j.bin
[127.0.0.1]:45102  200  -  GET      /readyz

is this problem on LocalAi side or on Auto-gpt side ?

scenaristeur commented 9 months ago

for the first part : https://github.com/Significant-Gravitas/Auto-GPT/discussions/4280 the second part seems to be Auto-gpt side https://github.com/Significant-Gravitas/Auto-GPT/issues/4752

mudler commented 7 months ago

I Love LocalAI, it's a really good alternative to paid solution running on cpu, this allow low budget to be in the party : #GREATJob !!!

I 've tried @mudler Autogpt example but it seems that it does not work anymore.

  Asking user via keyboard...
Budget: $
NOTE:All files/directories created by this agent can be found inside its workspace at:  /app/auto_gpt_workspace
3DWorld Explorer  has been created with the following details:
Name:  3DWorld Explorer
Role:  an AI designed able to build 3D scene with enable3D, explore it and build things in it according to the user instruction : instruction like 'create three cube of différent size' will be converted by '3DWorld Explorer' to action that put 3 cubes in the environnements
Goals: 
-  create a 3dworld by copying the 'basic setup' of enable3D documentation, run it and access it in the webbrowser, create capture of the scene
-  add some chat interface in the webpage to allow user to chat with "3DWorld Explorer" (3dwe) and to give instructions, understand the instructions, ask the user if it is not clear or to get confirmation, 3dwe should keep an history to be able to revert to a previous state, user should be able to modify position and size of the objects
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/autogpt/__main__.py", line 5, in <module>
    autogpt.app.cli.main()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1666, in invoke
    rv = super().invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/app/autogpt/app/cli.py", line 121, in main
    run_auto_gpt(
  File "/app/autogpt/app/main.py", line 159, in run_auto_gpt
    memory = get_memory(config)
  File "/app/autogpt/memory/vector/__init__.py", line 82, in get_memory
    raise NotImplementedError(
NotImplementedError: The Redis memory backend has been rendered incompatible by work on the memory system, and has been removed temporarily.
ERROR: 1

i have remove reference to redis in the docker-compose.yaml like that :

version: "3.9"
services:
  api:
    image: quay.io/go-skynet/local-ai:latest
    ports:
      - 8080:8080
    env_file:
      - .env
    environment:
      - DEBUG=true
      - MODELS_PATH=/models
    volumes:
      - ./models:/models:cached
    command: ["/usr/bin/local-ai" ]
  auto-gpt:
    image: significantgravitas/auto-gpt
    depends_on:
      api:
        condition: service_healthy
      # redis:
      #   condition: service_started
    env_file:
      - .env
    #environment:
      # MEMORY_BACKEND: ${MEMORY_BACKEND:-redis}
      # REDIS_HOST: ${REDIS_HOST:-redis}
    profiles: ["exclude-from-up"]
    volumes:
      - ./auto_gpt_workspace:/app/autogpt/auto_gpt_workspace
      - ./data:/app/data
      ## allow auto-gpt to write logs to disk
      - ./logs:/app/logs
      ## uncomment following lines if you want to make use of these files
      ## you must have them existing in the same folder as this docker-compose.yml
      #- type: bind
      #  source: ./azure.yaml
      #  target: /app/azure.yaml
      #- type: bind
      #  source: ./ai_settings.yaml
      #  target: /app/ai_settings.yaml
  # redis:
  #   image: "redis/redis-stack-server:latest"

but now i got an error in parsing json

I want Auto-GPT to: create a python game NOTE:All files/directories created by this agent can be found inside its workspace at: /app/auto_gpt_workspace CMOGPT has been created with the following details: Name: CMOGPT Role: a professional digital marketer AI that assists Solo entrepreneurs in growing their businesses by providing world-class expertise in solving marketing problems for Saas, content products, agencies and more. Goals: Could not load MemoryItems from file: input length is 0: line 1 column 1 (char 0) Using memory of type: JSONFileMemory Using Browser: chrome Error parsing JSON response with literal_eval invalid syntax (, line 2) Response could not be parsed: Validation of response failed: 'thoughts' is a required property

Failed validating 'required' in schema:
    {'$schema': 'http://json-schema.org/draft-07/schema#',
     'additionalProperties': False,
     'properties': {'command': {'additionalProperties': False,
                                'properties': {'args': {'type': 'object'},
                                               'name': {'type': 'string'}},
                                'required': ['name', 'args'],
                                'type': 'object'},
                    'thoughts': {'additionalProperties': False,
                                 'properties': {'criticism': {'description': 'constructive '
                                                                             'self-criticism',
                                                              'type': 'string'},
                                                'plan': {'description': '- '
                                                                        'short '
                                                                        'bulleted\n'
                                                                        '- '
                                                                        'list '
                                                                        'that '
                                                                        'conveys\n'
                                                                        '- '
                                                                        'long-term '
                                                                        'plan',
                                                         'type': 'string'},
                                                'reasoning': {'type': 'string'},
                                                'speak': {'description': 'thoughts '
                                                                         'summary '
                                                                         'to '
                                                                         'say '
                                                                         'to '
                                                                         'user',
                                                          'type': 'string'},
                                                'text': {'description': 'thoughts',
                                                         'type': 'string'}},
                                 'required': ['text',
                                              'reasoning',
                                              'plan',
                                              'criticism',
                                              'speak'],
                                 'type': 'object'}},
     'required': ['thoughts', 'command'],
     'type': 'object'}

On instance:
    {};
  'command' is a required property

Failed validating 'required' in schema:
    {'$schema': 'http://json-schema.org/draft-07/schema#',
     'additionalProperties': False,
     'properties': {'command': {'additionalProperties': False,
                                'properties': {'args': {'type': 'object'},
                                               'name': {'type': 'string'}},
                                'required': ['name', 'args'],
                                'type': 'object'},
                    'thoughts': {'additionalProperties': False,
                                 'properties': {'criticism': {'description': 'constructive '
                                                                             'self-criticism',
                                                              'type': 'string'},
                                                'plan': {'description': '- '
                                                                        'short '
                                                                        'bulleted\n'
                                                                        '- '
                                                                        'list '
                                                                        'that '
                                                                        'conveys\n'
                                                                        '- '
                                                                        'long-term '
                                                                        'plan',
                                                         'type': 'string'},
                                                'reasoning': {'type': 'string'},
                                                'speak': {'description': 'thoughts '
                                                                         'summary '
                                                                         'to '
                                                                         'say '
                                                                         'to '
                                                                         'user',
                                                          'type': 'string'},
                                                'text': {'description': 'thoughts',
                                                         'type': 'string'}},
                                 'required': ['text',
                                              'reasoning',
                                              'plan',
                                              'criticism',
                                              'speak'],
                                 'type': 'object'}},
     'required': ['thoughts', 'command'],
     'type': 'object'}

On instance:

CMOGPT THOUGHTS: 
REASONING:  None
CRITICISM:  None
NO ACTION SELECTED:  The Agent failed to select an action.
  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for CMOGPT...
  Asking user via keyboard...
Input:

LocalAI (docker logs follow...) seems to receive the instruction (with something strange CMOGPT , professional marketer !!! but that is not the problem)

Task: 'create a python game'
Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.
### Response:
9:21AM DBG Prompt (after templating): The prompt below is a question to answer, a task to complete, or a conversation to respond to; decide which and write an appropriate response.
### Prompt:

Your task is to devise up to 5 highly effective goals and an appropriate role-based name (_GPT) for an autonomous agent, ensuring that the goals are optimally aligned with the successful completion of its assigned task.

The user will provide the task, you will provide only the output in the exact format specified below with no explanation or conversation.

Example input:
Help me with marketing my business

Example output:
Name: CMOGPT
Description: a professional digital marketer AI that assists Solopreneurs in growing their businesses by providing world-class expertise in solving marketing problems for SaaS, content products, agencies, and more.
Goals:
- Engage in effective problem-solving, prioritization, planning, and supporting execution to address your marketing needs as your virtual Chief Marketing Officer.

- Provide specific, actionable, and concise advice to help you make informed decisions without the use of platitudes or overly wordy explanations.

- Identify and prioritize quick wins and cost-effective campaigns that maximize results with minimal time and budget investment.

- Proactively take the lead in guiding you and offering suggestions when faced with unclear information or uncertainty to ensure your marketing strategy remains on track.

Task: 'create a python game'
Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.
### Response:
9:21AM DBG Loading model gpt4all-j from ggml-gpt4all-j.bin
9:21AM DBG Model already loaded in memory: ggml-gpt4all-j.bin
[127.0.0.1]:45102  200  -  GET      /readyz

is this problem on LocalAi side or on Auto-gpt side ?

I'm not sure if this is related to new features in auto-gpt, it needs a closer look for sure