Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Commit 4943e30

Browse files
committed
modified: simpletool/models.py
modified: tool_example.py modified: tool_example.txt
1 parent d64b73f commit 4943e30

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

simpletool/models.py

-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ class SimpleToolResponseModel(BaseModel):
4444
description: str = Field(..., description="Description of the tool's functionality")
4545
input_schema: Optional[dict] = Field(None, description="Input schema for the tool, if available")
4646

47-
# def __repr__(self):
48-
# return f"SimpleTool(name='{self.name}', description='{self.description}', input_schema={self.input_schema})"
49-
5047
class Config:
5148
"""Pydantic model configuration."""
5249
schema_extra = {

tool_example.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ async def run(self, arguments: dict) -> List[TextContent]:
2222

2323

2424
async def main(t: str):
25-
my_tool = MyTool()
26-
return my_tool, await my_tool.run({"text": t})
25+
mytool = MyTool()
26+
return mytool, await mytool.run({"text": t})
2727

2828

2929
my_tool, r = asyncio.run(main("Hello, world!"))
@@ -47,7 +47,8 @@ async def main(t: str):
4747
print(f"Type: {type(my_tool.to_dict)}")
4848
print(my_tool.to_dict)
4949

50-
print("\nRepresentation - my_tool.__repr__():")
50+
# Display the string representation of MyTool
51+
print("\nString Representation - repr(my_tool):")
5152
print(f"Type: {type(repr(my_tool))}")
5253
print(repr(my_tool))
5354

tool_example.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ String Representation - str(my_tool):
77
Type: <class 'str'>
88
{"name": "my_tool", "description": "A tool for testing", "input_schema": {"type": "object", "properties": {"text": {"type": "string"}}, "required": ["text"]}}
99

10-
Tool Details - my_tool.info:
10+
Tool Details Print - my_tool.info:
1111
Type: <class 'str'>
1212
{
1313
"name": "my_tool",
@@ -25,9 +25,13 @@ Type: <class 'str'>
2525
}
2626
}
2727

28-
Dictionary Representation - my_tool.to_dict:
28+
Dictionary - my_tool.to_dict:
2929
Type: <class 'dict'>
3030
{'name': 'my_tool', 'description': 'A tool for testing', 'input_schema': {'type': 'object', 'properties': {'text': {'type': 'string'}}, 'required': ['text']}}
31+
32+
String Representation - repr(my_tool):
33+
Type: <class 'str'>
34+
MyTool(name='my_tool', description='A tool for testing', input_schema={'properties': {'text': {'type': 'string'}}, 'required': ['text'], 'type': 'object'})
3135
----------------------------------------------------------------------
3236
Input: MODEL:
3337
Type: <class 'pydantic._internal._model_construction.ModelMetaclass'>

0 commit comments

Comments
 (0)