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
File details
Details for the file mars_text_embedding_sdk_python-0.2.2.tar.gz
.
File metadata
- Download URL: mars_text_embedding_sdk_python-0.2.2.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.9.18 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5adf05b0d23da6ce6d1c6479b5d3715673c880ce94d14e56ff5604771991ba3 |
|
MD5 | 4c55e7d0d1015224433b13cbd55a999f |
|
BLAKE2b-256 | d51f19b2968c7938c82f49fb2a9e163ead15667f483fd9a9648cef147a915e6d |
File details
Details for the file mars_text_embedding_sdk_python-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: mars_text_embedding_sdk_python-0.2.2-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.9.18 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88c2014114fe16e73f5d0edf1cf137f2844182a4aca56dd430fdc3ccd0de5b8d |
|
MD5 | 14e401c5ca1da4d81e11d3d0c11f5edd |
|
BLAKE2b-256 | 63db651e17b38d30e276919f92d01c52741bdbf89ba26d561428f5acf77508ab |