Package org.vrspace.server.connect
Class OllamaConnector
java.lang.Object
org.vrspace.server.connect.OllamaConnector
Component that connects to Ollama, and provides services and tools to agents, bots, and other components. It can generate
image description from the image of a 3D model, and store it to local vector database for later search. Image processing is
done asynchronously, one by one, and optionally paused during search, to keep down resource consumption. Models used for
images and tool calls (search) are configured in properties file, and can be different, or the same one.
- Author:
- joe
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondescribeImage(String url) Describe the image: issue API call to Ollama vision model, and post-process the image.voidshutdown()sketchfabSearch(String keywords, Integer maxSize, Boolean animated, Boolean rigged, Integer maxResults) void(Re)start stopped image processing.voidStop image processing to speed up general chat.org.springframework.ai.ollama.OllamaChatModelReturns configured tools model.voidPassed as a post-processing function to sketchfab connector search.org.springframework.ai.ollama.OllamaChatModelReturns configured vision model.
-
Constructor Details
-
OllamaConnector
public OllamaConnector()
-
-
Method Details
-
describeImage
Describe the image: issue API call to Ollama vision model, and post-process the image.- Parameters:
url- image URL- Returns:
- generated and post-processed description
-
updateDescriptionFromThumbnail
Passed as a post-processing function to sketchfab connector search. Adds a task to image processing executor that processes the image with vision model, and asynchronously saves generated description of the model to the object and vector databases. -
visionModel
public org.springframework.ai.ollama.OllamaChatModel visionModel()Returns configured vision model. -
toolsModel
public org.springframework.ai.ollama.OllamaChatModel toolsModel()Returns configured tools model. -
stopImageProcessing
public void stopImageProcessing()Stop image processing to speed up general chat. -
startImageProcessing
public void startImageProcessing()(Re)start stopped image processing. -
shutdown
@PreDestroy public void shutdown() -
sketchfabSearch
@Tool(description="Sketchfab 3D model search web API") public String sketchfabSearch(@ToolParam(description="Search keywords") String keywords, @ToolParam(description="Maximum model size, in megabytes") Integer maxSize, @ToolParam(description="Request only animated models") Boolean animated, @ToolParam(description="Request only rigged models") Boolean rigged, @ToolParam(description="Maximum number of results") Integer maxResults) -
localSearch
@Tool(description="Search local vector database for known 3D models") public String localSearch(@ToolParam(description="Search query") String query, @ToolParam(description="Maximum model size, in megabytes") Integer maxSize, @ToolParam(description="Request only animated models") Boolean animated, @ToolParam(description="Request only rigged models") Boolean rigged, @ToolParam(description="Maximum number of results") Integer maxResults)
-