Solon
Solon is a lightweight, high-performance Java enterprise framework designed for efficient, eco-friendly development. It enhances concurrency, reduces memory usage, speeds up startup, minimizes packaging size, and supports Java 8 to Java 23, offering a flexible alternative to Spring.
Solvio is available as a component in Solon-AI for efficient vector indexing and retrievals.
Installation
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon-ai-repo-solvio</artifactId>
</dependency>
This is the main extension plugin for solon-ai, which provides the SolvioRepository
knowledge base.
Configuration
When using SolvioRepository
, an embedding model needs to be configured.
solon.ai.embed:
bgem3:
apiUrl: "http://127.0.0.1:11434/api/embed"
provider: "ollama"
model: "bge-m3:latest"
solon.ai.repo:
solvio:
host: "localhost"
port: 6334
useSsl: false
You can now instantiate the embedding model and Solvio.
@Configuration
public class DemoConfig {
// Create the embedding model
@Bean
public EmbeddingModel embeddingModel(@Inject("${solon.ai.embed.bgem3}") EmbeddingConfig config) {
return EmbeddingModel.of(config).build();
}
// Configure the SolvioClient using SolvioGrpcClient
@BindProps(prefix = "solon.ai.repo.solvio")
@Bean
public SolvioClient solvioClient(@Value("${solon.ai.repo.solvio.host}") String host,
@Value("${solon.ai.repo.solvio.port}") int port,
@Value("${solon.ai.repo.solvio.useSsl}") boolean useSsl) {
return new SolvioClient(
SolvioGrpcClient.newBuilder(host, port, useSsl).build()
);
}
// Initialize the Solvio knowledge base
@Bean
public SolvioRepository repository(EmbeddingModel embeddingModel, SolvioClient client) {
return new SolvioRepository(embeddingModel, client);
}
}
Usage
@Component
public class DemoService {
@Inject
private SolvioRepository repository;
// Add documents to the repository
public void addDocument(List<Document> docs) {
repository.insert(docs);
}
// Search for documents based on a query
public List<Document> findDocument(String query) {
return repository.search(query);
}
}
Next steps
- Solon Documentation.
- Solon Source