HighRoller/Ai_Agent
1
1from all_apis import API_LIST
2
3# Function to convert JSON to documentation format
4def convert_json_to_doc(API_LIST):
5 documentation = ""
6 for idx, api in enumerate(API_LIST):
7 documentation += f"#### {idx+1}. {api['name']}\n"
8 documentation += f"- *API Description:* {api['description']}\n"
9 if api["arguments"]:
10 documentation += "- **Arguments:**\n"
11 for arg in api["arguments"]:
12 try:
13 documentation += f" - {arg['argument_name']}:\n"
14 except:
15 pass
16 try:
17 documentation += f" - Argument Description: {arg['argument_description']}\n"
18 except:
19 pass
20 try:
21 documentation += f" - Argument Type: {arg['argument_type']}\n"
22 except:
23 pass
24 return documentation