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

custom tool input error #157

Open
farahFif opened this issue Dec 20, 2024 · 0 comments
Open

custom tool input error #157

farahFif opened this issue Dec 20, 2024 · 0 comments

Comments

@farahFif
Copy link

farahFif commented Dec 20, 2024

Hello,

I am creating a custom tool. The problem is that sometimes it can run the tool and sometimes it raises a problem with the input. I don't understand why such behaviour. Thanks for helping.

I encountered an error while trying to use the tool. This was the error: Arguments validation failed: 1 validation error for MyCustomToolSchema
argument
Input should be a valid string [type=string_type, input_value={'description': 'My perio...r only?', 'type': 'str'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.10/v/string_type.
Tool data retreiver accepts these inputs: Tool Name: data retreiver
Tool Arguments: {'argument': {'description': None, 'type': 'str'}}

this is my tool :


class MyCustomTool(BaseTool):
    name: str = "data retreiver"
    description: str = (
        "This tool searches for the most relevant answers given the question."
    )

    def _run(self, argument: str) -> str:
        # Implementation goes here
        url = "some private url"
        headers = {
        'x-api-key': "private"}

        response = requests.get(url, headers=headers).json()
        response = response['data']
        response = [r['answer'].replace("\n","") for r in response]
                
        return response

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