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

pydantic will detect definitions #11

Open
zy2021314 opened this issue Jul 14, 2024 · 0 comments
Open

pydantic will detect definitions #11

zy2021314 opened this issue Jul 14, 2024 · 0 comments

Comments

@zy2021314
Copy link

zy2021314 commented Jul 14, 2024

Traceback (most recent call last):
File "D:\pythonProject\llm_agents\run_agent.py", line 1, in
from llm_agents import Agent, ChatLLM, PythonREPLTool, HackerNewsSearchTool, SerpAPITool
File "D:\pythonProject\llm_agents\llm_agents_init_.py", line 5, in
from llm_agents.tools.search import SerpAPITool
File "D:\pythonProject\llm_agents\llm_agents\tools\search.py", line 74, in
class SerpAPITool(ToolInterface):
File "D:\Anaconda\envs\agents\Lib\site-packages\pydantic_internal_model_construction.py", line 96, in new
private_attributes = inspect_namespace(
^^^^^^^^^^^^^^^^^^
File "D:\Anaconda\envs\agents\Lib\site-packages\pydantic_internal_model_construction.py", line 391, in inspect_namespace
raise PydanticUserError(
pydantic.errors.PydanticUserError: Field 'name' defined on a base class was overridden by a non-annotated attribute. All field definitions, including overrides, require a type annotation.

For further information visit https://errors.pydantic.dev/2.8/u/model-field-overridden

I don't know if it's a version update of the library, or if it's my configuration problem, I need to re-enforce the type definition in all utility classes, such as:

class GoogleSearchTool(ToolInterface):
"""Tool for Google search results."""

name:str = "Google Search"
description:str  = "Get specific information from a search query. Input should be a question like 'How to add number in Clojure?'. Result will be the answer to the question."

def use(self, input_text: str) -> str:
    return search(input_text)`
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

1 participant