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.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.2.1.tar.gz (10.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.2.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: raily_ai-0.2.1.tar.gz
  • Upload date:
  • Size: 10.6 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.2.1.tar.gz
Algorithm Hash digest
SHA256 be2347ac367819349f6b7f9dc2c848a6d4623e5c6f096d45a453c9bfa969e712
MD5 4b250d9c94e34a7a8fde1223184fa817
BLAKE2b-256 0763d9d188560d1c793ddf404a847c0655ab6abae4d97243c43bbc5505ea95b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: raily_ai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 86b4de52fa944c68ea71ae39e9f2780986fbd23827b44183bcce98f400374ad5
MD5 b903f07d6cba42cce5c20bbe5cabe295
BLAKE2b-256 fab8dd5ba6523ef76efb1a405dfe0911f778b8766f3fc941a6c29b3af2424d68

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