Skip to main content

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))

Release files for mars-text-embedding-sdk-python 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mars-text-embedding-sdk-python 0.2.6
File Size Uploaded
mars_text_embedding_sdk_python-0.2.6.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mars-text-embedding-sdk-python 0.2.6
File Interpreter ABI Platform
mars_text_embedding_sdk_python-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / mars_text_embedding_sdk_python-0.2.6.tar.gz

Download URL mars_text_embedding_sdk_python-0.2.6.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3045d80fc48c02ca5376cce537d33aafbd9853f11fbe16aa80ec5c197a8080ad
BLAKE2b-256 checksum
How to use checksums
3589dd30274331c40d49cdadc24fdf1d8705a033f3d8008abdb91b93c6b39fd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.9.18 Darwin/23.0.0

Release files / mars_text_embedding_sdk_python-0.2.6-py3-none-any.whl

Download URL mars_text_embedding_sdk_python-0.2.6-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ac571f563ae815f6802963d46ea92a88f29fbfabde1c8c30ba9aa402078e66f
BLAKE2b-256 checksum
How to use checksums
e87fe44ae00dd0edca720b7b4e174961965adcfa684ab1c9f5cae4e7f90e066b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.9.18 Darwin/23.0.0

Release history Release notifications | RSS feed

This release

0.2.6 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page