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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ openapi-doc: docs/openapi.json ## Generate OpenAPI documentation
requirements.txt: pyproject.toml pdm.lock ## Generate requirements.txt file containing hashes for all non-devel packages
pdm export --prod --format requirements --output requirements.txt --no-extras --without evaluation

doc:
scripts/gen_doc.py

docs/config.puml: src/models/config.py ## Generate PlantUML class diagram for configuration
pyreverse src/models/config.py --output puml --output-directory=docs/
mv docs/classes.puml docs/config.puml
Expand Down
41 changes: 41 additions & 0 deletions scripts/gen_doc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python3

"""Generate documentation for all modules from Lightspeed Stack core service."""

import os

import ast
from pathlib import Path


for path in Path("src").rglob("*"):
if path.is_dir():
directory = path
cwd = os.getcwd()
os.chdir(directory)
print(directory)

try:
with open("README.md", "w", encoding="utf-8", newline="\n") as indexfile:
print(
f"# List of source files stored in `{directory}` directory",
file=indexfile,
)
print("", file=indexfile)
files = sorted(os.listdir())

for file in files:
if file.endswith(".py"):
print(f"## [{file}]({file})", file=indexfile)
with open(file, "r", encoding="utf-8") as fin:
source = fin.read()
try:
mod = ast.parse(source)
doc = ast.get_docstring(mod)
except SyntaxError:
doc = None
if doc:
print(doc.splitlines()[0], file=indexfile)
print(file=indexfile)
finally:
os.chdir(cwd)
14 changes: 14 additions & 0 deletions src/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# List of source files stored in `src/app` directory

## [__init__.py](__init__.py)
REST API service based on FastAPI.

## [database.py](database.py)
Database engine management.

## [main.py](main.py)
Definition of FastAPI based web service.

## [routers.py](routers.py)
REST API routers.

38 changes: 38 additions & 0 deletions src/app/endpoints/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# List of source files stored in `src/app/endpoints` directory

## [__init__.py](__init__.py)
Implementation of all endpoints.

## [authorized.py](authorized.py)
Handler for REST API call to authorized endpoint.

## [config.py](config.py)
Handler for REST API call to retrieve service configuration.

## [conversations.py](conversations.py)
Handler for REST API calls to manage conversation history.

## [feedback.py](feedback.py)
Handler for REST API endpoint for user feedback.

## [health.py](health.py)
Handlers for health REST API endpoints.

## [info.py](info.py)
Handler for REST API call to provide info.

## [metrics.py](metrics.py)
Handler for REST API call to provide metrics.

## [models.py](models.py)
Handler for REST API call to list available models.

## [query.py](query.py)
Handler for REST API call to provide answer to query.

## [root.py](root.py)
Handler for the / endpoint.

## [streaming_query.py](streaming_query.py)
Handler for REST API call to provide answer to streaming query.

23 changes: 23 additions & 0 deletions src/auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# List of source files stored in `src/auth` directory

## [__init__.py](__init__.py)
This package contains authentication code and modules.

## [interface.py](interface.py)
Abstract base class for all authentication method implementations.

## [jwk_token.py](jwk_token.py)
Manage authentication flow for FastAPI endpoints with JWK based JWT auth.

## [k8s.py](k8s.py)
Manage authentication flow for FastAPI endpoints with K8S/OCP.

## [noop.py](noop.py)
Manage authentication flow for FastAPI endpoints with no-op auth.

## [noop_with_token.py](noop_with_token.py)
Manage authentication flow for FastAPI endpoints with no-op auth and provided user token.

## [utils.py](utils.py)
Authentication utility functions.

8 changes: 8 additions & 0 deletions src/metrics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# List of source files stored in `src/metrics` directory

## [__init__.py](__init__.py)
Metrics module for Lightspeed Stack.

## [utils.py](utils.py)
Utility functions for metrics handling.

14 changes: 14 additions & 0 deletions src/models/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# List of source files stored in `src/models` directory

## [__init__.py](__init__.py)
Pydantic models.

## [config.py](config.py)
Model with service configuration.

## [requests.py](requests.py)
Models for REST API requests.

## [responses.py](responses.py)
Models for REST API responses.

11 changes: 11 additions & 0 deletions src/models/database/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# List of source files stored in `src/models/database` directory

## [__init__.py](__init__.py)
Database models package.

## [base.py](base.py)
Base model for SQLAlchemy ORM classes.

## [conversations.py](conversations.py)
User conversation models.

8 changes: 8 additions & 0 deletions src/runners/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# List of source files stored in `src/runners` directory

## [__init__.py](__init__.py)
Runners.

## [uvicorn.py](uvicorn.py)
Uvicorn runner.

29 changes: 29 additions & 0 deletions src/utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# List of source files stored in `src/utils` directory

## [__init__.py](__init__.py)
Utils.

## [checks.py](checks.py)
Checks that are performed to configuration options.

## [common.py](common.py)
Common utilities for the project.

## [endpoints.py](endpoints.py)
Utility functions for endpoint handlers.

## [llama_stack_version.py](llama_stack_version.py)
Check if the Llama Stack version is supported by the LCS.

## [mcp_headers.py](mcp_headers.py)
MCP headers handling.

## [suid.py](suid.py)
Session ID utility functions.

## [transcripts.py](transcripts.py)
Transcript handling.

## [types.py](types.py)
Common types for the project.