Skip to main content

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:

  1. Generate Embeddings (languages depend on the model)
  2. Identify Language (35 languages supported)
  3. Translate Text (13 languages supported)

Generate Embeddings

embeddings = client.generate_embeddings("Hello, world!")

Identify Language

language = client.identify_language("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.generate_embeddings("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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sawalni-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

sawalni-0.1.0-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file sawalni-0.1.0.tar.gz.

File metadata

  • Download URL: sawalni-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for sawalni-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bfa73d8c3351ced869c2b09519e59b8cc57a84518eda2e68b468b0906ed3bc47
MD5 cfa689e26ee442c661c008c53df589ef
BLAKE2b-256 5c3b9bd9d0e38bdc480ddeae3e76aae8d9aa2b1f5e4dc66fe2266c14edcdc515

See more details on using hashes here.

File details

Details for the file sawalni-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sawalni-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for sawalni-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50c7d760f7d3a9cccb32d7200ecfeb720f6d18d7271d508a1658d75774ed68b6
MD5 afa5141832450aefbc7b70941be452f5
BLAKE2b-256 24829517db233f58aced5802de8d30535d4b6fba76c0fac53446e9e0e5472803

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page