No project description provided
Project description
Example
from mars_text_embedding_sdk_python import EmbeddingSDK, KeyValue, Object
## Create the caller object to end point
sdk = EmbeddingSDK("http://127.0.0.1:4000/graphql")
## Create objects consisting of KeyValues
objects = [
Object(
key_values=[
KeyValue(key="hello", value="world"),
KeyValue(key="hello", value="world"),
KeyValue(key="you", value="are"),
],
),
Object(
key_values=[
KeyValue(key="you", value="are"),
KeyValue(key="cool", value="beans"),
KeyValue(key="cool", value="beans"),
]
)
]
# Make the call and extract data
# If something goes wrong here, check the .error property instead. .data will be None.
emb_comp = sdk(objects, dims=300).data
# Now, use to_arrays aggregation function to, for instance, aggregate embeddings to their mean
arrs = emb_comp.to_arrays(lambda x: x.mean(axis=0))
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
Close
Hashes for mars_text_embedding_sdk_python-0.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b6885eb7df6efd5e317ae4e0914cd411a81d7e56d00c905fc2fa00de6608dfb |
|
MD5 | 20e7528c6a682e5c2a51172d5a375918 |
|
BLAKE2b-256 | f4729712e4375557466a28f102a13445e49ef161efc1c56a7f4b198149ec739e |
Close
Hashes for mars_text_embedding_sdk_python-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5d4c5dcd8a38f8939d6c1444f8c8cc580594cd38d2af3206cb610d44403bcdd |
|
MD5 | d183b8aefacbab3e0055210787fbc609 |
|
BLAKE2b-256 | 2dd4ca6beaec0b4e37eeb0f3697d254ac57dc4fa3e35b06f835bddeea6a76504 |