@simfinity/constellation-client 1.0.14 → 1.0.16
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 +1 -6
- package/dist/index.cjs +0 -35
- package/dist/index.d.cts +1 -11
- package/dist/index.d.ts +1 -11
- package/dist/index.js +0 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,15 +32,13 @@ const client = new WebClient({
|
|
|
32
32
|
streamingEndpoint: "wss://simfinity.constellation.com:30003",
|
|
33
33
|
key: "my-key",
|
|
34
34
|
llm: "openai",
|
|
35
|
-
model: "gpt-4o-realtime-preview-2024-12-17",
|
|
36
|
-
voiceEnabled: true,
|
|
37
35
|
});
|
|
38
36
|
|
|
39
37
|
try {
|
|
40
38
|
/* ... */
|
|
41
39
|
|
|
42
40
|
// Start a chat session
|
|
43
|
-
await client.startSession(
|
|
41
|
+
await client.startSession(true);
|
|
44
42
|
await client.connect(true, {
|
|
45
43
|
onStreamClosed: (reason: string) => {
|
|
46
44
|
console.log("Stream connection lost");
|
|
@@ -84,9 +82,6 @@ export interface WebClientConfig {
|
|
|
84
82
|
key: string;
|
|
85
83
|
llm: LlmType;
|
|
86
84
|
model: string;
|
|
87
|
-
voiceEnabled?: boolean;
|
|
88
|
-
voiceName?: string;
|
|
89
|
-
tools?: string[];
|
|
90
85
|
}
|
|
91
86
|
```
|
|
92
87
|
|
package/dist/index.cjs
CHANGED
|
@@ -31,41 +31,6 @@ var WebClient = class {
|
|
|
31
31
|
this.sessionId = null;
|
|
32
32
|
this.config = config;
|
|
33
33
|
}
|
|
34
|
-
/* /!**
|
|
35
|
-
* Retrieve the list of available tools:
|
|
36
|
-
* Tools, or functions, can be exposed to & added to the model's context, allowing it
|
|
37
|
-
* to use them during the session as part of its response creation process. In order to add
|
|
38
|
-
* a tool to the session context, it must be listed (by name) at session creation time
|
|
39
|
-
* (see startSession(...) function)
|
|
40
|
-
*
|
|
41
|
-
* @remarks
|
|
42
|
-
* Tools are remote functions exposed by MCP servers and integrated by the constellation server
|
|
43
|
-
*
|
|
44
|
-
* @exception
|
|
45
|
-
* This method throws new Error(...) if unable to execute successfully for any reason.
|
|
46
|
-
*!/
|
|
47
|
-
public async fetchSupportedTools(): Promise<ToolDescription[]> {
|
|
48
|
-
const response = await fetch(`${this.config.sessionEndpoint}/supported_tools`, {
|
|
49
|
-
method: 'GET',
|
|
50
|
-
headers: {
|
|
51
|
-
'Authorization': `Bearer ${this.config.key}`,
|
|
52
|
-
'Content-Type': 'application/json',
|
|
53
|
-
'Accept': 'application/json'
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
if (!response.ok) {
|
|
58
|
-
throw new Error(`Could not fetch the list of available tools\n[${response.status}:${response.statusText}]`)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
const result: ToolDescription[] = await response.json();
|
|
63
|
-
return result ?? [];
|
|
64
|
-
}
|
|
65
|
-
catch(error) {
|
|
66
|
-
throw `Failed to read session create response: ${error}`;
|
|
67
|
-
}
|
|
68
|
-
}*/
|
|
69
34
|
/**
|
|
70
35
|
* Start a persistent chat room on the server, allowing for re-connection,
|
|
71
36
|
* when the streaming connection is lost. Once a session was started it must
|
package/dist/index.d.cts
CHANGED
|
@@ -70,16 +70,6 @@ interface EventHandlers {
|
|
|
70
70
|
onTranscriptResponse?: (transcript: string) => void;
|
|
71
71
|
onTechnicalError?: (error: string) => void;
|
|
72
72
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Description of an available tool that can be added to a session context.
|
|
75
|
-
* Tools included in the session context can be used by the AI model during the session.
|
|
76
|
-
* Tools (or functions) can be many things, for example a calendar manager, allowing
|
|
77
|
-
* the model to manage the user's schedule.
|
|
78
|
-
*/
|
|
79
|
-
interface ToolDescription {
|
|
80
|
-
name: string;
|
|
81
|
-
description: string;
|
|
82
|
-
}
|
|
83
73
|
/**
|
|
84
74
|
* This class is a code wrapper to integrate the Simfinity constellation server.
|
|
85
75
|
* The constellation server is a proxy managing streaming sessions with third party LLMs.
|
|
@@ -216,4 +206,4 @@ declare class WebClient {
|
|
|
216
206
|
private send;
|
|
217
207
|
}
|
|
218
208
|
|
|
219
|
-
export { type EventHandlers, type LlmType, type SessionConfig,
|
|
209
|
+
export { type EventHandlers, type LlmType, type SessionConfig, WebClient, type WebClientConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -70,16 +70,6 @@ interface EventHandlers {
|
|
|
70
70
|
onTranscriptResponse?: (transcript: string) => void;
|
|
71
71
|
onTechnicalError?: (error: string) => void;
|
|
72
72
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Description of an available tool that can be added to a session context.
|
|
75
|
-
* Tools included in the session context can be used by the AI model during the session.
|
|
76
|
-
* Tools (or functions) can be many things, for example a calendar manager, allowing
|
|
77
|
-
* the model to manage the user's schedule.
|
|
78
|
-
*/
|
|
79
|
-
interface ToolDescription {
|
|
80
|
-
name: string;
|
|
81
|
-
description: string;
|
|
82
|
-
}
|
|
83
73
|
/**
|
|
84
74
|
* This class is a code wrapper to integrate the Simfinity constellation server.
|
|
85
75
|
* The constellation server is a proxy managing streaming sessions with third party LLMs.
|
|
@@ -216,4 +206,4 @@ declare class WebClient {
|
|
|
216
206
|
private send;
|
|
217
207
|
}
|
|
218
208
|
|
|
219
|
-
export { type EventHandlers, type LlmType, type SessionConfig,
|
|
209
|
+
export { type EventHandlers, type LlmType, type SessionConfig, WebClient, type WebClientConfig };
|
package/dist/index.js
CHANGED
|
@@ -5,41 +5,6 @@ var WebClient = class {
|
|
|
5
5
|
this.sessionId = null;
|
|
6
6
|
this.config = config;
|
|
7
7
|
}
|
|
8
|
-
/* /!**
|
|
9
|
-
* Retrieve the list of available tools:
|
|
10
|
-
* Tools, or functions, can be exposed to & added to the model's context, allowing it
|
|
11
|
-
* to use them during the session as part of its response creation process. In order to add
|
|
12
|
-
* a tool to the session context, it must be listed (by name) at session creation time
|
|
13
|
-
* (see startSession(...) function)
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* Tools are remote functions exposed by MCP servers and integrated by the constellation server
|
|
17
|
-
*
|
|
18
|
-
* @exception
|
|
19
|
-
* This method throws new Error(...) if unable to execute successfully for any reason.
|
|
20
|
-
*!/
|
|
21
|
-
public async fetchSupportedTools(): Promise<ToolDescription[]> {
|
|
22
|
-
const response = await fetch(`${this.config.sessionEndpoint}/supported_tools`, {
|
|
23
|
-
method: 'GET',
|
|
24
|
-
headers: {
|
|
25
|
-
'Authorization': `Bearer ${this.config.key}`,
|
|
26
|
-
'Content-Type': 'application/json',
|
|
27
|
-
'Accept': 'application/json'
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
throw new Error(`Could not fetch the list of available tools\n[${response.status}:${response.statusText}]`)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
const result: ToolDescription[] = await response.json();
|
|
37
|
-
return result ?? [];
|
|
38
|
-
}
|
|
39
|
-
catch(error) {
|
|
40
|
-
throw `Failed to read session create response: ${error}`;
|
|
41
|
-
}
|
|
42
|
-
}*/
|
|
43
8
|
/**
|
|
44
9
|
* Start a persistent chat room on the server, allowing for re-connection,
|
|
45
10
|
* when the streaming connection is lost. Once a session was started it must
|