(func)
| 105 | |
| 106 | # set the get route to /func.__name__ and format docs |
| 107 | def task(func): |
| 108 | func.__doc__ = '''You MUST check model_docs to fetch the available models FIRST: |
| 109 | Action: model_docs |
| 110 | Action Input: {"task" : "%s"} |
| 111 | After that you can choose an available models in the list. |
| 112 | ''' % func.__name__ |
| 113 | @wraps(func) |
| 114 | def try_run_task(*args, **kwargs): |
| 115 | try: |
| 116 | return func(*args, **kwargs) |
| 117 | except RepositoryNotFoundError as e: |
| 118 | return '''The model with model_id you input is not available. Plese check the model_docs to get other available models: |
| 119 | Action: model_docs |
| 120 | Action Input: {"task" : "%s"} |
| 121 | After that you can choose an available models in the list. |
| 122 | ''' |
| 123 | path = "/" + func.__name__ |
| 124 | try_run_task.route = path |
| 125 | task_list.append(func.__name__) |
| 126 | return tool.get(path)(try_run_task) |
| 127 | |
| 128 | def format_docs(str): |
| 129 | def set_docs(func): |
nothing calls this directly
no outgoing calls
no test coverage detected