Interface GPTTool
-
public interface GPTTool
An action the AI can perform - likely from the sidebar chat.- See Also:
- "https://platform.openai.com/docs/guides/function-calling"
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
execute(String arguments, GPTCompletionCallback.GPTToolExecutionContext context)
Executes the tool call and returns the result to present to the AI.String
getName()
The name of the tool - must be exactly the name given ingetToolDeclaration()
.String
getToolDeclaration()
The description to use for the OpenAI tool call.
-
-
-
Method Detail
-
getName
@Nonnull String getName()
The name of the tool - must be exactly the name given ingetToolDeclaration()
.
-
getToolDeclaration
@Nonnull String getToolDeclaration()
The description to use for the OpenAI tool call. Will be inserted into the OpenAI tools array. E.g.:{ "type": "function", "function": { "name": "get_delivery_date", "description": "Get the delivery date for a customer's order. Call this whenever you need to know the delivery date, for example when a customer asks 'Where is my package'", "parameters": { "type": "object", "properties": { "order_id": { "type": "string", "description": "The customer's order ID." } }, "required": ["order_id"], "additionalProperties": false } }, "strict": true }
- See Also:
- "https://platform.openai.com/docs/api-reference/chat/create"
-
execute
@Nonnull String execute(@Nullable String arguments, @Nullable GPTCompletionCallback.GPTToolExecutionContext context)
Executes the tool call and returns the result to present to the AI.- Parameters:
arguments
- The arguments to the tool call, as JSON that matches the schema given ingetToolDeclaration()
.
-
-