Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #188 from sr5434/iss
Browse files Browse the repository at this point in the history
Add an ISS position tracker to the Astro plugin
  • Loading branch information
NeonN3mesis authored Sep 21, 2023
2 parents fa5b4e9 + 91bc5fd commit fbf7724
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/autogpt_plugins/astro/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Auto-GPT Space Plugin
This plugin enables AutoGPT to see how many people are in space. This can help enable AutoGPT to better achieve its goals
This plugin enables AutoGPT to see how many people are in space and see the position of the ISS. This can help enable AutoGPT to better achieve its goals.

## Use cases
- Researching how many people are in space
Expand Down
10 changes: 8 additions & 2 deletions src/autogpt_plugins/astro/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""This is the email plugin for Auto-GPT."""
"""This is the space plugin for Auto-GPT."""
import os
from typing import Any, Dict, List, Optional, Tuple, TypedDict, TypeVar

Expand Down Expand Up @@ -34,6 +34,12 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
{},
get_num_astronauts,
)
prompt.add_command(
"Get the coordinates of the ISS",
"get_coords_iss",
{},
get_coords_iss,
)

return prompt

Expand Down Expand Up @@ -246,4 +252,4 @@ def can_handle_report(self) -> bool:
return False

def report(self, message: str) -> None:
pass
pass
15 changes: 15 additions & 0 deletions src/autogpt_plugins/astro/astronauts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,18 @@ def get_num_astronauts():
data = response.json()
#Extract the number and return it
return data["number"]

def get_coords_iss():
"""Get the coordinates of the ISS
Args:
None
Returns:
int: The latitude of the ISS.
int: The longitude of the ISS.
"""
#Get the data
response = requests.get("http://api.open-notify.org/iss-now.json")
#Convert it to JSON
data = response.json()
#Extract the number and return it
return float(data["iss_position"]["latitude"]), float(data["iss_position"]["longitude"])
9 changes: 7 additions & 2 deletions src/autogpt_plugins/astro/test_astro_plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from .astronauts import get_num_astronauts

from .astronauts import get_coords_iss

def test_astro():
assert type(get_num_astronauts())==int
assert type(get_num_astronauts())==int

def test_iss():
latitude, longitude = get_coords_iss()
assert type(latitude)==float
assert type(longitude)==float

0 comments on commit fbf7724

Please sign in to comment.