forked from All-Hands-AI/OpenHands
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'All-Hands-AI:main' into main
- Loading branch information
Showing
19 changed files
with
176 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,7 +278,15 @@ function AccountSettings() { | |
<SettingsDropdownInput | ||
testId="runtime-settings-input" | ||
name="runtime-settings-input" | ||
label="Runtime Settings" | ||
label={ | ||
<> | ||
Runtime Settings ( | ||
<a href="mailto:[email protected]"> | ||
get in touch for access | ||
</a> | ||
) | ||
</> | ||
} | ||
items={REMOTE_RUNTIME_OPTIONS} | ||
defaultSelectedKey={settings.REMOTE_RUNTIME_RESOURCE_FACTOR?.toString()} | ||
isDisabled | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
openhands/memory/condenser/impl/browser_output_condenser.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from __future__ import annotations | ||
|
||
from openhands.core.config.condenser_config import BrowserOutputCondenserConfig | ||
from openhands.events.event import Event | ||
from openhands.events.observation import BrowserOutputObservation | ||
from openhands.events.observation.agent import AgentCondensationObservation | ||
from openhands.memory.condenser.condenser import Condenser | ||
|
||
|
||
class BrowserOutputCondenser(Condenser): | ||
"""A condenser that masks the observations from browser outputs outside of a recent attention window. | ||
The intent here is to mask just the browser outputs and leave everything else untouched. This is important because currently we provide screenshots and accessibility trees as input to the model for browser observations. These are really large and consume a lot of tokens without any benefits in performance. So we want to mask all such observations from all previous timesteps, and leave only the most recent one in context. | ||
""" | ||
|
||
def __init__(self, attention_window: int = 1): | ||
self.attention_window = attention_window | ||
super().__init__() | ||
|
||
def condense(self, events: list[Event]) -> list[Event]: | ||
"""Replace the content of browser observations outside of the attention window with a placeholder.""" | ||
results: list[Event] = [] | ||
cnt: int = 0 | ||
for event in reversed(events): | ||
if ( | ||
isinstance(event, BrowserOutputObservation) | ||
and cnt >= self.attention_window | ||
): | ||
results.append( | ||
AgentCondensationObservation( | ||
f'Current URL: {event.url}\nContent Omitted' | ||
) | ||
) | ||
else: | ||
results.append(event) | ||
if isinstance(event, BrowserOutputObservation): | ||
cnt += 1 | ||
|
||
return list(reversed(results)) | ||
|
||
@classmethod | ||
def from_config( | ||
cls, config: BrowserOutputCondenserConfig | ||
) -> BrowserOutputCondenser: | ||
return BrowserOutputCondenser(**config.model_dump(exclude=['type'])) | ||
|
||
|
||
BrowserOutputCondenser.register_config(BrowserOutputCondenserConfig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.