Spaces:
Running
Running
File size: 975 Bytes
3281c07 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#!/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()
|