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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22c198c1af460d2927de08c3c24e422399d9b68c8cb2ae05f84ac45c8fb55937 |
|
MD5 | cae4df5a1c6f7452dea79eaf9555d23f |
|
BLAKE2b-256 | 2bf8a6d3371f51d8a689940f814090290988e0f497a53d8d182160ebe58b3e63 |
Close
Hashes for mars_text_embedding_sdk_python-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fcac06e86e1fbb3cc12c11dd555e959a098a0a8e16ad75c2a4ad49c6bb3a7a3 |
|
MD5 | e2156a77adced4650a2a4ca56307d567 |
|
BLAKE2b-256 | 5c53f96d85e9bba98b0c285c7ba33b732acaaeb24bdd2b474e4af1c3f641e922 |