GeminiAgentsToolkit / investor-agent

1 stars 1 forks source link

Error while running `python pipeline.py` #55

Open goswamig opened 1 month ago

goswamig commented 1 month ago

Currently running pipeline.py fails due to missing creds , a good README.md will be appreciated :)

$ python pipeline.py 
all_functions: [<function buy_option_by_market_price at 0x116f818a0>, <function get_option_contract at 0x116f81760>, <function sell_option_by_limit_price at 0x12003e0c0>, <function sell_option_by_market_price at 0x12003e020>, <function sell_option_by_market_price_with_option_ticker at 0x12003df80>, <function sell_option_by_stop_limit_price at 0x12003e200>, <function sell_option_by_stop_price at 0x12003e160>, <function check_if_trading_is_blocked at 0x12003e480>, <function get_account_buying_power at 0x12003ee80>, <function get_account_equity_value at 0x1201d79c0>, <function get_current_date at 0x1201d7a60>, <function get_system_info at 0x1201d7b00>, <function is_account_paper_or_prod at 0x12003ef20>, <function switch_to_paper_account at 0x1201d7920>, <function switch_to_prod_account at 0x12003e340>, <function buy_stock_by_market_price at 0x1201d7d80>, <function sell_stock_by_market_price at 0x1201d7c40>, <function submit_stocks_limit_buy_order at 0x1201d7ce0>, <function submit_stocks_limit_sell_order at 0x1201d7e20>, <function cancel_order_by_id at 0x1201e0040>, <function get_100_latest_open_orders at 0x1201e0180>, <function get_closed_orders_in_between_dates at 0x1201e0220>, <function get_last_n_closed_orders at 0x1201e02c0>, <function get_order_by_id at 0x1201e00e0>, <function get_portfolio at 0x1201e0400>, <function get_stock_price at 0x1201e3f60>, <bound method ScheduledTaskExecutor.add_task of <gemini_agents_toolkit.scheduler.ScheduledTaskExecutor object at 0x100fbe180>>, <bound method ScheduledTaskExecutor.get_all_jobs of <gemini_agents_toolkit.scheduler.ScheduledTaskExecutor object at 0x100fbe180>>, <bound method ScheduledTaskExecutor.delete_job of <gemini_agents_toolkit.scheduler.ScheduledTaskExecutor object at 0x100fbe180>>]
about to send msg: this is one step in the pipeline, this steps are user command but not comming direclty from the user:
        Following prompt provided by user, and user expects this to compute in a boolean yes/no answer, you have to retunr
        True/False and nothing else in your response. 
        Prompt: is the market open now?
        data from prev steps: None.

        IMPORTANT: remember you ONLY can return True/False, no print(False) or print(True) or any other print statement
Retrying send_message... Attempt #1, Last error: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
about to send msg: this is one step in the pipeline, this steps are user command but not comming direclty from the user:
        Following prompt provided by user, and user expects this to compute in a boolean yes/no answer, you have to retunr
        True/False and nothing else in your response. 
        Prompt: is the market open now?
        data from prev steps: None.

        IMPORTANT: remember you ONLY can return True/False, no print(False) or print(True) or any other print statement
Retrying send_message... Attempt #2, Last error: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
Error: RetryError[<Future at 0x120a71370 state=finished raised DefaultCredentialsError>]
Traceback (most recent call last):
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/gemini_agents_toolkit/agent.py", line 176, in send_message
    response = self.chat.send_message(msg)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/vertexai/generative_models/_generative_models.py", line 926, in send_message
    return self._send_message(
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/vertexai/generative_models/_generative_models.py", line 1022, in _send_message
    response = self._model._generate_content(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/vertexai/generative_models/_generative_models.py", line 613, in _generate_content
    gapic_response = self._prediction_client.generate_content(request=request)
                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/vertexai/generative_models/_generative_models.py", line 365, in _prediction_client
    aiplatform_initializer.global_config.create_client(
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/google/cloud/aiplatform/initializer.py", line 506, in create_client
    "credentials": credentials or self.credentials,
                                  ^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/google/cloud/aiplatform/initializer.py", line 348, in credentials
    self._set_project_as_env_var_or_google_auth_default()
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/google/cloud/aiplatform/initializer.py", line 99, in _set_project_as_env_var_or_google_auth_default
    credentials, _ = google.auth.default()
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/google/auth/_default.py", line 693, in default
    raise exceptions.DefaultCredentialsError(_CLOUD_SDK_MISSING_CREDENTIALS)
google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/gautamkumar/projects/investment/investor-agent/pipeline.py", line 56, in <module>
    run_the_pipeline()
  File "/Users/gautamkumar/projects/investment/investor-agent/pipeline.py", line 28, in run_the_pipeline
    if not pipeline.boolean_step("is the market open now?"):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/gemini_agents_toolkit/pipeline/eager_pipeline.py", line 68, in boolean_step
    bool_answer = agent_to_use.send_message(prompt)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File "/Users/gautamkumar/projects/investment/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 419, in exc_check
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x120a71370 state=finished raised DefaultCredentialsError>]
^CTraceback (most recent call last):
  File "/Users/gautamkumar/projects/investment/investor-agent/pipeline.py", line 60, in <module>
    time.sleep(3600)  
    ^^^^^^^^^^^^^^^^
KeyboardInterrupt

(.venv) Gautams-Laptop:investor-agent gautamkumar$ 
goswamig commented 1 month ago

README.md does not says _CLOUD_SDK_MISSING_CREDENTIALS