Cliente oficial de Python para Vetsa Intelligence API
Project description
Vetsa Intelligence Python Client
Librería oficial para integrar la API de Vetsa Cloud v1.2.0 en tus aplicaciones Python. Soporta generación de texto, búsqueda online, imágenes y síntesis de voz (TTS).
Instalación
Instala el paquete usando pip:
pip install vetsa
Configuración
Necesitas una API Key del Dashboard de Vetsa.
from vetsa import VetsaClient
Inicializa el cliente
client = VetsaClient(api_key="TU_API_KEY_AQUI")
Ejemplos de Uso
- Chat y Texto (Modelo Spaik)
Puedes usar el método rápido chat para conversaciones o generación de texto.
Chat simple (modelo por defecto: spaik-pro)
response = client.chat("Explícame qué es la computación cuántica en una frase.") print(response['data']['response'])
Chat con búsqueda en internet en tiempo real (Spaik Online)
noticias = client.chat("¿Qué noticias hay sobre la exploración espacial hoy?", search=True) print(noticias['data']['response'])
- Texto a Voz (TTS)
Convierte texto en audio natural. La librería maneja automáticamente la decodificación del audio para que obtengas los bytes listos para guardar o reproducir.
Voces disponibles: emily, jonas, alexa, luis-angel.
try: # Generar audio audio_bytes = client.text_to_speech( text="Hola, soy la inteligencia artificial de Vetsa funcionando en Python.", voice="jonas" )
# Guardar en un archivo .ogg
with open("audio_generado.ogg", "wb") as f:
f.write(audio_bytes)
print("¡Audio generado correctamente como 'audio_generado.ogg'!")
except Exception as e: print(f"Error generando audio: {e}")
- Generación de Imágenes
Para generar imágenes, usa el método genérico generate con el modelo de visión.
response = client.generate( model="spaik-pro-vision", contents="Un astronauta programando en una laptop en medio de un bosque futurista neon", options={ "width": 1024, "height": 1024, "quality": "hd" } )
La API devuelve la URL de la imagen generada
print("Imagen generada:", response['data']['url'])
Manejo de Errores
La librería incluye manejo de excepciones nativo para los códigos de error de Vetsa:
PermissionError: Si tu API Key es inválida (Error 401).
BlockingIOError: Si excediste tu cuota (Error 402).
ConnectionError: Si envías peticiones muy rápido (Error 429).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vetsa-0.1.0.tar.gz.
File metadata
- Download URL: vetsa-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
817012e16a0c555b174e5f5b58c62a5827c7ced4c25341a4eef1647c018b6817
|
|
| MD5 |
34660927a24983cdaecffecebaf38830
|
|
| BLAKE2b-256 |
71a5cdc7d4421100ccaf7fcce1f6f1aa2e75cc5e935a730b4e4c72253c64bcaf
|
File details
Details for the file vetsa-0.1.0-py3-none-any.whl.
File metadata
- Download URL: vetsa-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cf7691e2e1632e434b2998326da971a8894d748d90f59ec3cb7240acc38de44
|
|
| MD5 |
4457392a040282102e41b6964c72c08b
|
|
| BLAKE2b-256 |
401f4c8c73b8ac48eacf48a74340573679a5f516ce862594e05e002470b87e6c
|