Index
AsyncBaseTool #
Bases: BaseTool
Base-level tool class that is backwards compatible with the old tool spec but also supports async.
Source code in llama-index-core/llama_index/core/tools/types.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
call
abstractmethod
#
call(input: Any) -> ToolOutput
This is the method that should be implemented by the tool developer.
Source code in llama-index-core/llama_index/core/tools/types.py
167 168 169 170 171 |
|
acall
abstractmethod
async
#
acall(input: Any) -> ToolOutput
This is the async version of the call method. Should also be implemented by the tool developer as an async-compatible implementation.
Source code in llama-index-core/llama_index/core/tools/types.py
173 174 175 176 177 178 179 |
|
BaseToolAsyncAdapter #
Bases: AsyncBaseTool
Adapter class that allows a synchronous tool to be used as an async tool.
Source code in llama-index-core/llama_index/core/tools/types.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
BaseTool #
Bases: DispatcherSpanMixin
Source code in llama-index-core/llama_index/core/tools/types.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
to_langchain_tool #
to_langchain_tool(**langchain_tool_kwargs: Any) -> Tool
To langchain tool.
Source code in llama-index-core/llama_index/core/tools/types.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
to_langchain_structured_tool #
to_langchain_structured_tool(**langchain_tool_kwargs: Any) -> StructuredTool
To langchain structured tool.
Source code in llama-index-core/llama_index/core/tools/types.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
ToolMetadata
dataclass
#
ToolMetadata(description: str, name: Optional[str] = None, fn_schema: Optional[Type[pydantic.main.BaseModel]] =
Parameters:
Name | Type | Description | Default |
---|---|---|---|
description
|
str
|
|
required |
name
|
str | None
|
|
None
|
fn_schema
|
Type[BaseModel] | None
|
|
<class 'llama_index.core.tools.types.DefaultToolFnSchema'>
|
return_direct
|
bool
|
|
False
|
Source code in llama-index-core/llama_index/core/tools/types.py
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 |
|
get_name #
get_name() -> str
Get name.
Source code in llama-index-core/llama_index/core/tools/types.py
53 54 55 56 57 |
|
to_openai_function #
to_openai_function() -> Dict[str, Any]
Deprecated and replaced by to_openai_tool
.
The name and arguments of a function that should be called, as generated by the
model.
Source code in llama-index-core/llama_index/core/tools/types.py
59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
to_openai_tool #
to_openai_tool(skip_length_check: bool = False) -> Dict[str, Any]
To OpenAI tool.
Source code in llama-index-core/llama_index/core/tools/types.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
ToolOutput #
Bases: BaseModel
Tool output.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content
|
str
|
|
required |
tool_name
|
str
|
|
required |
raw_input
|
Dict[str, Any]
|
|
required |
raw_output
|
Any
|
|
required |
is_error
|
bool
|
|
False
|
Source code in llama-index-core/llama_index/core/tools/types.py
90 91 92 93 94 95 96 97 98 99 100 101 |
|