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

type object 'SEC10QToolSchema' has no attribute 'model_fields' #192

Open
matthale16 opened this issue Nov 13, 2024 · 3 comments
Open

type object 'SEC10QToolSchema' has no attribute 'model_fields' #192

matthale16 opened this issue Nov 13, 2024 · 3 comments

Comments

@matthale16
Copy link

When attempting to run stock_analysis I'm getting error:
AttributeError: type object 'SEC10QToolSchema' has no attribute 'model_fields'

AttributeError Traceback (most recent call last)
Cell In[34], line 5
1 inputs = {
2 'query': 'What is the company you want to analyze?',
3 'company_stock': 'AMZN',
4 }
----> 5 analysis_returned = StockAnalysisCrew().crew().kickoff(inputs=inputs)

File ~\AppData\Roaming\Python\Python311\site-packages\crewai\project\annotations.py:85, in crew..wrapper(self, *args, **kwargs)
83 # Instantiate tasks in order
84 for task_name, task_method in tasks:
---> 85 task_instance = task_method(self)
86 instantiated_tasks.append(task_instance)
87 agent_instance = getattr(task_instance, "agent", None)

File ~\AppData\Roaming\Python\Python311\site-packages\crewai\project\utils.py:7, in memoize..memoized_func(*args, **kwargs)
5 key = (args, tuple(kwargs.items()))
6 if key not in cache:
----> 7 cache[key] = func(*args, **kwargs)
8 return cache[key]

File ~\AppData\Roaming\Python\Python311\site-packages\crewai\project\annotations.py:13, in task..wrapper(*args, **kwargs)
11 @wraps(func)
12 def wrapper(*args, **kwargs):
---> 13 result = func(*args, **kwargs)
14 if not result.name:
15 result.name = func.name

File ~\Dropbox\Hale Personal Files1\Programming Dropbox\241112_multi-agent\crew.py:88, in StockAnalysisCrew.financial_analysis(self)
84 @task
85 def financial_analysis(self) -> Task:
86 return Task(
87 config=self.tasks_config['financial_analysis'],
---> 88 agent=self.financial_analyst_agent(),
89 )

File ~\AppData\Roaming\Python\Python311\site-packages\crewai\project\utils.py:7, in memoize..memoized_func(*args, **kwargs)
5 key = (args, tuple(kwargs.items()))
6 if key not in cache:
----> 7 cache[key] = func(*args, **kwargs)
8 return cache[key]

File ~\Dropbox\Hale Personal Files1\Programming Dropbox\241112_multi-agent\crew.py:79, in StockAnalysisCrew.financial_analyst_agent(self)
69 @agent
70 def financial_analyst_agent(self) -> Agent:
71 return Agent(
72 config=self.agents_config['financial_analyst'],
73 verbose=True,
74 llm=llm,
75 tools=[
76 ScrapeWebsiteTool(),
77 WebsiteSearchTool(),
78 CalculatorTool(),
---> 79 SEC10QTool(),
80 SEC10KTool(),
81 ]
82 )

File ~\Dropbox\Hale Personal Files1\Programming Dropbox\241112_multi-agent\tools\sec_tools.py:113, in SEC10QTool.init(self, stock_name, **kwargs)
111 print("enter init")
112 # exit()
--> 113 super().init(**kwargs)
114 if stock_name is not None:
115 content = self.get_10q_url_content(stock_name)

[... skipping hidden 1 frame]

File ~\AppData\Roaming\Python\Python311\site-packages\crewai\tools\base_tool.py:46, in BaseTool.model_post_init(self, _BaseTool__context)
45 def model_post_init(self, __context: Any) -> None:
---> 46 self._generate_description()
48 super().model_post_init(__context)

File ~\AppData\Roaming\Python\Python311\site-packages\crewai\tools\base_tool.py:109, in BaseTool._generate_description(self)
103 def _generate_description(self):
104 args_schema = {
105 name: {
106 "description": field.description,
107 "type": BaseTool._get_arg_annotations(field.annotation),
108 }
--> 109 for name, field in self.args_schema.model_fields.items()
110 }
112 self.description = f"Tool Name: {self.name}\nTool Arguments: {args_schema}\nTool Description: {self.description}"

AttributeError: type object 'SEC10QToolSchema' has no attribute 'model_fields'

@theCyberTech
Copy link
Contributor

can you change

from pydantic.v1 import BaseModel, Field

to

from pydantic import BaseModel, Field

Copy link

github-actions bot commented Jan 4, 2025

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@jomach
Copy link

jomach commented Jan 8, 2025

same issue

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

No branches or pull requests

3 participants