chore: remove the admin client and tests (#1923)

This commit is contained in:
Sarah Wooders
2024-10-22 15:02:28 -07:00
committed by GitHub
parent 1be576a28e
commit 7871eeb9c2
8 changed files with 34 additions and 263 deletions

View File

@@ -1,33 +1,19 @@
import json
from letta import Admin, create_client
from letta.memory import ChatMemory
from letta import create_client
from letta.schemas.memory import ChatMemory
"""
Make sure you run the Letta server before running this example.
```
export MEMGPT_SERVER_PASS=your_token
letta server
```
"""
def main():
# Create an admin client
admin = Admin(base_url="http://localhost:8283", token="your_token")
# Create a user + token
create_user_response = admin.create_user()
user_id = create_user_response.user_id
token = create_user_response.api_key
print(f"Created user: {user_id} with token: {token}")
# List available keys
get_keys_response = admin.get_keys(user_id=user_id)
print(f"User {user_id} has keys: {get_keys_response}")
# Connect to the server as a user
client = create_client(base_url="http://localhost:8283", token=token)
client = create_client(base_url="http://localhost:8283")
# Create an agent
agent_state = client.create_agent(name="my_agent", memory=ChatMemory(human="My name is Sarah.", persona="I am a friendly AI."))
@@ -42,10 +28,6 @@ def main():
client.delete_agent(agent_id=agent_state.id)
print(f"Deleted agent: {agent_state.name} with ID {str(agent_state.id)}")
# Delete user
admin.delete_user(user_id=user_id)
print(f"Deleted user: {user_id} with token: {token}")
if __name__ == "__main__":
main()

View File

@@ -11,6 +11,8 @@ from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
# NOTE: THIS file it out of date for >=0.5.0
# If modifying these scopes, delete the file token.json.
SCOPES = ["https://www.googleapis.com/auth/gmail.readonly"]
TOKEN_PATH = os.path.expanduser("~/.letta/gmail_token.json")