Skip to main content
Isaacus is a foundational legal AI research company building AI models, apps, and tools for the legal tech ecosystem. Isaacus’ offering includes Kanon 2 Embedder, the world’s best legal embedding model (as measured on the Massive Legal Embedding Benchmark), as well as legal zero-shot classification and legal extractive question answering models. Isaacus offers first-class support for LangChain’s embedding interface, accessible via the langchain-isaacus integration package.

Setup

To get started using Isaacus models with LangChain, head to the Isaacus Platform and create a new account. Once signed up, add a payment method (thereby claiming your free credits) and generate an API key. Next, install the langchain-isaacus integration package:
pip install langchain-isaacus
You should then set your ISAACUS_API_KEY environment variable to your Isaacus API key.
export ISAACUS_API_KEY="your_api_key_here"

Embeddings

The code snippet below demonstrates how you might use Isaacus’ Kanon 2 Embedder model to assess the semantic similarity of legal queries to a legal document with LangChain. A more detailed walkthrough of how to generate embeddings with the Isaacus LangChain integration is available here.
import numpy as np # NOTE you may need to `pip install numpy`.

from langchain_isaacus import IsaacusEmbeddings

# Create an Isaacus API client for Kanon 2 Embedder.
client = IsaacusEmbeddings(
    "kanon-2-embedder",
    # dimensions=1792, # You may optionally wish to specify a lower dimension.
)

# Embed a dummy document.
document_embedding = client.embed_documents(texts=["These are GitHub's billing policies."])[0]

# Embed our search queries.
relevant_query_embedding = client.embed_query(text="What are GitHub's billing policies?")
irrelevant_query_embedding = client.embed_query(text="What are Microsoft's billing policies?")

# Compute the similarity between the queries and the document.
relevant_similarity = np.dot(relevant_query_embedding, document_embedding)
irrelevant_similarity = np.dot(irrelevant_query_embedding, document_embedding)

# Log the results.
print(f"Similarity of relevant query to the document: {relevant_similarity * 100:.2f}")
print(f"Similarity of irrelevant query to the document: {irrelevant_similarity * 100:.2f}")

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.