mckaywrigley / ai-brainstore

Come join the best place on the internet to learn AI skills. Use code "aibrainstore" for an extra 20% off.
https://JoinTakeoff.com
MIT License
692 stars 101 forks source link

"I made a mistake. Trying again..." loop #2

Open CryptoLibertus opened 1 year ago

CryptoLibertus commented 1 year ago

Anyone know how to solve this loop?

Insuffient memories. Now learning...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...
nattyraz commented 1 year ago

Anyone know how to solve this loop?

Insuffient memories. Now learning...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

yes i got the same issue ...

nattyraz commented 1 year ago

Anyone know how to solve this loop?

Insuffient memories. Now learning...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I made a mistake. Trying again...

I delete my SERPAPI_API_KEY and is working now.... Not sur wy, but is Working !

nattyraz commented 1 year ago

@CryptoLibertus I delete my SERPAPI_API_KEY and is working now.... Not sur wy, but is Working !

CryptoLibertus commented 1 year ago

well its strange but it does work now. I got a bunch of the same but then got an answer. Might be something related to Chroma.

nattyraz commented 1 year ago

well its strange but it does work now. I got a bunch of the same but then got an answer. Might be something related to Chroma.

it work for me, but is verry slow... can we add a other api? whiteout adding to much code ?

r-fumachi commented 1 year ago

I also had this issue. At first it was because of a wrong SerpApi key, and then it was because I wasn't providing a "clear question".

https://github.com/mckaywrigley/ai-brainstore/blob/273dd45a4df4298c582c3efe8a49b8e75e7db0c9/utils/index.ts#L78

Debug logs are helpful to figure out what is actually causing the loop.

    catch (e) {
        console.log("Error", e.stack);
        console.log("Error", e.name);
        console.log("Error", e.message);
        console.log(chalk.red("\nI made a mistake. Trying again..."));
        return answerFromSearch(brain, input);
    }

For example when you don't provide a question, the error is

I made a mistake. Trying again...
Error Error: Unable to parse JSON response from chat agent.

I'm sorry, but the input "gg" is not a clear question or request. Please provide a valid input that I can help you with.
    at ChatAgent.extractToolAndInput  

And when your key is wrong then the error is

I made a mistake. Trying again...
Error Error: Got error from serpAPI: Invalid API key. Your API key should be here: https://serpapi.com/manage-api-key
    at SerpAPI._call 

I'd make the bot output the error message and then just allow the user to ask another question instead of this endless "made a mistake" loop

nattyraz commented 1 year ago

hi

I also had this issue. At first it was because of a wrong SerpApi key, and then it was because I wasn't providing a "clear question".

https://github.com/mckaywrigley/ai-brainstore/blob/273dd45a4df4298c582c3efe8a49b8e75e7db0c9/utils/index.ts#L78

Debug logs are helpful to figure out what is actually causing the loop.

    catch (e) {
        console.log("Error", e.stack);
        console.log("Error", e.name);
        console.log("Error", e.message);
        console.log(chalk.red("\nI made a mistake. Trying again..."));
        return answerFromSearch(brain, input);
    }

For example when you don't provide a question, the error is

I made a mistake. Trying again...
Error Error: Unable to parse JSON response from chat agent.

I'm sorry, but the input "gg" is not a clear question or request. Please provide a valid input that I can help you with.
    at ChatAgent.extractToolAndInput  

And when your key is wrong then the error is

I made a mistake. Trying again...
Error Error: Got error from serpAPI: Invalid API key. Your API key should be here: https://serpapi.com/manage-api-key
    at SerpAPI._call 

I'd make the bot output the error message and then just allow the user to ask another question instead of this endless "made a mistake" loop

hi @r-fumachi , i got my API key from = https://serper.dev/api-key, and is should work..... did't you fix it ?

r-fumachi commented 1 year ago

your key should be here https://serpapi.com/manage-api-key

nattyraz commented 1 year ago

your key should be here https://serpapi.com/manage-api-key yes !! your are a master !! thx