BLUEPATTERNSAI · AWARENESS COOKBOOK

Ground and evaluate any LLM response.

Place Awareness between your application and its foundational model. Requests are routed, grounded in certified context, evaluated, and returned with citations—or blocked safely.

01 · Overview & use case

Build a governed LLM call

Send questions to the OpenAI-compatible Awareness endpoint instead of calling the model directly. Awareness retrieves approved legal evidence, evaluates grounding and safety, and exposes citations and token telemetry.

Current certified path. Legal-domain evaluation using the registered sarvam-105b model. Other providers or domains require certification.

02 · Prerequisites & setup

Install nothing beyond Python

python3 --version
export AWARENESS_API_KEY='<tenant-key-from-secure-onboarding>'
export AWARENESS_BASE_URL='https://awareness.bluepatterns.ai/v1'
python3 awareness_cookbook.py

Never put admin or provider credentials in browser code, source control, or a client bundle.

03 · Core implementation

Runnable Python client

Save awareness_cookbook.py beside this page and run it. It handles timeouts and malformed responses without bypassing evaluation.

from awareness_cookbook import call_awareness
result = call_awareness("What is the exact authorization protocol for a $6,000 software purchase under Section 99-B?")
print(result.output, result.citations, result.usage)

The result contains the evaluated answer, source citations, usage counters, and cache state.

04 · Good vs. bad patterns

Keep the evaluation boundary intact

🚫 Suboptimal approachOptimized pattern
Call the provider from the UI.
fetch(PROVIDER_URL)
Route every request through Awareness.
base_url="https://awareness.bluepatterns.ai/v1"
Trust any HTTP 200 response.Require the decision, citations, and usage fields.
Put keys in React/browser code.Keep tenant keys in a server-side secret manager.
Retry by dropping evidence or safety checks.Let Awareness repack, retry, or fail closed.

05 · Production considerations

Operate the boundary deliberately