0102030405060708091011121314151617
import { BedrockRuntime, VectorStore, SemanticCache } from '@infra/ai';
// LLMOps pipeline with semantic caching, hybrid retrieval & guardrails
export async function executeAgentWorkflow(userQuery: string) {
const cached = await SemanticCache.getSimilarity(userQuery, { threshold: . });
if (cached) return { stream: cached.stream, cached: true };
const documents = await VectorStore.hybridSearch(userQuery, { topK: , rerank: true });
const agentPlan = await BedrockRuntime.invokeModel({
modelId: 'anthropic.claude-3-5-sonnet',
prompt: buildGroundedPrompt(userQuery, documents),
guardrails: { piiFilter: true, hallucinationThreshold: . },
});
await SemanticCache.set(userQuery, agentPlan);
return agentPlan;
}