OpenBB-MCP / config.py
xarical's picture
Add home path (~) expansion in config.py (fixes 42c6967b4ce8a92df939d60ee4eacecd6492b7b1)
221bb1f
raw
history blame contribute delete
908 Bytes
import json
import os
from openbb import obb
import openbb
import utils
# Configure LLM mode for OpenBB
print("Configuring LLM mode...")
obb.user.preferences.output_type="llm"
obb.system.python_settings.docstring_sections=['description', 'examples']
obb.system.python_settings.docstring_max_length=1024
# Set API keys
obb.user.credentials.fmp_api_key = os.environ["FMP_API_KEY"]
# Configure default provider for OpenBB
print("Configuring default provider...")
OPENBB_CONF_PATH = "~/.openbb_platform/user_settings.json"
path = os.path.expanduser(OPENBB_CONF_PATH)
with open(path) as file:
config = json.load(file)
for tool_name in utils.get_callable_names("obb", obb):
tname = tool_name[3:].replace(".", "/")
config["defaults"]["commands"][tname] = {"provider": "yfinance"}
with open(path, "w") as file:
json.dump(config, file)
# Build OpenBB
print("Building OpenBB...")
openbb.build()