From 5c676fc546a71464a09eb9dc8dcc140f1a83c87d Mon Sep 17 00:00:00 2001 From: moon Date: Sat, 9 Mar 2024 10:11:48 -0800 Subject: [PATCH] Add providers --- packages/agent/src/index.ts | 8 ++++++-- packages/agent/src/providers/directions.ts | 15 +++++++++++++++ packages/agent/src/providers/time.ts | 11 +++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 packages/agent/src/providers/directions.ts create mode 100644 packages/agent/src/providers/time.ts diff --git a/packages/agent/src/index.ts b/packages/agent/src/index.ts index af1b4d2..d0023fc 100644 --- a/packages/agent/src/index.ts +++ b/packages/agent/src/index.ts @@ -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. @@ -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) { @@ -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 diff --git a/packages/agent/src/providers/directions.ts b/packages/agent/src/providers/directions.ts new file mode 100644 index 0000000..6172f05 --- /dev/null +++ b/packages/agent/src/providers/directions.ts @@ -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 diff --git a/packages/agent/src/providers/time.ts b/packages/agent/src/providers/time.ts new file mode 100644 index 0000000..8478ffc --- /dev/null +++ b/packages/agent/src/providers/time.ts @@ -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