@lobehub/chat 0.146.0 → 0.146.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
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.146.1](https://github.com/lobehub/lobe-chat/compare/v0.146.0...v0.146.1)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-04-10**</sup>
|
|
8
|
+
|
|
9
|
+
<br/>
|
|
10
|
+
|
|
11
|
+
<details>
|
|
12
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
13
|
+
|
|
14
|
+
</details>
|
|
15
|
+
|
|
16
|
+
<div align="right">
|
|
17
|
+
|
|
18
|
+
[](#readme-top)
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
5
22
|
## [Version 0.146.0](https://github.com/lobehub/lobe-chat/compare/v0.145.13...v0.146.0)
|
|
6
23
|
|
|
7
24
|
<sup>Released on **2024-04-08**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.146.
|
|
3
|
+
"version": "0.146.1",
|
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -24,26 +24,27 @@ afterEach(() => {
|
|
|
24
24
|
|
|
25
25
|
describe('LobeAnthropicAI', () => {
|
|
26
26
|
describe('init', () => {
|
|
27
|
-
|
|
28
27
|
it('should correctly initialize with an API key', async () => {
|
|
29
28
|
const instance = new LobeAnthropicAI({ apiKey: 'test_api_key' });
|
|
30
29
|
expect(instance).toBeInstanceOf(LobeAnthropicAI);
|
|
31
30
|
expect(instance.baseURL).toBe('https://api.anthropic.com');
|
|
32
31
|
});
|
|
33
|
-
|
|
32
|
+
|
|
34
33
|
it('should correctly initialize with a baseURL', async () => {
|
|
35
|
-
const instance = new LobeAnthropicAI({
|
|
34
|
+
const instance = new LobeAnthropicAI({
|
|
35
|
+
apiKey: 'test_api_key',
|
|
36
|
+
baseURL: 'https://api.anthropic.proxy',
|
|
37
|
+
});
|
|
36
38
|
expect(instance).toBeInstanceOf(LobeAnthropicAI);
|
|
37
39
|
expect(instance.baseURL).toBe('https://api.anthropic.proxy');
|
|
38
40
|
});
|
|
39
|
-
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
describe('chat', () => {
|
|
43
44
|
it('should return a StreamingTextResponse on successful API call', async () => {
|
|
44
45
|
const result = await instance.chat({
|
|
45
46
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
46
|
-
model: 'claude-
|
|
47
|
+
model: 'claude-3-haiku-20240307',
|
|
47
48
|
temperature: 0,
|
|
48
49
|
});
|
|
49
50
|
|
|
@@ -65,7 +66,7 @@ describe('LobeAnthropicAI', () => {
|
|
|
65
66
|
// Act
|
|
66
67
|
const result = await instance.chat({
|
|
67
68
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
68
|
-
model: 'claude-
|
|
69
|
+
model: 'claude-3-haiku-20240307',
|
|
69
70
|
temperature: 0,
|
|
70
71
|
top_p: 1,
|
|
71
72
|
});
|
|
@@ -74,7 +75,7 @@ describe('LobeAnthropicAI', () => {
|
|
|
74
75
|
expect(instance['client'].messages.create).toHaveBeenCalledWith({
|
|
75
76
|
max_tokens: 4096,
|
|
76
77
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
77
|
-
model: 'claude-
|
|
78
|
+
model: 'claude-3-haiku-20240307',
|
|
78
79
|
stream: true,
|
|
79
80
|
temperature: 0,
|
|
80
81
|
top_p: 1,
|
|
@@ -99,7 +100,7 @@ describe('LobeAnthropicAI', () => {
|
|
|
99
100
|
{ content: 'You are an awesome greeter', role: 'system' },
|
|
100
101
|
{ content: 'Hello', role: 'user' },
|
|
101
102
|
],
|
|
102
|
-
model: 'claude-
|
|
103
|
+
model: 'claude-3-haiku-20240307',
|
|
103
104
|
temperature: 0,
|
|
104
105
|
});
|
|
105
106
|
|
|
@@ -107,7 +108,7 @@ describe('LobeAnthropicAI', () => {
|
|
|
107
108
|
expect(instance['client'].messages.create).toHaveBeenCalledWith({
|
|
108
109
|
max_tokens: 4096,
|
|
109
110
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
110
|
-
model: 'claude-
|
|
111
|
+
model: 'claude-3-haiku-20240307',
|
|
111
112
|
stream: true,
|
|
112
113
|
system: 'You are an awesome greeter',
|
|
113
114
|
temperature: 0,
|
|
@@ -130,7 +131,7 @@ describe('LobeAnthropicAI', () => {
|
|
|
130
131
|
const result = await instance.chat({
|
|
131
132
|
max_tokens: 2048,
|
|
132
133
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
133
|
-
model: 'claude-
|
|
134
|
+
model: 'claude-3-haiku-20240307',
|
|
134
135
|
temperature: 0.5,
|
|
135
136
|
top_p: 1,
|
|
136
137
|
});
|
|
@@ -139,7 +140,7 @@ describe('LobeAnthropicAI', () => {
|
|
|
139
140
|
expect(instance['client'].messages.create).toHaveBeenCalledWith({
|
|
140
141
|
max_tokens: 2048,
|
|
141
142
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
142
|
-
model: 'claude-
|
|
143
|
+
model: 'claude-3-haiku-20240307',
|
|
143
144
|
stream: true,
|
|
144
145
|
temperature: 0.5,
|
|
145
146
|
top_p: 1,
|
|
@@ -163,7 +164,7 @@ describe('LobeAnthropicAI', () => {
|
|
|
163
164
|
frequency_penalty: 0.5, // Unsupported option
|
|
164
165
|
max_tokens: 2048,
|
|
165
166
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
166
|
-
model: 'claude-
|
|
167
|
+
model: 'claude-3-haiku-20240307',
|
|
167
168
|
presence_penalty: 0.5,
|
|
168
169
|
temperature: 0.5,
|
|
169
170
|
top_p: 1,
|
|
@@ -173,7 +174,7 @@ describe('LobeAnthropicAI', () => {
|
|
|
173
174
|
expect(instance['client'].messages.create).toHaveBeenCalledWith({
|
|
174
175
|
max_tokens: 2048,
|
|
175
176
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
176
|
-
model: 'claude-
|
|
177
|
+
model: 'claude-3-haiku-20240307',
|
|
177
178
|
stream: true,
|
|
178
179
|
temperature: 0.5,
|
|
179
180
|
top_p: 1,
|
|
@@ -209,7 +210,7 @@ describe('LobeAnthropicAI', () => {
|
|
|
209
210
|
// Act
|
|
210
211
|
await instance.chat({
|
|
211
212
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
212
|
-
model: 'claude-
|
|
213
|
+
model: 'claude-3-haiku-20240307',
|
|
213
214
|
temperature: 0,
|
|
214
215
|
});
|
|
215
216
|
|
|
@@ -239,16 +240,16 @@ describe('LobeAnthropicAI', () => {
|
|
|
239
240
|
// Act
|
|
240
241
|
await instance.chat({
|
|
241
242
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
242
|
-
model: 'claude-
|
|
243
|
+
model: 'claude-3-haiku-20240307',
|
|
243
244
|
temperature: 0,
|
|
244
245
|
});
|
|
245
246
|
} catch (e) {
|
|
246
247
|
// Assert
|
|
247
248
|
expect(e).toEqual({
|
|
248
|
-
endpoint:
|
|
249
|
+
endpoint: 'https://api.anthropic.com',
|
|
249
250
|
error: apiError,
|
|
250
251
|
errorType: 'InvalidAnthropicAPIKey',
|
|
251
|
-
provider
|
|
252
|
+
provider,
|
|
252
253
|
});
|
|
253
254
|
}
|
|
254
255
|
});
|
|
@@ -270,16 +271,16 @@ describe('LobeAnthropicAI', () => {
|
|
|
270
271
|
// Act
|
|
271
272
|
await instance.chat({
|
|
272
273
|
messages: [{ content: 'Hello', role: 'user' }],
|
|
273
|
-
model: 'claude-
|
|
274
|
+
model: 'claude-3-haiku-20240307',
|
|
274
275
|
temperature: 0,
|
|
275
276
|
});
|
|
276
277
|
} catch (e) {
|
|
277
278
|
// Assert
|
|
278
279
|
expect(e).toEqual({
|
|
279
|
-
endpoint:
|
|
280
|
+
endpoint: 'https://api.anthropic.com',
|
|
280
281
|
error: apiError,
|
|
281
282
|
errorType: 'AnthropicBizError',
|
|
282
|
-
provider
|
|
283
|
+
provider,
|
|
283
284
|
});
|
|
284
285
|
}
|
|
285
286
|
});
|