Registry / ai-ml / mongodb-assistant-eval

mongodb-assistant-eval

JSON →
library0.0.8jsnpmunverified

An evaluation library for the MongoDB Assistant API, version 0.0.8, designed to support dataset schemas and loaders, evaluation scorers, metrics, and a programmatic CLI helper for building evaluation pipelines. It integrates with Braintrust for running evals, OpenAI for tool call types, and Zod for schema validation. Optional peer dependencies enable LLM-as-judge scorers (via ai, autoevals), MongoDB dataset loading, and Slack reporting. It is actively developed by MongoDB, with TypeScript types included. Key differentiators include a focus on conversation evaluation with built-in scorers like Factuality and Faithfulness, and flexible dataset loaders from YAML, JSON, or MongoDB.

npm install mongodb-assistant-eval
INSTALL
IMPORT
SIG · MONGODB-ASSISTANT-
M
mongodb-assistant-eval
ai-mljavascriptv0.0.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ConversationEvalCaseSchema
import { ConversationEvalCaseSchema } from 'mongodb-assistant-eval/schema'
import { ConversationEvalCaseSchema } from 'mongodb-assistant-eval'
Schema is exported from the /schema subpath, not the main entry.
getConversationEvalCasesFromYaml
import { getConversationEvalCasesFromYaml } from 'mongodb-assistant-eval/datasets'
import { getConversationEvalCasesFromYaml } from 'mongodb-assistant-eval'
Loaders are in /datasets subpath.
createMongoDbAssistantEvalCli
import { createMongoDbAssistantEvalCli } from 'mongodb-assistant-eval/cli'
import { createMongoDbAssistantEvalCli } from 'mongodb-assistant-eval'
CLI helper is in /cli subpath.
ConversationEvalScorer
import type { ConversationEvalScorer } from 'mongodb-assistant-eval/eval'
import { ConversationEvalScorer } from 'mongodb-assistant-eval/eval'
Scorer types are exported as types from /eval subpath.

Shows how to load eval cases from YAML, define a task, and create a CLI with Slack reporter.

import { ConversationEvalCaseSchema } from 'mongodb-assistant-eval/schema'; import { getConversationEvalCasesFromYaml } from 'mongodb-assistant-eval/datasets'; import { createMongoDbAssistantEvalCli } from 'mongodb-assistant-eval/cli'; import { createSlackReporter } from 'mongodb-assistant-eval/reporters'; import { createEvalJudgeModel } from 'mongodb-assistant-eval/scorers'; import fs from 'fs'; const yaml = fs.readFileSync('./cases.yaml', 'utf8'); const cases = getConversationEvalCasesFromYaml({ yaml }); const cli = createMongoDbAssistantEvalCli({ projectName: 'my-eval-project', datasets: { default: cases }, models: { gpt4: 'gpt-4' }, tasks: { chat: async ({ input }) => { return { messages: [{ role: 'assistant', content: 'Hello!' }] }; }, }, scorers: {}, validators: {}, reporters: { slack: createSlackReporter({ slackToken: process.env.SLACK_BOT_TOKEN ?? '', slackConversationId: process.env.SLACK_EVAL_CHANNEL_ID ?? '', }), }, }); cli.parse();
Debug
Known issues
gotchaImport paths must use subpath exports (e.g., 'mongodb-assistant-eval/schema'), not the main package entry.
fix
Use correct subpath: import { ConversationEvalCaseSchema } from 'mongodb-assistant-eval/schema'
affects: >=0.0.0
deprecatedSome peer dependencies like '@ai-sdk/azure' may change in future versions as the AI SDK evolves.
fix
Stay updated with the latest ai SDK releases.
affects: >=0.0.0
gotchaMongoDB loader supports both v6 and v7, but requires the correct driver version range: ^6.3.0 || ^7.1.0.
fix
npm install mongodb@^6.3.0 or mongodb@^7.1.0
affects: >=0.0.0
gotchaScorer functions must return { name: string, score: number | null } or null pattern. Forgetting the name property causes runtime errors.
fix
Return an object with name and score.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'mongodb-assistant-eval' or its corresponding type declarations.
Importing from the main package entry instead of subpath like 'mongodb-assistant-eval/schema'.
fix
Use correct subpath import: import { ConversationEvalCaseSchema } from 'mongodb-assistant-eval/schema'
TypeError: createMongoDbAssistantEvalCli is not a function
Importing from 'mongodb-assistant-eval' instead of 'mongodb-assistant-eval/cli'.
fix
import { createMongoDbAssistantEvalCli } from 'mongodb-assistant-eval/cli'
Error: Missing required peer dependencies: braintrust, openai, zod
Required peer deps not installed.
fix
npm install braintrust openai zod
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies
braintrustrequiredCore eval runner, datasets, results
openairequiredTool call types used by scorers
zodrequiredSchema validation, makeConversationEvalCaseSchema
aioptionalcreateEvalJudgeModel for LLM-as-judge scorers
@ai-sdk/openaioptionalcreateEvalJudgeModel for LLM-as-judge scorers
@ai-sdk/azureoptionalcreateEvalJudgeModel for LLM-as-judge scorers
autoevalsoptionalBuilt-in LLM scorers (Factuality, Faithfulness, etc.)
mongodboptionalgetConversationEvalCasesFromMongoDb loader
@slack/web-apioptionalSlack evaluation reporting
slack-block-builderoptionalSlack evaluation reporting
slackify-markdownoptionalSlack evaluation reporting
Agent activity
11 hits · last 30 days
node
10
Resources
mongodb-assistant-eval — npm install mongodb-assistant-eval · libregistry