polywrap / PolyGPT

PolyGPT is an autonomous agent that can learn new capabilities on-demand.
61 stars 9 forks source link

Feat: Awareness of previous actions to avoid looping #36

Closed rihp closed 1 year ago

rihp commented 1 year ago

Todo: add function calling to history for better memory management

We can create something like a mapping of previous commands called so that algorithmically we handle when the bot is about to call the same command twice, this is very annoying specially when calling functions that are long and token expensive, like double browsing the same website

rihp commented 1 year ago

We could try to implement it at this level

  checkIfFunctionWasProposed(
    response: ChatCompletionResponseMessage
  ): ChatCompletionRequestMessageFunctionCall | undefined {
    if (response.function_call) {
      return response.function_call;
    } else {
      this._chatInteractions.push({ role: "assistant", content: response.content! });
      return undefined;
    }
  }