Official Python SDK for the Sawalni API
Project description
Sawalni Python SDK
This is the official Python SDK for the Sawalni API, providing easy access to language-related services such as embedding generation, language identification, and translation. Sawalni API is developed by Omneity Labs, and provides unique multilingual models and NLP capabilities, including pioneering Moroccan Darija support.
Installation
Install the package using pip:
pip install sawalni
Quick Start
To use the Sawalni SDK, you'll need an API key. You can set it as an environment variable or pass it directly to the client:
from sawalni import Sawalni
client = Sawalni(api_key='your_api_key_here')
# or specify the key via SAWALNI_API_KEY in the environment
Features
The SDK supports both synchronous and asynchronous operations for the following services:
- Generate Embeddings (languages depend on the model)
- Identify Language (35 languages supported)
- Translate Text (13 languages supported)
Generate Embeddings
embeddings = client.embed("Hello, world!")
Identify Language
language = client.identify("Bonjour le monde")
Translate Text
translation = client.translate("Hello", source="eng_Latn", target="ary_Latn")
Asynchronous Usage
For asynchronous operations, use the SawalniAsync client:
from sawalni import SawalniAsync
async_client = SawalniAsync(api_key='your_api_key_here')
embeddings = await async_client.embed("Hello, world!")
Documentation
For detailed information about available models, parameters, languages and and response formats, please refer to the complete API documentation at https://api.sawalni.com.
Support
If you encounter any issues or have questions, please contact api@sawalni.com.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file sawalni-0.1.4.tar.gz
.
File metadata
- Download URL: sawalni-0.1.4.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c47934087310e3be0d1147d50c39ecc4eaf7962c6ea3452c55d025a3f9c6198 |
|
MD5 | 0b23cb02e16397414a623036e93a175f |
|
BLAKE2b-256 | 99c139013715026c55bc08f9d5d5528f9675e49d2c4d300363d43b932e804cd0 |
File details
Details for the file sawalni-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: sawalni-0.1.4-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42780dd14c7e8cc55979ae7bd42161070bc18a19ef3da1bceb39025e491da251 |
|
MD5 | dd2ac26de68943d2512f9b911215afbd |
|
BLAKE2b-256 | 5873f5c2ecf26885789a145cefa1aaaf3e54dff7b78ac98ba62bef1aa52b61cd |