Public Documentation

Lawie Docs

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.read scope
  • Access to Lawie Runtime prompts

Architecture Diagram

Slack events → Retrieval search → Runtime response → Slack reply.

Steps

  1. Listen to Slack events and send question payload to POST /retrieval/v1/search.
  2. Feed top hits into POST /llm-runtime/v1/storyboard with mode: safe.
  3. Reply with citations referencing documentId + page from the retrieval response.

API Calls Referenced

  • POST /retrieval/v1/search
  • POST /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.