pi-anthropic-oauth 0.1.10 → 0.1.11
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/package.json +1 -1
- package/src/stream.ts +11 -0
package/package.json
CHANGED
package/src/stream.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type Model,
|
|
11
11
|
type SimpleStreamOptions,
|
|
12
12
|
type StopReason,
|
|
13
|
+
streamSimpleAnthropic,
|
|
13
14
|
} from "@mariozechner/pi-ai";
|
|
14
15
|
import { isClaudeOAuthAccessToken, USER_AGENT } from "./auth.js";
|
|
15
16
|
import {
|
|
@@ -83,6 +84,16 @@ export function streamAnthropicOAuth(
|
|
|
83
84
|
context: Context,
|
|
84
85
|
options?: SimpleStreamOptions,
|
|
85
86
|
): AssistantMessageEventStream {
|
|
87
|
+
// pi-ai keys streamSimple by `api`, so this runs for every anthropic-messages
|
|
88
|
+
// model (copilot, openrouter, …). Delegate non-anthropic providers.
|
|
89
|
+
if (model.provider !== "anthropic") {
|
|
90
|
+
return streamSimpleAnthropic(
|
|
91
|
+
model as Model<"anthropic-messages">,
|
|
92
|
+
context,
|
|
93
|
+
options,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
86
97
|
const stream = createAssistantMessageEventStream();
|
|
87
98
|
|
|
88
99
|
void (async () => {
|