Yurts Python Quasar Client
Project description
Quasar Python Client
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
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 quasar_client-0.1.21.tar.gz
.
File metadata
- Download URL: quasar_client-0.1.21.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49a3e0fd1a7ddc9adf2f4303d3798c94e133f00ee52cff592f90c4ac48cfcdd0 |
|
MD5 | ab12506d4d0d8ff58347e52ead2c3279 |
|
BLAKE2b-256 | c94e34136976db7040ec44e6b7a55266bc964470fc749aef5044fd0d6dc06df0 |
File details
Details for the file quasar_client-0.1.21-py3-none-any.whl
.
File metadata
- Download URL: quasar_client-0.1.21-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc7049ec07b489cae3937c949030f25824d2004400ab64d4dad07189772250b2 |
|
MD5 | ea27dde885cc17940c1405647ea3146a |
|
BLAKE2b-256 | 0cf45fddc022bb7a736a25d2fbc3d04a48b56b95622c948bb5fdecaebf3218a8 |