Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling and improved handling of the .env file (which was currently unused) #12

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

arsaboo
Copy link

@arsaboo arsaboo commented Dec 23, 2024

Addressed some of the errors that I encountered:

$:~/ai-hedge-fund$ poetry run python src/agents.py --ticker AAPL
Traceback (most recent call last):
  File "/home/arsaboo/ai-hedge-fund/src/agents.py", line 751, in <module>
    result = run_hedge_fund(
  File "/home/arsaboo/ai-hedge-fund/src/agents.py", line 678, in run_hedge_fund
    final_state = app.invoke(
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/__init__.py", line 1929, in invoke
    for chunk in self.stream(
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/__init__.py", line 1649, in stream
    for _ in runner.tick(
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/runner.py", line 105, in tick
    run_with_retry(t, retry_policy, writer=writer)
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/retry.py", line 44, in run_with_retry
    task.proc.invoke(task.input, config)
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/utils/runnable.py", line 410, in invoke
    input = context.run(step.invoke, input, config, **kwargs)
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/utils/runnable.py", line 184, in invoke
    ret = context.run(self.func, input, **kwargs)
  File "/home/arsaboo/ai-hedge-fund/src/agents.py", line 46, in market_data_agent
    prices = get_prices(
  File "/home/arsaboo/ai-hedge-fund/src/tools.py", line 125, in get_prices
    raise Exception(
Exception: Error fetching data: 402 - {"error":"Insufficient credits","message":"Your current balance is $0.00. Please add more credits to continue using the API."}
$:~/ai-hedge-fund$ poetry run python src/agents.py --ticker AAPL
Traceback (most recent call last):
  File "/home/arsaboo/ai-hedge-fund/src/agents.py", line 751, in <module>
    result = run_hedge_fund(
  File "/home/arsaboo/ai-hedge-fund/src/agents.py", line 678, in run_hedge_fund
    final_state = app.invoke(
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/__init__.py", line 1929, in invoke
    for chunk in self.stream(
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/__init__.py", line 1649, in stream
    for _ in runner.tick(
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/runner.py", line 160, in tick
    _panic_or_proceed(
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/runner.py", line 370, in _panic_or_proceed
    raise exc
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/executor.py", line 70, in done
    task.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/pregel/retry.py", line 44, in run_with_retry
    task.proc.invoke(task.input, config)
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/utils/runnable.py", line 410, in invoke
    input = context.run(step.invoke, input, config, **kwargs)
  File "/home/arsaboo/.cache/pypoetry/virtualenvs/ai-hedge-fund-2IwyPuRU-py3.10/lib/python3.10/site-packages/langgraph/utils/runnable.py", line 184, in invoke
    ret = context.run(self.func, input, **kwargs)
  File "/home/arsaboo/ai-hedge-fund/src/agents.py", line 357, in sentiment_agent
    if trade["transaction_shares"] < 0:
TypeError: '<' not supported between instances of 'NoneType' and 'int'

@arsaboo arsaboo changed the title Add error handling for data fetching in market_data_agent Improve error handling Dec 23, 2024
@arsaboo arsaboo changed the title Improve error handling Improve error handling and improved handling of the .env file (which was currently unused) Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant