Skip to main content

Context Layer SDK - versioned context infrastructure for AI apps

Project description

Context Layer

Python SDK for ContextLayer — versioned context infrastructure for AI apps.

Installation

pip install layer-context

Quick Start

from layer_context import CL

cl = CL(api_key="cl_sk_your_key_here")

# Create a block
cl.create_block("system-prompt")

# Get a block handle
block = cl.block("system-prompt")

# Append context
block.append("You are a helpful assistant.")
block.append("Always respond in markdown.")

# Get compiled context
print(block.get_context())
# Output: "You are a helpful assistant.\nAlways respond in markdown."

# Update (replace entire context)
block.update("You are a coding assistant. Use Python examples.")

# Delete specific content
block.delete("Use Python examples.")

# Read updated context
print(block.get_context())
# Output: "You are a coding assistant."

# Create a new version
block.create_version()

# Work with specific versions
block.append("V2 content", version=2)
print(block.get_context(version=2))

# View history
entries = block.get_history()

# List all blocks
blocks = cl.list_blocks()

License

MIT

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

layer_context-0.1.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

layer_context-0.1.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file layer_context-0.1.3.tar.gz.

File metadata

  • Download URL: layer_context-0.1.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for layer_context-0.1.3.tar.gz
Algorithm Hash digest
SHA256 50dfb33f518137fd3c13b741926316ce8d5f9e7a74f88d8701e3988d4e84d05c
MD5 4bbf1b88ef79f4c97f2fd44666667299
BLAKE2b-256 2cc955c8ae6c2f0716d567a5d9b9fa9f76145ad77f5a8a2375faa74e8b52538b

See more details on using hashes here.

File details

Details for the file layer_context-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: layer_context-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for layer_context-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7513ce93c91d294686ec05f2dcafd68b0626366245bd05e134f9afe4b21fcc84
MD5 be7dda53253c167c94db8e6430ced741
BLAKE2b-256 5c28e0010841d736aae5314921d12f3d44e865b6c370d979b165e36c76722333

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