LangChain4Clj

A Clojure wrapper for LangChain4j - Build powerful AI applications with the simplicity and elegance of Clojure.

Quick Start

Add to your deps.edn:

{:deps {io.github.nandoolle/langchain4clj {:mvn/version "1.6.1"}}}

Or to your Leiningen project.clj:

[io.github.nandoolle/langchain4clj "1.6.1"]

Simple Example

(require '[langchain4clj.chat :as chat])

(def model (chat/create-chat-model 
             {:model-name "gpt-4"
              :api-key (System/getenv "OPENAI_API_KEY")}))

(chat/chat model "What is the capital of France?")
;; => "The capital of France is Paris."

Core Features

Explore the fundamental capabilities of LangChain4Clj:

Advanced Features

Build sophisticated AI applications:

Why LangChain4Clj?

  • Idiomatic Clojure - Leverages Clojure’s strengths: immutability, data-first design, and composability
  • Comprehensive - Full access to LangChain4j’s powerful features
  • Type-Safe - Malli and Schema support for request/response validation
  • Production-Ready - Built-in resilience, failover, and error handling
  • Well-Documented - Extensive guides and examples

Provider Support

LangChain4Clj supports all major AI providers:

  • OpenAI (GPT-4, GPT-3.5, DALL-E)
  • Anthropic (Claude 3.5 Sonnet, Claude 3 Opus/Haiku)
  • Google (Gemini Pro/Flash)
  • Azure OpenAI
  • Ollama (Local models)
  • And many more…

Getting Help

License

Copyright © 2024 Fernando Olle

Distributed under the Apache License 2.0.