Spaces:
Sleeping
Sleeping
| 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() | |