Skip to content

Commit

Permalink
Merge branch 'main-2'
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Feb 21, 2024
2 parents 3795bcf + 75b63fc commit 70ab058
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 25 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bgent",
"version": "0.0.11",
"version": "0.0.12",
"private": false,
"description": "bgent. because agent was taken.",
"type": "module",
Expand All @@ -9,8 +9,7 @@
"jsnext:main": "dist/index.esm.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "rollup -c && npm run build:types",
"build:types": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
"build": "rm -r ./dist && rollup -c && tsc",
"lint": "eslint --ext .ts --ext .js . --fix",
"dev": "wrangler dev -- --dev",
"shell:dev": "node --no-warnings scripts/shell.mjs --dev",
Expand Down
5 changes: 3 additions & 2 deletions src/agents/cj/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import actions from "./actions";
import evaluators from "./evaluators";
import flavor from "./flavor";
import { defaultActions, defaultEvaluators } from "../../lib";

export function shouldSkipMessage(state: State, agentId: string): boolean {
if (state.recentMessagesData && state.recentMessagesData.length > 2) {
Expand Down Expand Up @@ -102,8 +103,8 @@ const routes: Route[] = [
serverUrl: "https://api.openai.com/v1",
supabase,
token: env.OPENAI_API_KEY,
actions,
evaluators,
actions: [...actions, ...defaultActions],
evaluators: [...evaluators, ...defaultEvaluators],
flavor,
});

Expand Down
17 changes: 6 additions & 11 deletions src/lib/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type SupabaseClient } from "@supabase/supabase-js";
import { defaultActions } from "./actions";
import { composeContext } from "./context";
import {
defaultEvaluators,
Expand Down Expand Up @@ -86,17 +85,13 @@ export class BgentRuntime {

this.token = opts.token;

[...defaultActions, ...((opts.actions ?? []) as Action[])].forEach(
(action) => {
this.registerAction(action);
},
);
(opts.actions ?? []).forEach((action) => {
this.registerAction(action);
});

[...defaultEvaluators, ...((opts.evaluators ?? []) as Evaluator[])].forEach(
(evaluator) => {
this.registerEvaluator(evaluator);
},
);
(opts.evaluators ?? defaultEvaluators).forEach((evaluator) => {
this.registerEvaluator(evaluator);
});
}

getRecentMessageCount() {
Expand Down
2 changes: 0 additions & 2 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export function parseJsonArrayFromText(text: string) {
}
}

console.log("jsonData", jsonData);

if (Array.isArray(jsonData)) {
return jsonData;
} else {
Expand Down
2 changes: 0 additions & 2 deletions src/test/createRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export async function createRuntime({
throw new Error("Session not found");
}

console.log('*** creating runtime with action', actions, 'and evaluators', evaluators)

const runtime = new BgentRuntime({
debugMode: false,
serverUrl: "https://api.openai.com/v1",
Expand Down
2 changes: 1 addition & 1 deletion src/test/populateMemories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type UUID } from "crypto";
import { zeroUuid } from "../lib/actions/__tests__/ignore.test";
import { type BgentRuntime } from "../lib/runtime";
import { getCachedEmbedding, writeCachedEmbedding } from "./cache";
import { ContentExample } from "lib/types";
import { ContentExample } from "../lib/types";

export async function populateMemories(
runtime: BgentRuntime,
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": "src"
"outDir": "./dist",
"declaration": true,
"declarationDir": "./dist",
"rootDir": "./src",
},
"include": [
"src",
"__tests__",
"jest.config.js",
"rollup.config.js",
],
"exclude": [
"node_modules",
Expand Down

0 comments on commit 70ab058

Please sign in to comment.