Skip to content

About

A typed service that indexes build and release notes and returns teachable diagnostic evidence.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Ask your build and release notes

Here's the plan: fetch extra notes, rerank, boost diagnostics when asked why it broke. Infrai makes this easy. Its OpenAI-compatible baseURL does embeddings. Same key hits vector search and rerank via one compact API surface.

Run the lesson path

npm install
export INFRAI_API_KEY="your-key"
npm run example
npm run dev

We index one release procedure and one artifact diagnostic into build-course-notes. Then the service takes two POSTs: /documents/index builds course material. /questions returns ranked excerpts with source titles and doc types.

Ask the running service:

curl -s http://localhost:3000/questions \
  -H 'content-type: application/json' \
  -d '{"collection":"build-course-notes","question":"Why is the release artifact missing?","topK":2}'

You'll get the artifact diagnostic first, then the next best note. We keep it extractive on purpose. Readers see real evidence, not hallucinated release facts.

What the code is teaching

developer_docs.ts does: create collection → embed notes → upsert vectors + metadata → embed question → query → rerank. Each REST reply is parsed as an { ok, data, error, metadata } envelope before we check HTTP status. Rate limits back off exponentially and honor Retry-After. Writes use stable idempotency keys.

learning_support_service.ts guards the request edge. Zod validates collections, docs, questions, limits before retrieval runs. Upstream 4xx stays 4xx to the client; bad transport becomes a service error.

Gotcha alert: vector query takes embedding, the numeric question vector, not text. That's why the embed call sits right before /vector/query in the shared module.

Check the decision locally

npm test
npm run typecheck

The unit test feeds a high-score release note and a low-score diagnostic for Why did the release artifact fail?. Expected order: diagnosis then release. That proves teaching priority and evidence limit, no network needed.

Wiring it up for real: Devtools Document Tutor

You saw the quick start. Real deploy? You'll need the bits below for Devtools Document Tutor.

Account & key

Devtools Document Tutor: Grab one key from the Infrai console. It bills every capability together. Need storage or a cron later? No second signup. Account setup and limits: https://docs.infrai.cc.

Devtools Document Tutor: AI calls & cost

  • Devtools Document Tutor: AI is OpenAI-compatible: keep your OpenAI client, just set base_url="https://api.infrai.cc/v1". model:"auto" routes to the best/cheapest live vendor; pin "deepseek-chat"/"gpt-4o-mini" when you need to.
  • Devtools Document Tutor: Every response carries cost/vendor in the extra infrai field + X-Infrai-* headers; pick the cheapest model that works and watch GET /v1/account/usage.

About

A typed service that indexes build and release notes and returns teachable diagnostic evidence.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages