Skip to content

Docs: Update API documentation for endpoints to clarify parameters and functionality#638

Open
vprashrex wants to merge 2 commits intomainfrom
enhancement/update-api-documentation
Open

Docs: Update API documentation for endpoints to clarify parameters and functionality#638
vprashrex wants to merge 2 commits intomainfrom
enhancement/update-api-documentation

Conversation

@vprashrex
Copy link
Collaborator

@vprashrex vprashrex commented Mar 3, 2026

Summary

Target issue is #PLEASE_TYPE_ISSUE_NUMBER
Explain the motivation for making this change. What existing problem does the pull request solve?

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

Notes

Please add here if any other information is required for the reviewer.

Summary by CodeRabbit

  • New Features

    • Added STT and TTS completion types and input/output guardrails support.
    • Option to reference stored configs when creating evaluations.
  • Documentation

    • Extensive docs updates: clearer input formats, examples, and parameter descriptions across configs, LLM calls, evaluations, fine-tuning, STT dataset/feedback, onboarding, projects, and organization endpoints.
    • API key revocation wording updated to reflect soft-delete behavior.

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

Documentation updates across multiple API docs: provider/config handling, completion types and guardrails, evaluation usage of stored configs, LLM input formats, STT dataset/feedback schemas, fine-tuning field formats, and minor endpoint field clarifications; no code or public API signatures changed.

Changes

Cohort / File(s) Summary
Config docs
backend/app/api/docs/config/create.md, backend/app/api/docs/config/create_version.md
Document provider-type handling (Kaapi vs native), add completion types "text", "stt", "tts", introduce input_guardrails/output_guardrails, replace vector_store_idsknowledge_base_ids, and note partial-update behavior for config blobs/versioning.
Evaluation & STT docs
backend/app/api/docs/evaluation/create_evaluation.md, backend/app/api/docs/stt_evaluation/create_dataset.md, backend/app/api/docs/stt_evaluation/update_feedback.md
Shift evaluation examples to reference stored configs (config_id/config_version), change STT dataset creation to use uploaded file_ids and a samples array, and mark feedback fields as optional.
LLM call docs
backend/app/api/docs/llm/llm_call.md
Clarify input as three supported forms (plain string, structured object, list for multimodal), update conversation formatting, add stored-config mode (id+version) and schema pointers, and document guardrails/parameter behavior.
Fine-tuning docs
backend/app/api/docs/fine_tuning/create.md
Replace generic prerequisites with CSV dataset requirements (specific columns), change split_ratio to string-form interpretation, require base_model, and treat system_prompt as a form field; job summary presented as JSON example.
Endpoint field clarifications
backend/app/api/docs/api_keys/delete.md, backend/app/api/docs/collections/info.md, backend/app/api/docs/organization/update.md, backend/app/api/docs/projects/create.md
Adjust wording: API key deletion described as soft-delete, include_docs source clarified, org update documents is_active field, and project create docs include organization_id.
Onboarding docs
backend/app/api/docs/onboarding/onboarding.md
Add explicit email (required), password (optional, min 8 chars), and username (optional) field descriptions and behavior notes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested labels

documentation

Suggested reviewers

  • Prajna1999
  • AkhileshNegi
  • avirajsingh7

Poem

🐰 I hopped through docs both old and new,
Guardrails set, and types in threefold view,
Stored configs guide evaluations’ way,
Files turn to IDs for STT play,
A cheerful rabbit stamps the changelog true.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: updating API documentation to clarify parameters and functionality across multiple endpoints.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enhancement/update-api-documentation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
backend/app/api/docs/api_keys/delete.md (1)

3-3: Consider clarifying "soft delete" for API consumers.

The term "soft delete" is technical jargon that may not be immediately clear to all API users. Consider briefly explaining what this means in practice (e.g., whether the key can be restored, how long data is retained, etc.) to help users better understand the implications.

📝 Example clarification
-Revokes the API key via soft delete. Any requests using this key will fail after deletion.
+Revokes the API key by marking it as deleted (the key data is retained for audit purposes but cannot be used). Any requests using this key will fail immediately after deletion.

Or, if restoration is possible:

-Revokes the API key via soft delete. Any requests using this key will fail after deletion.
+Revokes the API key by marking it as inactive. The key can be restored if needed. Any requests using this key will fail immediately after deletion.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/app/api/docs/api_keys/delete.md` at line 3, Update the API docs text
in backend/app/api/docs/api_keys/delete.md to replace the terse "soft delete"
phrasing with a brief, consumer-facing clarification: state whether the key is
reversible (can be restored), how long any audit/retention records are kept (if
applicable), and confirm that any requests using the key will immediately fail
after deletion; include a short example sentence such as "This is a soft delete:
the key is deactivated immediately and requests will fail; it can be restored
within X days (if restoration is supported) and audit records are retained for Y
days," so consumers understand the practical implications.
backend/app/api/docs/onboarding/onboarding.md (1)

18-19: Consider grouping field descriptions for better readability.

The optional field descriptions (lines 18-19) are placed after the behavioral description (lines 16-17). For improved clarity, consider grouping all field descriptions together before explaining the behavior.

Example structure:

## 👤 User Handling
**Fields:**
- `email` (required): User's email address
- `password` (optional): Password for the primary user (must be at least 8 characters)
- `username` (optional): Full name of the primary user

**Behavior:**
- If `email` does not exist, a new user is created and linked to the project.
- If the user already exists, they are simply attached to the project.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/app/api/docs/onboarding/onboarding.md` around lines 18 - 19, Move the
optional field bullets (`password`, `username`) so all field descriptions are
grouped together before the behavior paragraph; create a short "Fields:"
subsection listing `email` (required), `password` (optional, min 8 chars) and
`username` (optional) and then create a separate "Behavior:" subsection that
explains the create-or-attach logic for `email` (e.g., new user created and
linked if email doesn't exist, otherwise attach existing user to project) to
match the suggested structure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@backend/app/api/docs/llm/llm_call.md`:
- Around line 22-30: The docs are inconsistent: the structured "input" list
example and the sentence above it only mention support for `image`, `pdf`, and
`text` but the "Supported input types" line includes `audio`; update the
documentation to clarify audio support by either (A) adding `audio` to the
multimodal structured input examples and the preceding sentence if audio is
supported in lists, or (B) explicitly stating that `audio` is only valid for
single-object (non-multimodal) calls — make the change next to the "input"
structured example and the "Supported input types" line so the terms "input" and
"Supported input types" consistently reflect whether `audio` can appear in the
list.

In `@backend/app/api/docs/stt_evaluation/create_dataset.md`:
- Around line 15-23: The example JSON in the create_dataset request contains an
invalid trailing comma after the last item in the "samples" array; remove the
trailing comma after { "file_id": 12, "ground_truth": "hello how can I help you"
} so the "samples" array and overall JSON become valid (verify keys "name",
"description", "language_id", "samples", "file_id", and "ground_truth" remain
unchanged).

---

Nitpick comments:
In `@backend/app/api/docs/api_keys/delete.md`:
- Line 3: Update the API docs text in backend/app/api/docs/api_keys/delete.md to
replace the terse "soft delete" phrasing with a brief, consumer-facing
clarification: state whether the key is reversible (can be restored), how long
any audit/retention records are kept (if applicable), and confirm that any
requests using the key will immediately fail after deletion; include a short
example sentence such as "This is a soft delete: the key is deactivated
immediately and requests will fail; it can be restored within X days (if
restoration is supported) and audit records are retained for Y days," so
consumers understand the practical implications.

In `@backend/app/api/docs/onboarding/onboarding.md`:
- Around line 18-19: Move the optional field bullets (`password`, `username`) so
all field descriptions are grouped together before the behavior paragraph;
create a short "Fields:" subsection listing `email` (required), `password`
(optional, min 8 chars) and `username` (optional) and then create a separate
"Behavior:" subsection that explains the create-or-attach logic for `email`
(e.g., new user created and linked if email doesn't exist, otherwise attach
existing user to project) to match the suggested structure.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2dc5949 and 0c45d74.

📒 Files selected for processing (12)
  • backend/app/api/docs/api_keys/delete.md
  • backend/app/api/docs/collections/info.md
  • backend/app/api/docs/config/create.md
  • backend/app/api/docs/config/create_version.md
  • backend/app/api/docs/evaluation/create_evaluation.md
  • backend/app/api/docs/fine_tuning/create.md
  • backend/app/api/docs/llm/llm_call.md
  • backend/app/api/docs/onboarding/onboarding.md
  • backend/app/api/docs/organization/update.md
  • backend/app/api/docs/projects/create.md
  • backend/app/api/docs/stt_evaluation/create_dataset.md
  • backend/app/api/docs/stt_evaluation/update_feedback.md

Comment on lines +15 to +23
```json
{
"name": "Hindi call center dataset",
"description": "100 samples from call center recordings",
"language_id": 5,
"samples": [
{ "file_id": 12, "ground_truth": "hello how can I help you" },
]
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat backend/app/api/docs/stt_evaluation/create_dataset.md

Repository: ProjectTech4DevAI/kaapi-backend

Length of output: 938


🏁 Script executed:

#!/bin/bash
# Run the verification script from the review comment
python - <<'PY'
import json, pathlib, re, sys
p = pathlib.Path("backend/app/api/docs/stt_evaluation/create_dataset.md")
text = p.read_text(encoding="utf-8")
m = re.search(r"```json\s*(\{.*?\})\s*```", text, flags=re.S)
if not m:
    print("No ```json block found")
    sys.exit(1)
snippet = m.group(1)
try:
    json.loads(snippet)
    print("Valid JSON example")
except json.JSONDecodeError as e:
    print(f"Invalid JSON example: {e}")
    sys.exit(2)
PY

Repository: ProjectTech4DevAI/kaapi-backend

Length of output: 140


Fix invalid JSON in the request example.

The trailing comma after the samples array item makes this JSON invalid and breaks copy/paste usage in API clients.

Suggested fix
 {
   "name": "Hindi call center dataset",
   "description": "100 samples from call center recordings",
   "language_id": 5,
   "samples": [
-    { "file_id": 12, "ground_truth": "hello how can I help you" },
+    { "file_id": 12, "ground_truth": "hello how can I help you" }
   ]
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```json
{
"name": "Hindi call center dataset",
"description": "100 samples from call center recordings",
"language_id": 5,
"samples": [
{ "file_id": 12, "ground_truth": "hello how can I help you" },
]
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/app/api/docs/stt_evaluation/create_dataset.md` around lines 15 - 23,
The example JSON in the create_dataset request contains an invalid trailing
comma after the last item in the "samples" array; remove the trailing comma
after { "file_id": 12, "ground_truth": "hello how can I help you" } so the
"samples" array and overall JSON become valid (verify keys "name",
"description", "language_id", "samples", "file_id", and "ground_truth" remain
unchanged).

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
backend/app/api/docs/llm/llm_call.md (1)

59-60: Add structure documentation for guardrails parameters.

While input_guardrails and output_guardrails are listed as optional parameters, the documentation doesn't explain what these lists should contain, their schema, or provide examples. Since this PR aims to clarify parameters and functionality, consider adding:

  • Expected structure/schema for guardrail objects
  • Available guardrail types or examples
  • A reference to detailed guardrails documentation if it exists elsewhere
📝 Example documentation enhancement
-    - `input_guardrails` (optional, list)
-    - `output_guardrails` (optional, list)
+    - `input_guardrails` (optional, list): List of guardrail configurations to apply to input validation
+      - Each guardrail object should specify the guardrail type and its parameters
+      - See guardrails schema documentation for available types and configuration options
+    - `output_guardrails` (optional, list): List of guardrail configurations to apply to output validation
+      - Each guardrail object should specify the guardrail type and its parameters
+      - See guardrails schema documentation for available types and configuration options
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/app/api/docs/llm/llm_call.md` around lines 59 - 60, The docs list
`input_guardrails` and `output_guardrails` but lack schema and examples; update
the llm_call.md entry for these parameters to describe the expected structure of
each guardrail object (e.g., required fields like `type`, `rule`, optional
`severity`/`params`), enumerate supported `type` values or common examples
(e.g., `no_personal_data`, `max_length`, `regex_match`), show a short YAML/JSON
example for both `input_guardrails` and `output_guardrails`, and add a link or
reference to any existing detailed guardrails documentation; ensure you
reference the parameter names `input_guardrails` and `output_guardrails` so
readers can find the usage in the LLM call docs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@backend/app/api/docs/llm/llm_call.md`:
- Line 63: Update the example in the Kaapi documentation to replace the
non-existent "GPT-5" model with a real model that actually disallows temperature
(e.g., the "o1" series reasoning models referenced elsewhere); edit the sentence
in the paragraph that mentions parameter suppression so it reads that "o1 series
models do not support the temperature parameter," and ensure the example still
references metadata.warnings and the Kaapi abstraction so readers know
suppressed parameters are listed there.

---

Nitpick comments:
In `@backend/app/api/docs/llm/llm_call.md`:
- Around line 59-60: The docs list `input_guardrails` and `output_guardrails`
but lack schema and examples; update the llm_call.md entry for these parameters
to describe the expected structure of each guardrail object (e.g., required
fields like `type`, `rule`, optional `severity`/`params`), enumerate supported
`type` values or common examples (e.g., `no_personal_data`, `max_length`,
`regex_match`), show a short YAML/JSON example for both `input_guardrails` and
`output_guardrails`, and add a link or reference to any existing detailed
guardrails documentation; ensure you reference the parameter names
`input_guardrails` and `output_guardrails` so readers can find the usage in the
LLM call docs.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c45d74 and 03f54e0.

📒 Files selected for processing (2)
  • backend/app/api/docs/llm/llm_call.md
  • backend/app/api/docs/onboarding/onboarding.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/app/api/docs/onboarding/onboarding.md

- `output_guardrails` (optional, list)
- **Note**
- When using ad-hoc configuration, do not include `id` and `version` fields
- When using the Kaapi abstraction, parameters that are not supported by the selected provider or model are automatically suppressed. If any parameters are ignored, a list of warnings is included in the metadata.warnings. For example, the GPT-5 model does not support the temperature parameter, so Kaapi will neither throw an error nor pass this parameter to the model; instead, it will return a warning in the metadata.warnings response.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for GPT-5 references in the codebase
rg -n "GPT-5|gpt-5" --type=md --type=py --type=txt

Repository: ProjectTech4DevAI/kaapi-backend

Length of output: 557


🏁 Script executed:

#!/bin/bash
# Get more context around line 63 in the file
cat -n backend/app/api/docs/llm/llm_call.md | sed -n '55,70p'

Repository: ProjectTech4DevAI/kaapi-backend

Length of output: 1642


🏁 Script executed:

#!/bin/bash
# Check for other model references in the documentation to understand naming conventions
rg -n "GPT|Claude|o1|model" backend/app/api/docs/llm/llm_call.md | head -20

Repository: ProjectTech4DevAI/kaapi-backend

Length of output: 695


Replace the non-existent "GPT-5" model with a real model example.

Line 63 references "GPT-5 model" as an example for parameter suppression, but GPT-5 doesn't exist. The documentation should use a real model with actual constraints—for example, "o1 series models do not support the temperature parameter" aligns with the reasoning model reference already mentioned on line 80.

Current snippet
    - When using the Kaapi abstraction, parameters that are not supported by the selected provider or model are automatically suppressed. If any parameters are ignored, a list of warnings is included in the metadata.warnings. For example, the GPT-5 model does not support the temperature parameter, so Kaapi will neither throw an error nor pass this parameter to the model; instead, it will return a warning in the metadata.warnings response.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/app/api/docs/llm/llm_call.md` at line 63, Update the example in the
Kaapi documentation to replace the non-existent "GPT-5" model with a real model
that actually disallows temperature (e.g., the "o1" series reasoning models
referenced elsewhere); edit the sentence in the paragraph that mentions
parameter suppression so it reads that "o1 series models do not support the
temperature parameter," and ensure the example still references
metadata.warnings and the Kaapi abstraction so readers know suppressed
parameters are listed there.

@vprashrex vprashrex self-assigned this Mar 3, 2026
@vprashrex vprashrex added the documentation Improvements or additions to documentation label Mar 3, 2026
@vprashrex vprashrex moved this to In Review in Kaapi-dev Mar 3, 2026
"vector_store_ids": ["vs_692d71f3f5708191b1c46525f3c1e196"],
"max_num_results": 20
}]}}}
"completion": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add examples for stt, tts as well

## Important
- This endpoint accepts partial updates using dict[str, Any] for config_blob.
- Only the fields that need to be updated should be provided.
- Fields such as type and provider are inherited from the existing configuration and cannot be changed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provider can be be changes ig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants