idosal / AgentLLM

AgentLLM is a PoC for browser-native autonomous agents
https://agentllm.vercel.app
GNU General Public License v3.0
384 stars 64 forks source link

AgentLLM stuck after adding tasks and now showing error on retry #7

Closed StefanIsMe closed 1 year ago

StefanIsMe commented 1 year ago

Hi there,

I'm new to AgentLLM and I'm having some trouble getting it to work. I followed the instructions and ran the agent for the first time. It downloaded everything it needed and initialized correctly. The agent also added two tasks, but then it got stuck and didn't do anything else.

I tried canceling the agent and running it again, but now I'm constantly seeing the error message in the attached screenshot. I'm not sure what's causing this error or how to fix it.

image

idosal commented 1 year ago

Hey, Does it happen to you with any other prompts? Please try refreshing the page and trying again. I added more indicative error messages, so if it recurs please attach it here for further inspection.

This is part of the output I received for your prompt: agent-llm-output

MaunoKoponen commented 1 year ago

It seems the error comes from helpers.ts not being able to parse lists properly. I asked ChatGPT-4 to help with this and it gave me a improved funtion, but cant make a pull request before verifying it works ok - I keep getting GPU connection Lost error" always at some point. Anyway, this is what ChatGPT4 suggested: "The input string in this case has a different format than both the regex and the bullet point cases. It is using triple backticks to wrap the task list. To handle this case, you can add an additional condition to the extractArray function to look for the triple backticks and extract the tasks within. Here's an example of how to modify the extractArray function to handle all three cases:" So in src/utils/helpers.ts:

export const extractArray = (inputStr: string): string[] => { // Match an outer array of strings (including nested arrays) const regex = /([(?:\s"(?:[^"\]|\.)"\s,?)+\s])/; const match = inputStr.match(regex);

if (match && match[0]) { try { // Parse the matched string to get the array return JSON.parse(match[0]) as string[]; } catch (error) { console.error("Error parsing the matched array:", error); } } else { // Check for triple backtick format const backtickRegex = /([\s\S]*?)/g; const backtickMatch = inputStr.match(backtickRegex);

if (backtickMatch && backtickMatch.length > 0) {
  const tasks = backtickMatch
    .map(block => block.replace(/```/g, '').trim().split('\n'))
    .flat()
    .filter(line => line.trim().length > 0);

  if (tasks.length > 0) {
    return tasks;
  }
} else {
  // Split the input string into lines
  const lines = inputStr.split('\n');

  // Extract the text after the bullet points
  const tasks = lines
    .filter(line => line.trim().startsWith('*'))
    .map(line => line.trim().substr(1).trim());

  if (tasks.length > 0) {
    return tasks;
  }
}

}

idosal commented 1 year ago

Thanks, @MaunoKoponen! You're right - I didn't bother with parsing the list case. Instead, I fix the output with self-reflection. It almost always works, but some things fall through the cracks with Vicuna. Hopefully, the upcoming version with WizardLM-7B would solve the output issues entirely. If not, I'll handle this edge case. :)

In any case, the "stuck" issue was fixed.

idosal commented 1 year ago

WizardLM is now live! It hasn't failed me yet. If you run into it again please let me know and I'll add the relevant code. Thanks!

StefanIsMe commented 1 year ago

Hey, I apologize for not getting back to you sooner. I tried to resolve the issue on my end, but unfortunately, I had the same error. I noticed that there was an update to WizardLLM, so I thought I would give it another try, but unfortunately, I encountered the same error again. I have a 3060 RTX graphics card, so I'm not sure why I'm experiencing these errors.

However, I did try using WebLLM, and it worked perfectly fine. I understand that it's a different project, but it does prove that my computer is capable of running WebGPU. I'll continue to look for a solution to the issue with AgentLLM, and I'll update you as soon as I have more information.

idosal commented 1 year ago

Does it happen consistently? Could you please share the console output for one the failures here?

StefanIsMe commented 1 year ago

Hey, yes it does consistently happen. Usually, I get the error in the attached screenshot, but sometimes the agent will start and add 3 tasks before getting stuck and not doing anything further. I even let the agent run for 30 minutes, but it was still stuck.

I've attached a new screenshot that includes the console and the console log as requested. Let me know if there's anything else I can provide to help diagnose the issue.

image


759-321cd3240cdbc07b.js:4 Entering new llm_chain chain...
759-321cd3240cdbc07b.js:1 Starting LLM 43cbfb3c-c23f-4e5d-a0bb-1c50cffd3ba1 with name webLlm with prompts: You have the following objective: `conduct market research and recommend 3 xiaomi phones to sell in ecommerce`. Create a list of zero to four tasks to be completed by you such that your goal is more closely reached or completely reached. The response list MUST be a SINGLE ARRAY OF STRINGS where each string is a TASK NAME wrapped in quotes (EXAMPLE OF RESPONSE FORMAT: "["task name", "task name"]"). You MUST be able to parse the array of strings with Javascript’s JSON.parse() function. You must respond with the array WITHOUT ANY OTHER TEXT.

agentllm.vercel.app/:1 GPU connection lost
759-321cd3240cdbc07b.js:2 LLM 43cbfb3c-c23f-4e5d-a0bb-1c50cffd3ba1 errored: OperationError: The operation failed for an operation-specific reason

759-321cd3240cdbc07b.js:4 Entering new llm_chain chain...
759-321cd3240cdbc07b.js:1 Starting LLM f7a6e4d1-4819-4991-bbe8-eb31f42c37c7 with name webLlm with prompts: You have the following objective: `conduct market research and recommend 3 xiaomi phones to sell in ecommerce`. Create a list of zero to four tasks to be completed by you such that your goal is more closely reached or completely reached. The response list MUST be a SINGLE ARRAY OF STRINGS where each string is a TASK NAME wrapped in quotes (EXAMPLE OF RESPONSE FORMAT: "["task name", "task name"]"). You MUST be able to parse the array of strings with Javascript’s JSON.parse() function. You must respond with the array WITHOUT ANY OTHER TEXT.

agentllm.vercel.app/:1 Uncaught (in promise) DOMException: Device is lost
Promise.then (async)
deviceCopyFromGPU @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
g @ index-cc4a2d3ea5fbdd8f.js:1
$func1797 @ 009c33da:0x104fc5
$func1895 @ 009c33da:0x10dc14
$func1633 @ 009c33da:0xfda33
$_ZN3tvm7runtime7NDArray10CopyFromToEPK8DLTensorPS2_Pv @ 009c33da:0xd19fa
$TVMArrayCopyFromTo @ 009c33da:0x10324e
copyFrom @ index-cc4a2d3ea5fbdd8f.js:1
updateLogitsOnCPU @ index-cc4a2d3ea5fbdd8f.js:1
sampleTokenFromLogits @ index-cc4a2d3ea5fbdd8f.js:1
generate @ index-cc4a2d3ea5fbdd8f.js:1
await in generate (async)
e @ index-cc4a2d3ea5fbdd8f.js:1
759-321cd3240cdbc07b.js:2 LLM f7a6e4d1-4819-4991-bbe8-eb31f42c37c7 errored: OperationError: The operation failed for an operation-specific reason

759-321cd3240cdbc07b.js:4 Entering new llm_chain chain...
759-321cd3240cdbc07b.js:1 Starting LLM 2df460c6-3e8e-4c56-8ff8-dfe9a43c9f77 with name webLlm with prompts: You have the following objective: `conduct market research and recommend 3 xiaomi phones to sell in ecommerce`. Create a list of zero to four tasks to be completed by you such that your goal is more closely reached or completely reached. The response list MUST be a SINGLE ARRAY OF STRINGS where each string is a TASK NAME wrapped in quotes (EXAMPLE OF RESPONSE FORMAT: "["task name", "task name"]"). You MUST be able to parse the array of strings with Javascript’s JSON.parse() function. You must respond with the array WITHOUT ANY OTHER TEXT.

agentllm.vercel.app/:1 Uncaught (in promise) DOMException: Device is lost
Promise.then (async)
deviceCopyFromGPU @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
g @ index-cc4a2d3ea5fbdd8f.js:1
$func1797 @ 009c33da:0x104fc5
$func1895 @ 009c33da:0x10dc14
$func1633 @ 009c33da:0xfda33
$_ZN3tvm7runtime7NDArray10CopyFromToEPK8DLTensorPS2_Pv @ 009c33da:0xd19fa
$TVMArrayCopyFromTo @ 009c33da:0x10324e
copyFrom @ index-cc4a2d3ea5fbdd8f.js:1
updateLogitsOnCPU @ index-cc4a2d3ea5fbdd8f.js:1
sampleTokenFromLogits @ index-cc4a2d3ea5fbdd8f.js:1
generate @ index-cc4a2d3ea5fbdd8f.js:1
await in generate (async)
e @ index-cc4a2d3ea5fbdd8f.js:1
await in e (async)
_call @ index-cc4a2d3ea5fbdd8f.js:1
_generate @ 759-321cd3240cdbc07b.js:7
_generateUncached @ 759-321cd3240cdbc07b.js:7
await in _generateUncached (async)
generate @ 759-321cd3240cdbc07b.js:7
generatePrompt @ 759-321cd3240cdbc07b.js:7
_call @ 759-321cd3240cdbc07b.js:4
await in _call (async)
call @ 759-321cd3240cdbc07b.js:4
await in call (async)
C @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1
759-321cd3240cdbc07b.js:2 LLM 2df460c6-3e8e-4c56-8ff8-dfe9a43c9f77 errored: OperationError: The operation failed for an operation-specific reason

759-321cd3240cdbc07b.js:4 Entering new llm_chain chain...
759-321cd3240cdbc07b.js:1 Starting LLM b88eca2b-e941-46de-bbb2-7197004e9a5e with name webLlm with prompts: You have the following objective: `conduct market research and recommend 3 xiaomi phones to sell in ecommerce`. Create a list of zero to four tasks to be completed by you such that your goal is more closely reached or completely reached. The response list MUST be a SINGLE ARRAY OF STRINGS where each string is a TASK NAME wrapped in quotes (EXAMPLE OF RESPONSE FORMAT: "["task name", "task name"]"). You MUST be able to parse the array of strings with Javascript’s JSON.parse() function. You must respond with the array WITHOUT ANY OTHER TEXT.

agentllm.vercel.app/:1 Uncaught (in promise) DOMException: Device is lost
Promise.then (async)
deviceCopyFromGPU @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
g @ index-cc4a2d3ea5fbdd8f.js:1
$func1797 @ 009c33da:0x104fc5
$func1895 @ 009c33da:0x10dc14
$func1633 @ 009c33da:0xfda33
$_ZN3tvm7runtime7NDArray10CopyFromToEPK8DLTensorPS2_Pv @ 009c33da:0xd19fa
$TVMArrayCopyFromTo @ 009c33da:0x10324e
copyFrom @ index-cc4a2d3ea5fbdd8f.js:1
updateLogitsOnCPU @ index-cc4a2d3ea5fbdd8f.js:1
sampleTokenFromLogits @ index-cc4a2d3ea5fbdd8f.js:1
generate @ index-cc4a2d3ea5fbdd8f.js:1
await in generate (async)
e @ index-cc4a2d3ea5fbdd8f.js:1
await in e (async)
_call @ index-cc4a2d3ea5fbdd8f.js:1
_generate @ 759-321cd3240cdbc07b.js:7
_generateUncached @ 759-321cd3240cdbc07b.js:7
await in _generateUncached (async)
generate @ 759-321cd3240cdbc07b.js:7
generatePrompt @ 759-321cd3240cdbc07b.js:7
_call @ 759-321cd3240cdbc07b.js:4
await in _call (async)
call @ 759-321cd3240cdbc07b.js:4
await in call (async)
C @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1
759-321cd3240cdbc07b.js:2 LLM b88eca2b-e941-46de-bbb2-7197004e9a5e errored: OperationError: The operation failed for an operation-specific reason

759-321cd3240cdbc07b.js:4 Entering new llm_chain chain...
759-321cd3240cdbc07b.js:1 Starting LLM 4e0113c5-db5f-4755-bfdb-9a83165138c2 with name webLlm with prompts: You have the following objective: `conduct market research and recommend 3 xiaomi phones to sell in ecommerce`. Create a list of zero to four tasks to be completed by you such that your goal is more closely reached or completely reached. The response list MUST be a SINGLE ARRAY OF STRINGS where each string is a TASK NAME wrapped in quotes (EXAMPLE OF RESPONSE FORMAT: "["task name", "task name"]"). You MUST be able to parse the array of strings with Javascript’s JSON.parse() function. You must respond with the array WITHOUT ANY OTHER TEXT.

agentllm.vercel.app/:1 Uncaught (in promise) DOMException: Device is lost
Promise.then (async)
deviceCopyFromGPU @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
g @ index-cc4a2d3ea5fbdd8f.js:1
$func1797 @ 009c33da:0x104fc5
$func1895 @ 009c33da:0x10dc14
$func1633 @ 009c33da:0xfda33
$_ZN3tvm7runtime7NDArray10CopyFromToEPK8DLTensorPS2_Pv @ 009c33da:0xd19fa
$TVMArrayCopyFromTo @ 009c33da:0x10324e
copyFrom @ index-cc4a2d3ea5fbdd8f.js:1
updateLogitsOnCPU @ index-cc4a2d3ea5fbdd8f.js:1
sampleTokenFromLogits @ index-cc4a2d3ea5fbdd8f.js:1
generate @ index-cc4a2d3ea5fbdd8f.js:1
await in generate (async)
e @ index-cc4a2d3ea5fbdd8f.js:1
await in e (async)
_call @ index-cc4a2d3ea5fbdd8f.js:1
_generate @ 759-321cd3240cdbc07b.js:7
_generateUncached @ 759-321cd3240cdbc07b.js:7
await in _generateUncached (async)
generate @ 759-321cd3240cdbc07b.js:7
generatePrompt @ 759-321cd3240cdbc07b.js:7
_call @ 759-321cd3240cdbc07b.js:4
await in _call (async)
call @ 759-321cd3240cdbc07b.js:4
await in call (async)
C @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1
759-321cd3240cdbc07b.js:2 LLM 4e0113c5-db5f-4755-bfdb-9a83165138c2 errored: OperationError: The operation failed for an operation-specific reason

index-cc4a2d3ea5fbdd8f.js:1 DOMException: The operation failed for an operation-specific reason
undefined
agentllm.vercel.app/:1 Uncaught (in promise) DOMException: Device is lost
Promise.then (async)
deviceCopyFromGPU @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ index-cc4a2d3ea5fbdd8f.js:1
g @ index-cc4a2d3ea5fbdd8f.js:1
$func1797 @ 009c33da:0x104fc5
$func1895 @ 009c33da:0x10dc14
$func1633 @ 009c33da:0xfda33
$_ZN3tvm7runtime7NDArray10CopyFromToEPK8DLTensorPS2_Pv @ 009c33da:0xd19fa
$TVMArrayCopyFromTo @ 009c33da:0x10324e
copyFrom @ index-cc4a2d3ea5fbdd8f.js:1
updateLogitsOnCPU @ index-cc4a2d3ea5fbdd8f.js:1
sampleTokenFromLogits @ index-cc4a2d3ea5fbdd8f.js:1
generate @ index-cc4a2d3ea5fbdd8f.js:1
await in generate (async)
e @ index-cc4a2d3ea5fbdd8f.js:1
await in e (async)
_call @ index-cc4a2d3ea5fbdd8f.js:1
_generate @ 759-321cd3240cdbc07b.js:7
_generateUncached @ 759-321cd3240cdbc07b.js:7
await in _generateUncached (async)
generate @ 759-321cd3240cdbc07b.js:7
generatePrompt @ 759-321cd3240cdbc07b.js:7
_call @ 759-321cd3240cdbc07b.js:4
await in _call (async)
call @ 759-321cd3240cdbc07b.js:4
await in call (async)
C @ index-cc4a2d3ea5fbdd8f.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
Promise.then (async)
l @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
a @ 759-321cd3240cdbc07b.js:1
u @ 759-321cd3240cdbc07b.js:1
(anonymous) @ 759-321cd3240cdbc07b.js:1
s @ 759-321cd3240cdbc07b.js:1```
idosal commented 1 year ago

Interesting. I'll try to see if there's anything in the way I handle the generation that might cause. Thanks for reporting!