Skip to main content

A semantic RBAC system with RAG capabilities

Project description

Gatecraft

Gatecraft is a semantic Role-Based Access Control (RBAC) system with Retrieval-Augmented Generation (RAG) capabilities. It provides a flexible way to manage access control based on semantic similarity and content understanding.

Features

  • Semantic-based access control
  • Integration with OpenAI embeddings
  • Pinecone vector store support
  • Flexible RBAC system
  • RAG capabilities

Installation

pip install gatecraft

Quick Start

from gatecraft.core.user import User


from gatecraft.core.role import Role


from gatecraft.core.permission import Permission


from gatecraft.utils.semantic_condition import SemanticCondition


from gatecraft.core.entity import Entity


from gatecraft.core.policy import AccessControlPolicy


from gatecraft.db.semantic_database import SemanticDatabase


from gatecraft.db.pinecone_vector_store import PineconeVectorStore





# Initialize vector store


vector_store = PineconeVectorStore(


**    **api_key="your-pinecone-api-key",


**    **environment="your-environment",


**    **index_name="your-index-name"


)





# Create semantic database


semantic_db = SemanticDatabase(vector_store)





# Create policy


policy = AccessControlPolicy(database=semantic_db)





# Create users and roles


user = User(user_id=1, name="Alice")


role = Role(role_id=1, name="Cat Lover")


permission = Permission(permission_id=1, name="Access Cat Content")





# Add semantic condition


condition = SemanticCondition(term="cat", threshold=0.8)


permission.add_condition(condition)





# Set up relationships


role.add_permission(permission)


user.add_role(role)





# Check access


entity = Entity(entity_id=1, data="A cute kitten playing with yarn")


has_access = policy.is_access_allowed(user, entity)

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

gatecraft-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

gatecraft-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file gatecraft-0.1.0.tar.gz.

File metadata

  • Download URL: gatecraft-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.18

File hashes

Hashes for gatecraft-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e0e005c7c3020cf819ff230dcb46a28bdb0ef6cc5b277792fe345a5c62eed394
MD5 6c4e55f52aea258faeeb9b535c86eb4a
BLAKE2b-256 74fe370c1bd0ea6586d71f3848faa60408944775683537a4a94a805976c2efce

See more details on using hashes here.

File details

Details for the file gatecraft-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gatecraft-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.18

File hashes

Hashes for gatecraft-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6cf737d4cf42f5ffc299059c08aaab45497484edd6534477a97d6e4d181c83d
MD5 4066edcb63b9c56ae601e664a17dec63
BLAKE2b-256 59ed9e8f3c9d0715a85bbb0bef845b623570197af25f0d5f29a6209983397044

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