xarical commited on
Commit
8aac38c
·
1 Parent(s): 15d6f9f

Add currency and news submodules to the default include, improve comments

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -7,15 +7,18 @@ import utils
7
  if gr.NO_RELOAD:
8
  from openbb import obb
9
 
 
 
 
 
 
10
  # Get tool names and guides
11
  ARGS = "obb", obb # type: ignore
12
- tool_names = utils.get_callable_names(
13
- *ARGS,
14
- include={"equity"}
15
- )
16
  tool_guides = utils.generate_callable_guides(*ARGS, tool_names)
17
 
18
 
 
19
  with gr.Blocks() as demo:
20
  gr.Markdown("# OpenBB MCP")
21
 
@@ -43,7 +46,7 @@ with gr.Blocks() as demo:
43
  output = gr.Textbox(label="Output", lines=10)
44
  test_btn = gr.Button("Run")
45
 
46
- # Format vars
47
  t = tool_name
48
  tool_name = tool_name.replace(".", "_")
49
  tool_guide = tool_guide.replace(t, tool_name)
@@ -128,6 +131,7 @@ def {tool_name}({csv_tool_names}) -> str:
128
  """)
129
 
130
 
 
131
  if __name__ == "__main__":
132
  demo.launch(
133
  server_port=7860,
 
7
  if gr.NO_RELOAD:
8
  from openbb import obb
9
 
10
+ # A set of submodules to include when searching for tools, registering
11
+ # them to the MCP server, and dynamically building the Gradio interface
12
+ # List of valid values: https://docs.openbb.co/platform/reference
13
+ INCLUDE = {"currency", "equity", "news"}
14
+
15
  # Get tool names and guides
16
  ARGS = "obb", obb # type: ignore
17
+ tool_names = utils.get_callable_names(*ARGS, include=INCLUDE)
 
 
 
18
  tool_guides = utils.generate_callable_guides(*ARGS, tool_names)
19
 
20
 
21
+ # Build the demo interface
22
  with gr.Blocks() as demo:
23
  gr.Markdown("# OpenBB MCP")
24
 
 
46
  output = gr.Textbox(label="Output", lines=10)
47
  test_btn = gr.Button("Run")
48
 
49
+ # Format vars for dynamic function generation
50
  t = tool_name
51
  tool_name = tool_name.replace(".", "_")
52
  tool_guide = tool_guide.replace(t, tool_name)
 
131
  """)
132
 
133
 
134
+ # Launch the demo
135
  if __name__ == "__main__":
136
  demo.launch(
137
  server_port=7860,