Skip to content

Commit 215a533

Browse files
mongodbenBen Perlmutter
andauthored
(EAI-1023, EAI-1024, EAI-1025): Scrubbed messages with redaction (#701)
* start on redaction * add routes to trace handlers * compilin * update env and tests * remove scrubbing and analysis from scripts dir * update env vars * fix ci errs --------- Co-authored-by: Ben Perlmutter <[email protected]>
1 parent 4fcadab commit 215a533

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+12973
-1184
lines changed

.drone.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ steps:
3535
VECTOR_SEARCH_INDEX_NAME: vector_index
3636
OPENAI_CHAT_COMPLETION_MODEL_VERSION: 2023-06-01-preview
3737
OPENAI_PREPROCESSOR_CHAT_COMPLETION_DEPLOYMENT: gpt-4o-mini
38+
OPENAI_ANALYZER_CHAT_COMPLETION_DEPLOYMENT: gpt-4.1-mini
3839
OPENAI_API_VERSION: "2024-06-01"
40+
OPENAI_RESOURCE_NAME: "docs-ai-chatbot-useast2resource-sandbox"
3941
BRAINTRUST_TEXT_TO_DRIVER_PROJECT_NAME: "text-to-node-js-driver-benchmark"
4042
BRAINTRUST_API_KEY:
4143
from_secret: braintrust_api_key

package-lock.json

Lines changed: 90 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/chatbot-server-mongodb-public/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PORT=3000
22
OPENAI_ENDPOINT="https://<resource_name>.openai.azure.com/"
3+
OPENAI_RESOURCE_NAME="<resource_name>"
34
OPENAI_API_KEY="<api_key>"
45
OPENAI_VERIFIED_ANSWER_EMBEDDING_DEPLOYMENT="docs-chatbot-embedding-ada-002"
56
OPENAI_RETRIEVAL_EMBEDDING_DEPLOYMENT="text-embedding-3-small"
@@ -13,6 +14,7 @@ VECTOR_SEARCH_INDEX_NAME="<index_name>"
1314
NODE_ENV="development"
1415
ALLOWED_ORIGINS="http://example.com,http://localhost:5173"
1516
OPENAI_PREPROCESSOR_CHAT_COMPLETION_DEPLOYMENT="<deployment name>"
17+
OPENAI_ANALYZER_CHAT_COMPLETION_DEPLOYMENT="<deployment name>"
1618
OPENAI_API_VERSION="2024-06-01"
1719
JUDGE_EMBEDDING_MODEL="text-embedding-3-small"
1820
JUDGE_LLM="gpt-4o-mini"

packages/chatbot-server-mongodb-public/environments/production.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ env:
1313
OPENAI_CHAT_COMPLETION_DEPLOYMENT: gpt-4o
1414
OPENAI_VERIFIED_ANSWER_EMBEDDING_DEPLOYMENT: "docs-chatbot-embedding-ada-002"
1515
OPENAI_RETRIEVAL_EMBEDDING_DEPLOYMENT: "text-embedding-3-small"
16+
OPENAI_RESOURCE_NAME: "docs-ai-chatbot-useast2resource"
17+
OPENAI_ANALYZER_CHAT_COMPLETION_DEPLOYMENT: gpt-4.1-mini
1618
JUDGE_LLM: "gpt-4o-mini"
1719
JUDGE_EMBEDDING_MODEL: "text-embedding-3-small"
1820
SLACK_COMMENT_CONVERSATION_ID: "C07A68V63EH"

packages/chatbot-server-mongodb-public/environments/staging.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ env:
1313
OPENAI_CHAT_COMPLETION_DEPLOYMENT: gpt-4o
1414
OPENAI_VERIFIED_ANSWER_EMBEDDING_DEPLOYMENT: "docs-chatbot-embedding-ada-002"
1515
OPENAI_RETRIEVAL_EMBEDDING_DEPLOYMENT: "text-embedding-3-small"
16+
OPENAI_RESOURCE_NAME: "docs-ai-chatbot-useast2resource-sandbox"
17+
OPENAI_ANALYZER_CHAT_COMPLETION_DEPLOYMENT: gpt-4.1-mini
1618
BRAINTRUST_CHATBOT_TRACING_PROJECT_NAME: "chatbot-responses-staging"
1719
JUDGE_LLM: "gpt-4o-mini"
1820
JUDGE_EMBEDDING_MODEL: "text-embedding-3-small"
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"preset": "ts-jest",
3-
"setupFiles": ["<rootDir>/src/jestEnvSetUp.ts"],
4-
"setupFilesAfterEnv": ["<rootDir>/src/jestSetUp.ts"],
3+
"testEnvironment": "node",
4+
"setupFiles": [
5+
"<rootDir>/src/test/jestSetUp.ts"
6+
],
57
"testPathIgnorePatterns": [
6-
"<rootDir>/build",
7-
"<rootDir>/src/llmQualitativeTests"
8-
]
9-
}
8+
"<rootDir>/build"
9+
],
10+
"globalSetup": "<rootDir>/src/test/globalSetup.ts",
11+
"globalTeardown": "<rootDir>/src/test/globalTeardown.ts"
12+
}

packages/chatbot-server-mongodb-public/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"dependencies": {
3030
"@segment/analytics-node": "^2.2.1",
3131
"@slack/web-api": "^7.8.0",
32+
"ahocorasick": "^1.0.2",
3233
"common-tags": "^1.8.2",
3334
"cookie-parser": "^1.4.6",
3435
"dotenv": "^16.0.3",
@@ -47,6 +48,7 @@
4748
"@babel/preset-env": "^7.22.5",
4849
"@babel/preset-typescript": "^7.22.5",
4950
"@lg-chat/rich-links": "^1.2.0",
51+
"@types/ahocorasick": "^1.0.0",
5052
"@types/common-tags": "^1.8.1",
5153
"@types/cookie-parser": "^1.4.6",
5254
"@types/express": "^4.17.21",
@@ -60,6 +62,7 @@
6062
"eslint-config-prettier": "^8.8.0",
6163
"eslint-plugin-jest": "^27.2.1",
6264
"jest": "^29.6.1",
65+
"mongodb-memory-server": "^10.1.4",
6366
"node-mocks-http": "^1.16.2",
6467
"nodemon": "^3.0.1",
6568
"prettier": "^2.8.7",

packages/chatbot-server-mongodb-public/src/EnvVars.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,28 @@ const MODEL_JUDGE_ENV_VARS = {
22
JUDGE_LLM: "",
33
JUDGE_EMBEDDING_MODEL: "",
44
};
5+
56
export const EVAL_ENV_VARS = {
67
...MODEL_JUDGE_ENV_VARS,
78
};
89

10+
export const ANALYZER_ENV_VARS = {
11+
OPENAI_ANALYZER_CHAT_COMPLETION_DEPLOYMENT: "",
12+
};
13+
914
export const TRACING_ENV_VARS = {
1015
...MODEL_JUDGE_ENV_VARS,
16+
...ANALYZER_ENV_VARS,
17+
};
18+
19+
export const AZURE_OPENAI_ENV_VARS = {
20+
OPENAI_API_KEY: "",
21+
OPENAI_API_VERSION: "",
22+
OPENAI_RESOURCE_NAME: "",
23+
};
24+
25+
export const PREPROCESSOR_ENV_VARS = {
26+
OPENAI_PREPROCESSOR_CHAT_COMPLETION_DEPLOYMENT: "",
1127
};
1228

1329
export const SLACK_ENV_VARS = {

0 commit comments

Comments
 (0)