Spaces:
Sleeping
Sleeping
Slight improvement to logging
Browse files
app.py
CHANGED
|
@@ -13,12 +13,14 @@ if gr.NO_RELOAD:
|
|
| 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 |
|
|
@@ -70,7 +72,7 @@ def {tool_name}({csv_tool_names}) -> str:
|
|
| 70 |
\"\"\"
|
| 71 |
{tool_guide}
|
| 72 |
\"\"\"
|
| 73 |
-
print(locals())
|
| 74 |
args = []
|
| 75 |
try:
|
| 76 |
kwargs = json.loads(kwargs)
|
|
@@ -133,6 +135,7 @@ def {tool_name}({csv_tool_names}) -> str:
|
|
| 133 |
|
| 134 |
# Launch the demo
|
| 135 |
if __name__ == "__main__":
|
|
|
|
| 136 |
demo.launch(
|
| 137 |
server_port=7860,
|
| 138 |
show_api=False,
|
|
|
|
| 13 |
INCLUDE = {"currency", "equity", "news"}
|
| 14 |
|
| 15 |
# Get tool names and guides
|
| 16 |
+
print("Getting tool names and guides...")
|
| 17 |
ARGS = "obb", obb # type: ignore
|
| 18 |
tool_names = utils.get_callable_names(*ARGS, include=INCLUDE)
|
| 19 |
tool_guides = utils.generate_callable_guides(*ARGS, tool_names)
|
| 20 |
|
| 21 |
|
| 22 |
# Build the demo interface
|
| 23 |
+
print("Building the demo...")
|
| 24 |
with gr.Blocks() as demo:
|
| 25 |
gr.Markdown("# OpenBB MCP")
|
| 26 |
|
|
|
|
| 72 |
\"\"\"
|
| 73 |
{tool_guide}
|
| 74 |
\"\"\"
|
| 75 |
+
print("{tool_name}:", locals())
|
| 76 |
args = []
|
| 77 |
try:
|
| 78 |
kwargs = json.loads(kwargs)
|
|
|
|
| 135 |
|
| 136 |
# Launch the demo
|
| 137 |
if __name__ == "__main__":
|
| 138 |
+
print("Starting the demo...")
|
| 139 |
demo.launch(
|
| 140 |
server_port=7860,
|
| 141 |
show_api=False,
|
config.py
CHANGED
|
@@ -8,6 +8,7 @@ import utils
|
|
| 8 |
|
| 9 |
|
| 10 |
# Configure LLM mode for OpenBB
|
|
|
|
| 11 |
obb.user.preferences.output_type="llm"
|
| 12 |
obb.system.python_settings.docstring_sections=['description', 'examples']
|
| 13 |
obb.system.python_settings.docstring_max_length=1024
|
|
@@ -16,6 +17,7 @@ obb.system.python_settings.docstring_max_length=1024
|
|
| 16 |
obb.user.credentials.fmp_api_key = os.environ["FMP_API_KEY"]
|
| 17 |
|
| 18 |
# Configure default provider for OpenBB
|
|
|
|
| 19 |
OPENBB_CONF_PATH = "~/.openbb_platform/user_settings.json"
|
| 20 |
with open(OPENBB_CONF_PATH) as file:
|
| 21 |
config = json.load(file)
|
|
@@ -26,4 +28,5 @@ with open(OPENBB_CONF_PATH, "w") as file:
|
|
| 26 |
json.dump(config, file)
|
| 27 |
|
| 28 |
# Build OpenBB
|
|
|
|
| 29 |
openbb.build()
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
# Configure LLM mode for OpenBB
|
| 11 |
+
print("Configuring LLM mode...")
|
| 12 |
obb.user.preferences.output_type="llm"
|
| 13 |
obb.system.python_settings.docstring_sections=['description', 'examples']
|
| 14 |
obb.system.python_settings.docstring_max_length=1024
|
|
|
|
| 17 |
obb.user.credentials.fmp_api_key = os.environ["FMP_API_KEY"]
|
| 18 |
|
| 19 |
# Configure default provider for OpenBB
|
| 20 |
+
print("Configuring default provider...")
|
| 21 |
OPENBB_CONF_PATH = "~/.openbb_platform/user_settings.json"
|
| 22 |
with open(OPENBB_CONF_PATH) as file:
|
| 23 |
config = json.load(file)
|
|
|
|
| 28 |
json.dump(config, file)
|
| 29 |
|
| 30 |
# Build OpenBB
|
| 31 |
+
print("Building OpenBB...")
|
| 32 |
openbb.build()
|