Woof is a dual-purpose Java library that provides:
- A convenient wrapper for Neo4J graph database operations
- Integration with various Large Language Model (LLM) providers
- Simple API for creating and manipulating graph nodes and edges
- Support for traversing and querying graph structures
- Semantic relationship definitions for code and data analysis
- Utilities for managing graph connections and transactions
- Unified interface for interacting with different LLM providers
- Support for multiple LLM backends:
- AWS Bedrock
- Azure OpenAI
- Ollama (local LLM deployment)
- Simple prompt-based interaction model
- Java 21 or higher
- Neo4J database (for graph operations)
- Access to at least one supported LLM provider (for AI features)
Add Woof as a dependency in your Maven project:
<dependency>
<groupId>com.mojo.woof</groupId>
<artifactId>woof</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>// Initialize the Neo4J driver
Neo4JDriverBuilder builder = new Neo4JDriverBuilder("bolt://localhost:7687", "neo4j", "password");
// Create a GraphSDK instance
try (GraphSDK sdk = new GraphSDK(builder)) {
// Create nodes
WoofNode node1 = new WoofNode(List.of("Person"), Map.of("name", "Alice"));
WoofNode node2 = new WoofNode(List.of("Person"), Map.of("name", "Bob"));
// Add nodes to the graph
Record record1 = sdk.createNode(node1);
Record record2 = sdk.createNode(node2);
// Connect nodes with a relationship
sdk.connect(record1, record2, "KNOWS", "friendship");
}import com.mojo.woof.llm.AWSCredentials;
import com.mojo.woof.llm.OllamaCredentials;
// Using Ollama
OllamaCredentials ollamaCredentials = OllamaCredentials.fromEnv();
Advisor ollamaAdvisor = new OllamaAdvisor(ollamaCredentials);
List<String> responses = ollamaAdvisor.advise("Explain what a graph database is");
// Using AWS Bedrock
AWSCredentials awsCredentials = AWSCredentials.fromEnv();
Advisor awsAdvisor = new AWSAdvisor(awsCredentials);
List<String> responses = awsAdvisor.advise("Summarize the key features of Neo4J");- Neo4j Java Driver
- Google Gson (for JSON processing)
- Lombok
- Apache Commons Lang
- Google Guava
- Azure AI OpenAI Client
- AWS Bedrock Runtime
See the LICENSE file for details.