Skip to main content

Official Python SDK for Vecto

Project description

DocsBlogDiscordTutorials

Vecto Python SDK

Official Python SDK for Vecto, the database software that puts intelligent search and powerful models at your fingertips, allowing you to leverage the full potential of AI in mere minutes.

Installation

You can install the package from our latest GitHub release.

pip install vecto-sdk

Alternatively you can also download the latest wheel file from the releases page.

For the token, sign up for your access here.

Building the Wheel

If you would like to build your own wheel, run python setup.py bdist_wheel --universal which creates a .whl file in the dist folder. You can install that wheel file with pip install dist/vecto-*.whl into your current environment (if the file is in the current working directory).

Sample Usage

For first time users, we recommend using our VectorSpace interface.

Find Nearest Neighbors

import vecto
vecto.api_key = os.getenv("VECTO_API_KEY", "")
vector_space = vecto.VectorSpace("my-cool-ai")

for animal in ["lion", "wolf", "cheetah", "giraffe", "elephant", "rhinoceros", "hyena", "zebrah"]:
    vector_space.ingest_text(animal, { 'text': animal, 'region': 'Africa' })

similar_animals = vector_space.lookup_text("cat", top_k=3)
                        
for animal in similar_animals:
    print(f"{animal.attributes['text']} similarity: {animal.similarity:.2%}")

# Prints: "lion similarity: 84.91%"

Ingest Text or Images

import vecto
from pathlib import Path
vecto.api_key = os.getenv("VECTO_API_KEY", "")
vector_space = vecto.VectorSpace("my-cool-image-ai")

if not vector_space.exists():
    vector_space.create(model='CLIP', modality='IMAGE') 

for animal in ["lion.png", "wolf.png", "cheetah.png", "giraffe.png", "elephant.png", "rhinoceros.png", "hyena.png", "zebra.png"]:
    vector_space.ingest_image(Path(animal), { 'text': animal.replace('.png', ''), 'region': 'Africa' })

similar_animals = vector_space.lookup_image(Path("cat.png"), top_k=1)

for animal in similar_animals:
    print(f"{animal.attributes['text']}")

# Prints: lion

Looking up by Analogy

import vecto
vecto.api_key = os.getenv("VECTO_API_KEY", "")
vector_space = vecto.VectorSpace("word_space")

if not vector_space.exists():
    vector_space.create(model='SBERT', modality='TEXT') 

for word in ["man", "woman", "child", "mother", "father", "boy", "girl", "king", "queen"]:
    vector_space.ingest_text(word, { 'text': word })

analogy = vector_space.compute_text_analogy("king", { 'start': 'man', 'end': 'woman' }, top_k=3)

for word in analogy:
    print(f"{word.attributes['text']} similarity: {word.similarity:.2%}")

# Prints: "queen similarity: 93.41%"

For more advanced capabilities including management access, we recommend using the core Vecto class.

Tutorial

We have a new Vecto tutorial! Checkout the Vecto tutorials repository.

Developers Discord

Have any questions? Feel free to chat with the devs at our Discord!

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

vecto_sdk-0.2.4.tar.gz (55.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vecto_sdk-0.2.4-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file vecto_sdk-0.2.4.tar.gz.

File metadata

  • Download URL: vecto_sdk-0.2.4.tar.gz
  • Upload date:
  • Size: 55.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for vecto_sdk-0.2.4.tar.gz
Algorithm Hash digest
SHA256 c1371cccacb29e022bb691cb08e4bcec06e89f7fa209e5052a9f07a1e07c436c
MD5 8d11a32a604a1841fce1b933b2975be7
BLAKE2b-256 59c33433609e846e4c2c8eb0fa7798c953d852aa0433c414623612200123b11d

See more details on using hashes here.

File details

Details for the file vecto_sdk-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: vecto_sdk-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for vecto_sdk-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 58a3c1f7e4c71a1c8ce384ebc9915661131401e58f402ee502a16da558555171
MD5 379f670e2f2e7d137dbfc0b9af04be4c
BLAKE2b-256 b548d8f414291bad5cae1f0be7613b61d280323d73d4aec13013bdb87fe30cec

See more details on using hashes here.

Supported by

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