Skip to main content

Official Python SDK for KeiroLabs API - Search, Research, and Web Crawling

Project description

KeiroLabs Python SDK

Official Python SDK for KeiroLabs API
AI-powered search, research, and web crawling capabilities

PyPI version Python Support License: MIT

Get API Key | PyPI | Documentation


Installation

pip install keirolabs

Quick Start

from keirolabs import Keiro

# Initialize with your API key
client = Keiro(api_key="your-api-key")

# Search
result = client.search("machine learning trends 2024")
print(result['data'])

# Get AI answers
answer = client.answer("How does neural network training work?")
print(answer['data'])

# Research topics
research = client.research("quantum computing applications")
print(research['data'])

Get your API key: https://www.keirolabs.cloud/


API Methods

Method Description Credits
search(query) Neural search 1
search_pro(query) Advanced search Variable
search_engine(query) Search engine Variable
answer(query) AI-powered answers 5
research(query) Topic research Variable
research_pro(query) Advanced research Variable
web_crawler(url) Extract web data Variable
health_check() Server status Free
validate_api_key() Key validation Free

Usage Examples

Basic Search

result = client.search("Python best practices")
print(f"Found {len(result['data'])} results")
print(f"Credits remaining: {result['creditsRemaining']}")

Generate Answers

answer = client.answer("What is reinforcement learning?")
print(answer['data'])

Research Topics

research = client.research("climate change solutions")
print(research['data'])

Web Crawler

data = client.web_crawler("https://example.com")
print(data['data'])

Error Handling

from keirolabs import Keiro
from keirolabs.exceptions import (
    KeiroAuthError,
    KeiroRateLimitError,
    KeiroValidationError,
    KeiroConnectionError
)

client = Keiro(api_key="your-api-key")

try:
    result = client.search("query")
except KeiroAuthError:
    print("Invalid API key")
except KeiroRateLimitError:
    print("Out of credits")
except KeiroValidationError as e:
    print(f"Invalid parameter: {e}")
except KeiroConnectionError as e:
    print(f"Connection error: {e}")

Exception Types

Exception Description
KeiroError Base exception class
KeiroAuthError Invalid API key (401/403)
KeiroRateLimitError Out of credits (402)
KeiroValidationError Invalid parameters (400)
KeiroConnectionError Network issues
KeiroAPIError General API errors (5xx)

Configuration

Custom Timeout

client = Keiro(
    api_key="your-api-key",
    timeout=60  # seconds
)

Local Development

client = Keiro(
    api_key="your-api-key",
    base_url="http://localhost:8000/api"
)

Environment Variables (Recommended)

from dotenv import load_dotenv
import os
from keirolabs import Keiro

load_dotenv()
client = Keiro(api_key=os.getenv("KEIRO_API_KEY"))

Create .env file:

KEIRO_API_KEY=your-api-key-here

Context Manager

with Keiro(api_key="your-api-key") as client:
    result = client.search("query")
    print(result)
# Session automatically closed

Requirements

  • Python >= 3.7
  • requests >= 2.28.0

Links

Resource URL
Homepage https://www.keirolabs.cloud/
PyPI https://pypi.org/project/keirolabs
JavaScript SDK https://www.npmjs.com/package/keirolabs
Support support@keiro.com

License

MIT License - see LICENSE file for details.


Version 0.1.5
Made by KeiroLabs Team

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

keirolabs-0.1.5.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

keirolabs-0.1.5-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file keirolabs-0.1.5.tar.gz.

File metadata

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

File hashes

Hashes for keirolabs-0.1.5.tar.gz
Algorithm Hash digest
SHA256 85cef19ee08a99b13d6fbbf5b6bba109fd368841815286cc8559365364470799
MD5 09c7f43e79480f759e79a71f1cae9073
BLAKE2b-256 0b4c4c7793f67bf90375d8bc68dc307e6a7a6f65ed8a4f4f06db297931afb2c5

See more details on using hashes here.

File details

Details for the file keirolabs-0.1.5-py3-none-any.whl.

File metadata

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

File hashes

Hashes for keirolabs-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 17af34044befcc6b27b07e0531e3e333b6af6b16ae2111cd2b4d6327c5a6fd66
MD5 5ae54b54a188e0812e6110c6040f49fb
BLAKE2b-256 dd1c43759dcc0bfc1dc517a723e71a00753f609fcb85b1bdb80b807b91b9f2db

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