Skip to content

Commit

Permalink
Add learn_github_repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Aug 11, 2023
1 parent b68a975 commit 65aefde
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
29 changes: 27 additions & 2 deletions agixtsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,15 @@ def get_agentconfig(self, agent_name: str) -> Dict[str, Any]:
except Exception as e:
return self.handle_error(e)

def get_conversations(self, agent_name: str) -> List[str]:
def get_conversations(self, agent_name: str = "") -> List[str]:
if agent_name == "":
url = f"{self.base_uri}/api/conversations"
else:
url = f"{self.base_uri}/api/{agent_name}/conversations"
try:
response = requests.get(
headers=self.headers,
url=f"{self.base_uri}/api/{agent_name}/conversations",
url=url,
)
return response.json()["conversations"]
except Exception as e:
Expand Down Expand Up @@ -639,3 +643,24 @@ def learn_file(self, agent_name: str, file_name: str, file_content: str) -> str:
return response.json()["message"]
except Exception as e:
return self.handle_error(e)

def learn_github_repo(
self,
agent_name: str,
github_repo: str,
github_user: str = None,
github_token: str = None,
):
try:
response = requests.post(
headers=self.headers,
url=f"{self.base_uri}/api/agent/{agent_name}/learn/github",
json={
"github_repo": github_repo,
"github_user": github_user,
"github_token": github_token,
},
)
return response.json()["message"]
except Exception as e:
return self.handle_error(e)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name="agixtsdk",
version="0.0.19",
version="0.0.20",
description="The AGiXT SDK for Python.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 65aefde

Please sign in to comment.