Skip to main content

🦜️🔗 Langchain

LangChain is a popular open-source framework for developing applications powered by language models.

Insert star counter... other stuff like that

Install

pip install langchain / yarn add langchain

Main Benefits

  • 1
  • 2
  • 3

Simple Example

Python

import chromadb
from langchain.vectorstores import Chroma
from langchain.embeddings.sentence_transformer import SentenceTransformerEmbeddings

# Chroma code
persistent_client = chromadb.PersistentClient()
collection = persistent_client.get_or_create_collection("collection_name")
collection.add(ids=["1", "2", "3"], documents=["a", "b", "c"])

# LangChain Code
embedding_function = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")

langchain_chroma = Chroma(
client=persistent_client,
collection_name="collection_name",
embedding_function=embedding_function,
)
# Important! - the embedding functiion passed to langchain is their wrapper, not Chroma's


print("There are", langchain_chroma._collection.count(), "in the collection")

Javascript

// stuff goes here

Resources

Tutorials