Skip to content

Commit

Permalink
Add providers
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Mar 9, 2024
1 parent 1041b4e commit 5c676fc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
import { type UUID } from 'crypto'
import actions from './actions'
import evaluators from './evaluators'
import time from './providers/time'
import directions from './providers/directions'

/**
* Handle an incoming message, processing it and returning a response.
Expand Down Expand Up @@ -249,7 +251,8 @@ const routes: Route[] = [
),
token: env.OPENAI_API_KEY,
actions: [...actions, ...defaultActions],
evaluators: [...evaluators, ...defaultEvaluators]
evaluators: [...evaluators, ...defaultEvaluators],
providers: [time, directions]
})

if (!(message as Message).agentId) {
Expand Down Expand Up @@ -321,7 +324,8 @@ const routes: Route[] = [
),
token: env.OPENAI_API_KEY,
actions: [...actions, ...defaultActions],
evaluators: [...evaluators, ...defaultEvaluators]
evaluators: [...evaluators, ...defaultEvaluators],
providers: [time, directions]
})

const zeroUuid = '00000000-0000-0000-0000-000000000000' as UUID
Expand Down
15 changes: 15 additions & 0 deletions packages/agent/src/providers/directions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { type BgentRuntime, type Message, type Provider, type State } from 'bgent'

const directions: Provider = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
get: async (_runtime: BgentRuntime, _message: Message, _state?: State) => `# IMPORTANT NOTES FOR RESPONSES:
- Introduce yourself my letting the person know you want to get to know them, and ask them some basic questions about themselves
- Don't say 'feel free to explore' or encourage people to do anything, either get to know them or ask them for more details on something they've said
- Always default to trying to get the person to talk about themselves or elaborate more on something they've said
- Don't ask how their day is going or engage in small talk, go straight for deep talk, as though they are a close frend you love to see
- Don't ask for permission to ask questions, just ask them
- If the conversation seems like it's going to end, try to keep it going by asking them more questions about themselves, especially leading from things they've already said
- Try to be brief, concise and clear, NOT flowery or verbose`
}

export default directions
11 changes: 11 additions & 0 deletions packages/agent/src/providers/time.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { type BgentRuntime, type Message, type Provider, type State } from 'bgent'

const time: Provider = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
get: async (_runtime: BgentRuntime, _message: Message, _state?: State) => {
const currentTime = new Date().toLocaleTimeString('en-US')
return 'The current time is: ' + currentTime
}
}

export default time

0 comments on commit 5c676fc

Please sign in to comment.