Skip to content

Commit aacc74b

Browse files
authored
feat(ask-baml): implement feedback features, add embeddings CD (#2262)
<!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Implements feedback features, continuous deployment for embeddings, and updates backend for query and feedback handling in ask-baml. > > - **Behavior**: > - Implements feedback features in `AssistantResponseFeedback.tsx` to allow users to submit feedback on assistant responses. > - Adds continuous deployment for embeddings in `pinecone-api.ts` and `update-pinecone.ts`. > - Updates `ChatBot.tsx` to handle session management and feedback integration. > - **API**: > - Adds `ask-baml-chat` and `ask-baml-feedback` routes for handling chat queries and feedback submissions. > - Integrates Notion and Slack logging in `notion-api.ts` and `slack-api.ts`. > - **Models**: > - Introduces `@baml/sage-interface` package for shared types and interfaces. > - Updates `QueryRequest` and `QueryResponse` schemas in `api.ts`. > - **Misc**: > - Refactors `store.ts` for session management and query handling. > - Updates `next.config.ts` to transpile `@baml/sage-interface`. > - Adds tests for Notion and Slack integrations in `notion-api.test.ts` and `slack-api.test.ts`. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for 3248b1b. You can [customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
1 parent 0ba1c43 commit aacc74b

Some content is hidden

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

60 files changed

+3948
-3543
lines changed

.claude/settings.local.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
23
"permissions": {
34
"allow": [
45
"Bash(grep:*)",
@@ -39,8 +40,11 @@
3940
"Bash(npm run lint)",
4041
"Bash(npm run format:*)",
4142
"Bash(npm run:*)",
42-
"Bash(npx biome check:*)"
43+
"Bash(npx biome check:*)",
44+
"Bash(npx tsc:*)",
45+
"Bash(npx tsc:*)",
46+
"WebFetch(domain:www.npmjs.com)"
4347
],
4448
"deny": []
4549
}
46-
}
50+
}

.github/workflows/publish-docs.yml

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
docs:
1717
runs-on: ubuntu-latest
1818
permissions: write-all
19+
environment:
20+
name: ${{ github.ref == 'refs/heads/canary' && 'boundary-tools-prod' || 'boundary-tools-dev' }}
21+
1922
steps:
2023
- name: Checkout repository
2124
uses: actions/checkout@v4
@@ -29,11 +32,10 @@ jobs:
2932
run: npm install -g fern-api
3033

3134
- name: Install dependencies and build custom.js
32-
working-directory: ./typescript/apps/sage-client
35+
working-directory: ./typescript/apps/ask-baml-client
3336
run: pnpm install && pnpm run build
3437

3538
- name: Generate preview URL
36-
id: generate-docs
3739
env:
3840
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
3941
run: |
@@ -56,6 +58,8 @@ jobs:
5658
backend:
5759
runs-on: ubuntu-latest
5860
permissions: write-all
61+
environment:
62+
name: ${{ github.ref == 'refs/heads/canary' && 'boundary-tools-prod' || 'boundary-tools-dev' }}
5963
defaults:
6064
run:
6165
working-directory: ../sage-backend
@@ -72,13 +76,28 @@ jobs:
7276
working-directory: .
7377
run: npm install -g fern-api
7478

79+
# We need to do this `deploy` step because we're relying on a pnpm workspace and Vercel doesn't play nice with this:
80+
#
81+
# - doing normal `vercel deploy` is confusing, because the monorepo can be either promptfiddle or ask-baml-backend
82+
# - doing `vercel build` in the monorepo and then `deploy --prebuilt` results in this error:
83+
#
84+
# Using prebuilt build artifacts...
85+
# [Error: ENOENT: no such file or directory, lstat '/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/jest-worker/processChild.js'] {
86+
# errno: -2,
87+
# code: 'ENOENT',
88+
# syscall: 'lstat',
89+
# path: '/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/jest-worker/processChild.js'
90+
# }}
91+
#
92+
# So our current solution is to do this mechanism.
7593
- name: Pull sage-backend out of monorepo
7694
working-directory: ./typescript
77-
run: pnpm --filter=sage-backend deploy ../sage-backend
95+
run: |
96+
pnpm --filter=sage-backend install
97+
pnpm --filter=sage-backend deploy ../sage-backend
7898
7999
- name: Install dependencies and build
80100
run: |
81-
pnpm install
82101
pnpm baml-cli generate
83102
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref }}" = "refs/heads/canary" ]; then
84103
echo TARGET_ENV=prod >>$GITHUB_ENV
@@ -88,15 +107,22 @@ jobs:
88107
89108
- name: Build Vercel project
90109
env:
110+
NOTION_ASK_BAML_LOGS_DATABASE_ID: ${{ secrets.NOTION_ASK_BAML_LOGS_DATABASE_ID }}
111+
NOTION_BOUNDARY_BOT_TOKEN: ${{ secrets.NOTION_BOUNDARY_BOT_TOKEN }}
112+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
91113
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
114+
SLACK_BOUNDARY_BOT_TOKEN: ${{ secrets.SLACK_BOUNDARY_BOT_TOKEN }}
115+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
116+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_SAGE_PROJECT_ID }}
117+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN_SAM }}
92118
run: |
93-
pnpm vercel pull --yes --token=${{ secrets.VERCEL_TOKEN_SAM }}
119+
pnpm vercel pull --environment $TARGET_ENV --yes --token=${{ secrets.VERCEL_TOKEN_SAM }}
94120
pnpm vercel build --target $TARGET_ENV --token=${{ secrets.VERCEL_TOKEN_SAM }}
95121
96122
- name: Deploy preview backend
97123
env:
98124
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
99-
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_SAGE_BACKEND }}
125+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_SAGE_PROJECT_ID }}
100126
run: |
101127
pnpm vercel deploy --target $TARGET_ENV --prebuilt --token=${{ secrets.VERCEL_TOKEN_SAM }} | tee preview_url.txt
102128
@@ -105,3 +131,36 @@ jobs:
105131
uses: thollander/[email protected]
106132
with:
107133
file-path: ../sage-backend/preview_url.txt
134+
135+
pinecone:
136+
runs-on: ubuntu-latest
137+
environment:
138+
name: ${{ github.ref == 'refs/heads/canary' && 'boundary-tools-prod' || 'boundary-tools-dev' }}
139+
defaults:
140+
run:
141+
working-directory: typescript/apps/sage-backend
142+
steps:
143+
- name: Checkout repository
144+
uses: actions/checkout@v4
145+
146+
- name: Setup Node.js and pnpm
147+
uses: ./.github/actions/setup-node
148+
with:
149+
install-dependencies: false
150+
151+
- name: Set environment variables
152+
run: |
153+
if [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref }}" = "refs/heads/canary" ]; then
154+
echo NODE_ENV=production >>$GITHUB_ENV
155+
else
156+
echo NODE_ENV=development >>$GITHUB_ENV
157+
fi
158+
159+
- name: Update pinecone
160+
env:
161+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
162+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
163+
run: |
164+
pnpm --filter=sage-backend install
165+
pnpm tsx tools/update-pinecone.ts ../../../fern/docs.yml
166+

biome.json

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,23 @@
77
"defaultBranch": "main"
88
},
99
"files": {
10-
"ignoreUnknown": false,
11-
"ignore": [
12-
".next",
13-
"dist",
14-
"**/dist/**",
15-
"build",
16-
"**/build/**",
17-
"bin",
18-
"**/bin/**",
19-
"node_modules",
20-
"**/node_modules/**",
21-
"**/baml_client/**",
22-
"**/generated/**",
23-
"**/target/**",
24-
"**/.turbo/**",
25-
"**/coverage/**",
26-
"engine/**",
27-
"typescript/**",
28-
"integ-tests/**",
29-
"tools/**",
30-
"patches/**",
31-
"jetbrains/**",
32-
"pnpm-lock.yaml"
10+
"include": [
11+
"typescript/packages/sage-interface/**/*.ts",
12+
"typescript/packages/sage-interface/**/*.tsx"
3313
]
3414
},
3515
"json": {
3616
"formatter": {
3717
"enabled": true,
3818
"indentStyle": "space",
39-
"indentWidth": 2
19+
"indentWidth": 2,
20+
"lineWidth": 100
4021
}
4122
},
4223
"formatter": {
4324
"enabled": true,
44-
"indentStyle": "space"
45-
},
46-
"organizeImports": {
47-
"enabled": true
25+
"indentStyle": "space",
26+
"lineWidth": 100
4827
},
4928
"linter": {
5029
"enabled": true,
@@ -56,12 +35,7 @@
5635
"useExhaustiveDependencies": "warn",
5736
"useHookAtTopLevel": "error"
5837
},
59-
"nursery": {
60-
"noCommonJs": "error",
61-
"noNestedTernary": "off",
62-
"useAtIndex": "error",
63-
"useCollapsedIf": "error"
64-
},
38+
"nursery": {},
6539
"style": {
6640
"noNegationElse": "off",
6741
"useNodejsImportProtocol": "error",

mise.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ node = "lts" # For pnpm
2424
"pipx:maturin" = "latest"
2525

2626
# Node tools
27-
"npm:pnpm" = "9.12.0"
27+
"npm:pnpm" = "10.14.0"
2828
"npm:@infisical/cli" = "latest"
2929

3030
[settings]
3131
experimental = true
32-
# idiomatic_version_file_enable_tools = ["node", "python", "ruby", "go"]
32+
# idiomatic_version_file_enable_tools = ["node", "python", "ruby", "go"]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"@types/node": "24.0.3",
3838
"turbo": "2.5.4",
3939
"typescript": "5.8.3",
40+
"vercel": "^44.5.5",
4041
"vitest": "3.2.3",
4142
"pnpm": "9.12.0"
4243
},

0 commit comments

Comments
 (0)