Class SearchPageAITool
- java.lang.Object
-
- com.composum.ai.backend.slingbase.experimential.impl.SearchPageAITool
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SearchPageAITool.Config
-
Constructor Summary
Constructors Constructor Description SearchPageAITool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate(SearchPageAITool.Config config)
protected void
deactivate()
String
execute(String arguments, org.apache.sling.api.resource.Resource resource, com.composum.ai.backend.base.service.chat.GPTCompletionCallback.GPTToolExecutionContext context)
Does a query with lucene and then rates the results with the embedding.String
getDescription(Locale locale)
Human readable description.String
getName(Locale locale)
Human readable name.String
getToolDeclaration()
The description to use for the OpenAI tool call.String
getToolName()
Name for the purpose of calling - must matchAITool.getToolDeclaration()
.boolean
isAllowedFor(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:AITool
Human readable name.
-
getDescription
@Nonnull public String getDescription(@Nullable Locale locale)
Description copied from interface:AITool
Human readable description.- Specified by:
getDescription
in interfaceAITool
-
getToolName
@Nonnull public String getToolName()
Description copied from interface:AITool
Name for the purpose of calling - must matchAITool.getToolDeclaration()
.- Specified by:
getToolName
in interfaceAITool
-
getToolDeclaration
@Nonnull public String getToolDeclaration()
Description copied from interface:AITool
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 }
- Specified by:
getToolDeclaration
in interfaceAITool
- See Also:
- "https://platform.openai.com/docs/api-reference/chat/create"
-
isAllowedFor
public boolean isAllowedFor(@Nonnull org.apache.sling.api.resource.Resource resource)
Description copied from interface:AITool
Whether the tool is enabled for the given resource.- Specified by:
isAllowedFor
in 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)
Does a query with lucene and then rates the results with the embedding.
-
activate
protected void activate(SearchPageAITool.Config config)
-
deactivate
protected void deactivate()
-
-