Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mars_text_embedding_sdk_python-0.2.6.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file mars_text_embedding_sdk_python-0.2.6.tar.gz.

File metadata

File hashes

Hashes for mars_text_embedding_sdk_python-0.2.6.tar.gz
Algorithm Hash digest
SHA256 3045d80fc48c02ca5376cce537d33aafbd9853f11fbe16aa80ec5c197a8080ad
MD5 6036e6c13fa2516647aa07bde798db57
BLAKE2b-256 3589dd30274331c40d49cdadc24fdf1d8705a033f3d8008abdb91b93c6b39fd0

See more details on using hashes here.

File details

Details for the file mars_text_embedding_sdk_python-0.2.6-py3-none-any.whl.

File metadata

File hashes

Hashes for mars_text_embedding_sdk_python-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8ac571f563ae815f6802963d46ea92a88f29fbfabde1c8c30ba9aa402078e66f
MD5 ab511342426a734fbd6d862f11a45c8e
BLAKE2b-256 e87fe44ae00dd0edca720b7b4e174961965adcfa684ab1c9f5cae4e7f90e066b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page