Skip to main content

libscope Python SDK

Python client library for the libscope AI knowledge base.

Installation

pip install libscope

Or for development:

pip install -e ".[dev]"

Quick Start

from libscope import LibscopeClient

with LibscopeClient() as client:
    # Add a document from a URL
    doc = client.add_document("https://docs.python.org/3/tutorial/")

    # Add a document from raw text
    client.add_text("My Notes", "Some useful content...", topic="python")

    # Search
    results = client.search("how to use decorators")
    for hit in results.results:
        print(f"{hit.title}: {hit.score:.2f}")

    # Manage tags
    client.add_tags(doc.id, ["python", "tutorial"])

    # Ask a question (RAG)
    answer = client.ask("What is the best practice for error handling?")
    print(answer.answer)

Async Usage

import asyncio
from libscope import AsyncLibscopeClient

async def main():
    async with AsyncLibscopeClient() as client:
        results = await client.search("decorators")
        for hit in results.results:
            print(f"{hit.title}: {hit.score:.2f}")

asyncio.run(main())

Configuration

# Custom server URL and timeout
client = LibscopeClient(
    base_url="http://my-server:3378",
    timeout=60.0,
)

API Reference

Document Operations

Method Description
search(query, *, limit, topic, tags, min_score) Semantic search
add_document(url, *, topic, tags) Index a document from URL
add_text(title, content, *, topic, tags) Index raw text
get_document(doc_id) Get a document by ID
list_documents(*, topic, limit, offset) List documents
delete_document(doc_id) Delete a document

Topic Operations

Method Description
list_topics() List all topics
create_topic(name, *, parent_id) Create a topic

Tag Operations

Method Description
add_tags(doc_id, tags) Add tags to a document
remove_tags(doc_id, tags) Remove tags from a document
list_tags() List all tags

Analytics & Q&A

Method Description
get_analytics() Get knowledge base statistics
ask(question, *, topic) RAG-powered question answering
health() Check server health

Requirements

  • Python 3.9+
  • A running libscope server (default: http://localhost:3378)

License

MIT

Metadata

Release files for pylibscope 1.2.1

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

Source distribution (sdist)

Source distribution for pylibscope 1.2.1
File Size Uploaded
pylibscope-1.2.1.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylibscope 1.2.1
File Interpreter ABI Platform
pylibscope-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / pylibscope-1.2.1.tar.gz

Download URL pylibscope-1.2.1.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9e10f252458189855cc2bcdb8805061d00d10f2c0d44e1231912ae772740e93f
BLAKE2b-256 checksum
How to use checksums
2eaae7f1e2555d3fe0a744dd49114176952d5a560539015223c8fe2ad26c34e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release files / pylibscope-1.2.1-py3-none-any.whl

Download URL pylibscope-1.2.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b68d7ce1409c1d06b8fa3dbef056d2e9b086c385f9df57ef068511257227968d
BLAKE2b-256 checksum
How to use checksums
04f074f03d282144e4dc297c7c636546626e407f31ab10ad0e5ec7d5792dd0a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.1 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