Testing

Testing

Basic Connectivity Test

#!/usr/bin/env python3

from secret_ai_sdk.secret import Secret
from secret_ai_sdk.secret_ai import ChatSecret

# Test configuration
TEST_API_KEY = 'your_test_api_key'
TEST_MODEL = 'deepseek-r1:70b'

def test_secret_ai_connection():
    """Test basic connectivity and functionality"""
    import os
    os.environ['SECRET_AI_API_KEY'] = TEST_API_KEY
    
    # Test Secret Network client
    secret_client = Secret()
    models = secret_client.get_models()
    assert len(models) >= 1, "No models available"
    
    urls = secret_client.get_urls(model=TEST_MODEL)
    assert len(urls) >= 1, "No URLs available for model"
    
    # Test ChatSecret
    secret_ai_llm = ChatSecret(
        base_url=urls[0],
        model=TEST_MODEL,
        temperature=0.7
    )
    
    messages = [
        ("system", "Respond with exactly 'SUCCESS' if you understand."),
        ("human", "Test message"),
    ]
    
    response = secret_ai_llm.invoke(messages)
    assert response is not None, "No response received"
    assert len(response.content) > 0, "Empty response content"
    
    print("βœ… All tests passed!")

if __name__ == '__main__':
    test_secret_ai_connection()

Voice Services Test

Last updated

Was this helpful?