-
Notifications
You must be signed in to change notification settings - Fork 90
Examples/voice agent live retrieval UI #409
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
samanyugoyal2010
wants to merge
18
commits into
usemoss:main
Choose a base branch
from
samanyugoyal2010:examples/voice-agent-live-retrieval-ui
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.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
93fa217
feat(examples): add web UI + region metadata filtering to voice-agent
HarshaNalluru 78886cc
examples(voice-agent): address review
HarshaNalluru 3f9a979
examples(voice-agent): set tsconfig baseUrl for @/ paths; token route…
HarshaNalluru 7d4cb55
examples(voice-agent): address review
HarshaNalluru 23dc412
examples(voice-agent): neutral context label + no-match guardrail, ca…
HarshaNalluru 784931b
examples(voice-agent): fix review issues for live retrieval UI
samanyugoyal2010 403de62
examples(voice-agent): address follow-up review findings
samanyugoyal2010 cb18de5
examples(voice-agent): harden token boundary, region races, and paylo…
samanyugoyal2010 aa2fc54
examples(voice-agent): close remaining token and region race gaps
samanyugoyal2010 8b42ad3
Update moss-live-labs/examples/voice-agent/web/app/api/token/route.ts
samanyugoyal2010 58b57d6
Update moss-live-labs/examples/voice-agent/web/app/api/token/route.ts
samanyugoyal2010 c8adde1
examples(voice-agent): fix Windows env scripts, prod tokens, proxy he…
samanyugoyal2010 1c811dc
examples(voice-agent): test token guard and drop dead region/session …
samanyugoyal2010 0305335
examples(voice-agent): harden tokenGuard against spoofed proxy and Ho…
samanyugoyal2010 75a9443
Update moss-live-labs/examples/voice-agent/web/lib/tokenGuard.ts
samanyugoyal2010 15987bc
examples(voice-agent): log TRUST_PROXY misconfig once at startup
samanyugoyal2010 cc8c782
Merge remote branch
samanyugoyal2010 a821b56
Potential fix for pull request finding
samanyugoyal2010 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
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
50 changes: 50 additions & 0 deletions
50
moss-live-labs/examples/voice-agent/DEMO_SCRIPT_METADATA.md
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,50 @@ | ||
| # Demo Script — Metadata Filtering (region-scoped answers) | ||
|
|
||
| ~90s. Shows the **same question** returning **different, correct answers** by region, | ||
| because Moss filters retrieval on `metadata.region` — one shared index, scoped per query. | ||
|
|
||
| ## Before you record | ||
| - [ ] **Re-seed** (metadata changed): delete the configured index in the Moss portal | ||
| (`MOSS_INDEX_NAME`, default `demo-customer_faqs`), then `uv run python seed_index.py`. | ||
| - [ ] `uv run python agent.py dev` · `livekit-server --dev` · `cd web && npm run dev` | ||
| (UI at localhost:3000) | ||
| - [ ] Region is chosen with the **US / EU picker** in the panel (starts on US) — no restart. | ||
|
|
||
| ## 1 · Frame it (0:00–0:12) | ||
| > "Same knowledge base, one index. This support panel has a region picker — right now it's | ||
| > set to the US, and Moss only retrieves policies that apply to that region. Watch." | ||
|
|
||
| **[Connect. Panel shows the picker on US and `region: US + global`.]** | ||
|
|
||
| ## 2 · US answer (0:12–0:35) | ||
| > "What's your return window?" | ||
|
|
||
| **[Point at panel: the filter line + the retrieved US chunk.]** | ||
| > "Thirty days. The panel shows the filter — region is US or global — and it pulled the | ||
| > US returns policy. The EU policy is in the same index, but it was filtered out." | ||
|
|
||
| ## 3 · Switch region (0:35–1:05) | ||
| **[Click EU in the picker — the filter line flips to `region: EU + global` instantly.]** | ||
| > "Now I switch the same agent to the EU — no restart, just the filter. Same question." | ||
|
|
||
| > "What's your return window?" | ||
|
|
||
| > "Fourteen days — the EU right of withdrawal. Same index, same question, different answer, | ||
| > because the metadata filter scoped retrieval to the right region." | ||
|
|
||
| ## 4 · Why it matters (1:05–1:25) | ||
| > "That's one line of filter in the query. It's how you serve region-specific policies, | ||
| > or isolate tenants, or gate content by plan — all from a single Moss index, evaluated | ||
| > locally in milliseconds. Open source at github.com/usemoss/moss." | ||
|
|
||
| --- | ||
|
|
||
| ## The filter (for reference) | ||
| ```python | ||
| QueryOptions(top_k=5, alpha=0.8, | ||
| filter={"field": "region", "condition": {"$in": ["EU", "all"]}}) | ||
| ``` | ||
|
|
||
| ## Try these too | ||
| - "How much is shipping?" → US quotes dollars, EU quotes euros (with VAT). | ||
| - A global question ("I forgot my password") → same answer in both regions (region = `all`). |
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
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.