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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be2347ac367819349f6b7f9dc2c848a6d4623e5c6f096d45a453c9bfa969e712
|
|
| MD5 |
4b250d9c94e34a7a8fde1223184fa817
|
|
| BLAKE2b-256 |
0763d9d188560d1c793ddf404a847c0655ab6abae4d97243c43bbc5505ea95b8
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86b4de52fa944c68ea71ae39e9f2780986fbd23827b44183bcce98f400374ad5
|
|
| MD5 |
b903f07d6cba42cce5c20bbe5cabe295
|
|
| BLAKE2b-256 |
fab8dd5ba6523ef76efb1a405dfe0911f778b8766f3fc941a6c29b3af2424d68
|