A Python client for Orign
Project description
orign-py
A Python client for Orign
Installation
pip install orign
Install the Orign CLI
curl -fsSL -H "Cache-Control: no-cache" https://storage.googleapis.com/orign/releases/install.sh | bash
Login to Orign
$ orign login
Usage
Get a list of available models
$ orign get models
Chat
Define which model we would like to use
from orign import ChatModel
model = ChatModel(model="allenai/Molmo-7B-D-0924", provider="vllm")
Open a socket connection to the model
await model.connect()
Chat with the model
async for response in model.chat(msg="What's in this image?", image="https://tinyurl.com/2fz6ms35"):
print(response)
Stream tokens from the model
async for response in model.chat(msg="What is the capital of France?", stream_tokens=True):
print(response)
Send a thread of messages to the model
async for response in model.chat(prompt=[
{"role": "user", "content": "What is the capital of France?"},
{"role": "assistant", "content": "Paris"},
{"role": "user", "content": "When was it built?"}
]):
print(response)
Send a batch of threads to the model
async for response in model.chat(batch=[
[{"role": "user", "content": "What is the capital of France?"}, {"role": "assistant", "content": "Paris"}, {"role": "user", "content": "When was it built?"}],
[{"role": "user", "content": "What is the capital of Spain?"}, {"role": "assistant", "content": "Madrid"}, {"role": "user", "content": "When was it built?"}]
]):
print(response)
Embeddings
Define which model we would like to use
from orign import EmbeddingModel
model = EmbeddingModel(provider="sentence-tf", model="clip-ViT-B-32")
Embed a text
await model.embed(text="What is the capital of France?")
Embed an image
await model.embed(image="https://example.com/image.jpg")
Embed text and image
await model.embed(text="What is the capital of France?", image="https://example.com/image.jpg")
OCR
Define which model we would like to use
from orign import OCRModel
model = OCRModel(provider="easyocr")
Detect text in an image
await model.detect(image="https://example.com/image.jpg")
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
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 orign-0.1.6.tar.gz.
File metadata
- Download URL: orign-0.1.6.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/23.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2493abb32ffd56a0ea7165a4a377c2f0a15a915895ed5d20b69387d38d375c1d
|
|
| MD5 |
96829d7ae1b46912c50356f5eb20f1a3
|
|
| BLAKE2b-256 |
fdf9d969c5345496c879541a84c8f6378f5adc02231f557002c007e6eac1ac49
|
File details
Details for the file orign-0.1.6-py3-none-any.whl.
File metadata
- Download URL: orign-0.1.6-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/23.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad566ba2ffd4d263286eb67073a6fed2b231749dc90d3c9ddf286ed79097ee4e
|
|
| MD5 |
be72abd5679bcb831dd5393f0ce976ec
|
|
| BLAKE2b-256 |
8bc1e03605701e7cc00f7155d364241db857559d1329684b2d86f2e2f443e6f3
|