lawyer_assitance / examples /test /test_assistant /test_assistant_delete.py
qgyd2021's picture
[update]add list assistant files
3281c07
raw
history blame contribute delete
925 Bytes
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
import json
import time
from openai import OpenAI
from openai.types.beta.asssitant_deleted import AsssitantDeleted
from project_settings import environment, project_path
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--openai_api_key",
default=environment.get("openai_api_key", default=None, dtype=str),
type=str
)
args = parser.parse_args()
return args
def main():
args = get_args()
client = OpenAI(
api_key=args.openai_api_key
)
result: AsssitantDeleted = client.beta.assistants.delete(assistant_id="asst_bXMHkMvMfJX2J0JgK4nIHKqc")
print(f"result: {result}")
print(result.model_dump(mode="json"))
result = json.dumps(result.model_dump(mode="json"), indent=4, ensure_ascii=False)
print(result)
return
if __name__ == '__main__':
main()