Skip to main content

Cognify Python SDK

PyPI version Python Support License: MIT

A comprehensive Python SDK for the Cognify AI platform, providing easy access to document management, search, RAG (Retrieval-Augmented Generation), and conversation capabilities.

🚀 Features

  • 📄 Document Management: Upload, process, and manage documents with metadata
  • 🔍 Search & Query: Semantic, keyword, and hybrid search capabilities
  • 🤖 RAG Operations: Retrieval-Augmented Generation for intelligent Q&A
  • 💬 Conversations: Chat and conversation management with context
  • 📁 Collections: Organize documents into collections with permissions
  • 🏢 Multi-tenant Support: Organization-level isolation and workspaces
  • 🔐 Authentication: Secure API key and JWT token support
  • ⚡ Async/Sync Support: Both asynchronous and synchronous API methods
  • 🎯 Type Safety: Full type hints and Pydantic models
  • 🛡️ Error Handling: Comprehensive exception hierarchy

Installation

pip install cognify-sdk

Quick Start

from cognify_sdk import CognifyClient

# Initialize the client
client = CognifyClient(api_key="your_api_key")

# Upload a document
with open("document.pdf", "rb") as f:
    document = client.documents.upload(
        name="My Document",
        file=f,
        metadata={"category": "research"}
    )

# Search documents
results = client.query.search(
    query="artificial intelligence",
    limit=10
)

# Start a conversation
conversation = client.conversations.create(
    title="AI Discussion",
    initial_message="What is artificial intelligence?"
)

Async Support

The SDK supports both synchronous and asynchronous operations:

import asyncio
from cognify_sdk import CognifyClient

async def main():
    async with CognifyClient(api_key="your_api_key") as client:
        # Async operations
        documents = await client.documents.alist()
        results = await client.query.asearch("machine learning")

asyncio.run(main())

Configuration

Configure the SDK using environment variables or direct parameters:

# Environment variables
export COGNIFY_API_KEY="your_api_key"
export COGNIFY_BASE_URL="https://api.cognify.ai"
export COGNIFY_TIMEOUT=30
# Direct configuration
client = CognifyClient(
    api_key="your_api_key",
    base_url="https://api.cognify.ai",
    timeout=60,
    max_retries=3,
    debug=True
)

Development Status

This SDK is currently in active development. The following modules are planned:

  • Core Client Architecture
  • Authentication Module
  • Documents Module
  • Query/Search Module
  • RAG/Agents Module
  • Conversations Module
  • Collections/Organizations Module

Requirements

  • Python 3.11+
  • httpx >= 0.25.0
  • pydantic >= 2.0.0

License

MIT License - see LICENSE file for details.

Support

For support and questions, please contact support@cognify.ai or visit our documentation at https://docs.cognify.ai

Metadata

Release files for cognify-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cognify-sdk 0.1.0
File Size Uploaded
cognify_sdk-0.1.0.tar.gz 178.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cognify-sdk 0.1.0
File Interpreter ABI Platform
cognify_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 265.9 kB

Release files / cognify_sdk-0.1.0.tar.gz

Download URL cognify_sdk-0.1.0.tar.gz
Size 178.9 kB
Tags Source
SHA-256 checksum
How to use checksums
16fc83cd1b36ce3aa32a3ef1ed1870844cb0f2d6007a92fe155afdd459d1586a
BLAKE2b-256 checksum
How to use checksums
94af918f39abc9d55b08f5aee8e83bf186443ff1a2576f34b26cddccc400dbc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.2

Release files / cognify_sdk-0.1.0-py3-none-any.whl

Download URL cognify_sdk-0.1.0-py3-none-any.whl
Size 87.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
001d97b9e942b5478ddc336e15e775318e2aa2e25970f07347597dfb92b87e7b
BLAKE2b-256 checksum
How to use checksums
c01d1ca67732285b05f0d7fa39a6e8dcd450a2358e78000bd931af0bb244b8a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page