@pipedog/openai 0.3.0 → 0.5.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 ADDED
@@ -0,0 +1,53 @@
1
+ # @pipedog/openai
2
+
3
+ OpenAI services for pipedog: the chat completions LLM (`OpenAILLMService`), the Responses API
4
+ (`OpenAIResponsesLLMService`), Realtime (`OpenAIRealtimeLLMService`), Live, speech-to-text
5
+ (`OpenAISTTService`, and `OpenAIRealtimeSTTService` with server-side turn detection),
6
+ text-to-speech (`OpenAITTSService`) and image generation (`OpenAIImageGenService`). It uses the
7
+ official `openai` JS SDK (installed as a dependency), and `baseUrl` points it at OpenAI-compatible
8
+ servers.
9
+
10
+ A port of Pipecat's `pipecat.services.openai` and the OpenAI adapters in
11
+ `pipecat.adapters.services`. Subpaths mirror upstream: `@pipedog/openai/llm`, `/stt`, `/tts`,
12
+ `/realtime/llm`, `/live/llm`, `/responses/llm`, `/image`.
13
+
14
+ ## Install
15
+
16
+ ```sh
17
+ bun add @pipedog/core @pipedog/asyncio @pipedog/openai
18
+ ```
19
+
20
+ It depends on [`@pipedog/whisper`](https://www.npmjs.com/package/@pipedog/whisper), which is
21
+ installed with it.
22
+
23
+ ## Usage
24
+
25
+ ```ts
26
+ import { OpenAILLMSettings } from "@pipedog/openai/base_llm";
27
+ import { OpenAILLMService } from "@pipedog/openai/llm";
28
+ import { OpenAISTTService } from "@pipedog/openai/stt";
29
+ import { OpenAITTSService } from "@pipedog/openai/tts";
30
+
31
+ const apiKey = process.env.OPENAI_API_KEY ?? null;
32
+
33
+ const stt = new OpenAISTTService({ apiKey });
34
+ const llm = new OpenAILLMService({
35
+ apiKey,
36
+ settings: new OpenAILLMSettings({ systemInstruction: "You are a helpful voice assistant." }),
37
+ });
38
+ const tts = new OpenAITTSService({ apiKey, sampleRate: 24000 });
39
+ // new Pipeline([transport.input(), stt, userAggregator, llm, tts, transport.output(), ...])
40
+ ```
41
+
42
+ ## Runtimes
43
+
44
+ Bun, Node.js 22+, Deno and Cloudflare Workers.
45
+
46
+ ## Links
47
+
48
+ - Docs: [voice bot guide](https://polvallverdu.github.io/pipedog/docs/voice-bot/),
49
+ [turn detection](https://polvallverdu.github.io/pipedog/docs/turn-detection/) (realtime STT turns),
50
+ [Workers](https://polvallverdu.github.io/pipedog/docs/workers/)
51
+ - [pipedog README](https://github.com/polvallverdu/pipedog#readme)
52
+ - License: BSD 2-Clause, a port of Pipecat (Copyright (c) 2024–2026 Daily). See
53
+ [LICENSE](https://github.com/polvallverdu/pipedog/blob/main/LICENSE).
@@ -3,9 +3,10 @@
3
3
  *
4
4
  * Porting notes:
5
5
  * - The WebSocket is opened with `websocketConnect` from core, which sends
6
- * the `Authorization` header on Bun, Node and Deno. Runtimes whose
7
- * `WebSocket` can't send headers (Cloudflare Workers) pass a
8
- * `webSocketFactory` (an addition to the upstream options).
6
+ * the `Authorization` header on Bun, Node, Deno and Cloudflare Workers
7
+ * (through `fetch` with an `Upgrade: websocket` header). Other runtimes
8
+ * whose `WebSocket` can't send headers pass a `webSocketFactory` (an
9
+ * addition to the upstream options).
9
10
  * - `parse_server_event` raises only `ValueError`, which the receive loop
10
11
  * skips; here any (non-cancellation) error from `parseServerEvent` is
11
12
  * treated as that.
@@ -204,7 +205,8 @@ export interface OpenAILiveLLMServiceOptions extends LLMServiceOptions {
204
205
  delegation?: ResponsesDelegation | ClientDelegation | null;
205
206
  /**
206
207
  * Creates the underlying `WebSocket` (see `WebsocketConnectOptions`), for
207
- * runtimes whose `WebSocket` can't send the `Authorization` header.
208
+ * runtimes other than Bun, Node, Deno and Cloudflare Workers, whose
209
+ * `WebSocket` can't send the `Authorization` header.
208
210
  */
209
211
  webSocketFactory?: WebsocketConnectOptions["webSocketFactory"];
210
212
  }
package/dist/live/llm.js CHANGED
@@ -8,9 +8,10 @@
8
8
  *
9
9
  * Porting notes:
10
10
  * - The WebSocket is opened with `websocketConnect` from core, which sends
11
- * the `Authorization` header on Bun, Node and Deno. Runtimes whose
12
- * `WebSocket` can't send headers (Cloudflare Workers) pass a
13
- * `webSocketFactory` (an addition to the upstream options).
11
+ * the `Authorization` header on Bun, Node, Deno and Cloudflare Workers
12
+ * (through `fetch` with an `Upgrade: websocket` header). Other runtimes
13
+ * whose `WebSocket` can't send headers pass a `webSocketFactory` (an
14
+ * addition to the upstream options).
14
15
  * - `parse_server_event` raises only `ValueError`, which the receive loop
15
16
  * skips; here any (non-cancellation) error from `parseServerEvent` is
16
17
  * treated as that.
package/dist/stt.d.ts CHANGED
@@ -13,9 +13,9 @@
13
13
  * `BaseWhisperSTTService` (`@pipedog/whisper`).
14
14
  * - `OpenAIRealtimeSTTService` uses the global `WebSocket` through
15
15
  * `WebsocketService._websocketConnect()`. The `Authorization` header is sent
16
- * on the opening handshake, which the Bun, Node and Deno `WebSocket`
17
- * support; on Cloudflare Workers override `_connectWebsocket()` or the
18
- * connect options to open the socket through `fetch`.
16
+ * on the opening handshake on Bun, Node, Deno and Cloudflare Workers (where
17
+ * core opens the socket through `fetch` with an `Upgrade: websocket`
18
+ * header); browsers can't send it.
19
19
  * - Deprecated APIs are not ported: the `model`, `language`, `prompt`,
20
20
  * `temperature` (`OpenAISTTService`) and `model`, `language`, `prompt`,
21
21
  * `noiseReduction` (`OpenAIRealtimeSTTService`) constructor options.
package/dist/stt.js CHANGED
@@ -18,9 +18,9 @@
18
18
  * `BaseWhisperSTTService` (`@pipedog/whisper`).
19
19
  * - `OpenAIRealtimeSTTService` uses the global `WebSocket` through
20
20
  * `WebsocketService._websocketConnect()`. The `Authorization` header is sent
21
- * on the opening handshake, which the Bun, Node and Deno `WebSocket`
22
- * support; on Cloudflare Workers override `_connectWebsocket()` or the
23
- * connect options to open the socket through `fetch`.
21
+ * on the opening handshake on Bun, Node, Deno and Cloudflare Workers (where
22
+ * core opens the socket through `fetch` with an `Upgrade: websocket`
23
+ * header); browsers can't send it.
24
24
  * - Deprecated APIs are not ported: the `model`, `language`, `prompt`,
25
25
  * `temperature` (`OpenAISTTService`) and `model`, `language`, `prompt`,
26
26
  * `noiseReduction` (`OpenAIRealtimeSTTService`) constructor options.
package/package.json CHANGED
@@ -1,7 +1,19 @@
1
1
  {
2
2
  "name": "@pipedog/openai",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "OpenAI services (LLM, Responses, Realtime, Live, STT, TTS, image) for pipedog.",
5
+ "keywords": [
6
+ "pipecat",
7
+ "pipedog",
8
+ "voice-ai",
9
+ "conversational-ai",
10
+ "realtime",
11
+ "openai",
12
+ "llm",
13
+ "stt",
14
+ "tts",
15
+ "realtime-api"
16
+ ],
5
17
  "license": "BSD-2-Clause",
6
18
  "repository": {
7
19
  "type": "git",
@@ -33,9 +45,9 @@
33
45
  "test": "bun test"
34
46
  },
35
47
  "dependencies": {
36
- "@pipedog/asyncio": "0.3.0",
37
- "@pipedog/core": "0.3.0",
38
- "@pipedog/whisper": "0.3.0",
48
+ "@pipedog/asyncio": "0.5.0",
49
+ "@pipedog/core": "0.5.0",
50
+ "@pipedog/whisper": "0.5.0",
39
51
  "fast-png": "^8.0.0",
40
52
  "openai": "^6.49.0"
41
53
  },