Skip to content

Too Many Requests. Rate limited. Try after a while #61

@tonyt82

Description

@tonyt82

import os
import autogen
from textwrap import dedent
from finrobot.utils import register_keys_from_json
from finrobot.agents.workflow import SingleAssistantShadow

llm_config = {
"config_list": autogen.config_list_from_json(
"OAI_CONFIG_LIST",
filter_dict={
"model": ["gpt-4-0125-preview"],
},
),
"timeout": 120,
"temperature": 0.5,
}
register_keys_from_json("config_api_keys")

work_dir = "report"
os.makedirs(work_dir, exist_ok=True)

assistant = SingleAssistantShadow(
"Expert_Investor",
llm_config,
max_consecutive_auto_reply=None,
human_input_mode="TERMINATE",
)

company = "NVDA"
fyear = "2025"

message = dedent(
f"""
With the tools you've been provided, write an annual report based on {company}'s {fyear} 10-k report, format it into a pdf.
Pay attention to the followings:
- Explicitly explain your working plan before you kick off.
- Use tools one by one for clarity, especially when asking for instructions.
- All your file operations should be done in "{work_dir}".
- Display any image in the chat once generated.
- All the paragraphs should combipyne between 400 and 450 words, don't generate the pdf until this is explicitly fulfilled.
"""
)

assistant.chat(message, use_cache=True, max_turns=50,
summary_method="last_msg")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions