Closed JEugenio-GitHub closed 8 months ago
I think the difference here is that you now need to better type the argument, instead of just giving it a name, specific its type and I think it should work better but I’ll give it a try later this week Em 12 de mar. de 2024, 02:20 -0300, JEugenio-GitHub @.***> escreveu:
For some reason, the input data for my tool is wrong in newer versions of crewai. This works with crewai=0.16.0 but when updating to the latest crewai > 0.19.0 I am seeing this issue. Here is my tool: @tool("Search multiple 10-Q forms") def search_multiple_10qs(data): """ Useful to search information from the latest 10-Q form for a list of companies. The input to this tool should be a dictionairy object with key=tickers and value=list of research questions Example data: { "AAPL": ["What is Apple's revenue for last quater?", "What are Apple's revenue streams?","What is the current financial health of Apple?"], "CRWD: ["What is CrowdStrike's revenue for last quater?", "How does CrowdStrike earn it's money?","Does CrowdStrike have any risks?"], "BABA: ["What is Alibaba's revenue for last quater?", "How does CrowdStrike's financial health look compared to last quarter?", "What are CrowdStrike's biggest expense?"] } """ print("\nCalling multiple_10qs") print(type(data)) print(data) answer = "" for company, questions in data.items(): for question in questions: print(question)
For each question, get the internal answer
internal_answer = SECTools.__sec_query(question, company) # Assuming SECTools.__sec_query is correctly implemented # # Format the question and answer formatted_output = f"\n{company}-{question}\n{internal_answer}\n" # # Accumulate the answer answer += formatted_output
return answer Here is output: I need to craft a set of research questions for each company ('BMY', 'MA', 'AMZN') that are quantitative and can be derived from their financial statements. These questions should be designed to assess the financial health of each company and be understandable to a high school student beginning to explore personal finance. Given the audience, the questions should be straightforward and cover basic financial metrics such as revenue, expenses, and growth, as well as specific inquiries into risks, market share, and financial guidance. Considering this, I will proceed to formulate the questions.
Action: Search multiple 10-Q forms Action Input: { "BMY": [ "What is Bristol-Myers Squibb's total revenue for the last quarter?", "How many revenue streams does Bristol-Myers Squibb have, and what are they?", "What were Bristol-Myers Squibb's total operational expenses last quarter?", "What is Bristol-Myers Squibb's net income from the last quarter?", "What are the biggest financial risks currently facing Bristol-Myers Squibb?", "What financial guidance has Bristol-Myers Squibb provided for the next quarter?", "What is Bristol-Myers Squibb's current market share in the pharmaceutical industry?" ], "MA": [ "What is MasterCard's total revenue for the last quarter?", "What are the main revenue streams for MasterCard?", "What were MasterCard's total operational expenses last quarter?", "What is MasterCard's net income from the last quarter?", "What are the biggest financial risks currently facing MasterCard?", "What financial guidance has MasterCard provided for the upcoming quarter?", "What is MasterCard's current market share in the payment processing industry?" ], "AMZN": [ "What is Amazon's total revenue for the last quarter?", "How many revenue streams does Amazon have, and what are they?", "What were Amazon's total operational expenses last quarter?", "What is Amazon's net income from the last quarter?", "What are the biggest financial risks currently facing Amazon?", "What financial guidance has Amazon provided for the next quarter?", "What is Amazon's current market share in the e-commerce and cloud computing markets?" ] }
I encountered an error while trying to use the tool. This was the error: SECTools.search_multiple_10qs_2() got an unexpected keyword argument 'BMY'. Tool Search multiple 10-Q forms accepts these inputs: Search multiple 10-Q forms(data) - Useful to search information from the latest 10-Q form for a list of companies. The input to this tool should be a dictionairy object with key=tickers and value=list of research questions Example data: { "AAPL": ["What is Apple's revenue for last quater?", "What are Apple's revenue streams?","What is the current financial health of Apple?"], "CRWD: ["What is CrowdStrike's revenue for last quater?", "How does CrowdStrike earn it's money?","Does CrowdStrike have any risks?"], "BABA: ["What is Alibaba's revenue for last quater?", "How does CrowdStrike's financial health look compared to last quarter?", "What are CrowdStrike's biggest expense?"] } — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
It ended up working better after typing the input and output of the tool. I also updated the example given in the description to include the payload object first.
This is the tool that is now working
@tool("Search multiple 10-Q forms")
def search_multiple_10qs(payload: dict) -> str:
"""
Useful to search information from the latest 10-Q form for a
list of companies.
The input to this tool should be a dictionairy.
For example:
{
"payload": {
"AAPL": ["What is Apple's revenue for last quater?", "What are Apple's revenue streams?","What is the current financial health of Apple?"],
"CRWD: ["What is CrowdStrike's revenue for last quater?", "How does CrowdStrike earn it's money?","Does CrowdStrike have any risks?"],
"BABA: ["What is Alibaba's revenue for last quater?", "How does CrowdStrike's financial health look compared to last quarter?", "What are CrowdStrike's biggest expense?"]
}
}
"""
print("\nCalling multiple_10qs")
print(type(payload))
print(payload)
answer = ""
for company, questions in payload.items():
for question in questions:
print(question)
# For each question, get the internal answer
internal_answer = SECTools.__sec_query(question, company) # Assuming SECTools.__sec_query is correctly implemented
# # Format the question and answer
formatted_output = f"\n{company}-{question}\n{internal_answer}\n"
# # Accumulate the answer
answer += formatted_output
return answer
For some reason, the input data for my tool is wrong in newer versions of crewai. This works with crewai=0.16.0 but when updating to the latest crewai > 0.19.0 I am seeing this issue.
Here is my tool:
Here is output: