Spaces:
Sleeping
Sleeping
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import argparse | |
import json | |
import time | |
from openai import OpenAI | |
from openai.pagination import SyncCursorPage | |
from openai.types.beta.threads import ThreadMessage | |
from openai.types.beta.assistant import Assistant | |
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 = client.files.delete(file_id="file-Rienw0VlV1Ed9QCLZcVmUfgI") | |
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() | |