Skip to content

Commit

Permalink
Planner Human Intervention Enhancement (aiplanethub#37)
Browse files Browse the repository at this point in the history
* Add human intervention prompt

* Update `HumanCLIInput` action

* Update single agent execution

* Fix iteration updation in worker

* Fix prompt picker

* Minor fixes & enhancements

* Fix single agent execution

* Update supported actions
  • Loading branch information
ShreehariVaasishta authored Jul 5, 2024
1 parent a30e134 commit 28213f8
Show file tree
Hide file tree
Showing 12 changed files with 303 additions and 257 deletions.
4 changes: 2 additions & 2 deletions src/openagi/actions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class BaseAction(BaseModel):
llm: Optional[LLMBaseModel] = Field(
description="LLM Model to be used.", default=None, exclude=True
)
memory: Memory = Field(
...,
memory: Optional[Memory] = Field(
description="Memory that stores the results of the earlier tasks executed for the current objective.",
exclude=True,
default=None,
)

def execute(self):
Expand Down
6 changes: 3 additions & 3 deletions src/openagi/actions/human_input.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, Dict
from openagi.actions.base import BaseAction
from pydantic import Field

from openagi.actions.base import BaseAction


class HumanCLIInput(BaseAction):
ques_prompt: str = Field(
Expand All @@ -10,5 +10,5 @@ class HumanCLIInput(BaseAction):
)

def execute(self):
response = input(self.ques_prompt)
response = input(f"Agent: {self.ques_prompt}\nYou: ")
return response
3 changes: 3 additions & 0 deletions src/openagi/actions/tools/webloader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import nltk
from langchain_community.document_loaders import WebBaseLoader
from pydantic import Field
Expand All @@ -15,6 +16,7 @@
class WebBaseContextTool(BaseAction):
"""
Use this Action to extract actual context from a Webpage. The WebBaseContextTool class provides a way to load and optionally summarize the content of a webpage, returning the metadata and page content as a context string.
If a url seems to be failing for more than once, ignore it and move forward.
"""

link: str = Field(
Expand Down Expand Up @@ -43,6 +45,7 @@ def execute(self):
if page_content:
page_content = page_content.strip()
if self.can_summarize:
logging.info(f"Summarizing the page {self.link}...")
page_content = self._get_summary(page_content)
context = metadata + page_content
return context
Loading

0 comments on commit 28213f8

Please sign in to comment.