valenceai 1.0.0 → 1.0.1
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/CHANGELOG.md +42 -0
- package/package.json +1 -1
- package/src/asyncAudio.js +11 -6
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,48 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.1] - 2025-12-29
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Async API Endpoints**: Fixed incorrect endpoint paths that caused `net::ERR_FAILED` errors
|
|
12
|
+
- Updated initiate upload: `${baseUrl}/v1/asynch/emotion/upload/initiate` (was `/upload/initiate`)
|
|
13
|
+
- Updated complete upload: `${baseUrl}/v1/asynch/emotion/upload/complete` (was `/upload/complete`)
|
|
14
|
+
- Updated status endpoint: `${baseUrl}/v1/asynch/emotion/status/${requestId}` (was `/prediction?request_id=...`)
|
|
15
|
+
- **Request ID Parameter**: Changed status endpoint to use path parameter instead of query parameter
|
|
16
|
+
- **URL Configuration**: SDK now properly uses `config.baseUrl` as fallback when legacy `config.asyncAudioUrl` is not set
|
|
17
|
+
|
|
18
|
+
### Technical Improvements
|
|
19
|
+
- **API Alignment**: JavaScript SDK now matches Python SDK's v1 API endpoint structure
|
|
20
|
+
- **Error Handling**: Resolved 404 errors from incorrect endpoint paths
|
|
21
|
+
- **URL Construction**: Consistent endpoint path building across all async operations
|
|
22
|
+
|
|
23
|
+
## [1.0.0] - 2025-12-29
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **WebSocket Streaming Support**: Real-time emotion detection via Socket.IO with `client.streaming.connect()`
|
|
27
|
+
- **Timeline Data**: Async API now returns emotion changes over time with helper methods
|
|
28
|
+
- **Rate Limiting API**: Check usage and limits with `client.rateLimit.getStatus()` and `client.rateLimit.getHealth()`
|
|
29
|
+
- **JSON Payload Support**: Discrete API now accepts in-memory audio arrays
|
|
30
|
+
- **Configurable URLs**: New unified URL configuration with staging defaults
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- **BREAKING**: Default URLs now point to staging (`https://demo.getvalenceai.com`)
|
|
34
|
+
- **BREAKING**: Async status endpoint changed to `/v1/asynch/emotion/status/{request_id}` (bug fix)
|
|
35
|
+
- **BREAKING**: Constructor signature changed to accept configuration objects
|
|
36
|
+
- **URL Configuration**: New unified `VALENCE_API_BASE_URL` and `VALENCE_WEBSOCKET_URL` environment variables
|
|
37
|
+
- **Deprecation**: Legacy `VALENCE_DISCRETE_URL` and `VALENCE_ASYNCH_URL` environment variables deprecated
|
|
38
|
+
|
|
39
|
+
### Technical Improvements
|
|
40
|
+
- **Socket.IO Integration**: Full WebSocket support with `socket.io-client` dependency
|
|
41
|
+
- **Timeline Helpers**: `getTimeline()`, `getEmotionAtTime()`, `getDominantEmotion()` methods
|
|
42
|
+
- **Event-Based Architecture**: Callbacks for predictions, errors, and connection events
|
|
43
|
+
- **Enhanced Configuration**: Flexible URL configuration with backward compatibility
|
|
44
|
+
|
|
45
|
+
### Documentation
|
|
46
|
+
- **Updated Examples**: New examples for streaming and rate limiting
|
|
47
|
+
- **Migration Guide**: Clear upgrade path from 0.x to 1.0.0
|
|
48
|
+
- **API Documentation**: Enhanced JSDoc for all new features
|
|
49
|
+
|
|
8
50
|
## [0.5.1] - 2025-06-24
|
|
9
51
|
|
|
10
52
|
### Fixed
|
package/package.json
CHANGED
package/src/asyncAudio.js
CHANGED
|
@@ -35,7 +35,9 @@ export async function uploadAsyncAudio(filePath, partSize = 5 * 1024 * 1024, max
|
|
|
35
35
|
try {
|
|
36
36
|
const fileSize = fs.statSync(filePath).size;
|
|
37
37
|
const partCount = Math.ceil(fileSize / partSize);
|
|
38
|
-
|
|
38
|
+
// Use the new v1 API endpoint structure
|
|
39
|
+
const baseUrl = config.asyncAudioUrl || config.baseUrl;
|
|
40
|
+
const initiateUrl = `${baseUrl}/v1/asynch/emotion/upload/initiate`;
|
|
39
41
|
|
|
40
42
|
log(`File size: ${fileSize} bytes, parts: ${partCount}`, 'debug');
|
|
41
43
|
|
|
@@ -75,7 +77,8 @@ export async function uploadAsyncAudio(filePath, partSize = 5 * 1024 * 1024, max
|
|
|
75
77
|
|
|
76
78
|
log('All parts uploaded, completing multipart upload', 'info');
|
|
77
79
|
|
|
78
|
-
|
|
80
|
+
// Use the new v1 API endpoint structure
|
|
81
|
+
const completeUrl = `${baseUrl}/v1/asynch/emotion/upload/complete`;
|
|
79
82
|
await axios.post(completeUrl, {
|
|
80
83
|
request_id: data.request_id,
|
|
81
84
|
upload_id: data.upload_id,
|
|
@@ -127,16 +130,18 @@ export async function getEmotions(requestId, maxTries = 20, intervalMs = 5000) {
|
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
log(`Starting emotion prediction polling for request ${requestId}`, 'info');
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
|
|
134
|
+
// Use the new v1 API endpoint structure
|
|
135
|
+
const baseUrl = config.asyncAudioUrl || config.baseUrl;
|
|
136
|
+
const url = `${baseUrl}/v1/asynch/emotion/status/${requestId}`;
|
|
132
137
|
|
|
133
138
|
for (let i = 0; i < maxTries; i++) {
|
|
134
139
|
try {
|
|
135
140
|
log(`Polling attempt ${i + 1}/${maxTries}`, 'debug');
|
|
136
|
-
|
|
141
|
+
|
|
142
|
+
// Request ID is now in the URL path, not query params
|
|
137
143
|
const res = await axios.get(url, {
|
|
138
144
|
headers: getHeaders(),
|
|
139
|
-
params: { request_id: requestId },
|
|
140
145
|
timeout: 15000
|
|
141
146
|
});
|
|
142
147
|
|