Skip to main content

Legion Intelligence Python ML Inference Client

Project description

Quasar Python Client

PyPI version

Installation

pip install quasar-client

Usage

from quasar_client import Quasar

quasar_base = "URL for Quasar-compatible server"
quasar = Quasar(quasar_base=quasar_base)

# Use OpenAI-compatible interfaces...
chat_completion = quasar.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": "Hello quasar",
        }
    ],
    model="gpt-3.5-turbo",
)

# Use Quasar-specific interfaces like NER...
entities = quasar.tagger.tag(
    task="ner", 
    text="Yurts Technologies is based in SF."
)

Quasar provides a convenient interface for common RAG APIs. In addition to the OpenAI APIs, the client supports:

  • Coreference Resolution
  • Entities
  • Embedding
  • Ranking
  • Topics/Keywords

Asynchronous Support

For developers looking to leverage asynchronous programming for improved performance and non-blocking IO operations, Quasar introduces async support for its APIs. This allows you to efficiently handle large volumes of requests and data processing in a non-blocking manner.

Async Usage Example

Below is an example of how to use the asynchronous interface for embedding texts:

from quasar_client import AsyncQuasar

quasar_base = "URL for Quasar-compatible server"
quasar = AsyncQuasar(quasar_base=quasar_base)

# Asynchronously embed texts
async def embed_texts(texts):
    embeddings = await quasar.embedding.embed(texts=texts)
    return embeddings

# Example texts
texts = ["Hello, world!", "How are you?"]

# Remember to run this in an async context

This async support ensures that your application can scale more efficiently, handling concurrent operations without the need for complex threading or multiprocessing setups.

Sync and Async Resource Modules

Quasar provides both synchronous and asynchronous resource classes to cater to different use cases and preferences. Whether you prefer the simplicity of synchronous code or the efficiency of asynchronous operations, Quasar has you covered.

# Synchronous Embedding Resource Class
class SyncEmbeddingResource(SyncResource):
    ...

# Asynchronous Embedding Resource Class
class AsyncEmbeddingResource(AsyncResource):
    ...

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

quasar_client-0.1.25.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quasar_client-0.1.25-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file quasar_client-0.1.25.tar.gz.

File metadata

  • Download URL: quasar_client-0.1.25.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.31

File hashes

Hashes for quasar_client-0.1.25.tar.gz
Algorithm Hash digest
SHA256 cb80a5b4a9dd7a3f9cc3e68d3dbc185475ad91b00ccc51425fa52b57131dd5c4
MD5 13c370ad1f27a701f9f371382e42df12
BLAKE2b-256 6a819724e53492aa19992a03909cbea346a41b5103a4773b3846b131aad5d13b

See more details on using hashes here.

File details

Details for the file quasar_client-0.1.25-py3-none-any.whl.

File metadata

File hashes

Hashes for quasar_client-0.1.25-py3-none-any.whl
Algorithm Hash digest
SHA256 b96fc8929686147d9653cd76db81af41ae1613636f1db09c1af25eded9a4dca1
MD5 b20fb635114be08b6dc5a3afc9e54cb5
BLAKE2b-256 d989253d16b5da67fb50dfde0d6e4c4cfcd11056160f9686cc631aace32d8395

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