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

Uploaded Python 3

File details

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

File metadata

  • Download URL: raily_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 10.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.2.0.tar.gz
Algorithm Hash digest
SHA256 cd1bcea489b426e697d160dc027bf6b63653fbfea182afd35de174a118a02f94
MD5 6a460fe83665294b3c5da3fc0c699297
BLAKE2b-256 e0f69c9ca6a176afd478bab0e2388f4941dab5fa79b96b1ad069cac066786208

See more details on using hashes here.

File details

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

File metadata

  • Download URL: raily_ai-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c99be5ce7bbf833139c6af383945d018fd419eb9057ed3375d22c20e7382794
MD5 252124a43110d7988ee83918c45af608
BLAKE2b-256 17fcaf45b1a579c7f28197772d59580f5326b763a138fd5afa354b2d35a7c938

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