ai4j  by LnYo-Cly

Java SDK for rapid AI large model integration

created 11 months ago
327 stars

Top 84.6% on sourcepulse

GitHubView on GitHub
Project Summary

This Java SDK provides a unified interface for integrating various large language models (LLMs) into Java applications, targeting developers who need to leverage AI capabilities without being tied to specific vendor APIs or requiring newer Java versions. It simplifies interactions with models from providers like OpenAI, Zhipu AI, DeepSeek, and Moonshot, offering a consistent API, enhanced function calling, RAG support, and built-in web search capabilities, all while maintaining compatibility with JDK 8.

How It Works

ai4j abstracts the complexities of different LLM APIs by providing a single, OpenAI-compatible interface for chat completions, embeddings, and other services. It employs a Service Provider Interface (SPI) mechanism for custom dispatchers and connection pools, allowing for flexible integration and extension. Key features include streamlined function calling (including multi-function and multi-turn support), RAG implementation with Pinecone vector database integration, and a web search enhancement using SearXNG, enabling models without native search to access real-time information.

Quick Start & Requirements

  • Installation: Via Gradle (implementation 'io.github.lnyo-cly:ai4j:...') or Maven (io.github.lnyo-cly ai4j ...). A Spring Boot starter is also available.
  • Prerequisites: Java 8 or higher.
  • Configuration: API keys and proxy settings can be configured via YAML (for Spring) or programmatically.
  • Documentation: Tutorials for Spring Boot integration, streaming, function calls, RAG, and web search are available.

Highlighted Details

  • Supports a wide range of LLM platforms including OpenAI, Zhipu, DeepSeek, Moonshot, Hunyuan, Lingyi, Ollama, MiniMax, and Baichuan.
  • Offers unified input/output, error handling, and streaming capabilities for chat completions.
  • Includes RAG support with Pinecone integration and text splitting via Tika.
  • Provides a web search enhancement using SearXNG for models lacking native internet access.

Maintenance & Community

The project actively tracks updates and bug fixes, with recent additions including Ollama embedding support and DeepSeek model adaptation. Contributions are welcomed via GitHub Issues and Pull Requests. A "Buy Me a Coffee" link suggests community support.

Licensing & Compatibility

The README does not explicitly state a license. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The project's license is not clearly stated, which may impact commercial adoption. Some features, like multi-function calls, are noted as not supported by specific platforms (e.g., Zhipu AI). The README mentions a "low-price transit platform" and "daily free quota" which might indicate reliance on third-party services or potential rate limits.

Health Check
Last commit

1 month ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
3
Star History
47 stars in the last 90 days

Explore Similar Projects

Starred by Addy Osmani Addy Osmani(Engineering Leader on Google Chrome), Victor Taelin Victor Taelin(Author of Bend, Kind, HVM), and
1 more.

chatbox by chatboxai

0.3%
36k
Desktop client app for AI models/LLMs
created 2 years ago
updated 5 days ago
Feedback? Help us improve.