langchain-java  by HamaWhiteGG

Java SDK for LLM app development, inspired by LangChain

created 2 years ago
563 stars

Top 58.0% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a Java implementation of the LangChain framework, enabling developers to build Large Language Model (LLM) powered applications within the Java ecosystem, particularly for Big Data scenarios. It offers integrations with various LLMs and vector stores, simplifying the creation of complex LLM workflows like RAG, SQL querying, and agent-based systems for Java developers.

How It Works

LangChain Java follows the core LangChain philosophy of composing LLMs with other components. It abstracts LLM interactions through LLM and Chat interfaces, supporting models like OpenAI, Azure OpenAI, ChatGLM2, and Ollama. Chains allow sequential execution of prompts and models, exemplified by LLMChain for text generation and SQLDatabaseChain for natural language to SQL queries. Agents dynamically select tools (e.g., Google Search, LLM-Math) to execute tasks, facilitating complex, multi-step reasoning.

Quick Start & Requirements

  • Install: Add the langchain-core dependency via Maven.
  • Prerequisites: Java 17+, Maven 3.5.4+, Unix-like environment.
  • Environment Variables: OPENAI_API_KEY (or other provider keys), OPENAI_PROXY (optional).
  • API Documentation: https://hamawhitegg.github.io/langchain-java
  • Example Setup: Setting OPENAI_API_KEY and initializing OpenAI or ChatOpenAI classes.

Highlighted Details

  • Supports SQL Chains for natural language interaction with SQL databases.
  • Integrates agents with tools like SerpAPI and LLM-Math for augmented capabilities.
  • Offers RAG (Retrieval-Augmented Generation) examples with Milvus and Pinecone.
  • Includes examples for Spark SQL and Flink SQL agents.

Maintenance & Community

  • Project maintained by HamaWhiteGG.
  • Community support via GitHub Issues.
  • WeChat contact provided for direct inquiries.

Licensing & Compatibility

  • The README does not explicitly state a license. The project structure and typical open-source practices suggest a permissive license, but this requires verification.
  • Compatibility with commercial or closed-source applications is not specified.

Limitations & Caveats

The project appears to be actively developed, with version 0.2.1 of langchain-core. Some integrations or advanced features might still be under development or have limited examples. The lack of an explicit license in the README is a significant caveat for adoption.

Health Check
Last commit

1 year ago

Responsiveness

1 week

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

Explore Similar Projects

Feedback? Help us improve.