Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ format: ## Format the code into unified format
schema: ## Generate OpenAPI schema file
uv run scripts/generate_openapi_schema.py docs/openapi.json

openapi-doc: docs/openapi.json ## Generate OpenAPI documentation
openapi-to-markdown --input_file docs/openapi.json --output_file docs/output.md
openapi-doc: docs/openapi.json scripts/fix_openapi_doc.py ## Generate OpenAPI documentation
openapi-to-markdown --input_file docs/openapi.json --output_file output.md
python3 scripts/fix_openapi_doc.py < output.md > docs/output.md
rm output.md

# TODO uv migration
requirements.txt: pyproject.toml pdm.lock ## Generate requirements.txt file containing hashes for all non-devel packages
Expand Down
10 changes: 3 additions & 7 deletions docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ Handle request to the / endpoint.

| Status Code | Description | Component |
|-------------|-------------|-----------|
| 200 | Successful Response | string
|
| 200 | Successful Response | string |
## GET `/v1/info`

> **Info Endpoint Handler**
Expand All @@ -48,8 +47,7 @@ Returns:

| Status Code | Description | Component |
|-------------|-------------|-----------|
| 200 | Successful Response | [InfoResponse](#inforesponse)
|
| 200 | Successful Response | [InfoResponse](#inforesponse) |
## GET `/v1/models`

> **Models Endpoint Handler**
Expand All @@ -76,7 +74,6 @@ Returns:
|-------------|-------------|-----------|
| 200 | Successful Response | [ModelsResponse](#modelsresponse) |
| 503 | Connection to Llama Stack is broken | |

## POST `/v1/query`

> **Query Endpoint Handler**
Expand Down Expand Up @@ -396,8 +393,7 @@ Prometheus format.

| Status Code | Description | Component |
|-------------|-------------|-----------|
| 200 | Successful Response | string
|
| 200 | Successful Response | string |
---

# 📋 Components
Expand Down
33 changes: 33 additions & 0 deletions scripts/fix_openapi_doc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python3

"""Filter to fix the generated OpenAPI documentation."""

import fileinput

TABLE_ROW_CONTINUATION_LINE = " |"

lines = list(fileinput.input())

lines_count = len(lines)

for i in range(lines_count):
current_line = lines[i].rstrip("\r\n")

# limit check
if i == lines_count - 1:
print(current_line)
break

# the next line must exists -> read it
next_line = lines[i + 1].rstrip("\r\n")

# skip the continuation line as it was used already
# during previous line processing
if current_line == TABLE_ROW_CONTINUATION_LINE:
continue

# check if table row continuation line is present
if next_line == TABLE_ROW_CONTINUATION_LINE:
print(current_line + TABLE_ROW_CONTINUATION_LINE)
else:
print(current_line)