Skip to main content

A framework for writing Unstract Tools/Apps

Project description

Unstract

No-code LLM Platform to launch APIs and ETL Pipelines to structure unstructured documents

Unstract SDK

The unstract-sdk package helps with developing tools that are meant to be run on the Unstract platform. This includes modules to help with tool development and execution, caching, making calls to LLMs / vectorDBs / embeddings .etc. They also contain helper methods/classes to aid with other tasks such as indexing and auditing the LLM calls.

Installation

  • The below libraries need to be installed to run the SDK
    • Linux

      sudo apt install build-essential pkg-config libmagic-dev tesseract-ocr pandoc
      
    • Mac

      brew install pkg-config libmagic pandoc tesseract-ocr
      

Tools

Create a scaffolding for a new tool

Example

unstract-tool-gen --command NEW --tool-name <name of tool> \
 --location ~/path_to_repository/unstract-tools/ --overwrite false

Supported commands:

  • NEW - Create a new tool

Environment variables required for all Tools

Variable Description
PLATFORM_SERVICE_HOST The host in which the platform service is running
PLATFORM_SERVICE_PORT The port in which the service is listening
PLATFORM_SERVICE_API_KEY The API key for the platform
TOOL_DATA_DIR The directory in the filesystem which has contents for tool execution

Llama Index support

Unstract SDK 0.3.2 uses the following version of Llama Index Version 0.9.28 as on January 14th, 2024

Developing with the SDK

Ensure that you have all the required dependencies and pre-commit hooks installed

pdm install
pre-commit install

Once the changes have been made, it can be tested with Unstract through the following means.

With PDM

Specify the SDK as a dependency to a project using a tool like pdm by adding the following to your pyproject.toml

[tool.pdm.dev-dependencies]
local_copies = [
    "-e unstract-adapters @ file:///${UNSTRACT_ADAPTERS_PATH}",
    "-e unstract-sdk @ file:///${UNSTRACT_SDK_PATH}",
]

Or by running the below command

pdm add -e /path/to/unstract-sdk --dev

With pip

  • If the project is using pip it might be possible to add it as a dependency in requirements.txt
-e /path/to/unstract-sdk

NOTE: Building locally might require the below section to be replaced in the unstract-sdk's build system configuration

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
  • Another option is to provide a git URL in requirements.txt, this can come in handy while building tool docker images. Don't forget to run apt install git within the Dockerfile for this
unstract-sdk @ git+https://github.com/Zipstack/unstract-sdk@feature-branch
  • Or try installing a local PyPI server and upload / download your package from this server

Environment variables required for various LLMs (deprecated)

  • Azure OpenAI
    • OPENAI_API_KEY
    • OPENAI_API_BASE
    • OPENAI_API_VERSION
    • OPENAI_API_ENGINE
    • OPENAI_API_MODEL

Documentation generation

Follow this README.md for generating documentation.

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

unstract_sdk-0.51.0.tar.gz (139.4 kB view details)

Uploaded Source

Built Distribution

unstract_sdk-0.51.0-py3-none-any.whl (213.6 kB view details)

Uploaded Python 3

File details

Details for the file unstract_sdk-0.51.0.tar.gz.

File metadata

  • Download URL: unstract_sdk-0.51.0.tar.gz
  • Upload date:
  • Size: 139.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.12.3 CPython/3.8.10

File hashes

Hashes for unstract_sdk-0.51.0.tar.gz
Algorithm Hash digest
SHA256 01d2d30e37af87d3671093f1382906f32bb5527c858a14788be86ad1005979ea
MD5 5b3a8a1ce1f3f6d87427b21965896141
BLAKE2b-256 4e230e32b1d4919af4b0924be27002c197313685d02f74a1c654cac001695f6d

See more details on using hashes here.

File details

Details for the file unstract_sdk-0.51.0-py3-none-any.whl.

File metadata

File hashes

Hashes for unstract_sdk-0.51.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f6ef64eb016578cd5fed22015bb9957a106451534ed12a49e3654b9d92f7004
MD5 f5a47a17100bcd8fe2de39f8031fd550
BLAKE2b-256 a0a56ba71af9f37320513aa8ee6e2e5dc5644a76a594685863309e408bdb8527

See more details on using hashes here.

Supported by

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