Skip to main content

Official Python SDK for SVECTOR AI Models - Advanced conversational AI and language models

Project description

SVECTOR Python SDK

PyPI version Python Support License: MIT

The official Python SDK for SVECTOR's AI models.

SVECTOR is a technology-driven organization focused on AI, Mathematics, and Computational research, developing cutting-edge language models including Spec-3, Spec-3-Turbo, Spec-3.5, Theta-35, and Theta-35-Mini.

This SDK provides programmatic access to SVECTOR's proprietary AI models for building intelligent applications, while our Spec Chat web interface at spec-chat.tech offers live model interaction.

Installation

pip install svector-sdk

Quick Start

Basic Usage

from svector import SVECTOR

# Initialize with your SVECTOR API key
client = SVECTOR(api_key="your-api-key-here")

# Use SVECTOR's models
response = client.chat.create(
    model="spec-3-turbo:latest",
    messages=[
        {"role": "user", "content": "What is artificial intelligence?"}
    ]
)

print(response["choices"][0]["message"]["content"])

Streaming Responses

# Stream responses in real-time
stream = client.chat.create(
    model="spec-3-turbo:latest",
    messages=[
        {"role": "user", "content": "Write a poem about technology"}
    ],
    stream=True
)

for event in stream:
    if event.get("choices") and event["choices"][0].get("delta", {}).get("content"):
        print(event["choices"][0]["delta"]["content"], end="", flush=True)

File Upload and Document Processing

# Upload a file for document processing
file_response = client.files.create("document.pdf", purpose="assistant")
file_id = file_response["file_id"]

# Ask questions about the uploaded file
response = client.chat.create(
    model="spec-3-turbo:latest",
    messages=[
        {"role": "user", "content": "Summarize this document"}
    ],
    files=[{"type": "file", "id": file_id}]
)

print(response["choices"][0]["message"]["content"])

Command Line Interface

SVECTOR also provides a powerful CLI:

# Set up your API key
svector config set-key your-api-key-here

# Start chatting
svector chat "Hello, SVECTOR!"

# Stream responses
svector stream "Write a poem about AI"

# List available models
svector models

# Upload files for document processing
svector file upload document.pdf

# Ask questions about files
svector ask "Summarize this document" --file file-123

API Reference

SVECTOR Client

client = SVECTOR(
    api_key="your-api-key",           # Required: Your SVECTOR API key
    base_url="https://spec-chat.tech",  # Optional: Custom API base URL
    timeout=30,                       # Optional: Request timeout in seconds
    max_retries=3                     # Optional: Max retry attempts
)

Chat Completions

response = client.chat.create(
    model="spec-3-turbo:latest",      # Required: Model name
    messages=[                        # Required: List of messages
        {"role": "user", "content": "Hello"}
    ],
    temperature=0.7,                  # Optional: 0.0 to 2.0
    max_tokens=150,                   # Optional: Max tokens to generate
    files=[                           # Optional: Files for document processing
        {"type": "file", "id": "file-123"}
    ],
    stream=False                      # Optional: Enable streaming
)

Models API

# List available models
models = client.models.list()
print(models["models"])

Files API

# Upload from file path
response = client.files.create("path/to/file.pdf", purpose="assistant")

# Upload from bytes
with open("file.pdf", "rb") as f:
    response = client.files.create(f.read(), purpose="assistant", filename="file.pdf")

# Upload from file object
with open("file.pdf", "rb") as f:
    response = client.files.create(f, purpose="assistant", filename="file.pdf")

Advanced Examples

Multi-turn Conversation

conversation = [
    {"role": "system", "content": "You are a helpful programming assistant."},
    {"role": "user", "content": "How do I create a function in Python?"},
]

response = client.chat.create(
    model="spec-3-turbo:latest",
    messages=conversation,
    temperature=0.3
)

# Add the AI response to conversation history
conversation.append({
    "role": "assistant", 
    "content": response["choices"][0]["message"]["content"]
})

# Continue the conversation
conversation.append({
    "role": "user", 
    "content": "Can you show me an example?"
})

response = client.chat.create(
    model="spec-3-turbo:latest",
    messages=conversation
)

Multi-file Document Processing

# Upload multiple files
file1 = client.files.create("technical_specs.pdf")
file2 = client.files.create("user_manual.pdf")

# Query across multiple documents
response = client.chat.create(
    model="spec-3-turbo:latest",
    messages=[
        {"role": "user", "content": "Compare the technical specifications with the user manual"}
    ],
    files=[
        {"type": "file", "id": file1["file_id"]},
        {"type": "file", "id": file2["file_id"]}
    ]
)

Error Handling

from svector import SVECTOR, AuthenticationError, RateLimitError, APIError

try:
    client = SVECTOR(api_key="invalid-key")
    response = client.chat.create(
        model="spec-3-turbo:latest",
        messages=[{"role": "user", "content": "Hello"}]
    )
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit exceeded")
except APIError as e:
    print(f"API error: {e}")

Features

  • Complete API Coverage: Chat completions, streaming, file upload, document processing
  • Type Safety: Full type hints for better development experience
  • Error Handling: Comprehensive error types and retry logic
  • Streaming Support: Real-time response streaming
  • File Upload: Support for various file formats and document processing
  • CLI Interface: Command-line tool for quick interactions
  • Production Ready: Robust error handling and retry mechanisms

🔑 Authentication

Get your API key from the SVECTOR Dashboard.

Set it as an environment variable:

export SVECTOR_API_KEY="your-api-key-here"

Or pass it directly to the client:

client = SVECTOR(api_key="your-api-key-here")

SVECTOR's AI Models

SVECTOR develops cutting-edge language models designed for scalable, intelligent solutions:

Available Models:

  • spec-3-turbo:latest - High-performance general-purpose model with optimized speed and accuracy
  • spec-3:latest - Advanced reasoning model for complex computational tasks
  • spec-3.5:latest - Next-generation model with enhanced capabilities (coming soon)
  • theta-35:latest - Large-scale model for enterprise applications and complex reasoning
  • theta-35-mini:latest - Efficient model optimized for speed and resource efficiency

Model Selection:

# List all available SVECTOR models
models = client.models.list()
print(models["data"])

# Use different models for different tasks
response = client.chat.create(
    model="spec-3-turbo:latest",  # Fast and efficient
    messages=[{"role": "user", "content": "Quick question"}]
)

response = client.chat.create(
    model="theta-35:latest",      # Advanced reasoning
    messages=[{"role": "user", "content": "Complex analysis task"}]
)

SVECTOR Technology Platform

SVECTOR is a technology company focused on AI, Mathematics, and Computational research. We develop:

  • AI Models: Spec-3, Spec-3-Turbo, Spec-3.5, Theta-35, Theta-35-Mini and more proprietary models
  • Mathematical Reasoning Systems: Advanced computational frameworks for scientific computing
  • Next-Gen Automation: Scalable intelligent solutions from quantum AI to enterprise automation
  • Spec Chat: Live web interface for model interaction at spec-chat.tech

This Python SDK provides programmatic access to SVECTOR's models for developers building AI-powered applications and integrations.

Requirements

  • Python 3.8+
  • requests library (automatically installed)

🤝 Support

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

Getting Started

  1. Install the package:

    pip install svector
    
  2. Get your API key: Visit https://platform.svector.co.in

  3. Start building:

    from svector import SVECTOR
    
    client = SVECTOR(api_key="your-key")
    response = client.chat.create(
        model="spec-3-turbo:latest",
        messages=[{"role": "user", "content": "Hello, SVECTOR!"}]
    )
    

Built by the SVECTOR Team

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

svector_sdk-1.0.6.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

svector_sdk-1.0.6-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file svector_sdk-1.0.6.tar.gz.

File metadata

  • Download URL: svector_sdk-1.0.6.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for svector_sdk-1.0.6.tar.gz
Algorithm Hash digest
SHA256 644b043df57cd6b9b4fc42987473c3d6645766f8f4ef8127dc253d84d8dfb0a4
MD5 57d73edcec8f5750e21a57f46390a8d5
BLAKE2b-256 d2bd256983d36202308e10fea49678f96a73f078705d983171e83dfa542b163c

See more details on using hashes here.

File details

Details for the file svector_sdk-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: svector_sdk-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for svector_sdk-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d1172a757b10a23a2f4eb854fcb0b7868a7667ad200e6d9094266186d812d7fa
MD5 b92ab9dc98d44db4f752386c2de4d2f1
BLAKE2b-256 3fbbbce90b1b3cce9dc4cf3ba94354a3fc09484a909ac1b33a5b01d8dc445e6b

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