@strav/brain 0.1.0 → 0.1.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/README.md +6 -6
- package/package.json +1 -1
- package/src/brain_manager.ts +1 -1
- package/src/brain_provider.ts +2 -2
- package/src/providers/anthropic_provider.ts +1 -1
- package/src/providers/openai_provider.ts +1 -1
- package/src/providers/openai_responses_provider.ts +1 -1
- package/src/utils/retry.ts +1 -1
- package/src/workflow.ts +3 -3
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @strav/brain
|
|
2
2
|
|
|
3
|
-
AI module for the [Strav](https://www.npmjs.com/package/@
|
|
3
|
+
AI module for the [Strav](https://www.npmjs.com/package/@strav/core) framework. Provides a unified interface for AI providers with support for agents, threads, tool use, and multi-step workflows.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
bun add @
|
|
8
|
+
bun add @strav/brain
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Requires `@
|
|
11
|
+
Requires `@strav/core` as a peer dependency.
|
|
12
12
|
|
|
13
13
|
## Providers
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ Requires `@stravigor/core` as a peer dependency.
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
20
|
```ts
|
|
21
|
-
import { brain } from '@
|
|
21
|
+
import { brain } from '@strav/brain'
|
|
22
22
|
|
|
23
23
|
// One-shot chat
|
|
24
24
|
const response = await brain.chat('Explain quantum computing')
|
|
@@ -41,7 +41,7 @@ const vectors = await brain.embed('Hello world')
|
|
|
41
41
|
## Agents
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
import { Agent, defineTool } from '@
|
|
44
|
+
import { Agent, defineTool } from '@strav/brain'
|
|
45
45
|
|
|
46
46
|
class ResearchAgent extends Agent {
|
|
47
47
|
provider = 'anthropic'
|
package/package.json
CHANGED
package/src/brain_manager.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject, ConfigurationError, Configuration } from '@
|
|
1
|
+
import { inject, ConfigurationError, Configuration } from '@strav/kernel'
|
|
2
2
|
import { AnthropicProvider } from './providers/anthropic_provider.ts'
|
|
3
3
|
import { OpenAIProvider } from './providers/openai_provider.ts'
|
|
4
4
|
import type {
|
package/src/brain_provider.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ServiceProvider } from '@
|
|
2
|
-
import type { Application } from '@
|
|
1
|
+
import { ServiceProvider } from '@strav/kernel'
|
|
2
|
+
import type { Application } from '@strav/kernel'
|
|
3
3
|
import BrainManager from './brain_manager.ts'
|
|
4
4
|
|
|
5
5
|
export default class BrainProvider extends ServiceProvider {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseSSE } from '../utils/sse_parser.ts'
|
|
2
2
|
import { retryableFetch, type RetryOptions } from '../utils/retry.ts'
|
|
3
|
-
import { ExternalServiceError } from '@
|
|
3
|
+
import { ExternalServiceError } from '@strav/kernel'
|
|
4
4
|
import type {
|
|
5
5
|
AIProvider,
|
|
6
6
|
CompletionRequest,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseSSE } from '../utils/sse_parser.ts'
|
|
2
2
|
import { retryableFetch, type RetryOptions } from '../utils/retry.ts'
|
|
3
|
-
import { ExternalServiceError } from '@
|
|
3
|
+
import { ExternalServiceError } from '@strav/kernel'
|
|
4
4
|
import type {
|
|
5
5
|
AIProvider,
|
|
6
6
|
CompletionRequest,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseSSE } from '../utils/sse_parser.ts'
|
|
2
2
|
import { retryableFetch, type RetryOptions } from '../utils/retry.ts'
|
|
3
|
-
import { ExternalServiceError } from '@
|
|
3
|
+
import { ExternalServiceError } from '@strav/kernel'
|
|
4
4
|
import type {
|
|
5
5
|
AIProvider,
|
|
6
6
|
CompletionRequest,
|
package/src/utils/retry.ts
CHANGED
package/src/workflow.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Workflow as BaseWorkflow } from '@
|
|
2
|
-
import type { WorkflowContext as BaseContext } from '@
|
|
1
|
+
import { Workflow as BaseWorkflow } from '@strav/workflow'
|
|
2
|
+
import type { WorkflowContext as BaseContext } from '@strav/workflow'
|
|
3
3
|
import { AgentRunner } from './helpers.ts'
|
|
4
4
|
import type { Agent } from './agent.ts'
|
|
5
5
|
import type { AgentResult, WorkflowResult, Usage } from './types.ts'
|
|
@@ -30,7 +30,7 @@ function addUsage(total: Usage, add: Usage): void {
|
|
|
30
30
|
// ── Workflow Builder ────────────────────────────────────────────────────────
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Multi-agent workflow orchestrator built on `@
|
|
33
|
+
* Multi-agent workflow orchestrator built on `@strav/workflow`.
|
|
34
34
|
*
|
|
35
35
|
* Supports sequential steps, parallel fan-out, routing, and loops.
|
|
36
36
|
* Each step wraps an Agent execution through the general-purpose workflow engine.
|