@keyframelabs/elements 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -28
- package/dist/agents/audio-utils.d.ts +1 -1
- package/dist/agents/elevenlabs.d.ts +11 -0
- package/dist/agents/index.d.ts +8 -16
- package/dist/agents/openai-realtime.d.ts +60 -0
- package/dist/agents/types.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +355 -371
- package/dist/types.d.ts +4 -1
- package/package.json +1 -1
- package/dist/agents/cartesia.d.ts +0 -32
- package/dist/agents/gemini-live.d.ts +0 -25
- package/dist/agents/vapi.d.ts +0 -30
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentType } from './agents';
|
|
1
|
+
import { AgentType, TurnDetection } from './agents';
|
|
2
2
|
import { AgentState } from '@keyframelabs/sdk';
|
|
3
3
|
export type EmbedStatus = 'connecting' | 'connected' | 'error' | 'disconnected';
|
|
4
4
|
export type VideoFit = 'cover' | 'contain';
|
|
@@ -7,6 +7,9 @@ export type VoiceAgentDetails = {
|
|
|
7
7
|
token?: string;
|
|
8
8
|
agent_id?: string;
|
|
9
9
|
signed_url?: string;
|
|
10
|
+
system_prompt?: string;
|
|
11
|
+
voice?: string;
|
|
12
|
+
turn_detection?: TurnDetection;
|
|
10
13
|
};
|
|
11
14
|
export type SessionDetails = {
|
|
12
15
|
server_url: string;
|
package/package.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AgentConfig } from './types';
|
|
2
|
-
import { BaseAgent } from './base';
|
|
3
|
-
/** Cartesia specific configuration */
|
|
4
|
-
export interface CartesiaConfig extends AgentConfig {
|
|
5
|
-
/** Agent ID from Cartesia dashboard */
|
|
6
|
-
agentId: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Cartesia Agent implementation.
|
|
10
|
-
*/
|
|
11
|
-
export declare class CartesiaAgent extends BaseAgent {
|
|
12
|
-
protected readonly agentName = "Cartesia";
|
|
13
|
-
private cartesiaInputFormat;
|
|
14
|
-
private cartesiaOutputRate;
|
|
15
|
-
private streamId;
|
|
16
|
-
private isReady;
|
|
17
|
-
private pingInterval;
|
|
18
|
-
connect(config: CartesiaConfig): Promise<void>;
|
|
19
|
-
private sendStartEvent;
|
|
20
|
-
/**
|
|
21
|
-
* Keep connection alive with periodic custom events.
|
|
22
|
-
* Cartesia requires activity every 30s.
|
|
23
|
-
*/
|
|
24
|
-
private startHeartbeat;
|
|
25
|
-
private stopHeartbeat;
|
|
26
|
-
protected handleParsedMessage(message: unknown): void;
|
|
27
|
-
private handleAck;
|
|
28
|
-
private handleMediaOutput;
|
|
29
|
-
private handleClear;
|
|
30
|
-
sendAudio(pcmData: Uint8Array): void;
|
|
31
|
-
close(): void;
|
|
32
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { AgentConfig } from './types';
|
|
2
|
-
import { BaseAgent } from './base';
|
|
3
|
-
/** Gemini Live specific configuration */
|
|
4
|
-
export interface GeminiLiveConfig extends AgentConfig {
|
|
5
|
-
/** Model to use (defaults to gemini-2.5-flash-native-audio-preview) */
|
|
6
|
-
model?: string;
|
|
7
|
-
/**
|
|
8
|
-
* Auth mechanism for websocket connection.
|
|
9
|
-
* - `api_key`: use `?key=<apiKey>`
|
|
10
|
-
* - `ephemeral_token`: use `?access_token=<apiKey>` where apiKey is the ephemeral token value
|
|
11
|
-
*/
|
|
12
|
-
authType?: 'api_key' | 'ephemeral_token';
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Gemini Live agent implementation.
|
|
16
|
-
*
|
|
17
|
-
* Handles WebSocket connection to Gemini Live API and converts
|
|
18
|
-
* audio responses to events that Persona SDK can consume.
|
|
19
|
-
*/
|
|
20
|
-
export declare class GeminiLiveAgent extends BaseAgent {
|
|
21
|
-
protected readonly agentName = "GeminiLive";
|
|
22
|
-
connect(config: GeminiLiveConfig): Promise<void>;
|
|
23
|
-
protected handleParsedMessage(message: unknown): void;
|
|
24
|
-
sendAudio(pcmData: Uint8Array): void;
|
|
25
|
-
}
|
package/dist/agents/vapi.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { AgentConfig } from './types';
|
|
2
|
-
import { BaseAgent } from './base';
|
|
3
|
-
/** Vapi specific configuration */
|
|
4
|
-
export interface VapiConfig extends AgentConfig {
|
|
5
|
-
/** Pre-authenticated WebSocket URL from backend (same concept as ElevenLabs signed_url) */
|
|
6
|
-
signedUrl: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Vapi WebSocket Transport agent implementation.
|
|
10
|
-
*
|
|
11
|
-
* Handles WebSocket connection to Vapi and converts
|
|
12
|
-
* audio responses to events that Persona SDK can consume.
|
|
13
|
-
*/
|
|
14
|
-
export declare class VapiAgent extends BaseAgent {
|
|
15
|
-
protected readonly agentName = "Vapi";
|
|
16
|
-
private vapiSampleRate;
|
|
17
|
-
connect(config: VapiConfig): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Handle binary audio data from Vapi.
|
|
20
|
-
* Vapi sends raw PCM 16-bit little-endian audio.
|
|
21
|
-
*/
|
|
22
|
-
private handleBinaryAudio;
|
|
23
|
-
protected handleParsedMessage(message: unknown): void;
|
|
24
|
-
sendAudio(pcmData: Uint8Array): void;
|
|
25
|
-
/**
|
|
26
|
-
* Send a control message to end the call.
|
|
27
|
-
*/
|
|
28
|
-
hangup(): void;
|
|
29
|
-
close(): void;
|
|
30
|
-
}
|