Skip to main content

Official Python SDK for the Raily search API.

Project description

Raily Python SDK

Official Python client for the Raily search API — search your own sources from your app with a typed, one-call client.

Documentation · Source

Install

pip install raily-sdk

Quickstart

from raily import Raily

client = Raily(api_key="rly_...", endpoint="https://<your-endpoint-url>")

for hit in client.search("anti-aging serum", limit=5):
    print(hit.id, hit.score, hit.fields, hit.text)

Async

from raily import AsyncRaily

client = AsyncRaily(api_key="rly_...", endpoint="https://<your-endpoint-url>")
hits = await client.search("anti-aging serum", limit=5)

Authentication

Create an API key in your Raily workspace (Identities → API keys) and pass it as api_key. The endpoint is your endpoint's URL. A key is scoped to one workspace and to the endpoint it was issued for — using it elsewhere is rejected.

import os
client = Raily(api_key=os.environ["RAILY_API_KEY"], endpoint=os.environ["RAILY_ENDPOINT"])

Results

search() returns a list of SearchHit:

field type meaning
id str | None stable result id
score float | None relevance score
source_collection str | None the source the hit came from
fields list rendered display fields (when the source's display is configured)
text str | None rendered text
raw dict the full result dict (forward-compatible)

Errors

from raily import RailyError, RailyAuthError

try:
    client.search("query")
except RailyAuthError:
    ...  # key missing / invalid / expired / not authorized for this endpoint
except RailyError:
    ...  # everything else (network, server, protocol)

License

Apache-2.0

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

raily_ai-0.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

raily_ai-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: raily_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for raily_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 caa0259bec0e04153f528b99c5b33a51a9037495e3deb3b62692a566e5e7bdb8
MD5 0eb132f75a689598f534a87cd019b6d6
BLAKE2b-256 ad7ea5e9b8b82cf6905b8c126831f1e1d062adadd66ca64b6fe07a36106bee83

See more details on using hashes here.

File details

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

File metadata

  • Download URL: raily_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for raily_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dfa71df8a9c6480c10e975824bccb63977ef3aec1274e1aa9dc10e42387913e
MD5 32acb9b1df334c1fb6d7fe0018180c9b
BLAKE2b-256 38319910a0d32fc23b4f3ce32682486dcaa7b038b6f7fa452facf1756fbed93a

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