llama-stack-mirror/llama_stack
Peter Double 86c6f1f112
fix: FastAPI built-in paths bypass custom routing (Docs) and update r… (#1841)
## What does this PR do?

This PR improves the server's request routing logic by ensuring built-in
FastAPI paths such as `/docs`, `/redoc`, `/openapi.json`,
`/favicon.ico`, and `/static` bypass the custom `TracingMiddleware`.
This prevents unnecessary tracing logic for documentation and static
file requests, ensuring better performance and cleaner logs.

Additionally, it adds proper metadata (`title`, `description`, and
`version`) to the FastAPI application initialization and updates the
requirements document accordingly.

[//]: # (Closes #1822 )

---

## Test Plan

- Ran the server locally with `uvicorn` using the provided `run.yaml`
config
- Verified that:
- FastAPI docs (`/docs`, `/redoc`) load correctly without triggering the
custom tracing middleware
  - All other routes still go through the middleware and trace logic
  - Application metadata appears as expected in the OpenAPI docs

To reproduce:
1. Start the server with `python server.py --template <template-name>`
2. Navigate to `/docs` and `/redoc`
3. Confirm that no extra trace headers are added for those routes
4. Confirm other API endpoints behave as expected and include
`x-trace-id` in the response headers

[//]: # (## Documentation)

---

Froze the requirements file to include many of the other libraries that
have been added in the past few releases to make install easier.

---------

Co-authored-by: Sébastien Han <seb@redhat.com>
2025-04-14 13:28:25 -04:00
..
apis fix: 100% OpenAI API verification for together and fireworks (#1946) 2025-04-14 08:56:29 -07:00
cli fix: misleading help text for 'llama stack build' and 'llama stack run' (#1910) 2025-04-12 01:19:11 -07:00
distribution fix: FastAPI built-in paths bypass custom routing (Docs) and update r… (#1841) 2025-04-14 13:28:25 -04:00
models fix: 100% OpenAI API verification for together and fireworks (#1946) 2025-04-14 08:56:29 -07:00
providers feat: allow ollama to use 'latest' if available but not specified (#1903) 2025-04-14 09:03:54 -07:00
strong_typing chore: more mypy checks (ollama, vllm, ...) (#1777) 2025-04-01 17:12:39 +02:00
templates fix: 100% OpenAI API verification for together and fireworks (#1946) 2025-04-14 08:56:29 -07:00
__init__.py export LibraryClient 2024-12-13 12:08:00 -08:00
env.py refactor(test): move tools, evals, datasetio, scoring and post training tests (#1401) 2025-03-04 14:53:47 -08:00
log.py chore: Remove style tags from log formatter (#1808) 2025-03-27 10:18:21 -04:00
schema_utils.py fix: dont check protocol compliance for experimental methods 2025-04-12 16:26:32 -07:00