Skip to content
LakeSharkDocumentation
ANSWERSETS / DOCUMENTATION

Knowledge

Add, verify, generate and retire the approved material an AnswerSet uses to answer directly.

Knowledge contains question-and-answer material scoped to an AnswerSet. Manually published and otherwise authorized reviewed Knowledge can be reused directly when a request matches sufficiently well. AI-generated seed and expansion items remain drafts until a user with AnswerSet write permission reviews and republishes them.

Create an approved answer

  1. Under Answers, open your AnswerSet and select Knowledge.
  2. Add a question or user intent and the corresponding approved answer.
  3. Assign labels to organize related procedures.
  4. Save the item, then ask a natural variation in Test.

For example:

User question Approved answer
How do I report a phishing email? Report suspicious messages using your organization’s approved security reporting process.
What if I entered my password on a phishing page? Follow the approved credential-reset and security-incident procedure immediately.

Use real, verified policies in your own workspace. The examples above are illustrative, not organization-specific policy.

Maintain existing Knowledge

The Knowledge view supports search, filtering, labels, editing and deletion. Treat these as normal operational maintenance, not a one-time setup step.

  • Edit: Correct outdated or ambiguous instructions and test the new version.
  • Delete: Remove inaccurate or retired procedures that should not influence future responses.
  • Search and labels: Locate related answers before adding duplicates.
  • Source review: Provider-seeded or provider-generated items are drafts that cannot be retrieved or used as scoring ground truth until reviewed and published. Select Review & publish, inspect the question, answer and label, then select Approve & publish to create a new revision.

After a change, compare both a known question and an out-of-scope question in Test. Check the response source and revision when investigating a change in routing.

Manage Knowledge through the API

Use the public Answers gateway at https://lakeshark.dev/api/answers with a workspace-scoped access token. These management endpoints require answers.read for listing and answers.write for changes; a Question Key is not a management credential.

Method Path Operation
GET /v1/answer-sets/{answer_set_id}/knowledge List and filter Knowledge with cursor pagination
POST /v1/answer-sets/{answer_set_id}/knowledge Create or update an entry with the same normalized question
PUT /v1/answer-sets/{answer_set_id}/knowledge/{knowledge_id} Replace the question, answer and labels
DELETE /v1/answer-sets/{answer_set_id}/knowledge/{knowledge_id} Delete one entry
POST /v1/answer-sets/{answer_set_id}/knowledge/bulk-delete Delete 1–100 entries in one transaction

Search and pagination

The list endpoint accepts optional label (up to 120 characters), q (up to 200 characters, case-insensitive substring search over question and answer), and source filters. Supported source filters are manual, import, provider_seed, generated, and auto_seed. limit is 1–100, defaulting to 25. Results are ordered by most recently updated first, with the entry ID breaking ties.

GET /v1/answer-sets/{answer_set_id}/knowledge?label=security-awareness&q=phishing&limit=25
Authorization: Bearer <ACCESS_TOKEN>

The response contains knowledge (the current page), total (the number matching the filters), has_more, and next_cursor. Pass the returned next_cursor as the cursor query parameter to fetch the next page with the same filters. Treat cursors as opaque; an invalid cursor returns HTTP 422. Pagination is based on each entry’s update timestamp and ID, so concurrent edits may change what subsequent pages contain.

Write and delete contracts

Creating or replacing Knowledge requires a JSON body with question (1–12,000 characters), answer (1–20,000 characters), and labels (1–12 labels). Labels are normalized to lowercase, hyphenated slugs. A saved answer must match an AnswerSet’s configured strict-answer choices when strict answers apply; otherwise the write fails with HTTP 422.

{
  "question": "How should I report phishing?",
  "answer": "Follow the approved security reporting procedure.",
  "labels": ["security-awareness"]
}

The create endpoint returns HTTP 201; create and update responses include knowledge and the new AnswerSet revision. Create is not guaranteed to append a distinct entry: the backend upserts when the normalized question already exists for the active configuration. Editing a generated or Auto Seed entry through the update endpoint marks it as manually reviewed and records its prior source in metadata.

For bulk deletion, send:

POST /v1/answer-sets/{answer_set_id}/knowledge/bulk-delete
Authorization: Bearer <ACCESS_TOKEN>
Content-Type: application/json
{
  "ids": ["00000000-0000-4000-8000-000000000001"]
}

The ids array must contain 1–100 distinct UUIDs. All IDs must belong to the selected AnswerSet; if any ID is missing, the request returns HTTP 404 without deleting the others. A successful single or bulk deletion returns deleted_ids, deleted_count, and the resulting revision. Deletions also remove now-unused labels. Test routing after destructive changes.

Generate with a provider

Knowledge generation supports two explicitly selected sources: Approved Knowledge (the default API mode, grounded in reviewed material) and AnswerSet purpose (unverified drafts from the stated purpose, guidance, and relevant general public knowledge). Purpose-mode drafts are not verified organizational policy and must be reviewed before publishing.

  1. Select Generate Knowledge in the Knowledge view.
  2. Choose Approved Knowledge when reviewed grounding material exists, or AnswerSet purpose when starting without an approved anchor.
  3. Choose 1 to 50 items per API request (the console may batch generation), with an optional label and guidance. Approved Knowledge mode requires approved material in the selected label when a label is supplied.
  4. Review the resulting draft questions and answers against trusted references before publishing. Purpose-mode results are unverified suggestions, not established policy.

Example guidance:

Create alternative ways employees may ask about our documented phishing
reporting procedure. Reuse only the verified steps already in Knowledge.
Do not invent contact details, escalation paths or new security policy.

API:

POST /v1/answer-sets/{answer_set_id}/knowledge/generate
Authorization: Bearer <ACCESS_TOKEN>
Content-Type: application/json
{
  "source": "approved_knowledge",
  "count": 3,
  "label": "security-awareness",
  "prompt": "Create reworded questions using the existing approved answers only."
}

For ungrounded drafts, set "source": "purpose" and supply an optional prompt; approved Knowledge is not required in this mode. The default source is "approved_knowledge", which returns 409 when no eligible reviewed Knowledge is available. Generated results in either mode remain drafts and cannot become their own grounding references.

Cost boundary: Generation invokes a provider and may use tokens and request quota. Answering from a matched Knowledge item is a different path and can avoid provider inference.

Troubleshooting

Problem Action
Generate returns 409 for missing grounding Choose purpose mode for unverified drafts, or approve grounding Knowledge first for approved Knowledge mode
Provider-generated item is incorrect Edit or remove it; do not rely on it as approved policy
Known questions trigger provider fallback Check whether the Knowledge item is still an unreviewed generated draft. Then verify coverage, wording, routing confidence and active revision
Several items contradict each other Consolidate conflicting reviewed answers and retest. Conflicting exact matches are not eligible for direct reuse or independent scoring ground truth
An item should never appear again Delete the retired content and validate expected behavior

Knowledge versus Auto Seed

Generate is an explicit authoring action using either approved Knowledge or the purpose-only draft source. Auto Seed is a separately controlled process for provider-backed runtime gaps, with relevance thresholds, per-gap limits and daily caps. Auto Seed cannot use its own generated output as a grounding anchor.

Auto Seed and learning · Response policy · Run metrics