@sprucelabs/sprucebot-llm 9.0.104 → 9.0.106
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 +19 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#
|
|
2
|
-
A Typescript library for leveraging Large Langage Models
|
|
1
|
+
# Sprucebot LLM
|
|
2
|
+
A Typescript library for leveraging Large Langage Models to do... anything!
|
|
3
3
|
|
|
4
4
|
* [Has memory](#memory)
|
|
5
5
|
* Remembers past messages to build context
|
|
@@ -7,7 +7,7 @@ A Typescript library for leveraging Large Langage Models (like GPT-3) to do... a
|
|
|
7
7
|
* [Manages state](#adding-state-to-your-conversation)
|
|
8
8
|
* The state builds as the conversation continues
|
|
9
9
|
* Invoke callbacks whenever state changes
|
|
10
|
-
* [Connect to 3rd party API's](pulling-from-3rd-party-apis)
|
|
10
|
+
* [Connect to 3rd party API's](#pulling-from-3rd-party-apis)
|
|
11
11
|
* Pull in data in real time
|
|
12
12
|
* Have your bot respond generated responses
|
|
13
13
|
* Unlimited use cases
|
|
@@ -16,8 +16,15 @@ A Typescript library for leveraging Large Langage Models (like GPT-3) to do... a
|
|
|
16
16
|
* Adapter Interface to create your own adapters
|
|
17
17
|
* Only support OpenAI models for now (more adapters based on demand)
|
|
18
18
|
* Fully typed
|
|
19
|
+
* Built in modern Typescript
|
|
20
|
+
* Fully typed [schema based](https://github.com/sprucelabsai-community/spruce-schema) state management
|
|
19
21
|
|
|
20
22
|
|
|
23
|
+
## Lexicon
|
|
24
|
+
|
|
25
|
+
- `Bot`: This is the abstraction that holds the agent's personality.
|
|
26
|
+
- `Skill`: Describes what the `Bot` is responsible for doing and how to do it (including tool integration).
|
|
27
|
+
|
|
21
28
|
## Getting started
|
|
22
29
|
|
|
23
30
|
### Install the library as a dependency
|
|
@@ -30,7 +37,7 @@ yarn add @sprucelabs/sprucebot-llm
|
|
|
30
37
|
npm install @sprucelabs/sprucebot-llm
|
|
31
38
|
```
|
|
32
39
|
|
|
33
|
-
### Cloning and testing
|
|
40
|
+
### Cloning and testing directly
|
|
34
41
|
|
|
35
42
|
To clone the repository and prepare for development, do the following:
|
|
36
43
|
|
|
@@ -41,13 +48,13 @@ yarn rebuild
|
|
|
41
48
|
code .
|
|
42
49
|
```
|
|
43
50
|
|
|
44
|
-
### Testing
|
|
51
|
+
### Testing it out for yourself
|
|
45
52
|
You can use `sprucebot-llm` inside any Javascript runtime (nodejs, bun, browser).
|
|
46
53
|
|
|
47
|
-
If you want to try this locally, you can checkout `chat.ts`. Here are the contents of that file for you to explore.
|
|
54
|
+
If you want to try this locally, you can checkout `chat.ts`. Here are the contents of that file for you to review now, rather than needing to explore the codebase.
|
|
48
55
|
|
|
49
56
|
```ts
|
|
50
|
-
import {
|
|
57
|
+
import { stdin as input, stdout as output } from 'node:process'
|
|
51
58
|
import * as readline from 'node:readline/promises'
|
|
52
59
|
import dotenv from 'dotenv'
|
|
53
60
|
import OpenAiAdapter from './bots/adapters/OpenAi'
|
|
@@ -145,9 +152,9 @@ const skill = bots.Skill({
|
|
|
145
152
|
|
|
146
153
|
```
|
|
147
154
|
|
|
148
|
-
### Listening
|
|
155
|
+
### Listening for state changes
|
|
149
156
|
|
|
150
|
-
If you supply a `stateSchema
|
|
157
|
+
If you supply a `stateSchema`, then your bot will work with it based on the job you decide to give it. While the conversation is taking place, if the state changes, the skill will emit the `did-update-state` event.
|
|
151
158
|
|
|
152
159
|
```ts
|
|
153
160
|
await skill.on('did-update-state', () => {
|
|
@@ -217,9 +224,11 @@ const skill = bots.Skill({
|
|
|
217
224
|
|
|
218
225
|
```
|
|
219
226
|
|
|
227
|
+
> *Note*: This is not MCP (Model Context Protocol). MCP is focused on making API's available to LLM's. `sprucebot-llm` comes at this from the opposite direction. It does not require you to do anything server side, so you can connect to all your existing endpoints/tools/systems without needing to change them.
|
|
228
|
+
|
|
220
229
|
### Choosing a model
|
|
221
230
|
|
|
222
|
-
When you configure a `Skill` with
|
|
231
|
+
When you configure a `Skill` with for bot, you can specify the model that the skill will use. In other words, you can have different skills use different models depending on their requirements.
|
|
223
232
|
|
|
224
233
|
```ts
|
|
225
234
|
|