Skip to main content

Internal SDK for Velyana Red Teaming API

Project description

Usage Documentation

1. Initialization

from velyana import VelyanaRedTeamClient

# Uses VELYANA_API_KEY environment variable and defaults to api_version="v1"
client = VelyanaRedTeamClient()

# Or pass explicitly
client = VelyanaRedTeamClient(api_key="your_api_key", api_version="v2")

2. Triggering a test with JSON body

The SDK encapsulates all endpoint paths. You only need to pass the body. Using a dictionary will automatically send the request as JSON:

payload = {
    "input": "test prompt",
    "attack_type": "jailbreak"
}

response = client.run_test(body=payload)
print(response.status_code)

3. Triggering with a raw body

To send non-JSON bodies (like raw text attacks):

response = client.run_test(body="raw string body")
print(response.status_code)

4. Triggering a specific attack

payload = {"target_model": "llama3", "prompt": "ignore previous instructions"}
response = client.trigger_attack("prompt-injection", body=payload)

5. Custom headers

You can override or append headers to specific requests:

client.run_test(body={}, headers={"X-Test": "true", "Content-Type": "text/xml"})

6. Error handling

from velyana.exceptions import APIError

try:
    response = client.run_test(body={})
except APIError as e:
    print(f"Error ({e.status_code}): {e.response_body}")
except Exception as e:
    print(e)

7. Async Usage

Use the corresponding a prefixed methods for asyncio:

import asyncio
from velyana import VelyanaRedTeamClient

async def main():
    client = VelyanaRedTeamClient()
    response = await client.arun_test(body={"attack": "eval()"})
    print(response.status_code)

asyncio.run(main())

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

velyana-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

velyana-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file velyana-0.1.1.tar.gz.

File metadata

  • Download URL: velyana-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for velyana-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9afe2c6120897cab0d4ccbe3b323751da6547eadb5efd3907feb78ff9811c9de
MD5 2053c5db870f84d2d99a558efc469a0c
BLAKE2b-256 38bba71f10ee576eee3474a45fe68a45549eb33348b6fed15e2d1d25a89e7d5c

See more details on using hashes here.

File details

Details for the file velyana-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: velyana-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for velyana-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9426a683ac7f7f1214f7efb18c2301fc4bb8e55cf85db4760348180b2f610af8
MD5 f904ef68d19f821ef8d77071f8d5936f
BLAKE2b-256 4b2e3a426f0edcf9dfd3d8328c0b3684008667a0ee83bbd6776791bb473d086f

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