Skip to content

Commit

Permalink
Add arxiv and agent reader
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Sep 14, 2023
1 parent c6fdefb commit a9e3717
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions agixtsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,48 @@ def learn_github_repo(
except Exception as e:
return self.handle_error(e)

def learn_arxiv(
self,
agent_name: str,
query: str = None,
arxiv_ids: str = None,
max_results: int = 5,
collection_number: int = 0,
):
try:
response = requests.post(
headers=self.headers,
url=f"{self.base_uri}/api/agent/{agent_name}/learn/arxiv",
json={
"query": query,
"arxiv_ids": arxiv_ids,
"max_results": max_results,
"collection_number": collection_number,
},
)
return response.json()["message"]
except Exception as e:
return self.handle_error(e)

def agent_reader(
self,
agent_name: str,
reader_name: str,
data: dict,
collection_number: int = 0,
):
if "collection_number" not in data:
data["collection_number"] = collection_number
try:
response = requests.post(
headers=self.headers,
url=f"{self.base_uri}/api/agent/{agent_name}/reader/{reader_name}",
json=data,
)
return response.json()["message"]
except Exception as e:
return self.handle_error(e)

def wipe_agent_memories(self, agent_name: str, collection_number: int = 0) -> str:
try:
response = requests.delete(
Expand Down
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.26",
version="0.0.27",
description="The AGiXT SDK for Python.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit a9e3717

Please sign in to comment.