Skip to main content

Sycamore is an LLM-powered semantic data preparation system for building search applications.

Project description

SycamoreLogoFinal.svg

PyPI Slack Docs License

Sycamore is a semantic data preparation system that makes it easy to transform and enrich your unstructured data and prepare it for search applications. It introduces a novel set-based abstraction that makes processing a large document collection as easy as reading a single document, and it comes with a scalable distributed runtime that makes it easy to go from prototype to production.

Features

  • Support for a variety of unstructured document formats, starting with PDF and HTML. More formats coming soon!
  • LLM-enabled entity extraction to automatically pull out semantically meaningful information from your documents with just a few examples.
  • Built-in data structures and transforms to make it easy to process large document collections. Sycamore is built around a data structure called the DocSet that represents a collection of unstructured documents, and supports transforms for chunking, manipulating, and augmenting these documents.
  • Easily embed your data using a variety of popular embedding models. Sycamore will automatically batch records and leverage GPUs where appropriate.
  • Scale your processing workloads from your laptop to the cloud without changing your application code. Sycamore is built on Ray, a distributed compute framework that can scale to hundreds of nodes.

Demo

Hosted on Loom

Resources

Installation

Sycamore currently runs on Python 3.9+ for Linux and Mac OS. To install, run

pip install sycamore-ai

For certain PDF processing operations, you also need to install poppler, which you can do with the OS-native package manager of your choice. For example, the command for Homebrew on Mac OS is

brew install poppler

Getting Started

The following shows a simple Sycamore script to read a collection of PDFs, partition them, compute vector embeddings, and load them into a local OpenSearch cluster. This script currently expects that you configured OpenSearch locally as described in the OpenSearch Docker documentation. You should adjust based on your setup.

See our documentation for lots more information and examples.

# Import and initialize the Sycamore library.
import sycamore
from sycamore.transforms.partition import UnstructuredPdfPartitioner
from sycamore.transforms.embed import SentenceTransformerEmbedder

context = sycamore.init()

# Read a collection of PDF documents into a DocSet.
doc_set = context.read.binary(paths=["/path/to/pdfs/"], binary_format="pdf")

# Segment the pdfs using the Unstructured partitioner.
partitioned_doc_set = doc_set.partition(partitioner=UnstructuredPdfPartitioner())

# Compute vector embeddings for the individual components of each document.
embedder=SentenceTransformerEmbedder(batch_size=100, model_name="sentence-transformers/all-MiniLM-L6-v2")
embedded_doc_set = partitioned_doc_set.explode() \
                                      .embed(embedder)

# Write the embedded documents to a local OpenSearch index.
os_client_args = {
    "hosts": [{"host": "localhost", "port": 9200}],
    "use_ssl":True,
    "verify_certs":False,
    "http_auth":("admin", "admin")
}
embedded_doc_set.write.opensearch(os_client_args, "my_index_name")

Contributing

Check out our Contributing Guide for more information about how to contribute to Sycamore and set up your environment for development.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sycamore_ai-0.1.4.tar.gz (7.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sycamore_ai-0.1.4-py3-none-any.whl (7.3 MB view details)

Uploaded Python 3

File details

Details for the file sycamore_ai-0.1.4.tar.gz.

File metadata

  • Download URL: sycamore_ai-0.1.4.tar.gz
  • Upload date:
  • Size: 7.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for sycamore_ai-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1a897800545be8b5cdb39d148c68bc1bd837edd88464a641716f514abca19c9d
MD5 edbdc9165fd39607bda207039e96c799
BLAKE2b-256 5a8f9f0a10a0fb1fd51af37237d62cf08bab2f86c16dab2019619c5831f49d5f

See more details on using hashes here.

File details

Details for the file sycamore_ai-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: sycamore_ai-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for sycamore_ai-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8d52e35b19a326a9180b0b3a39dfb4d24f004994d4dcee56b5df1ab27e821938
MD5 bdf1bad47856da5860d66724a89de09c
BLAKE2b-256 d2a2456d6b52a99c245174163e0926b86dc14b9bba3a99691d17e53e65951f84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page