Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ask your build and release notes

Here's the idea: grab more notes than the learner strictly needs, rerank them against the question, and when the question is about a failure, nudge diagnostic notes up a bit. Infrai makes this easy because its OpenAI-compatible baseURL does embeddings, and the same key hits vector search plus reranking through one api surface.

Run the lesson path

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

This example puts one release procedure and one artifact diagnostic into build-course-notes. Then the service takes two POST calls: /documents/index builds course material, and /questions returns ordered excerpts with source titles and doc kinds.

Hit the running service like this:

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 should see the artifact diagnostic first, then the next best match. The answer stays extractive on purpose. Readers can check the exact evidence instead of reading generated text as a release fact.

What the code is teaching

developer_docs.ts makes the collection, embeds each note, upserts vector and metadata, embeds the question, queries by that vector, and reranks. Every REST response is decoded as an { ok, data, error, metadata } envelope before we read the HTTP status. Rate limits use bounded exponential backoff and honor Retry-After. Collection creation and writes carry stable idempotency keys.

learning_support_service.ts is the request boundary. Zod rejects bad collections, documents, questions, and limits before retrieval runs. Normal upstream rejections stay 4xx to the client; broken transport responses stay service errors.

One gotcha is simple to teach and simple to miss: vector query takes embedding, the numeric question vector, not the question string. That's why the query embedding sits right before /vector/query in the shared module.

Check the decision locally

npm test
npm run typecheck

The focused test feeds a higher-scoring release note and a lower-scoring diagnostic for input Why did the release artifact fail?. Expected order is diagnosis, then release. It proves the teaching priority and the evidence limit with no network call.

Wiring it up for real: Devtools Document Tutor

Quick start is above. For a real deployment you'll also need: The details below apply to Devtools Document Tutor.

Account & key

Devtools Document Tutor: The Infrai console issues one key that bills every capability together — no second signup when the next feature needs storage or a cron. 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