garethpaul/gpt-docs-api is a static web project. Q&A Type Interface to ask questions against the Twilio docs with GPT-4.
This README is based on the checked-in source, manifests, scripts, and repository metadata on the main branch. The project language mix found during review was: Python (8), JavaScript (4).
CHANGES.md- maintenance historyREADME.md- project overview and local usage notesapi- source or example codechrome_extension- source or example codedocs- source or example codeMakefile- local build or utility targetsSECURITY.md- security reporting and disclosure guidanceVISION.md- project direction and maintenance guardrails
Additional scan context:
- Source directories: api, chrome_extension, docs
- Dependency and build manifests: Makefile
- Entry points or build surfaces: Makefile
- Test-looking files: api/chalicelib/public/test.html, api/tests/test_cache.py, api/tests/test_classification.py, api/tests/test_utils.py, chrome_extension/test.html, docs/plans/2026-06-08-gpt-docs-api-testability-dependency-baseline.md
- Git
git clone https://github.com/garethpaul/gpt-docs-api.git
cd gpt-docs-apiThe setup commands above are derived from repository files. Legacy mobile, Python, or JavaScript samples may require older SDKs or package versions than a modern workstation uses by default.
- Run
makeor inspectMakefilefor available targets.
Run the local verification gate before changing the API, cache, or classification helpers:
make lint
make test
make build
make check
make package-check
make verifyEvery Make gate derives the checkout root from the loaded Makefile, so an
absolute Makefile path can be invoked from any working directory without
changing the test, compile, baseline, or package-verification scope, including
when the absolute checkout path contains spaces.
Verification rejects caller-supplied MAKEFILES and MAKEFILE_LIST authority
instead of guessing a repository root from multiple loaded files.
make lint runs scripts/check-baseline.sh, make test runs deterministic
unit tests without live OpenAI, Pinecone, AWS, or Twilio credentials, and
make build compiles the Chalice app and helper modules. make verify keeps
the existing combined gate across tests, compile checks, and the source
baseline. The baseline also syntax-checks both extension bundles and verifies
that remote content uses text-only rendering with HTTP(S)-only source links.
GitHub Actions installs the pinned API requirements on Python 3.10, verifies
dependency consistency, constructs and inspects a real Chalice deployment
package, checks out without persisting the workflow token, and runs the same
offline make check baseline. Deployable dependencies come from the
hash-addressed Python 3.10 dependency lock in api/requirements.txt, with
direct intent in api/requirements.in; generated api/vendor/ environments
are not tracked. Regenerate the lock with the exact command in its header.
Hosted installation and Chalice packaging accept binary wheels only, preventing
verified source archives from producing unreviewed local build artifacts.
The job bootstraps exact pip 26.1.2 before dependency installation, so the
installer is not a moving workflow input.
The package verifier also confirms the generated role can read and write only
the gpt_docs DynamoDB cache table needed by the application.
The API implementation targets AWS Chalice, while repository settings publish
the static project content through GitHub Pages. Vercel automatic Git deployments are disabled
in vercel.json because their rewrite targeted the Flask entry point retired
during the 2023 Chalice migration.
Request validation rejects missing, non-string, whitespace-only, and over-limit
values. The maximum query length applies to the raw value before trimming or
model and retrieval work.
The retrieval context length guard enforces one separator-aware 4,000-character
total retrieval context budget across accepted Pinecone matches before
generated-answer prompt assembly. Links are returned only for included context.
Classification responses are constrained to the expected classification weight
schema before /classify/builder returns model-produced JSON to callers.
When the required SDK or runtime is unavailable, use static checks and source review first, then verify on a machine that has the matching platform toolchain.
- Detected references to OpenAI, Pinecone, AWS, and Twilio. Keep API keys, OAuth credentials, tokens, and account-specific values in local configuration only.
- Set
GPT_DOCS_API_KEYon deployments that expose/askor/classify/builder. Callers must send the same value inX-GPT-Docs-API-KeyorAuthorization: Bearer <token>before those routes read request bodies or spend server-side OpenAI/Pinecone credentials. - Extension clients require a user-supplied HTTPS API URL and browser-session API key; never ship the deployment's shared secret. Open the extension options
page after each browser restart, configure the HTTPS base URL for your own
deployment, and enter its key. The base URL persists locally; the key uses
memory-only
chrome.storage.session. The deployment must allow the Twilio Docs origins,Content-Type, andX-GPT-Docs-API-Keythrough CORS. Because session storage is a Chrome 102+ Manifest V3 API, both bundled manifests declare Chrome 102 as their minimum version. - Set
OPENAI_API_KEY,PINECONE_API_KEY,PINECONE_ENVIRONMENT, and AWS credentials only in local or deployment environment configuration.
- Review changes touching external API calls or credential-adjacent configuration; examples from the scan include api/app.py, api/chalicelib/classification.py, api/chalicelib/public/content.css, api/chalicelib/public/content.js, and 6 more.
- Keep
/askand/classify/builderbehind the shared caller API-key guard or a stronger API Gateway/JWT authorizer. Public asset routes may remain unauthenticated, but public asset routes must stay path-bound toapi/chalicelib/public. - Keep bundled extension requests limited to the fixed
/askand/classify/builderroutes. Do not persist user keys in local or sync storage, include them in logs, or accept non-HTTPS API origins. - Keep the maximum query length applied to the raw request value before trimming or invoking OpenAI, Pinecone, DynamoDB, or cache helpers.
- DynamoDB cache entries expire after one day in application reads and include
an integer
expires_atepoch attribute for DynamoDB TTL cleanup. - Cache reads and writes use a fixed-size SHA-256 identity in the existing
query_stringkey attribute, avoiding raw user questions and DynamoDB key length failures for accepted long or Unicode queries. - Cache hits require string responses and string-list links, and cached links are rechecked against the current HTTPS Twilio-host citation policy.
- Cache availability is not required for fresh answers: read failures fall through to retrieval, and write failures are logged after generation.
- Keep the classification weight schema limited to numeric
with_code,minimal_code, andno_codevalues. - The OpenAI 2.41.0 instance client is constructed per model operation from
OPENAI_API_KEY; tests inject resource-shaped clients and never require provider credentials or network access. - Twilio link host filtering keeps generated answer links limited to HTTPS
twilio.comor*.twilio.comhosts instead of substring matches. - Keep the retrieval metadata guard in place so incomplete Pinecone match metadata is skipped before answer generation.
- Malformed retrieval matches containers normalize to no matches before metadata iteration, preserving query-only answer generation.
- Unusable retrieval response accessors normalize to no matches, while callable mapping access and safe object attributes remain supported.
- Unusable retrieval metadata accessors normalize to missing metadata, while callable mapping access and safe object attributes remain supported.
- Keep the retrieval context length guard in place so oversized Pinecone metadata cannot expand generated-answer prompts without bound.
- Keep the total retrieval context budget shared across all matches, including separators, rather than applying the limit independently per match.
- Keep unexpected route failures logged server-side while callers receive generic 500 errors.
- Keep user queries and model responses on text-only DOM rendering in both extension bundles. Source links must be HTTP(S)-only and use opener isolation when opened in a new tab.
- Review changes touching network requests, sockets, or service endpoints; examples from the scan include api/chalicelib/public/content.js, api/chalicelib/public/manifest.json, api/chalicelib/public/segment-snippet.js, chrome_extension/content.js, and 2 more.
- Review changes touching file, media, JSON, XML, CSV, OCR, or data parsing; examples from the scan include api/app.py, api/chalicelib/classification.py, api/chalicelib/public/content.css, api/chalicelib/public/content.js, and 5 more.
- Review changes touching database, model, or persistence code; examples from the scan include api/chalicelib/classification.py, api/tests/test_classification.py, docs/plans/2026-06-08-gpt-docs-api-testability-dependency-baseline.md.
- Review changes touching infrastructure, proxy, cloud, or deployment configuration; examples from the scan include docs/plans/2026-06-08-gpt-docs-api-testability-dependency-baseline.md.
- See
SECURITY.mdfor vulnerability reporting and safe research guidance. - See
VISION.mdfor project direction and contribution guardrails. - See
CHANGES.mdfor maintenance history. - See
docs/plans/2026-06-08-gpt-docs-api-testability-dependency-baseline.mdfor the current testability and dependency baseline. - See
docs/plans/2026-06-08-source-baseline-guard.mdfor the source guard. - See
docs/plans/2026-06-08-gpt-docs-api-auth-guard.mdfor the API route authentication guard. - See
docs/plans/2026-06-08-public-file-boundary.mdfor the public asset path boundary. - See
docs/plans/2026-06-09-query-length-boundary.mdfor the maximum query length guard. - See
docs/plans/2026-06-09-make-gate-aliases.mdfor local verification target guardrails. - See
docs/plans/2026-06-09-retrieval-metadata-guard.mdfor the retrieval metadata guard. - See
docs/plans/2026-06-09-retrieval-context-length-guard.mdfor the retrieval context length guard. - See
docs/plans/2026-06-09-generic-error-responses.mdfor generic 500 errors on unexpected route failures. - See
docs/plans/2026-06-10-ci-baseline.mdfor the GitHub Actions baseline. - See
docs/plans/2026-06-10-cache-expiration-boundary.mdfor cache freshness and DynamoDB TTL behavior. - See
docs/plans/2026-06-12-cache-query-key-hashing.mdfor fixed-size, privacy-minimizing query cache identity. - See
docs/plans/2026-06-17-002-refactor-openai-client-v2-plan.mdfor the current OpenAI instance-client and dependency-lock boundary.
Keep changes small and tied to the project that is already present in this repository. For code changes, document the toolchain used, avoid committing generated dependency directories or local configuration, and update this README when setup or verification steps change.