diff --git a/examples/discover.ts b/examples/discover.ts index 5400c81..c8beaca 100644 --- a/examples/discover.ts +++ b/examples/discover.ts @@ -10,7 +10,7 @@ const prompt = "Give me a short list of the planets names in the solar system"; async function initAgent() { const brain = useAgentBrain(); - await brain.discoverExperts(); + await brain.discoverLocal(); console.log("Experts:", brain.experts.map(e => e.name)); console.log("Current expert:", brain.ex.name); brain.ex.setOnToken((t) => process.stdout.write(t)); diff --git a/examples/expert_for_model.ts b/examples/expert_for_model.ts new file mode 100644 index 0000000..9a13af0 --- /dev/null +++ b/examples/expert_for_model.ts @@ -0,0 +1,25 @@ +#!/usr/bin/env node +import { useAgentBrain, useLmExpert } from "@agent-smith/brain"; + +// run a local Ollama instance before running this example +// node --loader ts-node/esm expert_for_model.ts + +const ex = useLmExpert({ + name: "default", + localLm: "ollama", +}); +// add more experts ... + +const brain = useAgentBrain([ex]); + +async function main() { + // auto discover loc + console.log("Auto discovering brain backend ..."); + await brain.discover(true); + await brain.expertsForModelsInfo() + console.log("Experts for model:", brain.expertsForModels) +} + +(async () => { + await main(); +})(); diff --git a/examples/package.json b/examples/package.json index afcfec3..23096f3 100644 --- a/examples/package.json +++ b/examples/package.json @@ -6,10 +6,10 @@ }, "dependencies": { "@agent-smith/body": "^0.0.8", - "@agent-smith/brain": "^0.0.13", + "@agent-smith/brain": "^0.0.16", "@agent-smith/smem": "^0.0.2", "@xenova/transformers": "^2.17.1", - "vectordb": "^0.4.20" + "vectordb": "^0.5.0" }, "devDependencies": { "@locallm/types": "^0.0.16",