MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / model_docs

Function model_docs

bmtools/tools/hugging_tools/api.py:318–337  ·  view source on GitHub ↗

returns a document about the usage, examples, and available models of existing API. Every time before you use the API, you should get the document of EXISTING API ONLY and ONLY use the available models in the document. task: the name of API, includes %s retur

(task: str)

Source from the content-addressed store, hash-verified

316 @tool.get("/model_docs")
317 @format_docs(str(task_list))
318 def model_docs(task: str) -> str:
319 '''returns a document about the usage, examples, and available models of existing API.
320
321 Every time before you use the API, you should get the document of EXISTING API ONLY and ONLY use the available models in the document.
322
323 task: the name of API, includes %s
324
325 return the document of the API.
326
327 example:
328 Action: model_docs
329 Action Input: {"task" : "question_answering"}
330 Observation: "question_answering is a function that uses a pre-trained language model to answer questions based on a given context.\n You can choose one model from: 'distilbert-base-uncased-distilled-squad', 'deepset/minilm-uncased-squad2', 'etalab-ia/camembert-base-squadFR-fquad-piaf'.\n\n Action Input: {\"model_id\" : \"distilbert-base-uncased-distilled-squad\", \"question\" : \"When did the first moon landing occur?\", \"context\" : \"The first manned moon landing was achieved by the United States on July 20, 1969, in the Apollo 11 mission.\"}\n "
331 '''
332 with open(f'{DIRPATH}/{DOCS_PATH}', 'r') as f:
333 docs = json.load(f)
334 if task in docs.keys():
335 return docs[task]
336 else:
337 return "The function doesn't exist. Please input the valid function name."
338
339 return tool

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected