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

PydanticUserError while compiling error from basetool.py caused by ToolMetaclass #63

Closed
Jupiter1995 opened this issue Nov 14, 2023 · 8 comments

Comments

@Jupiter1995
Copy link

Jupiter1995 commented Nov 14, 2023

When running a customized assembler.py, I received a pydnatic error saying, "Field name doesn't have the annotation." The detailed error screenshot is attached below and some printouts to help understand the problem.

error:
image

printout code and printouts:
# test block codes inside basetool.py under ToolMetaclass.__new__():
print("----test block-----")
print(f"tool name: {name} \n")
print(f"namespace dict annotation list: {dct.get('__annotations__', [])} \n")
print(f"namespace items: {[k for k,v in dct.items()]} \n")
print(f"namespace vals: {[v for k,v in dct.items()]} \n")
print("----test block end----")
image

Copy link

Greetings! Thanks for your first issue!

@billxbf
Copy link
Member

billxbf commented Nov 19, 2023

I don't run into this error in my env. Seems like a version mismatch issue. What pydantic version are you using?

If you create a new env and pip install gentopia, you should get pydantic == 1.9.0

@Jupiter1995
Copy link
Author

I don't run into this error in my env. Seems like a version mismatch issue. What pydantic version are you using?

If you create a new env and pip install gentopia, you should get pydantic == 1.9.0

I did install the required packages via requirement.txt under docs. But I think you're right. Mine is 2.4.2. Let me uninstall it and check again. I'll keep you posted.

@Jupiter1995
Copy link
Author

I don't run into this error in my env. Seems like a version mismatch issue. What pydantic version are you using?
If you create a new env and pip install gentopia, you should get pydantic == 1.9.0

I did install the required packages via requirement.txt under docs. But I think you're right. Mine is 2.4.2. Let me uninstall it and check again. I'll keep you posted.

I created a new env and ran pip install gentopia, and it solved the old problem! However, I'm receiving a new error from typing package lol:
Screenshot 2023-11-19 at 11 46 19 AM
Any idea or suggestions?

@billxbf
Copy link
Member

billxbf commented Nov 20, 2023

what's your agent config file

@Jupiter1995
Copy link
Author

Jupiter1995 commented Nov 21, 2023

what's your agent config file

The agent.yaml file is attached below. Please ignore the environment as the implementation hasn't finished, so it will ignored in the agent_assembler.py.

name: mark
type: react_conv
version: 0.0.1
description: mark is a professional personal trainer. He is able to create customized plans for different people depends on their expectations and body conditions.
target_tasks:
  - create training plans and strategies.
  - collaborate with nutritionist to adjust training plans.
prompt_template: !prompt multi_agent_test.agents.personal_trainer.prompt.PromptOfTrianer
llm:
  model_name: baize
  params:
    temperature: 0.5
    top_p: 0.9
    repetition_penalty: 0.0
    max_tokens: 1024
environment:
  name: training_plan_test01
plugins:
  - name: google_search
  - name: arxiv_search
    param:
      top_k: 3
  - name: web_page

@Jupiter1995
Copy link
Author

I tried to use the original Gentopia without any changes and also the example agent elon but still received the same error within the new environment I created using pip install gentopia. The agent.yaml attached below.

name: elon
type: react
version: 0.0.1
description: elon is an experienced and visionary entrepreneur. He is able to create a startup from scratch and get a strong team to support his ideas.
target_tasks:
  - create business plans and strategies.
  - arrange a bunch of tools and agents to collaborate on his ideas.
prompt_template: !prompt gentpool.pool.elon.prompt.PromptOfElon
llm:
  model_name: baize
  params:
    temperature: 0.0
    top_p: 0.9
    repetition_penalty: 0.0
    max_tokens: 1024
plugins:
  - name: google_search
  - name: arxiv_search
    param:
      top_k: 3
  - name: web_page
  - name: bash_shell
  - !tool gentpool.pool.elon.tool.ElonDrawing
  - !include ../dr_science/agent.yaml

Screenshot of the error:
Screenshot 2023-11-26 at 12 24 45 PM

@Jupiter1995
Copy link
Author

I tried to use the original Gentopia without any changes and also the example agent elon but still received the same error within the new environment I created using pip install gentopia. The agent.yaml attached below.

name: elon
type: react
version: 0.0.1
description: elon is an experienced and visionary entrepreneur. He is able to create a startup from scratch and get a strong team to support his ideas.
target_tasks:
  - create business plans and strategies.
  - arrange a bunch of tools and agents to collaborate on his ideas.
prompt_template: !prompt gentpool.pool.elon.prompt.PromptOfElon
llm:
  model_name: baize
  params:
    temperature: 0.0
    top_p: 0.9
    repetition_penalty: 0.0
    max_tokens: 1024
plugins:
  - name: google_search
  - name: arxiv_search
    param:
      top_k: 3
  - name: web_page
  - name: bash_shell
  - !tool gentpool.pool.elon.tool.ElonDrawing
  - !include ../dr_science/agent.yaml

Screenshot of the error: Screenshot 2023-11-26 at 12 24 45 PM

Problem solved! I'll create a pull request

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

2 participants