Skip to content

About

Merchant-configurable voice commerce agent built with FastAPI, LangGraph, ChromaDB RAG, and Shopify integration. Features deterministic pricing, speech-to-text/text-to-speech, tenant isolation, and automated regression testing.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

VoiceCommerce AI

A merchant-configurable FastAPI backend for text and voice commerce. Actual LangGraph nodes coordinate policy retrieval and narrow read-only tools. Chroma persists policy vectors; SQLite persists conversations, immutable prompt snapshots, activation, and evaluation reports. Python Decimal rules own every discount and price.

The default workflow is fully offline after installation and needs no paid account. It includes two merchants, products, a customer-owned mock order, five policy types, two prompt versions, a fixed regression dataset, and explicit speech mocks. Mock STT returns a fixed transcript; mock TTS returns a 100 ms tone, not speech. Real opt-in adapters use Shopify Admin GraphQL and OpenAI HTTP APIs.

This is a tested development application with production-minded boundaries, not a claim of production deployment readiness. See limitations.

Quick start — Windows PowerShell

Install Python 3.12 and uv. Run from the repository root (all subsequent commands assume this directory):

git clone https://github.com/ruthick76/VoiceCommerce-AI.git
Set-Location VoiceCommerce-AI
uv python install 3.12
uv sync --frozen
# Optional; omit to use the same mock defaults:
Copy-Item .env.example .env
uv run python -m scripts.setup
uv run uvicorn app.main:create_app --factory --host 127.0.0.1 --port 8000

In a second PowerShell terminal:

Set-Location VoiceCommerce-AI
$headers = @{ Authorization = 'Bearer dev-demo-admin' }
Invoke-RestMethod -Uri 'http://127.0.0.1:8000/ready'
$c = Invoke-RestMethod -Method Post -Uri 'http://127.0.0.1:8000/api/v1/conversations' -Headers $headers -ContentType 'application/json' -Body '{}'
$body = @{ text = 'Can I get a discount on running shoes?'; product_id = 'shoes'; quantity = 1 } | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:8000/api/v1/conversations/$($c.id)/messages" -Headers $headers -ContentType 'application/json' -Body $body
uv run python -m scripts.smoke

The quote includes subtotal: "100.00", savings: "10.00", total: "90.00", eligible: true, currency: "USD", and policy sources. Money is serialized as strings.

Linux/macOS

git clone https://github.com/ruthick76/VoiceCommerce-AI.git
cd VoiceCommerce-AI
uv python install 3.12
uv sync --frozen
# Optional: cp .env.example .env
uv run python -m scripts.setup
uv run uvicorn app.main:create_app --factory --host 127.0.0.1 --port 8000

Use make setup, make run, or the cross-platform commands directly. Interactive API documentation is served at /docs, with its OpenAPI document at /openapi.json. Onboarding validates local HTTP internally; no cloud browser preview is provided.

Verification

uv run python -m scripts.check
# Individual quality checks:
uv run ruff check app tests scripts
uv run ruff format --check app tests scripts
uv run mypy app scripts
uv run pytest
uv run pytest --no-cov tests/unit
uv run pytest --no-cov tests/integration
uv run pytest --no-cov tests/evaluation
uv run python -m scripts.evaluate --versions v1 v2 --output reports/demo
uv run python -m scripts.evaluate --merchant outlet --output reports/outlet
# With the mock server running:
uv run python -m scripts.smoke

Coverage includes branches, with an enforced 80% minimum for the complete suite. Focused suite commands disable the aggregate threshold. HTTP is blocked inside automated tests unless replaced with a controlled transport. Evaluations produce evaluation.json and summary.txt and return a nonzero exit code on failure or zero cases. Measured results and caveats are recorded in implementation status.

Authentication and mock identities

Every /api/v1 endpoint requires a bearer token. Local development defaults:

Token Merchant Customer Privilege
dev-demo-admin demo alice merchant admin
dev-demo-customer demo alice customer
dev-outlet-admin outlet none merchant admin

These public demo tokens are for local use only. VC_ENVIRONMENT=production requires explicit VC_TOKENS. Give each principal a stable subject to share identity safely across token rotations. Without one, ownership is derived from the token's hash and rotation creates a new conversation identity. Admin role does not bypass conversation ownership. Customer identities and merchant IDs never come from message arguments.

Guides

No checkout, payment, refund, cancellation, arbitrary code tool, or storefront write is exposed. Quotes do not reserve inventory, include tax/shipping, or create discounts in Shopify.

About

Merchant-configurable voice commerce agent built with FastAPI, LangGraph, ChromaDB RAG, and Shopify integration. Features deterministic pricing, speech-to-text/text-to-speech, tenant isolation, and automated regression testing.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages