@astack-tech/integrations 0.1.1-beta.6 → 0.2.0-beta.10
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 +63 -0
- package/README.md +98 -1
- package/dist/index.cjs +230 -245
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +230 -245
- package/dist/index.js.map +1 -1
- package/dist/model-provider/index.cjs +232 -246
- package/dist/model-provider/index.cjs.map +1 -1
- package/dist/model-provider/index.d.cts +225 -146
- package/dist/model-provider/index.d.ts +225 -146
- package/dist/model-provider/index.js +230 -245
- package/dist/model-provider/index.js.map +1 -1
- package/package.json +47 -26
- package/src/index.ts +5 -3
- package/src/model-provider/deepseek/index.ts +35 -596
- package/src/model-provider/index.ts +23 -2
- package/src/model-provider/openai-compatible/index.ts +531 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @astack-tech/integrations
|
|
2
|
+
|
|
3
|
+
## 0.2.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4514aa8: `OpenAICompatible` and `Deepseek` check messages before sending a request. A message with a role other than `system`, `user`, `assistant` or `tool`, or a `tool` message without `tool_call_id`, now fails with a clear error instead of an API error. Omitted content is sent as empty text, except on `assistant` messages. Tools given in the OpenAI format are validated field by field.
|
|
8
|
+
|
|
9
|
+
## 0.2.0-beta.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [1eb93f0]
|
|
14
|
+
- @astack-tech/core@0.2.0-beta.4
|
|
15
|
+
|
|
16
|
+
## 0.2.0-beta.8
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 9aab43a: Add `ModelProvider.OpenAICompatible`, a provider for any API that speaks the OpenAI chat completions protocol: OpenAI and the compatible endpoints of DeepSeek, Qwen, Moonshot, Ollama, vLLM and others. Pass `model`, and `baseURL` for providers other than OpenAI; `name` labels errors and logs. `Deepseek` is now this provider with DeepSeek's defaults; its options, methods, ports and exported types are unchanged. The neutral message, tool and usage types are exported next to the `Deepseek*` names.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [1aba97f]
|
|
25
|
+
- @astack-tech/core@0.2.0-beta.3
|
|
26
|
+
|
|
27
|
+
## 0.2.0-beta.7
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- e71dd3b: Deepseek satisfies the `ModelProvider` interface of `@astack-tech/components` without a cast. Unset request options are omitted, an empty `choices` array fails with a clear error, non-object tool arguments become `{}`, and the pipeline fallback text is `API call failed`. API errors are logged only when `verbose` is set. Node.js 20 or later is required.
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [e71dd3b]
|
|
36
|
+
- @astack-tech/core@0.2.0-beta.2
|
|
37
|
+
|
|
38
|
+
## 0.1.1-beta.6
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
- @astack-tech/core@0.2.0-beta.1
|
|
44
|
+
|
|
45
|
+
## 0.1.1-beta.2
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- rebuild package
|
|
50
|
+
|
|
51
|
+
## 0.1.1-beta.1
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- fix agent tool finder
|
|
56
|
+
|
|
57
|
+
## 0.1.1-beta.0
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- beta release
|
|
62
|
+
- Updated dependencies
|
|
63
|
+
- @astack-tech/core@0.1.1-beta.0
|
package/README.md
CHANGED
|
@@ -1 +1,98 @@
|
|
|
1
|
-
|
|
1
|
+
# @astack-tech/integrations
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/astack-tech/astack/master/assets/brand/readme-banner.png" alt="AStack" width="100%">
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@astack-tech/integrations) [](https://github.com/astack-tech/astack/blob/master/LICENSE) [](https://nodejs.org)
|
|
6
|
+
|
|
7
|
+
Model providers for AStack. Each provider is a component: call it directly, use it in a pipeline, or pass it to an agent.
|
|
8
|
+
|
|
9
|
+
[Website](https://astack.tech) · [Docs](https://astack.tech/docs) · [Examples](https://astack.tech/examples) · [GitHub](https://github.com/astack-tech/astack)
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @astack-tech/integrations @astack-tech/core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { ModelProvider } from '@astack-tech/integrations';
|
|
21
|
+
|
|
22
|
+
const model = new ModelProvider.Deepseek({ apiKey: process.env['DEEPSEEK_API_KEY'] ?? '' });
|
|
23
|
+
|
|
24
|
+
const text = await model.run('What is flow-based programming?');
|
|
25
|
+
const reply = await model.chatCompletion([{ role: 'user', content: 'Hello' }]);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`Deepseek` and `OpenAICompatible` are also available from the subpath: `import { Deepseek, OpenAICompatible } from '@astack-tech/integrations/model-provider'`.
|
|
29
|
+
|
|
30
|
+
## Deepseek
|
|
31
|
+
|
|
32
|
+
Uses the OpenAI-compatible DeepSeek API through the official `openai` client.
|
|
33
|
+
|
|
34
|
+
| Option | Default | Description |
|
|
35
|
+
| -------------------- | ----------------------------- | -------------------------------------------------------------------- |
|
|
36
|
+
| `apiKey` | — | DeepSeek API key |
|
|
37
|
+
| `model` | `deepseek-chat` | Model name |
|
|
38
|
+
| `baseURL` | `https://api.deepseek.com/v1` | API base URL |
|
|
39
|
+
| `temperature` | `0.7` | Sampling temperature |
|
|
40
|
+
| `maxTokens`, `topP` | not sent | Optional sampling limits |
|
|
41
|
+
| `systemPrompt` | none | Added before every request |
|
|
42
|
+
| `rawTools` / `tools` | none | Tools as `{ name, description, parameters }` or in the OpenAI format |
|
|
43
|
+
| `verbose` | `false` | Log API errors to the console |
|
|
44
|
+
|
|
45
|
+
| Method | Returns |
|
|
46
|
+
| --------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
47
|
+
| `run(prompt)` | Text |
|
|
48
|
+
| `run(messages)`, `chatCompletion(messages, { temporaryTools })` | Assistant message with `content`, `tool_calls` and `usage` |
|
|
49
|
+
| `streamChatCompletion(messages, options)` | Async generator of text, tool-call and usage chunks |
|
|
50
|
+
| `generateCompletion(prompt)` | Text, or the JSON assistant message when the model calls tools |
|
|
51
|
+
|
|
52
|
+
Messages are checked before the request: the role must be `system`, `user`, `assistant` or `tool`, and a `tool` message needs `tool_call_id`. Otherwise the call fails without reaching the API.
|
|
53
|
+
|
|
54
|
+
| Pipeline input port | Output port |
|
|
55
|
+
| ------------------- | ------------ |
|
|
56
|
+
| `prompt` | `completion` |
|
|
57
|
+
| `messages` | `message` |
|
|
58
|
+
|
|
59
|
+
`Deepseek` satisfies the `ModelProvider` interface of `@astack-tech/components`, so it can drive `Agent` and `StreamingAgent` directly.
|
|
60
|
+
|
|
61
|
+
## OpenAICompatible
|
|
62
|
+
|
|
63
|
+
Calls any API that speaks the OpenAI chat completions protocol: OpenAI and the compatible endpoints of DeepSeek, Qwen, Moonshot, Ollama, vLLM and others. `Deepseek` is this provider with DeepSeek's defaults, so methods, ports and the other options are the same.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { ModelProvider } from '@astack-tech/integrations';
|
|
67
|
+
|
|
68
|
+
const model = new ModelProvider.OpenAICompatible({
|
|
69
|
+
apiKey: process.env['OPENAI_API_KEY'] ?? '',
|
|
70
|
+
model: 'gpt-4o-mini',
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
| Option | Default | Description |
|
|
75
|
+
| --------- | --------------------------- | -------------------------------- |
|
|
76
|
+
| `apiKey` | — | API key of the provider |
|
|
77
|
+
| `model` | — | Model name (required) |
|
|
78
|
+
| `baseURL` | `https://api.openai.com/v1` | API base URL |
|
|
79
|
+
| `name` | `The model API` | Provider name in errors and logs |
|
|
80
|
+
|
|
81
|
+
## Learn more
|
|
82
|
+
|
|
83
|
+
- [API reference](https://astack.tech/docs/api/integrations): every export, generated from the source
|
|
84
|
+
- [Model providers](https://astack.tech/docs/model-providers), including how to write your own
|
|
85
|
+
- Example: [chat](https://astack.tech/examples/chat)
|
|
86
|
+
|
|
87
|
+
## The AStack packages
|
|
88
|
+
|
|
89
|
+
| Package | Purpose |
|
|
90
|
+
| -------------------------------------------------------------------------------------- | ------------------------------------------ |
|
|
91
|
+
| [`@astack-tech/core`](https://www.npmjs.com/package/@astack-tech/core) | `Component`, `Pipeline` and ports |
|
|
92
|
+
| [`@astack-tech/components`](https://www.npmjs.com/package/@astack-tech/components) | Agents, text splitting and tool invocation |
|
|
93
|
+
| [`@astack-tech/tools`](https://www.npmjs.com/package/@astack-tech/tools) | Tool definitions for agents |
|
|
94
|
+
| [`@astack-tech/integrations`](https://www.npmjs.com/package/@astack-tech/integrations) | Model providers |
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
[MIT](./LICENSE). AStack is in public beta: APIs can change between beta releases. See [CHANGELOG.md](./CHANGELOG.md).
|