recipeDifficulty: beginnerTime: 15mVersion: v1Services: retrieval-api, llm-runtimeSDK: @lawie/sdk/retrievalReviewed: 2025-01-10Reviewer: Docs PlatformTags: retrieval, runtime, bots
Retrieval Bot Workflow
Combine Retrieval API + LLM runtime to answer contract questions.
Overview
This recipe glues Retrieval API results with LLM runtime responses to answer contract questions with citations.
Prerequisites
- Sandbox API key with
retrieval.readscope - Access to Lawie Runtime prompts
Architecture Diagram
Slack events → Retrieval search → Runtime response → Slack reply.
Steps
- Listen to Slack events and send question payload to
POST /retrieval/v1/search. - Feed top hits into
POST /llm-runtime/v1/storyboardwithmode: safe. - Reply with citations referencing
documentId+pagefrom the retrieval response.
API Calls Referenced
POST /retrieval/v1/searchPOST /llm-runtime/v1/storyboard
Troubleshooting
401→ API key missing or expired; regenerate via Lawie Admin.429→ Rate limit exceeded; back off and retry with jitter.