-
Notifications
You must be signed in to change notification settings - Fork 246
feat(gen-ai): add eval tests COMPASS-10084 #7641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mabaasit
wants to merge
43
commits into
main
Choose a base branch
from
eval-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,649
−1
Open
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
1295d51
add feature flag
mabaasit 7a44de4
migrate prompts to compass
mabaasit 2e2defe
Merge branch 'main' into COMPASS-10082-add-mms-prompts-and-feature-flag
mabaasit d524682
co-pilot feedback
mabaasit f9212fb
Merge branch 'COMPASS-10082-add-mms-prompts-and-feature-flag' of http…
mabaasit c96161b
clean up
mabaasit f499026
Merge branch 'main' into COMPASS-10082-add-mms-prompts-and-feature-flag
mabaasit f4d05a7
use edu api for gen ai
mabaasit 1763531
clean up a bit
mabaasit d5e2c84
fix url for test and ensure aggregations have content
mabaasit 0781580
tests
mabaasit 058e950
fix error handling
mabaasit 7d54d4d
clean up transport
mabaasit 0aa7ff5
Merge branch 'main' of https://github.com/mongodb-js/compass into COM…
mabaasit 309335a
changes in field name
mabaasit feacddc
use query parser
mabaasit c321983
fix check
mabaasit f5a34df
fix test
mabaasit 91b17d5
clean up
mabaasit ea4dfdf
copilot feedback
mabaasit f8a4c43
fix log id
mabaasit 8190219
fix cors issue on e2e tests
mabaasit c444cb9
more tests
mabaasit 6eec8db
add type
mabaasit 25c8089
wip
mabaasit 9b4c9b7
fix alltext
mabaasit 5e6d537
make expected output xml string
mabaasit d1b0b51
add fixtures and run gen ai eval tests
mabaasit 1b7343f
ts fixes
mabaasit a1b38c5
reformat
mabaasit 79e9910
clean up scorer
mabaasit 821917d
Merge branch 'main' of https://github.com/mongodb-js/compass into eva…
mabaasit 3bc7295
bootstrap
mabaasit eb49493
remove extra files
mabaasit fa1cf6f
Merge branch 'main' of https://github.com/mongodb-js/compass into eva…
mabaasit edc5e73
bootstrap
mabaasit 718e8b7
fix prompts and data
mabaasit 5244598
Merge branch 'main' of https://github.com/mongodb-js/compass into eva…
mabaasit 534b0d8
copilot review
mabaasit d0568ff
reduce num of docs
mabaasit 40ad7c9
reduce fixtures
mabaasit 48b38ce
Merge branch 'main' of https://github.com/mongodb-js/compass into eva…
mabaasit 6153f52
check fix
mabaasit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { streamText } from 'ai'; | ||
| import { createOpenAI } from '@ai-sdk/openai'; | ||
| import type { | ||
| ConversationEvalCaseInput, | ||
| ConversationTaskOutput, | ||
| } from './types'; | ||
|
|
||
| export async function makeChatbotCall( | ||
| input: ConversationEvalCaseInput | ||
| ): Promise<ConversationTaskOutput> { | ||
| const openai = createOpenAI({ | ||
| baseURL: | ||
| process.env.COMPASS_ASSISTANT_BASE_URL_OVERRIDE ?? | ||
| 'https://eval.knowledge-dev.mongodb.com/api/v1', | ||
| apiKey: '', | ||
| headers: { | ||
| 'X-Request-Origin': 'compass-gen-ai-braintrust', | ||
| 'User-Agent': 'mongodb-compass/x.x.x', | ||
| }, | ||
| }); | ||
| const result = streamText({ | ||
| model: openai.responses('mongodb-slim-latest'), | ||
| temperature: undefined, | ||
| prompt: input.messages, | ||
| providerOptions: { | ||
| openai: { | ||
| instructions: input.instructions.content, | ||
| store: false, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| const chunks: string[] = []; | ||
| for await (const chunk of result.toUIMessageStream()) { | ||
| if (chunk.type === 'text-delta') { | ||
| chunks.push(chunk.delta); | ||
| } | ||
| } | ||
| return { | ||
| messages: [{ content: chunks.join('') }], | ||
| }; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.