@aigne/open-router 0.3.11 → 0.4.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 +29 -0
- package/README.md +6 -4
- package/README.zh.md +6 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.1](https://github.com/AIGNE-io/aigne-framework/compare/open-router-v0.4.0...open-router-v0.4.1) (2025-07-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* The following workspace dependencies were updated
|
|
9
|
+
* dependencies
|
|
10
|
+
* @aigne/openai bumped to 0.6.1
|
|
11
|
+
* devDependencies
|
|
12
|
+
* @aigne/core bumped to 1.28.1
|
|
13
|
+
* @aigne/test-utils bumped to 0.4.13
|
|
14
|
+
|
|
15
|
+
## [0.4.0](https://github.com/AIGNE-io/aigne-framework/compare/open-router-v0.3.11...open-router-v0.4.0) (2025-07-01)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **example:** use AIGNE cli to run chat-bot example ([#198](https://github.com/AIGNE-io/aigne-framework/issues/198)) ([7085541](https://github.com/AIGNE-io/aigne-framework/commit/708554100692f2a557f7329ea78e46c3c870ce10))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Dependencies
|
|
24
|
+
|
|
25
|
+
* The following workspace dependencies were updated
|
|
26
|
+
* dependencies
|
|
27
|
+
* @aigne/openai bumped to 0.6.0
|
|
28
|
+
* devDependencies
|
|
29
|
+
* @aigne/core bumped to 1.28.0
|
|
30
|
+
* @aigne/test-utils bumped to 0.4.12
|
|
31
|
+
|
|
3
32
|
## [0.3.11](https://github.com/AIGNE-io/aigne-framework/compare/open-router-v0.3.10...open-router-v0.3.11) (2025-07-01)
|
|
4
33
|
|
|
5
34
|
|
package/README.md
CHANGED
|
@@ -100,6 +100,7 @@ const fallbackResult = await modelWithFallbacks.invoke({
|
|
|
100
100
|
## Streaming Responses
|
|
101
101
|
|
|
102
102
|
```typescript file="test/open-router-chat-model.test.ts" region="example-openrouter-chat-model-streaming"
|
|
103
|
+
import { isAgentResponseDelta } from "@aigne/core";
|
|
103
104
|
import { OpenRouterChatModel } from "@aigne/open-router";
|
|
104
105
|
|
|
105
106
|
const model = new OpenRouterChatModel({
|
|
@@ -111,7 +112,6 @@ const stream = await model.invoke(
|
|
|
111
112
|
{
|
|
112
113
|
messages: [{ role: "user", content: "Which model are you using?" }],
|
|
113
114
|
},
|
|
114
|
-
undefined,
|
|
115
115
|
{ streaming: true },
|
|
116
116
|
);
|
|
117
117
|
|
|
@@ -119,9 +119,11 @@ let fullText = "";
|
|
|
119
119
|
const json = {};
|
|
120
120
|
|
|
121
121
|
for await (const chunk of stream) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
if (isAgentResponseDelta(chunk)) {
|
|
123
|
+
const text = chunk.delta.text?.text;
|
|
124
|
+
if (text) fullText += text;
|
|
125
|
+
if (chunk.delta.json) Object.assign(json, chunk.delta.json);
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
console.log(fullText); // Output: "I'm powered by OpenRouter, using the Claude 3 Opus model from Anthropic."
|
package/README.zh.md
CHANGED
|
@@ -100,6 +100,7 @@ const fallbackResult = await modelWithFallbacks.invoke({
|
|
|
100
100
|
## 流式响应
|
|
101
101
|
|
|
102
102
|
```typescript file="test/open-router-chat-model.test.ts" region="example-openrouter-chat-model-streaming"
|
|
103
|
+
import { isAgentResponseDelta } from "@aigne/core";
|
|
103
104
|
import { OpenRouterChatModel } from "@aigne/open-router";
|
|
104
105
|
|
|
105
106
|
const model = new OpenRouterChatModel({
|
|
@@ -111,7 +112,6 @@ const stream = await model.invoke(
|
|
|
111
112
|
{
|
|
112
113
|
messages: [{ role: "user", content: "Which model are you using?" }],
|
|
113
114
|
},
|
|
114
|
-
undefined,
|
|
115
115
|
{ streaming: true },
|
|
116
116
|
);
|
|
117
117
|
|
|
@@ -119,9 +119,11 @@ let fullText = "";
|
|
|
119
119
|
const json = {};
|
|
120
120
|
|
|
121
121
|
for await (const chunk of stream) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
if (isAgentResponseDelta(chunk)) {
|
|
123
|
+
const text = chunk.delta.text?.text;
|
|
124
|
+
if (text) fullText += text;
|
|
125
|
+
if (chunk.delta.json) Object.assign(json, chunk.delta.json);
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
console.log(fullText); // Output: "I'm powered by OpenRouter, using the Claude 3 Opus model from Anthropic."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/open-router",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "AIGNE OpenRouter SDK for accessing multiple AI models through a unified API",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aigne/openai": "^0.
|
|
35
|
+
"@aigne/openai": "^0.6.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/bun": "^1.2.12",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"npm-run-all": "^4.1.5",
|
|
41
41
|
"rimraf": "^6.0.1",
|
|
42
42
|
"typescript": "^5.8.3",
|
|
43
|
-
"@aigne/
|
|
44
|
-
"@aigne/
|
|
43
|
+
"@aigne/core": "^1.28.1",
|
|
44
|
+
"@aigne/test-utils": "^0.4.13"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"lint": "tsc --noEmit",
|