Vectice Docs
API Reference (Latest)Vectice WebsiteStart Free Trial
Latest
Latest
  • 🏠Introduction
    • Vectice overview
      • Autolog
      • Next-Gen Autolog [BETA]
      • AskAI
      • Vectice for financial services
  • 🏁Quickstart
    • Getting started
    • Quickstart project
    • Tutorial project
    • FAQ
  • ▶️Demo Center
    • Feature videos
  • 📊Manage AI/ML projects
    • Organize workspaces
      • Create a workspace
      • Workspace Dashboard
    • Organize projects
      • Create a project
      • Project templates best practices
    • Invite colleagues
    • Define phase requirements
    • Collaborate with your team
  • 🚀Log and Manage Assets with Vectice API
    • API cheatsheets
      • Vectice Python API cheatsheet
      • Vectice R API cheatsheet
    • Connect to API
    • Log assets to Vectice
      • Autolog your assets
      • Log datasets
      • Log models
      • Log attachments and notes
      • Log code
      • Log a custom data source
      • Log assets using Vectice IDs
      • Log dataset structure and statistics
      • Log custom metadata in a table format
      • Log MLFLow runs
    • Retrieve assets from app
    • Manage your assets
    • Manage your iteration
    • Preserve your code and asset lineage
  • 🤝Create Model documentation and reports
    • Create model documentation with Vectice Reports
    • Streamline documentation with Macros
    • Auto-document Models and Datasets with AskAI Prompts
    • Document phase outcomes
  • 🗂️Admin Guides
    • Organization management
    • Workspace management
    • Teams management
    • User management
      • User roles and permissions
      • Update a user role in your organization
      • Activate and deactivate users
      • Reset a user's password
    • Manage report templates
  • 🔗Integrations
    • Integrations Overview
    • Integrate Vectice with your data platform
  • 💻IT & Security
    • IT & Security Overview
    • Secure Evaluation Environment Overview
    • Deployment
      • SaaS offering (Multi-Tenant SaaS)
      • Kubernetes self-hosted offering
        • General Architecture & Infrastructure
        • Kubernetes on GCP
          • Appendices
        • Kubernetes on AWS
          • Appendices
        • Kubernetes on Azure
          • Appendices
        • GCP Marketplace deployment
        • On premise
        • Configuration
      • Bring Your Own LLM Guide
    • Data privacy
    • User management
    • SSO management
      • Generic SAML integration
      • Okta SSO integration
    • Security
      • Data storage security
      • Network Security
        • HTTPS communication
        • Reverse proxy
        • CORS/CSRF
        • VPC segregation
      • Sessions
      • Secrets and certificates
      • Audit logs
      • SOC2
      • Security updates
      • Best practices
      • Business continuity
    • Monitoring
      • Installation guide
      • Customizing the deployments
    • Maintenance & upgrades
    • Integrating Vectice Securely
  • ⭐Glossary
    • Concepts
      • Workspaces
      • Projects
        • Setup a project
      • Phases
      • Iterations
        • Iterative development
      • Datasets
        • Dataset resources
        • Dataset properties
        • Dataset lineage and versions
      • Models
      • Reports
  • 🎯Release notes
    • Release notes
  • ↗️References
    • Vectice Python API Reference
    • Vectice R API Cheatsheet
    • Notebooks and code samples
    • Vectice website
Powered by GitBook
On this page
  • Install Vectice
  • Connect to Vectice
  • Auto-document your assets
  • Auto-document NOTES
  • Auto-document DATASETS
  • Auto-document MODELS
  • Close your iteration

Was this helpful?

  1. Log and Manage Assets with Vectice API
  2. API cheatsheets

Vectice Python API cheatsheet

PreviousAPI cheatsheetsNextVectice R API cheatsheet

Last updated 6 months ago

Was this helpful?

This API guide provides a quick overview of Vectice's simple Python API calls to help you get started auto-documenting your datasets, models, and notes.

Be sure to first!

Install Vectice

Start by installing the Vectice library.

# Install Vectice latest package
pip install vectice

# Install a specific version of the Vectice package
pip install vectice==<version number>

Connect to Vectice

Get started by connecting to the Vectice API and starting an iteration.

#import and connect to Vectice
import vectice
connect = vectice.connect(
    api_token = 'your-api-key',        # Paste your api key
    host = 'https://app.vectice.com',  # Paste your host
)

# Connect to your project phase using your phase ID
phase = connect.phase("PHA-XXX") #You can fetch the relevant phase ID from your chosen Vectice project in the app.

#Create an iteration
iteration = phase.create_or_get_current_iteration()
#import and connect to Vectice
import vectice
connect = vectice.connect(config="your-api-config.json") #Enter your API key JSON file

# Connect to your project phase using your phase ID
phase = connect.phase("PHA-XXX") #You can fetch the relevant phase ID from your chosen Vectice project in the app.

#Create an iteration
iteration = phase.create_or_get_current_iteration()

Auto-document your assets

Auto-document your notes, datasets, and models directly to Vectice.

Auto-document NOTES

# Auto-document your first comments or notes
iteration.log("this is a comment")

Auto-document DATASETS

from vectice import FileResource, Dataset

# Auto-document your first dataset from a local file
file_resource = FileResource(paths="my/file/path", dataframe=your_df)
clean_dataset = Dataset.clean(resource=file_resource, name="your_dataset_name")
iteration.log(clean_dataset)
from vectice import BigQueryResource, Dataset

# Auto-document your first dataset from BigQuery
bq_resource = BigQueryResource(paths="your-bq-table", dataframes=your_df)
clean_dataset = Dataset.clean(resource=bq_resource, name="your_dataset_name")
iteration.log(clean_dataset)
from vectice import S3Resource, Dataset

# Auto-document your first dataset from S3
s3_resource = S3Resource(uris="s3://.../<file_path_inside_bucket>", dataframes=your_df)
clean_dataset = Dataset.clean(resource=s3_resource, name="your_dataset_name")
iteration.log(clean_dataset)
from vectice import GCSResource, Dataset

# Auto-document your first dataset from GCS
gcs_resource = GCSResource(uris="gs://.../<file_path_inside_bucket>", dataframes=your_df)
clean_dataset = Dataset.clean(gcs_resource, name, attachments)
iteration.log(clean_dataset)
from vectice import DatabricksTableResource, Dataset

# Auto-document your first dataset from Databricks
db_resource = DatabricksTableResource(paths="my-table", dataframes=your_df)
clean_dataset = Dataset.clean(resource=gcs_resource, name="your_dataset_name")
iteration.log(clean_dataset)
from vectice import SnowflakeResource, Dataset

# Auto-document your first dataset from Snowflake

connection_parameters = {
    ...
}
new_session = Session.builder.configs(connection_parameters).create()

sf_resource = SnowflakeResource(
    dataframes=your_df
    snowflake_client=new_session,
    paths="SNOWFLAKE_SAMPLE_DATA.TPCH_SF10.PART",
)
clean_dataset = Dataset.clean(resource=sf_resource, name="your_dataset_name")
iteration.log(clean_dataset)
from vectice import SparkTableResource, Dataset

# Auto-document your first dataset from SparkTable
st_resource = SparkTableResource(
    dataframes=your_df
    spark_client=spark,
    paths="my_table",
)
clean_dataset = Dataset.clean(resource=st_resource, name="your_dataset_name")
iteration.log(clean_dataset)

Auto-document MODELS

from vectice import Model

# Auto-document your first model
model = Model(metrics, properties, attachments, predictor)
iteration.log(model)
import mlflow
from mlflow.client import MlflowClient
from vectice import Model

# Auto-document your first model
model = Model.mlflow(
        run_id="your-mlflow-run-id",
        client=MlflowClient() #also work with client=mlflow
    )
iteration.log(model)

Close your iteration

Once you are done logging your assets for an iteration, mark it complete.

# Completes and closes the current iteration once you are happy with it
iteration.complete()

For instructions on using these resources, refer to the guide's Resources section.

🚀
create your API key
Vectice API Reference