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-ai

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.score, hit.fields.get("title"))

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
score float | None relevance score
fields dict[str, str] flat {name: value} map of the source's display fields, e.g. hit.fields["title"]
text str | None a rendered text summary
source_collection str | None the source the hit came from
id str | None stable result id
raw dict the full original result, for anything not surfaced above

fields is a flat dict, so you read a value by name:

hit.fields["title"]              # e.g. "Anti-Aging Vitamin C Serum"
hit.fields.get("published_date") # None if this source doesn't expose it

The exact keys come from the source's configured display fields (e.g. title, author, published_date). Print one hit's fields to see what your source exposes.

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.3.0.tar.gz (106.6 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.3.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for raily_ai-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3b5997791e8de32757f196394c7bb331755536bf659e5d0a3c013a90fc303dd6
MD5 e4ac3fdab4e92ca8d230855586885e55
BLAKE2b-256 94c55f36790d8a143d756697d695865e68f1b75b667b97257071e59a921c0fe7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for raily_ai-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09734f1208a79b110c8bd0cf15badbfee3ff1cafaa101b72bdb0216d64a7e904
MD5 d0234dc9ac349a569ab50e30aee0546b
BLAKE2b-256 f588fd7b42c71734490dd63b16371fe59ea6f59b0b53aa8d873279a248e5dd4a

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