Skip to content

Commit

Permalink
Merge pull request #1 from Josh-XT/Migration-to-more-chains
Browse files Browse the repository at this point in the history
Migration to more chains
  • Loading branch information
Josh-XT authored Jun 29, 2023
2 parents 58897e7 + 0c460ff commit b8f8750
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
52 changes: 25 additions & 27 deletions agixtsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,52 +103,50 @@ def prompt_agent(
prompt_name: str,
prompt_args: dict,
user_input: str = "",
websearch: bool = False,
websearch_depth: int = 3,
context_results: int = 5,
shots: int = 1,
) -> str:
response = requests.post(
f"{self.base_uri}/api/agent/{agent_name}/prompt",
json={
"user_input": user_input,
"prompt_name": prompt_name,
"prompt_args": prompt_args,
"websearch": websearch,
"websearch_depth": websearch_depth,
"context_results": context_results,
"shots": shots,
},
)
return response.json()["response"]

def instruct(self, agent_name: str, prompt: str) -> str:
response = requests.post(
f"{self.base_uri}/api/agent/{agent_name}/instruct",
json={"prompt": prompt},
return self.prompt_agent(
agent_name=agent_name,
prompt_name="instruct",
user_input=prompt,
prompt_args={},
)
return response.json()["response"]

def smartinstruct(self, agent_name: str, shots: int, prompt: str) -> str:
response = requests.post(
f"{self.base_uri}/api/agent/{agent_name}/smartinstruct/{shots}",
json={"prompt": prompt},
def chat(self, agent_name: str, prompt: str) -> str:
return self.prompt_agent(
agent_name=agent_name,
prompt_name="Chat",
user_input=prompt,
prompt_args={"context_reslts": 4},
)
return response.json()["response"]

def chat(self, agent_name: str, prompt: str) -> str:
response = requests.post(
f"{self.base_uri}/api/agent/{agent_name}/chat",
json={"prompt": prompt},
def smartinstruct(self, agent_name: str, prompt: str) -> str:
return self.run_chain(
chain_name="Smart Instruct",
user_input=prompt,
agent_name=agent_name,
all_responses=False,
from_step=1,
)
return response.json()["response"]

def smartchat(self, agent_name: str, shots: int, prompt: str) -> str:
response = requests.post(
f"{self.base_uri}/api/agent/{agent_name}/smartchat/{shots}",
json={"prompt": prompt},
def smartchat(self, agent_name: str, prompt: str) -> str:
return self.run_chain(
chain_name="Smart Chat",
user_input=prompt,
agent_name=agent_name,
all_responses=False,
from_step=1,
)
return response.json()["response"]

def get_commands(self, agent_name: str) -> Dict[str, Dict[str, bool]]:
response = requests.get(f"{self.base_uri}/api/agent/{agent_name}/command")
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.3",
version="0.0.4",
description="The AGiXT SDK for Python.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit b8f8750

Please sign in to comment.