Base
ToolException ¶
Bases: Exception
An optional exception that tool throws when execution error occurs.
When this exception is thrown, the agent will not stop working, but will handle the exception according to the handle_tool_error variable of the tool, and the processing result will be returned to the agent as observation, and printed in red on the console.
Source code in libs/kotaemon/kotaemon/agents/tools/base.py
BaseTool ¶
Bases: BaseComponent
Source code in libs/kotaemon/kotaemon/agents/tools/base.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
description
instance-attribute
¶
Description used to tell the model how/when/why to use the tool. You can provide few-shot examples as a part of the description. This will be input to the prompt of LLM.
args_schema
class-attribute
instance-attribute
¶
Pydantic model class to validate and parse the tool's input arguments.
handle_tool_error
class-attribute
instance-attribute
¶
Handle the content of the ToolException thrown.
run ¶
Run the tool.
Source code in libs/kotaemon/kotaemon/agents/tools/base.py
from_langchain_format
classmethod
¶
Wrapper for Langchain Tool
Source code in libs/kotaemon/kotaemon/agents/tools/base.py
ComponentTool ¶
Bases: BaseTool
Wrapper around other BaseComponent to use it as a tool
Parameters:
Name | Type | Description | Default |
---|---|---|---|
component
|
BaseComponent-based component to wrap |
required | |
postprocessor
|
Optional postprocessor for the component output |
required |