Skip to content

Commit f936795

Browse files
authored
Merge pull request #10 from OpenBB-finance/feature/push-to-pypi
[Feature] Publish to PyPI
2 parents 8f64e8d + a04ceab commit f936795

File tree

5 files changed

+79
-52
lines changed

5 files changed

+79
-52
lines changed

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ["3.11"]
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
- name: Install Poetry
17+
uses: snok/install-poetry@v1
18+
with:
19+
version: 1.7.1
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Build
25+
run: |
26+
poetry build
27+
- name: Publish
28+
uses: pypa/gh-action-pypi-publish@release/v1
29+
with:
30+
password: ${{ secrets.TEST_PYPI_TOKEN }}
31+
repository_url: https://test.pypi.org/legacy/

openbb_agents/__init__.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
import logging
2+
import logging.config
3+
14
from openbb_agents.utils import get_verbosity
25

36
VERBOSE = get_verbosity()
7+
8+
logging_config = {
9+
"version": 1,
10+
"disable_existing_loggers": False,
11+
"formatters": {
12+
"json": {
13+
"()": "pythonjsonlogger.jsonlogger.JsonFormatter",
14+
"format": "%(asctime)s %(levelname)s %(name)s %(message)s",
15+
}
16+
},
17+
"handlers": {
18+
"console": {
19+
"class": "logging.StreamHandler",
20+
"stream": "ext://sys.stdout", # Default is stderr
21+
"formatter": "json",
22+
},
23+
},
24+
"loggers": { # define loggers for specific modules
25+
"openbb_agents.agent": {
26+
"handlers": ["console"],
27+
"level": "INFO",
28+
"propagate": False,
29+
},
30+
"openbb_agents.utils": {
31+
"handlers": ["console"],
32+
"level": "ERROR",
33+
"propagate": False,
34+
},
35+
"openbb_agents.chains": {
36+
"handlers": ["console"],
37+
"level": "INFO",
38+
"propagate": False,
39+
},
40+
},
41+
"root": { # root logger
42+
"handlers": ["console"],
43+
"level": "WARNING",
44+
},
45+
}
46+
47+
logging.config.dictConfig(logging_config)

openbb_agents/agent.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def openbb_agent(
5959
answered_subquestions = []
6060
for subquestion in subquestion_list.subquestions: # TODO: Do in parallel
6161
# Fetch tool for subquestion
62-
print(f"Attempting to select tools for: {subquestion.question}")
62+
logger.info("Attempting to select tools for: %s", {subquestion.question})
6363
selected_tools = select_tools(
6464
vector_index=vector_index,
6565
tools=tools,
@@ -70,10 +70,9 @@ def openbb_agent(
7070
# TODO: Improve filtering of tools (probably by storing them in a dict)
7171
tool_names = [tool.name for tool in selected_tools.tools]
7272
subquestion_tools = [tool for tool in tools if tool.name in tool_names]
73-
print(f"Retrieved tool(s): {tool_names}")
73+
logger.info("Retrieved tool(s): %s", tool_names)
7474

7575
# Then attempt to answer subquestion
76-
print(f"Attempting to answer question: {subquestion.question}")
7776
answered_subquestion = generate_subquestion_answer(
7877
SubQuestionAgentConfig(
7978
query=query,
@@ -86,7 +85,6 @@ def openbb_agent(
8685
verbose=verbose,
8786
)
8887
answered_subquestions.append(answered_subquestion)
89-
print(answered_subquestion)
9088

9189
# Answer final question
9290
return generate_final_response(

pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[tool.poetry]
22
name = "openbb-agents"
3-
version = "0.1.0"
3+
version = "0.0.2a"
44
description = "LLMs X OpenBB"
5-
authors = ["Your Name <[email protected]>"]
5+
authors = ["Michael Struwig <[email protected]>"]
66
readme = "README.md"
77

88
[tool.poetry.dependencies]
@@ -26,9 +26,6 @@ pre-commit = "^3.5.0"
2626
ruff = "^0.1.7"
2727
pytest = "^7.4.3"
2828

29-
[tool.isort]
30-
profile = "black"
31-
3229
[tool.ruff.lint]
3330
select = [
3431
"E", # pycodestyle

run.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,7 @@
11
import argparse
2-
import logging
3-
import logging.config
42

53
from openbb_agents import agent
64

7-
logging_config = {
8-
"version": 1,
9-
"disable_existing_loggers": False,
10-
"formatters": {
11-
"json": {
12-
"()": "pythonjsonlogger.jsonlogger.JsonFormatter",
13-
"format": "%(asctime)s %(levelname)s %(name)s %(message)s",
14-
}
15-
},
16-
"handlers": {
17-
"console": {
18-
"class": "logging.StreamHandler",
19-
"stream": "ext://sys.stdout", # Default is stderr
20-
"formatter": "json",
21-
},
22-
},
23-
"loggers": { # define loggers for specific modules
24-
"openbb_agents.agent": {
25-
"handlers": ["console"],
26-
"level": "INFO",
27-
"propagate": False,
28-
},
29-
"openbb_agents.utils": {
30-
"handlers": ["console"],
31-
"level": "ERROR",
32-
"propagate": False,
33-
},
34-
"openbb_agents.chains": {
35-
"handlers": ["console"],
36-
"level": "INFO",
37-
"propagate": False,
38-
},
39-
},
40-
"root": { # root logger
41-
"handlers": ["console"],
42-
"level": "WARNING",
43-
},
44-
}
45-
46-
logging.config.dictConfig(logging_config)
47-
485
parser = argparse.ArgumentParser(description="Query the OpenBB agent.")
496
parser.add_argument(
507
"query", metavar="query", type=str, help="The query to send to the agent."

0 commit comments

Comments
 (0)