Spaces:
Running
Running
File size: 1,010 Bytes
44e1a5b |
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 47 48 49 50 51 52 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
import importlib
import time
from openai import OpenAI
from openai.pagination import SyncCursorPage
from openai.types.beta.threads import ThreadMessage
from project_settings import environment, project_path
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--package_name",
default="get_current_weather",
type=str
)
parser.add_argument(
"--function_name",
default="get_current_weather",
type=str
)
args = parser.parse_args()
return args
def main():
args = get_args()
lib = importlib.import_module("functions.{}".format(args.package_name))
print(lib)
function_to_call = getattr(lib, args.function_name)
print(function_to_call)
result = function_to_call("beijing")
print(result)
del lib
lib = importlib.import_module("functions.not_exist")
print(lib)
return
if __name__ == '__main__':
main()
|