Socket
Book a DemoInstallSign in
Socket

@restackio/integrations-cartesia

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restackio/integrations-cartesia

This package provides integration with Cartesia AI services for Restack applications.

0.0.9
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

Cartesia Integration for Restack

This package provides integration with Cartesia AI services for Restack applications.

Installation

To install the package, use npm or yarn:

npm install @restackio/integrations-cartesia

Configuration

Before using the Cartesia integration, make sure to set up your Cartesia API key. You can do this by setting the CARTESIA_API_KEY environment variable or by passing it directly to the functions.

Usage

Starting the Cartesia Service

To start the Cartesia service, use the cartesiaService function:

// services.ts
import Restack from "@restackio/ai";
import { cartesiaService } from "@restackio/integrations-cartesia";

export async function services() {
  const client = new Restack();
  cartesiaService({ client }).catch((err) => {
    console.error("Error starting Cartesia service:", err);
  });
}

services().catch((err) => {
  console.error("Error running services:", err);
});

Text-to-Speech Function

The package provides a Text-to-Speech function that converts text to audio bytes: Here's how to use it inside a workflow as part of one of its steps:

// cartesiaSpeechToWorflow.ts
import { log, step } from "@restackio/ai/workflow";
import * as cartesiaFunctions from "@restackio/integrations-cartesia/functions";
import { cartesiaTaskQueue } from "@restackio/integrations-cartesia/taskQueue";

export async function cartesiaSpeechToTextWorkflow() {
  const result = await step<typeof cartesiaFunctions>({
    taskQueue: cartesiaTaskQueue,
  }).cartesiaTtsBytes({
    text: "Hello, world!",
    apiKey: "your-api-key", // Optional if CARTESIA_API_KEY is set in environment
  });
  log.info("result", { result: result.media.payload }); // Base64 encoded audio data
  return result;
}

FAQs

Package last updated on 09 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.