Skip to content

Commit

Permalink
Make lints happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtorreggiani committed Oct 26, 2024
1 parent e481ff3 commit 88f10e5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
9 changes: 2 additions & 7 deletions src/goose_plugins/toolkits/critical_systems_thinking.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ def analyze_request(self, statement: str) -> str:
]

exchange = Exchange(
provider=provider,
model="claude-3-5-sonnet-20240620",
messages=existing_messages_copy, system=None
provider=provider, model="claude-3-5-sonnet-20240620", messages=existing_messages_copy, system=None
)

request_input = f"""
Expand Down Expand Up @@ -141,10 +139,7 @@ def consider_solutions(self, statement: str) -> str:
]

exchange = Exchange(
provider=provider,
model="claude-3-5-sonnet-20240620",
messages=existing_messages_copy,
system=None
provider=provider, model="claude-3-5-sonnet-20240620", messages=existing_messages_copy, system=None
)

request_input = f"""
Expand Down
9 changes: 5 additions & 4 deletions src/goose_plugins/utils/selenium_web_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
from webdriver_manager.chrome import ChromeDriverManager
import time


def chrome_driver_path() -> str:
return "/opt/homebrew/bin/chromedriver"

def get_web_page_content(url: str, wait_time: int=10) -> str:

def get_web_page_content(url: str, wait_time: int = 10) -> str:
# Set up Chrome options
chrome_options = Options()
chrome_options.add_argument("--headless") # Run in headless mode (no GUI)
Expand All @@ -27,9 +29,7 @@ def get_web_page_content(url: str, wait_time: int=10) -> str:
driver.get(url)

# Wait for the page to load
WebDriverWait(driver, wait_time).until(
expected_conditions.presence_of_element_located((By.TAG_NAME, "body"))
)
WebDriverWait(driver, wait_time).until(expected_conditions.presence_of_element_located((By.TAG_NAME, "body")))

# Allow some time for JavaScript to execute
time.sleep(wait_time)
Expand All @@ -46,6 +46,7 @@ def get_web_page_content(url: str, wait_time: int=10) -> str:
# Close the browser
driver.quit()


if __name__ == "__main__":
url = "https://www.google.com"
content = get_web_page_content(url)
Expand Down
16 changes: 5 additions & 11 deletions src/goose_plugins/utils/serper_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
import json
import requests


def serper_search(query: str) -> str:
payload = json.dumps({ 'q': query })
headers = {
'X-API-KEY': os.getenv('SERPER_API_KEY'),
'Content-Type': 'application/json'
}
response = requests.request(
'POST',
'https://google.serper.dev/search',
headers=headers, data=payload
)
return response.text
payload = json.dumps({"q": query})
headers = {"X-API-KEY": os.getenv("SERPER_API_KEY"), "Content-Type": "application/json"}
response = requests.request("POST", "https://google.serper.dev/search", headers=headers, data=payload)
return response.text
2 changes: 2 additions & 0 deletions tests/toolkits/test_critical_systems_thinking.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ def critical_systems_thinking() -> CriticalSystemsThinking:
toolkit.exchange_view.processor.messages = []
return toolkit


def test_check_status(critical_systems_thinking: CriticalSystemsThinking) -> None:
result = critical_systems_thinking.check_status()

assert "OK" == result


if __name__ == "__main__":
pytest.main()

0 comments on commit 88f10e5

Please sign in to comment.