Class ModifyPageWriteTool
- java.lang.Object
 - 
- com.composum.ai.backend.slingbase.experimential.impl.ModifyPageWriteTool
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceModifyPageWriteTool.Config 
- 
Constructor Summary
Constructors Constructor Description ModifyPageWriteTool() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate(ModifyPageWriteTool.Config config)protected voiddeactivate()Stringexecute(String arguments, org.apache.sling.api.resource.Resource resource, com.composum.ai.backend.base.service.chat.GPTCompletionCallback.GPTToolExecutionContext context)Executes the tool call and returns the result to present to the AI.StringgetDescription(Locale locale)Human readable description.StringgetName(Locale locale)Human readable name.StringgetToolDeclaration()The description to use for the OpenAI tool call.StringgetToolName()Name for the purpose of calling - must matchAITool.getToolDeclaration().booleanisAllowedFor(org.apache.sling.api.resource.Resource resource)Whether the tool is enabled for the given resource.- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface com.composum.ai.backend.slingbase.experimential.AITool
makeGPTTool 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getName
@Nonnull public String getName(@Nullable Locale locale)
Description copied from interface:AIToolHuman readable name. 
- 
getDescription
@Nonnull public String getDescription(@Nullable Locale locale)
Description copied from interface:AIToolHuman readable description.- Specified by:
 getDescriptionin interfaceAITool
 
- 
getToolName
@Nonnull public String getToolName()
Description copied from interface:AIToolName for the purpose of calling - must matchAITool.getToolDeclaration().- Specified by:
 getToolNamein interfaceAITool
 
- 
getToolDeclaration
@Nonnull public String getToolDeclaration()
Description copied from interface:AIToolThe 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 }- Specified by:
 getToolDeclarationin interfaceAITool- See Also:
 - "https://platform.openai.com/docs/api-reference/chat/create"
 
 
- 
isAllowedFor
public boolean isAllowedFor(@Nullable org.apache.sling.api.resource.Resource resource)
Description copied from interface:AIToolWhether the tool is enabled for the given resource.- Specified by:
 isAllowedForin interfaceAITool
 
- 
execute
@Nonnull public String execute(@Nullable String arguments, @Nonnull org.apache.sling.api.resource.Resource resource, @Nullable com.composum.ai.backend.base.service.chat.GPTCompletionCallback.GPTToolExecutionContext context)
Description copied from interface:AIToolExecutes the tool call and returns the result to present to the AI. Must only be called ifAITool.isAllowedFor(Resource)returned true. 
- 
activate
protected void activate(ModifyPageWriteTool.Config config)
 
- 
deactivate
protected void deactivate()
 
 - 
 
 -